Completed
Push — master ( 8c94fe...9091ef )
by Yannick
34:02 queued 02:35
created
require/class.Source.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@  discard block
 block discarded – undo
7 7
 	public function __construct($dbc = null) {
8 8
 		$Connection = new Connection($dbc);
9 9
 		$this->db = $Connection->db;
10
-		if ($this->db === null) die('Error: No DB connection.');
10
+		if ($this->db === null) {
11
+			die('Error: No DB connection.');
12
+		}
11 13
 	}
12 14
 
13 15
 	public function getAllLocationInfo() {
@@ -72,7 +74,9 @@  discard block
 block discarded – undo
72 74
 			$query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0";
73 75
 		}
74 76
 		$query .= " ORDER BY last_seen DESC";
75
-		if ($limit) $query .= " LIMIT 400";
77
+		if ($limit) {
78
+			$query .= " LIMIT 400";
79
+		}
76 80
 		$query_values = array(':type' => $type);
77 81
 		try {
78 82
 			$sth = $this->db->prepare($query);
@@ -111,7 +115,9 @@  discard block
 block discarded – undo
111 115
 	}
112 116
 
113 117
 	public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') {
114
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
118
+		if ($last_seen == '') {
119
+			$last_seen = date('Y-m-d H:i:s');
120
+		}
115 121
 		$query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)";
116 122
 		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
117 123
 		try {
@@ -123,7 +129,9 @@  discard block
 block discarded – undo
123 129
 	}
124 130
 
125 131
 	public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') {
126
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
132
+		if ($last_seen == '') {
133
+			$last_seen = date('Y-m-d H:i:s');
134
+		}
127 135
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source";
128 136
 		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
129 137
 		try {
@@ -146,7 +154,9 @@  discard block
 block discarded – undo
146 154
 	}
147 155
 
148 156
 	public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') {
149
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
157
+		if ($last_seen == '') {
158
+			$last_seen = date('Y-m-d H:i:s');
159
+		}
150 160
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id";
151 161
 		$query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
152 162
 		try {
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +441 added lines, -111 removed lines patch added patch discarded remove patch
@@ -163,11 +163,26 @@  discard block
 block discarded – undo
163 163
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
164 164
 				<li><?php echo _("NOTAM scope:"); ?>
165 165
 					<select class="selectpicker" onchange="notamscope(this);">
166
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
167
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
168
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
169
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
170
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
166
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
167
+	print ' selected';
168
+}
169
+?>>All</option>
170
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
171
+	print ' selected';
172
+}
173
+?>>Airport/Enroute warning</option>
174
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
175
+	print ' selected';
176
+}
177
+?>>Airport warning</option>
178
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
179
+	print ' selected';
180
+}
181
+?>>Navigation warning</option>
182
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
183
+	print ' selected';
184
+}
185
+?>>Enroute warning</option>
171 186
 					</select
172 187
 				</li>
173 188
 			</ul>
@@ -195,7 +210,12 @@  discard block
 block discarded – undo
195 210
 		        <div class="form-group">
196 211
 			    <label>From (UTC):</label>
197 212
 		            <div class='input-group date' id='datetimepicker1'>
198
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
213
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
214
+	print $_POST['start_date'];
215
+} elseif (isset($_COOKIE['archive_begin'])) {
216
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
217
+}
218
+?>" required />
199 219
 		                <span class="input-group-addon">
200 220
             			    <span class="glyphicon glyphicon-calendar"></span>
201 221
 		                </span>
@@ -204,7 +224,12 @@  discard block
 block discarded – undo
204 224
 		        <div class="form-group">
205 225
 			    <label>To (UTC):</label>
206 226
 		            <div class='input-group date' id='datetimepicker2'>
207
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
227
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
228
+	print $_POST['end_date'];
229
+} elseif (isset($_COOKIE['archive_end'])) {
230
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
231
+}
232
+?>" />
208 233
             			<span class="input-group-addon">
209 234
 		                    <span class="glyphicon glyphicon-calendar"></span>
210 235
             			</span>
@@ -229,8 +254,20 @@  discard block
 block discarded – undo
229 254
 			</script>
230 255
 		    <li><?php echo _("Playback speed:"); ?>
231 256
 			<div class="range">
232
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
233
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
257
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
258
+	print $_POST['archivespeed'];
259
+} elseif (isset($_COOKIE['archive_speed'])) {
260
+	print $_COOKIE['archive_speed'];
261
+} else {
262
+	print '1';
263
+}
264
+?>">
265
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
266
+	print $_COOKIE['archive_speed'];
267
+} else {
268
+	print '1';
269
+}
270
+?></output>
234 271
 			</div>
235 272
 		    </li>
236 273
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -252,15 +289,27 @@  discard block
 block discarded – undo
252 289
 		    <li><?php echo _("Type of Map:"); ?>
253 290
 			<select  class="selectpicker" onchange="mapType(this);">
254 291
 			    <?php
255
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
256
-				else $MapType = $_COOKIE['MapType'];
292
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
293
+					$MapType = $globalMapProvider;
294
+				} else {
295
+					$MapType = $_COOKIE['MapType'];
296
+				}
257 297
 			    ?>
258 298
 			    <?php
259 299
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
260 300
 			    ?>
261
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
262
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
263
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
301
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
302
+	print ' selected';
303
+}
304
+?>>Bing-Aerial</option>
305
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
306
+	print ' selected';
307
+}
308
+?>>Bing-Hybrid</option>
309
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
310
+	print ' selected';
311
+}
312
+?>>Bing-Road</option>
264 313
 			    <?php
265 314
 				}
266 315
 			    ?>
@@ -270,56 +319,131 @@  discard block
 block discarded – undo
270 319
 			    <?php
271 320
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272 321
 			    ?>
273
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
274
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
275
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
322
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
323
+	print ' selected';
324
+}
325
+?>>Here-Aerial</option>
326
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
327
+	print ' selected';
328
+}
329
+?>>Here-Hybrid</option>
330
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
331
+	print ' selected';
332
+}
333
+?>>Here-Road</option>
276 334
 			    <?php
277 335
 				    }
278 336
 			    ?>
279 337
 			    <?php
280 338
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281 339
 			    ?>
282
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
283
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
284
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
285
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
340
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
341
+	print ' selected';
342
+}
343
+?>>Google Roadmap</option>
344
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
345
+	print ' selected';
346
+}
347
+?>>Google Satellite</option>
348
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
349
+	print ' selected';
350
+}
351
+?>>Google Hybrid</option>
352
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
353
+	print ' selected';
354
+}
355
+?>>Google Terrain</option>
286 356
 			    <?php
287 357
 				    }
288 358
 			    ?>
289 359
 			    <?php
290 360
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291 361
 			    ?>
292
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
293
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
294
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
362
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
363
+	print ' selected';
364
+}
365
+?>>MapQuest-OSM</option>
366
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
367
+	print ' selected';
368
+}
369
+?>>MapQuest-Aerial</option>
370
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
371
+	print ' selected';
372
+}
373
+?>>MapQuest-Hybrid</option>
295 374
 			    <?php
296 375
 				    }
297 376
 			    ?>
298
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
377
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
378
+	print ' selected';
379
+}
380
+?>>Yandex</option>
299 381
 			    <?php
300 382
 				}
301 383
 			    ?>
302 384
 			    <?php
303 385
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
304
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
305
-					else $MapBoxId = $_COOKIE['MapTypeId'];
386
+					if (!isset($_COOKIE['MapTypeId'])) {
387
+						$MapBoxId = 'default';
388
+					} else {
389
+						$MapBoxId = $_COOKIE['MapTypeId'];
390
+					}
306 391
 			    ?>
307
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
308
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
309
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
310
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
311
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
312
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
313
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
314
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
315
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
316
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
317
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
318
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
392
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
393
+	print ' selected';
394
+}
395
+?>>Mapbox default</option>
396
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
397
+	print ' selected';
398
+}
399
+?>>Mapbox streets</option>
400
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
401
+	print ' selected';
402
+}
403
+?>>Mapbox light</option>
404
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
405
+	print ' selected';
406
+}
407
+?>>Mapbox dark</option>
408
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
409
+	print ' selected';
410
+}
411
+?>>Mapbox satellite</option>
412
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
413
+	print ' selected';
414
+}
415
+?>>Mapbox streets-satellite</option>
416
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
417
+	print ' selected';
418
+}
419
+?>>Mapbox streets-basic</option>
420
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
421
+	print ' selected';
422
+}
423
+?>>Mapbox comic</option>
424
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
425
+	print ' selected';
426
+}
427
+?>>Mapbox outdoors</option>
428
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
429
+	print ' selected';
430
+}
431
+?>>Mapbox pencil</option>
432
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
433
+	print ' selected';
434
+}
435
+?>>Mapbox pirates</option>
436
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
437
+	print ' selected';
438
+}
439
+?>>Mapbox emerald</option>
319 440
 			    <?php
320 441
 				    }
321 442
 			    ?>
322
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
443
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
444
+	print ' selected';
445
+}
446
+?>>OpenStreetMap</option>
323 447
 			</select>
324 448
 		    </li>
325 449
 <?php
@@ -327,10 +451,22 @@  discard block
 block discarded – undo
327 451
 ?>
328 452
 		    <li><?php echo _("Type of Terrain:"); ?>
329 453
 			<select  class="selectpicker" onchange="terrainType(this);">
330
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
331
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
332
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
333
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
454
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
455
+	print ' selected';
456
+}
457
+?>>stk terrain</option>
458
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
459
+	print ' selected';
460
+}
461
+?>>ellipsoid</option>
462
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
463
+	print ' selected';
464
+}
465
+?>>vr terrain</option>
466
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
467
+	print ' selected';
468
+}
469
+?>>ArticDEM</option>
334 470
 			</select>
335 471
 		    </li>
336 472
 <?php
@@ -342,33 +478,69 @@  discard block
 block discarded – undo
342 478
 <?php
343 479
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
344 480
 ?>
345
-		    <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>
346
-		    <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>
347
-		    <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>
348
-		    <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>
349
-		    <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>
481
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
482
+	print 'checked';
483
+}
484
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
485
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
486
+	print 'checked';
487
+}
488
+?> ><?php echo _("Display flight path"); ?></label></div></li>
489
+		    <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)) {
490
+	print 'checked';
491
+}
492
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
493
+		    <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)) {
494
+	print 'checked';
495
+}
496
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
497
+		    <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)) {
498
+	print 'checked';
499
+}
500
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
350 501
 <?php
351 502
 	}
352 503
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
353 504
 ?>
354
-		    <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>
505
+		    <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)) {
506
+	print 'checked';
507
+}
508
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
355 509
 <?php
356 510
 	}
357 511
     }
358 512
 ?>
359
-		    <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>
360
-		    <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>
361
-		    <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>
362
-		    <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>
513
+		    <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'])) {
514
+	print 'checked';
515
+}
516
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
517
+		    <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))) {
518
+	print 'checked';
519
+}
520
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
521
+		    <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))) {
522
+	print 'checked';
523
+}
524
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
525
+		    <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))) {
526
+	print 'checked';
527
+}
528
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
363 529
 <?php
364 530
 	if (isset($globalMapFires) && $globalMapFires) {
365 531
 ?>
366
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
532
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
533
+	print 'checked';
534
+}
535
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
367 536
 <?php
368 537
 	}
369 538
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
370 539
 ?>
371
-		    <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>
540
+		    <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')) {
541
+	print 'checked';
542
+}
543
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
372 544
 <?php
373 545
     }
374 546
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -381,17 +553,25 @@  discard block
 block discarded – undo
381 553
 			if (function_exists('array_column')) {
382 554
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
383 555
 		    ?>
384
-		    <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>
556
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
557
+	print 'checked';
558
+}
559
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
385 560
 		    <?php
386 561
 			    }
387 562
 			} elseif (isset($globalSources)) {
388 563
 			    $dispolar = false;
389 564
 			    foreach ($globalSources as $testsource) {
390
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
565
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
566
+			        	$dispolar = true;
567
+			        }
391 568
 			    }
392 569
 			    if ($dispolar) {
393 570
 		    ?>
394
-		    <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>
571
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
572
+	print 'checked';
573
+}
574
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
395 575
 		    <?php
396 576
 			    }
397 577
 		        }
@@ -404,12 +584,22 @@  discard block
 block discarded – undo
404 584
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
405 585
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
406 586
 		    ?>
407
-		    <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>
587
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
588
+	print 'checked';
589
+}
590
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
408 591
 		    <?php 
409 592
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
410 593
 		    ?>
411 594
 		    <li><?php echo _("Aircraft icon color:"); ?>
412
-			<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'; ?>">
595
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
596
+	print $_COOKIE['IconColor'];
597
+} elseif (isset($globalAircraftIconColor)) {
598
+	print $globalAircraftIconColor;
599
+} else {
600
+	print '1a3151';
601
+}
602
+?>">
413 603
 		    </li>
414 604
 		    <?php
415 605
 				}
@@ -421,7 +611,14 @@  discard block
 block discarded – undo
421 611
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
422 612
 		    ?>
423 613
 		    <li><?php echo _("Marine icon color:"); ?>
424
-			<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'; ?>">
614
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
615
+	print $_COOKIE['MarineIconColor'];
616
+} elseif (isset($globalMarineIconColor)) {
617
+	print $globalMarineIconColor;
618
+} else {
619
+	print '1a3151';
620
+}
621
+?>">
425 622
 		    </li>
426 623
 		    <?php
427 624
 			    }
@@ -432,7 +629,14 @@  discard block
 block discarded – undo
432 629
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
433 630
 		    ?>
434 631
 		    <li><?php echo _("Tracker icon color:"); ?>
435
-			<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'; ?>">
632
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
633
+	print $_COOKIE['TrackerIconColor'];
634
+} elseif (isset($globalTrackerIconColor)) {
635
+	print $globalTrackerIconColor;
636
+} else {
637
+	print '1a3151';
638
+}
639
+?>">
436 640
 		    </li>
437 641
 		    <?php
438 642
 			    }
@@ -443,8 +647,22 @@  discard block
 block discarded – undo
443 647
 		    ?>
444 648
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
445 649
 			<div class="range">
446
-			    <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'; ?>">
447
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
650
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
651
+	print $_COOKIE['AirportZoom'];
652
+} elseif (isset($globalAirportZoom)) {
653
+	print $globalAirportZoom;
654
+} else {
655
+	print '7';
656
+}
657
+?>">
658
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
659
+	print $_COOKIE['AirportZoom'];
660
+} elseif (isset($globalAirportZoom)) {
661
+	print $globalAirportZoom;
662
+} else {
663
+	print '7';
664
+}
665
+?></output>
448 666
 			</div>
449 667
 		    </li>
450 668
 		    <?php
@@ -456,9 +674,19 @@  discard block
 block discarded – undo
456 674
 <?php
457 675
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
458 676
 ?>
459
-		    <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>
677
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
678
+	print 'checked';
679
+}
680
+?> ><?php echo _("Force Aircraft color"); ?></li>
460 681
 		    <li><?php echo _("Aircraft icon color:"); ?>
461
-			<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'; ?>">
682
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
683
+	print $_COOKIE['IconColor'];
684
+} elseif (isset($globalAircraftIconColor)) {
685
+	print $globalAircraftIconColor;
686
+} else {
687
+	print 'ff0000';
688
+}
689
+?>">
462 690
 		    </li>
463 691
 <?php
464 692
 	}
@@ -466,9 +694,19 @@  discard block
 block discarded – undo
466 694
 <?php
467 695
 	if (isset($globalMarine) && $globalMarine === TRUE) {
468 696
 ?>
469
-		    <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>
697
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
698
+	print 'checked';
699
+}
700
+?> ><?php echo _("Force Marine color"); ?></li>
470 701
 		    <li><?php echo _("Marine icon color:"); ?>
471
-			<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'; ?>">
702
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
703
+	print $_COOKIE['MarineIconColor'];
704
+} elseif (isset($globalMarineIconColor)) {
705
+	print $globalMarineIconColor;
706
+} else {
707
+	print 'ff0000';
708
+}
709
+?>">
472 710
 		    </li>
473 711
 <?php
474 712
 	}
@@ -476,9 +714,19 @@  discard block
 block discarded – undo
476 714
 <?php
477 715
 	if (isset($globalTracker) && $globalTracker === TRUE) {
478 716
 ?>
479
-		    <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>
717
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
718
+	print 'checked';
719
+}
720
+?> ><?php echo _("Force Tracker color"); ?></li>
480 721
 		    <li><?php echo _("Tracker icon color:"); ?>
481
-			<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'; ?>">
722
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
723
+	print $_COOKIE['TrackerIconColor'];
724
+} elseif (isset($globalTrackerIconColor)) {
725
+	print $globalTrackerIconColor;
726
+} else {
727
+	print 'ff0000';
728
+}
729
+?>">
482 730
 		    </li>
483 731
 <?php
484 732
 	}
@@ -486,22 +734,46 @@  discard block
 block discarded – undo
486 734
 ?>
487 735
 		    <li><?php echo _("Distance unit:"); ?>
488 736
 			<select class="selectpicker" onchange="unitdistance(this);">
489
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
490
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
491
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
737
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
738
+	echo ' selected';
739
+}
740
+?>>km</option>
741
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
742
+	echo ' selected';
743
+}
744
+?>>nm</option>
745
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
746
+	echo ' selected';
747
+}
748
+?>>mi</option>
492 749
 		        </select>
493 750
 		    </li>
494 751
 		    <li><?php echo _("Altitude unit:"); ?>
495 752
 			<select class="selectpicker" onchange="unitaltitude(this);">
496
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
497
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
753
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
754
+	echo ' selected';
755
+}
756
+?>>m</option>
757
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
758
+	echo ' selected';
759
+}
760
+?>>feet</option>
498 761
 		        </select>
499 762
 		    </li>
500 763
 		    <li><?php echo _("Speed unit:"); ?>
501 764
 			<select class="selectpicker" onchange="unitspeed(this);">
502
-			    <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>
503
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
504
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
765
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
766
+	echo ' selected';
767
+}
768
+?>>km/h</option>
769
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
770
+	echo ' selected';
771
+}
772
+?>>mph</option>
773
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
774
+	echo ' selected';
775
+}
776
+?>>knots</option>
505 777
 		        </select>
506 778
 		    </li>
507 779
 
@@ -519,9 +791,18 @@  discard block
 block discarded – undo
519 791
 		    <?php
520 792
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
521 793
 		    ?>
522
-			<?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 } ?>
523
-			<?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 } ?>
524
-			<?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 } ?>
794
+			<?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'])) {
795
+	print 'checked';
796
+}
797
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
798
+			<?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'])) {
799
+	print 'checked';
800
+}
801
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
802
+			<?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'])) {
803
+	print 'checked';
804
+}
805
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
525 806
 		    <?php
526 807
 			}
527 808
 		    ?>
@@ -529,10 +810,16 @@  discard block
 block discarded – undo
529 810
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
530 811
 		    ?>
531 812
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
532
-			    <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>
813
+			    <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'])) {
814
+	print 'checked';
815
+}
816
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
533 817
 			<?php } ?>
534 818
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
535
-			    <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>
819
+			    <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'])) {
820
+	print 'checked';
821
+}
822
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
536 823
 			<?php } ?>
537 824
 		    <?php
538 825
 			}
@@ -549,7 +836,9 @@  discard block
 block discarded – undo
549 836
 				}
550 837
 				foreach($allairlinenames as $airline) {
551 838
 					$airline_name = $airline['airline_name'];
552
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
839
+					if (strlen($airline_name) > 30) {
840
+						$airline_name = substr($airline_name,0,30).'...';
841
+					}
553 842
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
554 843
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
555 844
 					} else {
@@ -567,7 +856,10 @@  discard block
 block discarded – undo
567 856
 		    <li><?php echo _("Display alliance:"); ?>
568 857
 		    <br/>
569 858
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
570
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
859
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
860
+	echo ' selected';
861
+}
862
+?>><?php echo _("All"); ?></option>
571 863
 			    <?php
572 864
 				foreach($allalliancenames as $alliance) {
573 865
 					$alliance_name = $alliance['alliance'];
@@ -626,10 +918,22 @@  discard block
 block discarded – undo
626 918
 		    ?>
627 919
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
628 920
 			<select class="selectpicker" onchange="airlinestype(this);">
629
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
630
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
631
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
632
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
921
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
922
+	echo ' selected';
923
+}
924
+?>><?php echo _("All"); ?></option>
925
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
926
+	echo ' selected';
927
+}
928
+?>><?php echo _("Passenger"); ?></option>
929
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
930
+	echo ' selected';
931
+}
932
+?>><?php echo _("Cargo"); ?></option>
933
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
934
+	echo ' selected';
935
+}
936
+?>><?php echo _("Military"); ?></option>
633 937
 			</select>
634 938
 		    </li>
635 939
 		    <?php
@@ -637,7 +941,10 @@  discard block
 block discarded – undo
637 941
 		    ?>
638 942
 		    <li>
639 943
 			<?php echo _("Display flight with ident:"); ?>
640
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
944
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
945
+	print $_COOKIE['filter_ident'];
946
+}
947
+?>" />
641 948
 		    </li>
642 949
 		    <?php
643 950
 			}
@@ -656,7 +963,10 @@  discard block
 block discarded – undo
656 963
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
657 964
 	    <form>
658 965
 		<ul>
659
-		    <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>
966
+		    <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'])) {
967
+	print 'checked';
968
+}
969
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
660 970
 		    <li><?php echo _("Type:"); ?>
661 971
 			<select class="selectpicker" multiple onchange="sattypes(this);">
662 972
 			    <?php
@@ -664,25 +974,45 @@  discard block
 block discarded – undo
664 974
 				$types = $Satellite->get_tle_types();
665 975
 				foreach ($types as $type) {
666 976
 					$type_name = $type['tle_type'];
667
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
668
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
669
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
670
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
671
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
672
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
673
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
674
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
675
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
676
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
677
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
678
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
679
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
680
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
681
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
682
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
683
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
684
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
685
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
977
+					if ($type_name == 'musson') {
978
+						$type_name = 'Russian LEO Navigation';
979
+					} else if ($type_name == 'nnss') {
980
+						$type_name = 'Navi Navigation Satellite System';
981
+					} else if ($type_name == 'sbas') {
982
+						$type_name = 'Satellite-Based Augmentation System';
983
+					} else if ($type_name == 'glo-ops') {
984
+						$type_name = 'Glonass Operational';
985
+					} else if ($type_name == 'gps-ops') {
986
+						$type_name = 'GPS Operational';
987
+					} else if ($type_name == 'argos') {
988
+						$type_name = 'ARGOS Data Collection System';
989
+					} else if ($type_name == 'tdrss') {
990
+						$type_name = 'Tracking and Data Relay Satellite System';
991
+					} else if ($type_name == 'sarsat') {
992
+						$type_name = 'Search & Rescue';
993
+					} else if ($type_name == 'dmc') {
994
+						$type_name = 'Disaster Monitoring';
995
+					} else if ($type_name == 'resource') {
996
+						$type_name = 'Earth Resources';
997
+					} else if ($type_name == 'stations') {
998
+						$type_name = 'Space Stations';
999
+					} else if ($type_name == 'geo') {
1000
+						$type_name = 'Geostationary';
1001
+					} else if ($type_name == 'amateur') {
1002
+						$type_name = 'Amateur Radio';
1003
+					} else if ($type_name == 'x-comm') {
1004
+						$type_name = 'Experimental';
1005
+					} else if ($type_name == 'other-comm') {
1006
+						$type_name = 'Other Comm';
1007
+					} else if ($type_name == 'science') {
1008
+						$type_name = 'Space & Earth Science';
1009
+					} else if ($type_name == 'military') {
1010
+						$type_name = 'Miscellaneous Military';
1011
+					} else if ($type_name == 'radar') {
1012
+						$type_name = 'Radar Calibration';
1013
+					} else if ($type_name == 'tle-new') {
1014
+						$type_name = 'Last 30 days launches';
1015
+					}
686 1016
 					
687 1017
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
688 1018
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
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
 		$Tracker = new Tracker($this->db);
290
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
327
+		if (!isset($globalLiveInterval)) {
328
+			$globalLiveInterval = '200';
329
+		}
291 330
 		$filter_query = $this->getFilter($filter);
292 331
 
293 332
 		if (is_array($coord)) {
@@ -295,7 +334,9 @@  discard block
 block discarded – undo
295 334
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
296 335
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
297 336
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
298
-		} else return array();
337
+		} else {
338
+			return array();
339
+		}
299 340
 		if ($globalDBdriver == 'mysql') {
300 341
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
301 342
 		} else {
@@ -315,7 +356,9 @@  discard block
 block discarded – undo
315 356
 	{
316 357
 		global $globalDBdriver, $globalLiveInterval;
317 358
 		$Tracker = new Tracker($this->db);
318
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
359
+		if (!isset($globalLiveInterval)) {
360
+			$globalLiveInterval = '200';
361
+		}
319 362
 		$filter_query = $this->getFilter($filter,true,true);
320 363
 
321 364
 		if (is_array($coord)) {
@@ -323,7 +366,9 @@  discard block
 block discarded – undo
323 366
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324 367
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325 368
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
326
-		} else return array();
369
+		} else {
370
+			return array();
371
+		}
327 372
 		/*
328 373
 		if ($globalDBdriver == 'mysql') {
329 374
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
@@ -557,11 +602,15 @@  discard block
 block discarded – undo
557 602
 		//$query  = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date';
558 603
 		if ($globalDBdriver == 'mysql') {
559 604
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
560
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
605
+			if ($liveinterval) {
606
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
607
+			}
561 608
 			$query .= ' ORDER BY date';
562 609
 		} else {
563 610
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
564
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
611
+			if ($liveinterval) {
612
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
613
+			}
565 614
 			$query .= ' ORDER BY date';
566 615
 		}
567 616
 
@@ -656,7 +705,9 @@  discard block
 block discarded – undo
656 705
 				$i++;
657 706
 				$j++;
658 707
 				if ($j == 30) {
659
-					if ($globalDebug) echo ".";
708
+					if ($globalDebug) {
709
+						echo ".";
710
+					}
660 711
 				    	try {
661 712
 						
662 713
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -903,7 +954,9 @@  discard block
 block discarded – undo
903 954
 			{
904 955
 				return false;
905 956
 			}
906
-		} else return '';
957
+		} else {
958
+			return '';
959
+		}
907 960
 
908 961
 		if ($longitude != '')
909 962
 		{
@@ -911,7 +964,9 @@  discard block
 block discarded – undo
911 964
 			{
912 965
 				return false;
913 966
 			}
914
-		} else return '';
967
+		} else {
968
+			return '';
969
+		}
915 970
 
916 971
 		if ($altitude != '')
917 972
 		{
@@ -919,7 +974,9 @@  discard block
 block discarded – undo
919 974
 			{
920 975
 				return false;
921 976
 			}
922
-		} else $altitude = 0;
977
+		} else {
978
+			$altitude = 0;
979
+		}
923 980
 
924 981
 		if ($heading != '')
925 982
 		{
@@ -927,7 +984,9 @@  discard block
 block discarded – undo
927 984
 			{
928 985
 				return false;
929 986
 			}
930
-		} else $heading = 0;
987
+		} else {
988
+			$heading = 0;
989
+		}
931 990
 
932 991
 		if ($groundspeed != '')
933 992
 		{
@@ -935,9 +994,13 @@  discard block
 block discarded – undo
935 994
 			{
936 995
 				return false;
937 996
 			}
938
-		} else $groundspeed = 0;
997
+		} else {
998
+			$groundspeed = 0;
999
+		}
939 1000
 		date_default_timezone_set('UTC');
940
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1001
+		if ($date == '') {
1002
+			$date = date("Y-m-d H:i:s", time());
1003
+		}
941 1004
 
942 1005
         
943 1006
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -953,12 +1016,18 @@  discard block
 block discarded – undo
953 1016
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
954 1017
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
955 1018
 
956
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
957
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1019
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1020
+            		$groundspeed = 0;
1021
+            	}
1022
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1023
+            		$heading = 0;
1024
+            	}
958 1025
             	
959 1026
 		$query = '';
960 1027
 		if ($globalArchive) {
961
-			if ($globalDebug) echo '-- Delete previous data -- ';
1028
+			if ($globalDebug) {
1029
+				echo '-- Delete previous data -- ';
1030
+			}
962 1031
 			$query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;';
963 1032
 		}
964 1033
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
@@ -977,10 +1046,14 @@  discard block
 block discarded – undo
977 1046
                 echo 'noarchive : '.$noarchive."\n";
978 1047
                 */
979 1048
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
980
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
1049
+		    if ($globalDebug) {
1050
+		    	echo '(Add to Tracker archive '.$famtrackid.' : ';
1051
+		    }
981 1052
 		    $TrackerArchive = new TrackerArchive($this->db);
982 1053
 		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
983
-		    if ($globalDebug) echo $result.')';
1054
+		    if ($globalDebug) {
1055
+		    	echo $result.')';
1056
+		    }
984 1057
 		}
985 1058
 
986 1059
 		return "success";
Please login to merge, or discard this patch.
scripts/daemon-spotter.php 1 patch
Braces   +1049 added lines, -358 removed lines patch added patch discarded remove patch
@@ -14,13 +14,17 @@  discard block
 block discarded – undo
14 14
 require_once(dirname(__FILE__).'/../require/class.Source.php');
15 15
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
16 16
 require_once(dirname(__FILE__).'/../require/class.Common.php');
17
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
17
+if (isset($globalTracker) && $globalTracker) {
18
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
19
+}
18 20
 if (isset($globalMarine) && $globalMarine) {
19 21
     require_once(dirname(__FILE__).'/../require/class.AIS.php');
20 22
     require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
21 23
 }
22 24
 
23
-if (!isset($globalDebug)) $globalDebug = FALSE;
25
+if (!isset($globalDebug)) {
26
+	$globalDebug = FALSE;
27
+}
24 28
 
25 29
 // Check if schema is at latest version
26 30
 $Connection = new Connection();
@@ -59,66 +63,107 @@  discard block
 block discarded – undo
59 63
 //elseif (isset($options['source'])) $hosts = array($options['source']);
60 64
 if (isset($options['s'])) {
61 65
     $globalSources = array();
62
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']);
63
-    else $globalSources[] = array('host' => $options['s']);
64
-} elseif (isset($options['source'])) {
66
+    if (isset($options['format'])) {
67
+    	$globalSources[] = array('host' => $options['s'],'format' => $options['format']);
68
+    } else {
69
+    	$globalSources[] = array('host' => $options['s']);
70
+    }
71
+    } elseif (isset($options['source'])) {
65 72
     $globalSources = array();
66
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']);
67
-    else $globalSources[] = array('host' => $options['source']);
68
-}
73
+    if (isset($options['format'])) {
74
+    	$globalSources[] = array('host' => $options['source'],'format' => $options['format']);
75
+    } else {
76
+    	$globalSources[] = array('host' => $options['source']);
77
+    }
78
+    }
69 79
 if (isset($options['aprsserverhost'])) {
70 80
 	$globalServerAPRS = TRUE;
71 81
 	$globalServerAPRShost = $options['aprsserverhost'];
72 82
 }
73
-if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport'];
74
-if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid'];
75
-if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass'];
76
-if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; 
83
+if (isset($options['aprsserverport'])) {
84
+	$globalServerAPRSport = $options['aprsserverport'];
85
+}
86
+if (isset($options['aprsserverssid'])) {
87
+	$globalServerAPRSssid = $options['aprsserverssid'];
88
+}
89
+if (isset($options['aprsserverpass'])) {
90
+	$globalServerAPRSpass = $options['aprsserverpass'];
91
+}
92
+if (isset($options['noaprsserver'])) {
93
+	$globalServerAPRS = FALSE;
94
+}
77 95
 if (isset($options['enable-aircraft'])) {
78
-	if ($globalDebug) echo 'Enable Aircraft mode'."\n";
96
+	if ($globalDebug) {
97
+		echo 'Enable Aircraft mode'."\n";
98
+	}
79 99
 	$globalAircraft = TRUE; 
80 100
 }
81 101
 if (isset($options['disable-aircraft'])) {
82
-	if ($globalDebug) echo 'Disable Aircraft mode'."\n";
102
+	if ($globalDebug) {
103
+		echo 'Disable Aircraft mode'."\n";
104
+	}
83 105
 	$globalAircraft = FALSE;
84 106
 }
85 107
 if (isset($options['enable-tracker'])) {
86
-	if ($globalDebug) echo 'Enable Tracker mode'."\n";
108
+	if ($globalDebug) {
109
+		echo 'Enable Tracker mode'."\n";
110
+	}
87 111
 	$globalTracker = TRUE; 
88 112
 }
89 113
 if (isset($options['disable-tracker'])) {
90
-	if ($globalDebug) echo 'Disable Tracker mode'."\n";
114
+	if ($globalDebug) {
115
+		echo 'Disable Tracker mode'."\n";
116
+	}
91 117
 	$globalTracker = FALSE;
92 118
 }
93 119
 if (isset($options['enable-marine'])) {
94
-	if ($globalDebug) echo 'Enable Marine mode'."\n";
120
+	if ($globalDebug) {
121
+		echo 'Enable Marine mode'."\n";
122
+	}
95 123
 	$globalMarine = TRUE;
96 124
 }
97 125
 if (isset($options['disable-marine'])) {
98
-	if ($globalDebug) echo 'Disable Marine mode'."\n";
126
+	if ($globalDebug) {
127
+		echo 'Disable Marine mode'."\n";
128
+	}
99 129
 	$globalMarine = FALSE;
100 130
 }
101
-if (isset($options['nodaemon'])) $globalDaemon = FALSE;
102
-if (isset($options['server'])) $globalServer = TRUE;
103
-if (isset($options['idsource'])) $id_source = $options['idsource'];
104
-else $id_source = 1;
131
+if (isset($options['nodaemon'])) {
132
+	$globalDaemon = FALSE;
133
+}
134
+if (isset($options['server'])) {
135
+	$globalServer = TRUE;
136
+}
137
+if (isset($options['idsource'])) {
138
+	$id_source = $options['idsource'];
139
+} else {
140
+	$id_source = 1;
141
+}
105 142
 if (isset($globalServer) && $globalServer) {
106
-    if ($globalDebug) echo "Using Server Mode\n";
143
+    if ($globalDebug) {
144
+    	echo "Using Server Mode\n";
145
+    }
107 146
     $SI=new SpotterServer();
108 147
 /*
109 148
     require_once(dirname(__FILE__).'/../require/class.APRS.php');
110 149
     $SI = new adsb2aprs();
111 150
     $SI->connect();
112 151
 */
113
-} else $SI=new SpotterImport($Connection->db);
152
+} else {
153
+	$SI=new SpotterImport($Connection->db);
154
+}
114 155
 
115
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
156
+if (isset($globalTracker) && $globalTracker) {
157
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
158
+}
116 159
 if (isset($globalMarine) && $globalMarine) {
117 160
     require_once(dirname(__FILE__).'/../require/class.AIS.php');
118 161
     require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
119 162
 }
120 163
 
121
-if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
164
+if (isset($globalTracker) && $globalTracker) {
165
+	$TI = new TrackerImport($Connection->db);
166
+}
122 167
 if (isset($globalMarine) && $globalMarine) {
123 168
     $AIS = new AIS();
124 169
     $MI = new MarineImport($Connection->db);
@@ -141,7 +186,9 @@  discard block
 block discarded – undo
141 186
 }
142 187
 
143 188
 // let's try and connect
144
-if ($globalDebug) echo "Connecting...\n";
189
+if ($globalDebug) {
190
+	echo "Connecting...\n";
191
+}
145 192
 $use_aprs = false;
146 193
 $aprs_full = false;
147 194
 $reset = 0;
@@ -150,7 +197,9 @@  discard block
 block discarded – undo
150 197
     //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
151 198
     global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context;
152 199
     $reset++;
153
-    if ($globalDebug) echo 'Connect to all...'."\n";
200
+    if ($globalDebug) {
201
+    	echo 'Connect to all...'."\n";
202
+    }
154 203
     foreach ($hosts as $id => $value) {
155 204
 	$host = $value['host'];
156 205
 	$globalSources[$id]['last_exec'] = 0;
@@ -160,22 +209,30 @@  discard block
 block discarded – undo
160 209
         	//$formats[$id] = 'deltadbtxt';
161 210
         	$globalSources[$id]['format'] = 'deltadbtxt';
162 211
         	//$last_exec['deltadbtxt'] = 0;
163
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
212
+        	if ($globalDebug) {
213
+        		echo "Connect to deltadb source (".$host.")...\n";
214
+        	}
164 215
             } else if (preg_match('/vatsim-data.txt$/i',$host)) {
165 216
         	//$formats[$id] = 'vatsimtxt';
166 217
         	$globalSources[$id]['format'] = 'vatsimtxt';
167 218
         	//$last_exec['vatsimtxt'] = 0;
168
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
219
+        	if ($globalDebug) {
220
+        		echo "Connect to vatsim source (".$host.")...\n";
221
+        	}
169 222
     	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
170 223
         	//$formats[$id] = 'aircraftlistjson';
171 224
         	$globalSources[$id]['format'] = 'aircraftlistjson';
172 225
         	//$last_exec['aircraftlistjson'] = 0;
173
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
226
+        	if ($globalDebug) {
227
+        		echo "Connect to aircraftlist.json source (".$host.")...\n";
228
+        	}
174 229
     	    } else if (preg_match('/opensky/i',$host)) {
175 230
         	//$formats[$id] = 'aircraftlistjson';
176 231
         	$globalSources[$id]['format'] = 'opensky';
177 232
         	//$last_exec['aircraftlistjson'] = 0;
178
-        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
233
+        	if ($globalDebug) {
234
+        		echo "Connect to opensky source (".$host.")...\n";
235
+        	}
179 236
     	    /*
180 237
     	    // Disabled for now, site change source format
181 238
     	    } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) {
@@ -192,7 +249,9 @@  discard block
 block discarded – undo
192 249
         	//$formats[$id] = 'planeupdatefaa';
193 250
         	$globalSources[$id]['format'] = 'planeupdatefaa';
194 251
         	//$last_exec['planeupdatefaa'] = 0;
195
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
252
+        	if ($globalDebug) {
253
+        		echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
254
+        	}
196 255
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
197 256
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
198 257
         	    exit(0);
@@ -201,32 +260,46 @@  discard block
 block discarded – undo
201 260
         	//$formats[$id] = 'phpvmacars';
202 261
         	$globalSources[$id]['format'] = 'phpvmacars';
203 262
         	//$last_exec['phpvmacars'] = 0;
204
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
263
+        	if ($globalDebug) {
264
+        		echo "Connect to phpvmacars source (".$host.")...\n";
265
+        	}
205 266
             } else if (preg_match('/VAM-json.php$/i',$host)) {
206 267
         	//$formats[$id] = 'phpvmacars';
207 268
         	$globalSources[$id]['format'] = 'vam';
208
-        	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
269
+        	if ($globalDebug) {
270
+        		echo "Connect to Vam source (".$host.")...\n";
271
+        	}
209 272
             } else if (preg_match('/whazzup/i',$host)) {
210 273
         	//$formats[$id] = 'whazzup';
211 274
         	$globalSources[$id]['format'] = 'whazzup';
212 275
         	//$last_exec['whazzup'] = 0;
213
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
276
+        	if ($globalDebug) {
277
+        		echo "Connect to whazzup source (".$host.")...\n";
278
+        	}
214 279
             } else if (preg_match('/blitzortung/i',$host)) {
215 280
         	$globalSources[$id]['format'] = 'blitzortung';
216
-        	if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n";
281
+        	if ($globalDebug) {
282
+        		echo "Connect to blitzortung source (".$host.")...\n";
283
+        	}
217 284
             } else if (preg_match('/airwhere/i',$host)) {
218 285
         	$globalSources[$id]['format'] = 'airwhere';
219
-        	if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n";
286
+        	if ($globalDebug) {
287
+        		echo "Connect to airwhere source (".$host.")...\n";
288
+        	}
220 289
             } else if (preg_match('/recentpireps/i',$host)) {
221 290
         	//$formats[$id] = 'pirepsjson';
222 291
         	$globalSources[$id]['format'] = 'pirepsjson';
223 292
         	//$last_exec['pirepsjson'] = 0;
224
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
293
+        	if ($globalDebug) {
294
+        		echo "Connect to pirepsjson source (".$host.")...\n";
295
+        	}
225 296
             } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
226 297
         	//$formats[$id] = 'fr24json';
227 298
         	$globalSources[$id]['format'] = 'fr24json';
228 299
         	//$last_exec['fr24json'] = 0;
229
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
300
+        	if ($globalDebug) {
301
+        		echo "Connect to fr24 source (".$host.")...\n";
302
+        	}
230 303
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
231 304
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
232 305
         	    exit(0);
@@ -235,7 +308,9 @@  discard block
 block discarded – undo
235 308
         	//$formats[$id] = 'fr24json';
236 309
         	$globalSources[$id]['format'] = 'myshiptracking';
237 310
         	//$last_exec['fr24json'] = 0;
238
-        	if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n";
311
+        	if ($globalDebug) {
312
+        		echo "Connect to myshiptracking source (".$host.")...\n";
313
+        	}
239 314
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
240 315
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
241 316
         	    exit(0);
@@ -244,17 +319,24 @@  discard block
 block discarded – undo
244 319
             } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
245 320
         	//$formats[$id] = 'tsv';
246 321
         	$globalSources[$id]['format'] = 'tsv';
247
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
322
+        	if ($globalDebug) {
323
+        		echo "Connect to tsv source (".$host.")...\n";
324
+        	}
248 325
             }
249 326
         } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
250 327
     		if ($globalSources[$id]['format'] == 'aisnmeahttp') {
251 328
     		    $idf = fopen($globalSources[$id]['host'],'r',false,$context);
252 329
     		    if ($idf !== false) {
253 330
     			$httpfeeds[$id] = $idf;
254
-        		if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
331
+        		if ($globalDebug) {
332
+        			echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
333
+        		}
334
+    		    } elseif ($globalDebug) {
335
+    		    	echo "Can't connect to ".$globalSources[$id]['host']."\n";
255 336
     		    }
256
-    		    elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n";
257
-    		} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
337
+    		} elseif ($globalDebug) {
338
+    			echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
339
+    		}
258 340
         } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
259 341
 	    $hostport = explode(':',$host);
260 342
 	    if (isset($hostport[1])) {
@@ -294,17 +376,25 @@  discard block
 block discarded – undo
294 376
         		//$formats[$id] = 'beast';
295 377
         		$globalSources[$id]['format'] = 'beast';
296 378
 		    //} else $formats[$id] = 'sbs';
297
-		    } else $globalSources[$id]['format'] = 'sbs';
379
+		    } else {
380
+		    	$globalSources[$id]['format'] = 'sbs';
381
+		    }
298 382
 		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
299 383
 		}
300
-		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
384
+		if ($globalDebug) {
385
+			echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
386
+		}
301 387
             } else {
302
-		if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
388
+		if ($globalDebug) {
389
+			echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
390
+		}
303 391
     	    }
304 392
         }
305 393
     }
306 394
 }
307
-if (!isset($globalMinFetch)) $globalMinFetch = 15;
395
+if (!isset($globalMinFetch)) {
396
+	$globalMinFetch = 15;
397
+}
308 398
 
309 399
 // Initialize all
310 400
 $status = array();
@@ -313,13 +403,19 @@  discard block
 block discarded – undo
313 403
 $formats = array();
314 404
 $last_exec = array();
315 405
 $time = time();
316
-if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut;
317
-else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
318
-else $timeout = 20;
406
+if (isset($globalSourcesTimeout)) {
407
+	$timeout = $globalSourcesTimeOut;
408
+} else if (isset($globalSBS1TimeOut)) {
409
+	$timeout = $globalSBS1TimeOut;
410
+} else {
411
+	$timeout = 20;
412
+}
319 413
 $errno = '';
320 414
 $errstr='';
321 415
 
322
-if (!isset($globalDaemon)) $globalDaemon = TRUE;
416
+if (!isset($globalDaemon)) {
417
+	$globalDaemon = TRUE;
418
+}
323 419
 /* Initiate connections to all the hosts simultaneously */
324 420
 //connect_all($hosts);
325 421
 //connect_all($globalSources);
@@ -348,7 +444,9 @@  discard block
 block discarded – undo
348 444
     if (isset($source['format']) && $source['format'] == 'aprs') {
349 445
 	$aprs_connect = 0;
350 446
 	$use_aprs = true;
351
-	if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true;
447
+	if (isset($source['port']) && $source['port'] == '10152') {
448
+		$aprs_full = true;
449
+	}
352 450
 	break;
353 451
     }
354 452
 }
@@ -359,25 +457,48 @@  discard block
 block discarded – undo
359 457
 	$aprs_connect = 0;
360 458
 	$aprs_keep = 120;
361 459
 	$aprs_last_tx = time();
362
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
363
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
364
-	if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid;
365
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
366
-	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
367
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
368
-	if ($aprs_full) $aprs_filter = '';
369
-	if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass;
370
-	else $aprs_pass = '-1';
460
+	if (isset($globalAPRSversion)) {
461
+		$aprs_version = $globalAPRSversion;
462
+	} else {
463
+		$aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
464
+	}
465
+	if (isset($globalAPRSssid)) {
466
+		$aprs_ssid = $globalAPRSssid;
467
+	} else {
468
+		$aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
469
+	}
470
+	if (isset($globalAPRSfilter)) {
471
+		$aprs_filter = $globalAPRSfilter;
472
+	} else {
473
+		$aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
474
+	}
475
+	if ($aprs_full) {
476
+		$aprs_filter = '';
477
+	}
478
+	if (isset($globalAPRSpass)) {
479
+		$aprs_pass = $globalAPRSpass;
480
+	} else {
481
+		$aprs_pass = '-1';
482
+	}
371 483
 
372
-	if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n";
373
-	else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
374
-}
484
+	if ($aprs_filter != '') {
485
+		$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n";
486
+	} else {
487
+		$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
488
+	}
489
+	}
375 490
 
376 491
 // connected - lets do some work
377
-if ($globalDebug) echo "Connected!\n";
492
+if ($globalDebug) {
493
+	echo "Connected!\n";
494
+}
378 495
 sleep(1);
379
-if ($globalDebug) echo "SCAN MODE \n\n";
380
-if (!isset($globalCronEnd)) $globalCronEnd = 60;
496
+if ($globalDebug) {
497
+	echo "SCAN MODE \n\n";
498
+}
499
+if (!isset($globalCronEnd)) {
500
+	$globalCronEnd = 60;
501
+}
381 502
 $endtime = time()+$globalCronEnd;
382 503
 $i = 1;
383 504
 $tt = array();
@@ -391,20 +512,28 @@  discard block
 block discarded – undo
391 512
 
392 513
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
393 514
 while ($i > 0) {
394
-    if (!$globalDaemon) $i = $endtime-time();
515
+    if (!$globalDaemon) {
516
+    	$i = $endtime-time();
517
+    }
395 518
     // Delete old ATC
396 519
     if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
397
-	if ($globalDebug) echo 'Delete old ATC...'."\n";
520
+	if ($globalDebug) {
521
+		echo 'Delete old ATC...'."\n";
522
+	}
398 523
         $ATC->deleteOldATC();
399 524
     }
400 525
     
401 526
     if (count($last_exec) == count($globalSources)) {
402 527
 	$max = $globalMinFetch;
403 528
 	foreach ($last_exec as $last) {
404
-	    if ((time() - $last['last']) < $max) $max = time() - $last['last'];
529
+	    if ((time() - $last['last']) < $max) {
530
+	    	$max = time() - $last['last'];
531
+	    }
405 532
 	}
406 533
 	if ($max != $globalMinFetch) {
407
-	    if ($globalDebug) echo 'Sleeping...'."\n";
534
+	    if ($globalDebug) {
535
+	    	echo 'Sleeping...'."\n";
536
+	    }
408 537
 	    sleep($globalMinFetch-$max+2);
409 538
 	}
410 539
     }
@@ -414,7 +543,9 @@  discard block
 block discarded – undo
414 543
     foreach ($globalSources as $id => $value) {
415 544
 	date_default_timezone_set('UTC');
416 545
 	//if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n";
417
-	if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0;
546
+	if (!isset($last_exec[$id]['last'])) {
547
+		$last_exec[$id]['last'] = 0;
548
+	}
418 549
 	if ($value['format'] == 'deltadbtxt' && 
419 550
 	    (
420 551
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
@@ -423,7 +554,9 @@  discard block
 block discarded – undo
423 554
 	) {
424 555
 	    //$buffer = $Common->getData($hosts[$id]);
425 556
 	    $buffer = $Common->getData($value['host']);
426
-	    if ($buffer != '') $reset = 0;
557
+	    if ($buffer != '') {
558
+	    	$reset = 0;
559
+	    }
427 560
     	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
428 561
 	    $buffer = explode('\n',$buffer);
429 562
 	    foreach ($buffer as $line) {
@@ -432,20 +565,41 @@  discard block
 block discarded – undo
432 565
 	            $data = array();
433 566
 	            $data['hex'] = $line[1]; // hex
434 567
 	            $data['ident'] = $line[2]; // ident
435
-	            if (isset($line[3])) $data['altitude'] = $line[3]; // altitude
436
-	            if (isset($line[4])) $data['speed'] = $line[4]; // speed
437
-	            if (isset($line[5])) $data['heading'] = $line[5]; // heading
438
-	            if (isset($line[6])) $data['latitude'] = $line[6]; // lat
439
-	            if (isset($line[7])) $data['longitude'] = $line[7]; // long
568
+	            if (isset($line[3])) {
569
+	            	$data['altitude'] = $line[3];
570
+	            }
571
+	            // altitude
572
+	            if (isset($line[4])) {
573
+	            	$data['speed'] = $line[4];
574
+	            }
575
+	            // speed
576
+	            if (isset($line[5])) {
577
+	            	$data['heading'] = $line[5];
578
+	            }
579
+	            // heading
580
+	            if (isset($line[6])) {
581
+	            	$data['latitude'] = $line[6];
582
+	            }
583
+	            // lat
584
+	            if (isset($line[7])) {
585
+	            	$data['longitude'] = $line[7];
586
+	            }
587
+	            // long
440 588
 	            $data['verticalrate'] = ''; // vertical rate
441 589
 	            //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk
442 590
 	            $data['emergency'] = ''; // emergency
443 591
 		    $data['datetime'] = date('Y-m-d H:i:s');
444 592
 		    $data['format_source'] = 'deltadbtxt';
445 593
     		    $data['id_source'] = $id_source;
446
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
447
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
448
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
594
+		    if (isset($value['name']) && $value['name'] != '') {
595
+		    	$data['source_name'] = $value['name'];
596
+		    }
597
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
598
+		    	$data['noarchive'] = true;
599
+		    }
600
+		    if (isset($value['sourcestats'])) {
601
+		    	$data['sourcestats'] = $value['sourcestats'];
602
+		    }
449 603
     		    $SI->add($data);
450 604
 		    unset($data);
451 605
     		}
@@ -460,7 +614,9 @@  discard block
 block discarded – undo
460 614
 	    date_default_timezone_set('CET');
461 615
 	    $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host']));
462 616
 	    date_default_timezone_set('UTC');
463
-	    if ($buffer != '') $reset = 0;
617
+	    if ($buffer != '') {
618
+	    	$reset = 0;
619
+	    }
464 620
     	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
465 621
 	    $buffer = explode('\n',$buffer);
466 622
 	    foreach ($buffer as $line) {
@@ -469,16 +625,36 @@  discard block
 block discarded – undo
469 625
 		    $add = false;
470 626
 		    $ais_data = $AIS->parse_line(trim($line));
471 627
 		    $data = array();
472
-		    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
473
-		    if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi'];
474
-		    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
475
-		    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
476
-		    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
477
-		    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
478
-		    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
479
-		    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
480
-		    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
481
-		    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
628
+		    if (isset($ais_data['ident'])) {
629
+		    	$data['ident'] = $ais_data['ident'];
630
+		    }
631
+		    if (isset($ais_data['mmsi'])) {
632
+		    	$data['mmsi'] = $ais_data['mmsi'];
633
+		    }
634
+		    if (isset($ais_data['speed'])) {
635
+		    	$data['speed'] = $ais_data['speed'];
636
+		    }
637
+		    if (isset($ais_data['heading'])) {
638
+		    	$data['heading'] = $ais_data['heading'];
639
+		    }
640
+		    if (isset($ais_data['latitude'])) {
641
+		    	$data['latitude'] = $ais_data['latitude'];
642
+		    }
643
+		    if (isset($ais_data['longitude'])) {
644
+		    	$data['longitude'] = $ais_data['longitude'];
645
+		    }
646
+		    if (isset($ais_data['status'])) {
647
+		    	$data['status'] = $ais_data['status'];
648
+		    }
649
+		    if (isset($ais_data['type'])) {
650
+		    	$data['type'] = $ais_data['type'];
651
+		    }
652
+		    if (isset($ais_data['imo'])) {
653
+		    	$data['imo'] = $ais_data['imo'];
654
+		    }
655
+		    if (isset($ais_data['callsign'])) {
656
+		    	$data['callsign'] = $ais_data['callsign'];
657
+		    }
482 658
 		    if (isset($ais_data['timestamp'])) {
483 659
 			$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
484 660
 			if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) {
@@ -492,8 +668,12 @@  discard block
 block discarded – undo
492 668
 		    $data['format_source'] = 'aisnmeatxt';
493 669
     		    $data['id_source'] = $id_source;
494 670
 		    //print_r($data);
495
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
496
-		    if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
671
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
672
+		    	$data['noarchive'] = true;
673
+		    }
674
+		    if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') {
675
+		    	$MI->add($data);
676
+		    }
497 677
 		    unset($data);
498 678
 		}
499 679
     	    }
@@ -513,20 +693,48 @@  discard block
 block discarded – undo
513 693
 			    if ($line != '') {
514 694
 				$ais_data = $AIS->parse_line(trim($line));
515 695
 				$data = array();
516
-				if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
517
-				if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi'];
518
-				if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
519
-				if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
520
-				if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
521
-				if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
522
-				if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
523
-				if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
524
-				if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
525
-				if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid'];
526
-				if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
527
-				if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
528
-				if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
529
-				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
696
+				if (isset($ais_data['ident'])) {
697
+					$data['ident'] = $ais_data['ident'];
698
+				}
699
+				if (isset($ais_data['mmsi'])) {
700
+					$data['mmsi'] = $ais_data['mmsi'];
701
+				}
702
+				if (isset($ais_data['speed'])) {
703
+					$data['speed'] = $ais_data['speed'];
704
+				}
705
+				if (isset($ais_data['heading'])) {
706
+					$data['heading'] = $ais_data['heading'];
707
+				}
708
+				if (isset($ais_data['latitude'])) {
709
+					$data['latitude'] = $ais_data['latitude'];
710
+				}
711
+				if (isset($ais_data['longitude'])) {
712
+					$data['longitude'] = $ais_data['longitude'];
713
+				}
714
+				if (isset($ais_data['status'])) {
715
+					$data['status'] = $ais_data['status'];
716
+				}
717
+				if (isset($ais_data['statusid'])) {
718
+					$data['status_id'] = $ais_data['statusid'];
719
+				}
720
+				if (isset($ais_data['type'])) {
721
+					$data['type'] = $ais_data['type'];
722
+				}
723
+				if (isset($ais_data['typeid'])) {
724
+					$data['type_id'] = $ais_data['typeid'];
725
+				}
726
+				if (isset($ais_data['imo'])) {
727
+					$data['imo'] = $ais_data['imo'];
728
+				}
729
+				if (isset($ais_data['callsign'])) {
730
+					$data['callsign'] = $ais_data['callsign'];
731
+				}
732
+				if (isset($ais_data['destination'])) {
733
+					$data['arrival_code'] = $ais_data['destination'];
734
+				}
735
+				if (isset($ais_data['eta_ts'])) {
736
+					$data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
737
+				}
530 738
 				if (isset($ais_data['timestamp'])) {
531 739
 				    $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
532 740
 				} else {
@@ -534,18 +742,27 @@  discard block
 block discarded – undo
534 742
 				}
535 743
 				$data['format_source'] = 'aisnmeahttp';
536 744
 				$data['id_source'] = $id_source;
537
-				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
538
-				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
745
+				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
746
+					$data['noarchive'] = true;
747
+				}
748
+				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') {
749
+					$MI->add($data);
750
+				}
539 751
 				unset($data);
540 752
 			    }
541 753
 			}
542 754
 		    }
543 755
 		} else {
544 756
 		    $format = $value['format'];
545
-		    if (isset($tt[$format])) $tt[$format]++;
546
-		    else $tt[$format] = 0;
757
+		    if (isset($tt[$format])) {
758
+		    	$tt[$format]++;
759
+		    } else {
760
+		    	$tt[$format] = 0;
761
+		    }
547 762
 		    if ($tt[$format] > 30) {
548
-			if ($globalDebug) echo 'Reconnect...'."\n";
763
+			if ($globalDebug) {
764
+				echo 'Reconnect...'."\n";
765
+			}
549 766
 			sleep(2);
550 767
 			$sourceeen[] = $value;
551 768
 			connect_all($sourceeen);
@@ -583,7 +800,9 @@  discard block
 block discarded – undo
583 800
 			    $data['datetime'] = date('Y-m-d H:i:s',$line['T']);
584 801
 			    $data['format_source'] = 'myshiptracking';
585 802
 			    $data['id_source'] = $id_source;
586
-			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
803
+			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
804
+			    	$data['noarchive'] = true;
805
+			    }
587 806
 			    $MI->add($data);
588 807
 			    unset($data);
589 808
 			}
@@ -608,7 +827,9 @@  discard block
 block discarded – undo
608 827
 			    $data['callsign'] = $line['callsign'];
609 828
 			    $data['mmsi'] = $line['mmsi'];
610 829
 			    $data['speed'] = $line['sog'];
611
-			    if ($line['heading'] != '511') $data['heading'] = $line['heading'];
830
+			    if ($line['heading'] != '511') {
831
+			    	$data['heading'] = $line['heading'];
832
+			    }
612 833
 			    $data['latitude'] = $line['latitude'];
613 834
 			    $data['longitude'] = $line['longitude'];
614 835
 			    $data['type_id'] = $line['shiptype'];
@@ -616,7 +837,9 @@  discard block
 block discarded – undo
616 837
 			    $data['datetime'] = $line['time'];
617 838
 			    $data['format_source'] = 'boatbeaconapp';
618 839
 			    $data['id_source'] = $id_source;
619
-			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
840
+			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
841
+			    	$data['noarchive'] = true;
842
+			    }
620 843
 			    $MI->add($data);
621 844
 			    unset($data);
622 845
 			}
@@ -637,22 +860,44 @@  discard block
 block discarded – undo
637 860
 		if (isset($all_data['features'][0]['id'])) {
638 861
 		    foreach ($all_data['features'] as $line) {
639 862
 			$data = array();
640
-			if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name'];
641
-			if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign'];
642
-			if (isset($line['properties']['mmsi'])) $data['mmsi'] = $line['properties']['mmsi'];
643
-			if (isset($line['properties']['imo'])) $data['mmsi'] = $line['properties']['imo'];
644
-			if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed'];
645
-			if (isset($line['properties']['heading'])) $data['heading'] = $line['properties']['heading'];
863
+			if (isset($line['properties']['name'])) {
864
+				$data['ident'] = $line['properties']['name'];
865
+			}
866
+			if (isset($line['properties']['callsign'])) {
867
+				$data['callsign'] = $line['properties']['callsign'];
868
+			}
869
+			if (isset($line['properties']['mmsi'])) {
870
+				$data['mmsi'] = $line['properties']['mmsi'];
871
+			}
872
+			if (isset($line['properties']['imo'])) {
873
+				$data['mmsi'] = $line['properties']['imo'];
874
+			}
875
+			if (isset($line['properties']['speed'])) {
876
+				$data['speed'] = $line['properties']['speed'];
877
+			}
878
+			if (isset($line['properties']['heading'])) {
879
+				$data['heading'] = $line['properties']['heading'];
880
+			}
646 881
 			$data['latitude'] = $line['geometry']['coordinates'][1];
647 882
 			$data['longitude'] = $line['geometry']['coordinates'][0];
648
-			if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType'];
649
-			if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination'];
650
-			if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta'];
883
+			if (isset($line['properties']['vesselType'])) {
884
+				$data['type'] = $line['properties']['vesselType'];
885
+			}
886
+			if (isset($line['properties']['destination'])) {
887
+				$data['arrival_code'] = $line['properties']['destination'];
888
+			}
889
+			if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') {
890
+				$data['arrival_date'] = $line['properties']['eta'];
891
+			}
651 892
 			$data['format_source'] = 'boatnerd';
652 893
 			$data['id_source'] = $id_source;
653 894
 			$data['datetime'] = date('Y-m-d H:i:s');
654
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
655
-			if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data);
895
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
896
+				$data['noarchive'] = true;
897
+			}
898
+			if ($line['properties']['vesselType'] != 'Navigation Aid') {
899
+				$MI->add($data);
900
+			}
656 901
 			unset($data);
657 902
 		    }
658 903
 		}
@@ -668,7 +913,9 @@  discard block
 block discarded – undo
668 913
 	    echo 'download...';
669 914
 	    $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter');
670 915
 	    echo 'done !'."\n";
671
-	    if ($buffer != '') $reset = 0;
916
+	    if ($buffer != '') {
917
+	    	$reset = 0;
918
+	    }
672 919
     	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
673 920
 	    $buffer = explode('\n',$buffer);
674 921
 	    foreach ($buffer as $line) {
@@ -693,7 +940,9 @@  discard block
 block discarded – undo
693 940
 		    //$data['etaTime'] = substr($line,135,5);
694 941
 		    $data['format_source'] = 'shipplotter';
695 942
     		    $data['id_source'] = $id_source;
696
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
943
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
944
+		    	$data['noarchive'] = true;
945
+		    }
697 946
 		    //print_r($data);
698 947
 		    echo 'Add...'."\n";
699 948
 		    $MI->add($data);
@@ -727,16 +976,28 @@  discard block
 block discarded – undo
727 976
     		    $line = explode(':', $line);
728 977
     		    if (count($line) > 30 && $line[0] != 'callsign') {
729 978
 			$data = array();
730
-			if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37];
731
-			else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
979
+			if (isset($line[37]) && $line[37] != '') {
980
+				$data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37];
981
+			} else {
982
+				$data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
983
+			}
732 984
 			$data['pilot_id'] = $line[1];
733 985
 			$data['pilot_name'] = $line[2];
734 986
 			$data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT);
735 987
 			$data['ident'] = $line[0]; // ident
736
-			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
988
+			if ($line[7] != '' && $line[7] != 0) {
989
+				$data['altitude'] = $line[7];
990
+			}
991
+			// altitude
737 992
 			$data['speed'] = $line[8]; // speed
738
-			if (isset($line[45])) $data['heading'] = $line[45]; // heading
739
-			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
993
+			if (isset($line[45])) {
994
+				$data['heading'] = $line[45];
995
+			}
996
+			// heading
997
+			elseif (isset($line[38])) {
998
+				$data['heading'] = $line[38];
999
+			}
1000
+			// heading
740 1001
 			$data['latitude'] = $line[5]; // lat
741 1002
 	        	$data['longitude'] = $line[6]; // long
742 1003
 	        	$data['verticalrate'] = ''; // vertical rate
@@ -752,7 +1013,9 @@  discard block
 block discarded – undo
752 1013
 			$data['frequency'] = $line[4];
753 1014
 			$data['type'] = $line[18];
754 1015
 			$data['range'] = $line[19];
755
-			if (isset($line[35])) $data['info'] = $line[35];
1016
+			if (isset($line[35])) {
1017
+				$data['info'] = $line[35];
1018
+			}
756 1019
     			$data['id_source'] = $id_source;
757 1020
 	    		//$data['arrival_airport_time'] = ;
758 1021
 	    		if ($line[9] != '') {
@@ -766,27 +1029,47 @@  discard block
 block discarded – undo
766 1029
 	    		elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
767 1030
 	    		*/
768 1031
 	    		$data['format_source'] = $value['format'];
769
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
770
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
771
-    			if ($line[3] == 'PILOT') $SI->add($data);
772
-			elseif ($line[3] == 'ATC') {
1032
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1033
+				$data['noarchive'] = true;
1034
+			}
1035
+			if (isset($value['name']) && $value['name'] != '') {
1036
+				$data['source_name'] = $value['name'];
1037
+			}
1038
+    			if ($line[3] == 'PILOT') {
1039
+    				$SI->add($data);
1040
+    			} elseif ($line[3] == 'ATC') {
773 1041
 				//print_r($data);
774 1042
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
775 1043
 				$data['info'] = str_replace('&amp;sect;','',$data['info']);
776 1044
 				$typec = substr($data['ident'],-3);
777
-				if ($typec == 'APP') $data['type'] = 'Approach';
778
-				elseif ($typec == 'TWR') $data['type'] = 'Tower';
779
-				elseif ($typec == 'OBS') $data['type'] = 'Observer';
780
-				elseif ($typec == 'GND') $data['type'] = 'Ground';
781
-				elseif ($typec == 'DEL') $data['type'] = 'Delivery';
782
-				elseif ($typec == 'DEP') $data['type'] = 'Departure';
783
-				elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
784
-				elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
785
-				elseif ($data['type'] == '') $data['type'] = 'Observer';
786
-				if (!isset($data['source_name'])) $data['source_name'] = '';
1045
+				if ($typec == 'APP') {
1046
+					$data['type'] = 'Approach';
1047
+				} elseif ($typec == 'TWR') {
1048
+					$data['type'] = 'Tower';
1049
+				} elseif ($typec == 'OBS') {
1050
+					$data['type'] = 'Observer';
1051
+				} elseif ($typec == 'GND') {
1052
+					$data['type'] = 'Ground';
1053
+				} elseif ($typec == 'DEL') {
1054
+					$data['type'] = 'Delivery';
1055
+				} elseif ($typec == 'DEP') {
1056
+					$data['type'] = 'Departure';
1057
+				} elseif ($typec == 'FSS') {
1058
+					$data['type'] = 'Flight Service Station';
1059
+				} elseif ($typec == 'CTR') {
1060
+					$data['type'] = 'Control Radar or Centre';
1061
+				} elseif ($data['type'] == '') {
1062
+					$data['type'] = 'Observer';
1063
+				}
1064
+				if (!isset($data['source_name'])) {
1065
+					$data['source_name'] = '';
1066
+				}
787 1067
 				if (isset($ATC)) {
788
-					if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
789
-					else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
1068
+					if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) {
1069
+						echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
1070
+					} else {
1071
+						echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
1072
+					}
790 1073
 				}
791 1074
 			}
792 1075
     			unset($data);
@@ -813,14 +1096,20 @@  discard block
 block discarded – undo
813 1096
 			$data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST'));
814 1097
 			$data['latitude'] = (float)$line['pktLatitude'];
815 1098
 			$data['longitude'] = (float)$line['pktLongitude'];
816
-			if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack'];
817
-			if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed'];
1099
+			if ((float)$line['pktTrack'] != 0) {
1100
+				$data['heading'] = (float)$line['pktTrack'];
1101
+			}
1102
+			if ((int)$line['pktSpeed'] != 0) {
1103
+				$data['speed'] = (int)$line['pktSpeed'];
1104
+			}
818 1105
 			$data['altitude'] = round((int)$line['pktAltitude']*3.28084);
819 1106
 			$data['altitude_relative'] = 'AMSL';
820 1107
 			$data['pilot_id'] = (int)$line['pktPilotID'];
821 1108
 			$data['aircraft_icao'] = 'PARAGLIDER';
822 1109
 			$pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id']));
823
-			if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4];
1110
+			if (isset($pilot_data[4])) {
1111
+				$data['pilot_name'] = $pilot_data[4];
1112
+			}
824 1113
 			$data['format_source'] = $value['format'];
825 1114
 			$SI->add($data);
826 1115
 			unset($data);
@@ -868,25 +1157,59 @@  discard block
 block discarded – undo
868 1157
 		    foreach ($all_data['acList'] as $line) {
869 1158
 			$data = array();
870 1159
 			$data['hex'] = $line['Icao']; // hex
871
-			if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
872
-			if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
873
-			if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
874
-			if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
875
-			if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
876
-			if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
1160
+			if (isset($line['Call'])) {
1161
+				$data['ident'] = $line['Call'];
1162
+			}
1163
+			// ident
1164
+			if (isset($line['Alt'])) {
1165
+				$data['altitude'] = $line['Alt'];
1166
+			}
1167
+			// altitude
1168
+			if (isset($line['Spd'])) {
1169
+				$data['speed'] = $line['Spd'];
1170
+			}
1171
+			// speed
1172
+			if (isset($line['Trak'])) {
1173
+				$data['heading'] = $line['Trak'];
1174
+			}
1175
+			// heading
1176
+			if (isset($line['Lat'])) {
1177
+				$data['latitude'] = $line['Lat'];
1178
+			}
1179
+			// lat
1180
+			if (isset($line['Long'])) {
1181
+				$data['longitude'] = $line['Long'];
1182
+			}
1183
+			// long
877 1184
 			//$data['verticalrate'] = $line['']; // verticale rate
878
-			if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
1185
+			if (isset($line['Sqk'])) {
1186
+				$data['squawk'] = $line['Sqk'];
1187
+			}
1188
+			// squawk
879 1189
 			$data['emergency'] = ''; // emergency
880
-			if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
881
-			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
882
-			else $data['datetime'] = date('Y-m-d H:i:s');
1190
+			if (isset($line['Reg'])) {
1191
+				$data['registration'] = $line['Reg'];
1192
+			}
1193
+			if (isset($line['PosTime'])) {
1194
+				$data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
1195
+			} else {
1196
+				$data['datetime'] = date('Y-m-d H:i:s');
1197
+			}
883 1198
 			//$data['datetime'] = date('Y-m-d H:i:s');
884
-			if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
1199
+			if (isset($line['Type'])) {
1200
+				$data['aircraft_icao'] = $line['Type'];
1201
+			}
885 1202
 			$data['format_source'] = 'aircraftlistjson';
886 1203
 			$data['id_source'] = $id_source;
887
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
888
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
889
-			if (isset($data['latitude'])) $SI->add($data);
1204
+			if (isset($value['name']) && $value['name'] != '') {
1205
+				$data['source_name'] = $value['name'];
1206
+			}
1207
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1208
+				$data['noarchive'] = true;
1209
+			}
1210
+			if (isset($data['latitude'])) {
1211
+				$SI->add($data);
1212
+			}
890 1213
 			unset($data);
891 1214
 		    }
892 1215
 		} elseif (is_array($all_data)) {
@@ -903,17 +1226,26 @@  discard block
 block discarded – undo
903 1226
 			$data['verticalrate'] = $line['vrt']; // verticale rate
904 1227
 			$data['squawk'] = $line['squawk']; // squawk
905 1228
 			$data['emergency'] = ''; // emergency
906
-			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
907
-			else $data['datetime'] = date('Y-m-d H:i:s');
1229
+			if (isset($line['PosTime'])) {
1230
+				$data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
1231
+			} else {
1232
+				$data['datetime'] = date('Y-m-d H:i:s');
1233
+			}
908 1234
 			$data['format_source'] = 'aircraftlistjson';
909 1235
 			$data['id_source'] = $id_source;
910
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
911
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1236
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1237
+				$data['noarchive'] = true;
1238
+			}
1239
+			if (isset($value['name']) && $value['name'] != '') {
1240
+				$data['source_name'] = $value['name'];
1241
+			}
912 1242
 			$SI->add($data);
913 1243
 			unset($data);
914 1244
 		    }
915 1245
 		}
916
-	    } elseif ($globalDebug) echo 'No data'."\n";
1246
+	    } elseif ($globalDebug) {
1247
+	    	echo 'No data'."\n";
1248
+	    }
917 1249
     	    //$last_exec['aircraftlistjson'] = time();
918 1250
     	    $last_exec[$id]['last'] = time();
919 1251
     	//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
@@ -949,8 +1281,12 @@  discard block
 block discarded – undo
949 1281
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
950 1282
 	    	    $data['format_source'] = 'planeupdatefaa';
951 1283
     		    $data['id_source'] = $id_source;
952
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
953
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1284
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1285
+		    	$data['noarchive'] = true;
1286
+		    }
1287
+		    if (isset($value['name']) && $value['name'] != '') {
1288
+		    	$data['source_name'] = $value['name'];
1289
+		    }
954 1290
 		    $SI->add($data);
955 1291
 		    unset($data);
956 1292
 		}
@@ -984,7 +1320,9 @@  discard block
 block discarded – undo
984 1320
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]);
985 1321
 		    $data['format_source'] = 'opensky';
986 1322
 		    $data['id_source'] = $id_source;
987
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1323
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1324
+		    	$data['noarchive'] = true;
1325
+		    }
988 1326
 		    $SI->add($data);
989 1327
 		    unset($data);
990 1328
 		}
@@ -1001,7 +1339,9 @@  discard block
 block discarded – undo
1001 1339
 	    //$buffer = $Common->getData($hosts[$id]);
1002 1340
 	    $buffer = $Common->getData($value['host']);
1003 1341
 	    $all_data = json_decode($buffer,true);
1004
-	    if (!empty($all_data)) $reset = 0;
1342
+	    if (!empty($all_data)) {
1343
+	    	$reset = 0;
1344
+	    }
1005 1345
 	    foreach ($all_data as $key => $line) {
1006 1346
 		if ($key != 'full_count' && $key != 'version' && $key != 'stats') {
1007 1347
 		    $data = array();
@@ -1022,8 +1362,12 @@  discard block
 block discarded – undo
1022 1362
 		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
1023 1363
 	    	    $data['format_source'] = 'fr24json';
1024 1364
     		    $data['id_source'] = $id_source;
1025
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1026
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1365
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1366
+		    	$data['noarchive'] = true;
1367
+		    }
1368
+		    if (isset($value['name']) && $value['name'] != '') {
1369
+		    	$data['source_name'] = $value['name'];
1370
+		    }
1027 1371
 		    $SI->add($data);
1028 1372
 		    unset($data);
1029 1373
 		}
@@ -1052,24 +1396,42 @@  discard block
 block discarded – undo
1052 1396
 		    if (isset($line['inf'])) {
1053 1397
 			$data = array();
1054 1398
 			$data['hex'] = $line['inf']['ia'];
1055
-			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
1399
+			if (isset($line['inf']['cs'])) {
1400
+				$data['ident'] = $line['inf']['cs'];
1401
+			}
1402
+			//$line[13]
1056 1403
 	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
1057
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
1058
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
1404
+	    		if (isset($line['inf']['gs'])) {
1405
+	    			$data['speed'] = round($line['inf']['gs']*0.539957);
1406
+	    		}
1407
+	    		// speed
1408
+	    		if (isset($line['inf']['tr'])) {
1409
+	    			$data['heading'] = $line['inf']['tr'];
1410
+	    		}
1411
+	    		// heading
1059 1412
 	    		$data['latitude'] = $line['pt'][0]; // lat
1060 1413
 	    		$data['longitude'] = $line['pt'][1]; // long
1061 1414
 	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
1062
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
1415
+	    		if (isset($line['inf']['sq'])) {
1416
+	    			$data['squawk'] = $line['inf']['sq'];
1417
+	    		}
1418
+	    		// squawk
1063 1419
 	    		//$data['aircraft_icao'] = $line[8];
1064
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
1420
+	    		if (isset($line['inf']['rc'])) {
1421
+	    			$data['registration'] = $line['inf']['rc'];
1422
+	    		}
1065 1423
 			//$data['departure_airport_iata'] = $line[11];
1066 1424
 			//$data['arrival_airport_iata'] = $line[12];
1067 1425
 	    		//$data['emergency'] = ''; // emergency
1068 1426
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
1069 1427
 	    		$data['format_source'] = 'radarvirtueljson';
1070 1428
     			$data['id_source'] = $id_source;
1071
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1072
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1429
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1430
+				$data['noarchive'] = true;
1431
+			}
1432
+			if (isset($value['name']) && $value['name'] != '') {
1433
+				$data['source_name'] = $value['name'];
1434
+			}
1073 1435
 			$SI->add($data);
1074 1436
 			unset($data);
1075 1437
 		    }
@@ -1095,30 +1457,65 @@  discard block
 block discarded – undo
1095 1457
 		    $data['id'] = $line['id'];
1096 1458
 		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
1097 1459
 		    $data['ident'] = $line['callsign']; // ident
1098
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
1099
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
1100
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
1101
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
1102
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
1103
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1460
+		    if (isset($line['pilotid'])) {
1461
+		    	$data['pilot_id'] = $line['pilotid'];
1462
+		    }
1463
+		    // pilot id
1464
+		    if (isset($line['name'])) {
1465
+		    	$data['pilot_name'] = $line['name'];
1466
+		    }
1467
+		    // pilot name
1468
+		    if (isset($line['alt'])) {
1469
+		    	$data['altitude'] = $line['alt'];
1470
+		    }
1471
+		    // altitude
1472
+		    if (isset($line['gs'])) {
1473
+		    	$data['speed'] = $line['gs'];
1474
+		    }
1475
+		    // speed
1476
+		    if (isset($line['heading'])) {
1477
+		    	$data['heading'] = $line['heading'];
1478
+		    }
1479
+		    // heading
1480
+		    if (isset($line['route'])) {
1481
+		    	$data['waypoints'] = $line['route'];
1482
+		    }
1483
+		    // route
1104 1484
 		    $data['latitude'] = $line['lat']; // lat
1105 1485
 		    $data['longitude'] = $line['lon']; // long
1106 1486
 		    //$data['verticalrate'] = $line['vrt']; // verticale rate
1107 1487
 		    //$data['squawk'] = $line['squawk']; // squawk
1108 1488
 		    //$data['emergency'] = ''; // emergency
1109
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
1110
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
1111
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
1489
+		    if (isset($line['depicao'])) {
1490
+		    	$data['departure_airport_icao'] = $line['depicao'];
1491
+		    }
1492
+		    if (isset($line['deptime'])) {
1493
+		    	$data['departure_airport_time'] = $line['deptime'];
1494
+		    }
1495
+		    if (isset($line['arricao'])) {
1496
+		    	$data['arrival_airport_icao'] = $line['arricao'];
1497
+		    }
1112 1498
 		    //$data['arrival_airport_time'] = $line['arrtime'];
1113
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
1114
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
1115
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
1116
-		    else $data['info'] = '';
1499
+		    if (isset($line['aircraft'])) {
1500
+		    	$data['aircraft_icao'] = $line['aircraft'];
1501
+		    }
1502
+		    if (isset($line['transponder'])) {
1503
+		    	$data['squawk'] = $line['transponder'];
1504
+		    }
1505
+		    if (isset($line['atis'])) {
1506
+		    	$data['info'] = $line['atis'];
1507
+		    } else {
1508
+		    	$data['info'] = '';
1509
+		    }
1117 1510
 		    $data['format_source'] = 'pireps';
1118 1511
     		    $data['id_source'] = $id_source;
1119 1512
 		    $data['datetime'] = date('Y-m-d H:i:s');
1120
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1121
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1513
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1514
+		    	$data['noarchive'] = true;
1515
+		    }
1516
+		    if (isset($value['name']) && $value['name'] != '') {
1517
+		    	$data['source_name'] = $value['name'];
1518
+		    }
1122 1519
 		    if ($line['icon'] == 'plane') {
1123 1520
 			$SI->add($data);
1124 1521
 		    //    print_r($data);
@@ -1127,16 +1524,28 @@  discard block
 block discarded – undo
1127 1524
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
1128 1525
 			$typec = substr($data['ident'],-3);
1129 1526
 			$data['type'] = '';
1130
-			if ($typec == 'APP') $data['type'] = 'Approach';
1131
-			elseif ($typec == 'TWR') $data['type'] = 'Tower';
1132
-			elseif ($typec == 'OBS') $data['type'] = 'Observer';
1133
-			elseif ($typec == 'GND') $data['type'] = 'Ground';
1134
-			elseif ($typec == 'DEL') $data['type'] = 'Delivery';
1135
-			elseif ($typec == 'DEP') $data['type'] = 'Departure';
1136
-			elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
1137
-			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
1138
-			else $data['type'] = 'Observer';
1139
-			if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']);
1527
+			if ($typec == 'APP') {
1528
+				$data['type'] = 'Approach';
1529
+			} elseif ($typec == 'TWR') {
1530
+				$data['type'] = 'Tower';
1531
+			} elseif ($typec == 'OBS') {
1532
+				$data['type'] = 'Observer';
1533
+			} elseif ($typec == 'GND') {
1534
+				$data['type'] = 'Ground';
1535
+			} elseif ($typec == 'DEL') {
1536
+				$data['type'] = 'Delivery';
1537
+			} elseif ($typec == 'DEP') {
1538
+				$data['type'] = 'Departure';
1539
+			} elseif ($typec == 'FSS') {
1540
+				$data['type'] = 'Flight Service Station';
1541
+			} elseif ($typec == 'CTR') {
1542
+				$data['type'] = 'Control Radar or Centre';
1543
+			} else {
1544
+				$data['type'] = 'Observer';
1545
+			}
1546
+			if (isset($ATC)) {
1547
+				echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']);
1548
+			}
1140 1549
 		    }
1141 1550
 		    unset($data);
1142 1551
 		}
@@ -1151,7 +1560,9 @@  discard block
 block discarded – undo
1151 1560
 	    )
1152 1561
 	) {
1153 1562
 	    //$buffer = $Common->getData($hosts[$id]);
1154
-	    if ($globalDebug) echo 'Get Data...'."\n";
1563
+	    if ($globalDebug) {
1564
+	    	echo 'Get Data...'."\n";
1565
+	    }
1155 1566
 	    $buffer = $Common->getData($value['host']);
1156 1567
 	    $all_data = json_decode($buffer,true);
1157 1568
 	    if ($buffer != '' && is_array($all_data)) {
@@ -1159,10 +1570,16 @@  discard block
 block discarded – undo
1159 1570
 		foreach ($all_data as $line) {
1160 1571
 	    	    $data = array();
1161 1572
 	    	    //$data['id'] = $line['id']; // id not usable
1162
-	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
1573
+	    	    if (isset($line['pilotid'])) {
1574
+	    	    	$data['id'] = $line['pilotid'].$line['flightnum'];
1575
+	    	    }
1163 1576
 	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1164
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
1165
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
1577
+	    	    if (isset($line['pilotname'])) {
1578
+	    	    	$data['pilot_name'] = $line['pilotname'];
1579
+	    	    }
1580
+	    	    if (isset($line['pilotid'])) {
1581
+	    	    	$data['pilot_id'] = $line['pilotid'];
1582
+	    	    }
1166 1583
 	    	    $data['ident'] = $line['flightnum']; // ident
1167 1584
 	    	    $data['altitude'] = $line['alt']; // altitude
1168 1585
 	    	    $data['speed'] = $line['gs']; // speed
@@ -1178,34 +1595,52 @@  discard block
 block discarded – undo
1178 1595
 	    		$datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone']));
1179 1596
 	    		$datetime->setTimeZone(new DateTimeZone('UTC'));
1180 1597
 	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1181
-	    	    } else $data['datetime'] = date('Y-m-d H:i:s');
1598
+	    	    } else {
1599
+	    	    	$data['datetime'] = date('Y-m-d H:i:s');
1600
+	    	    }
1182 1601
 	    	    $data['departure_airport_icao'] = $line['depicao'];
1183 1602
 	    	    $data['departure_airport_time'] = $line['deptime'];
1184 1603
 	    	    $data['arrival_airport_icao'] = $line['arricao'];
1185 1604
     		    $data['arrival_airport_time'] = $line['arrtime'];
1186 1605
     		    $data['registration'] = $line['aircraft'];
1187
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1188
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1606
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1607
+		    	$data['noarchive'] = true;
1608
+		    }
1609
+		    if (isset($line['route'])) {
1610
+		    	$data['waypoints'] = $line['route'];
1611
+		    }
1612
+		    // route
1189 1613
 		    if (isset($line['aircraftname'])) {
1190 1614
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
1191 1615
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
1192 1616
 	    		$aircraft_data = explode('-',$line['aircraftname']);
1193
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0];
1194
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1];
1195
-	    		else {
1617
+	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) {
1618
+	    			$data['aircraft_icao'] = $aircraft_data[0];
1619
+	    		} elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) {
1620
+	    			$data['aircraft_icao'] = $aircraft_data[1];
1621
+	    		} else {
1196 1622
 	    		    $aircraft_data = explode(' ',$line['aircraftname']);
1197
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1198
-	    		    else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1623
+	    		    if (isset($aircraft_data[1])) {
1624
+	    		    	$data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1625
+	    		    } else {
1626
+	    		    	$data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1627
+	    		    }
1199 1628
 	    		}
1200 1629
 	    	    }
1201
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
1630
+    		    if (isset($line['route'])) {
1631
+    		    	$data['waypoints'] = $line['route'];
1632
+    		    }
1202 1633
     		    $data['id_source'] = $id_source;
1203 1634
 	    	    $data['format_source'] = 'phpvmacars';
1204
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1635
+		    if (isset($value['name']) && $value['name'] != '') {
1636
+		    	$data['source_name'] = $value['name'];
1637
+		    }
1205 1638
 		    $SI->add($data);
1206 1639
 		    unset($data);
1207 1640
 		}
1208
-		if ($globalDebug) echo 'No more data...'."\n";
1641
+		if ($globalDebug) {
1642
+			echo 'No more data...'."\n";
1643
+		}
1209 1644
 		unset($buffer);
1210 1645
 		unset($all_data);
1211 1646
 	    }
@@ -1218,7 +1653,9 @@  discard block
 block discarded – undo
1218 1653
 	    )
1219 1654
 	) {
1220 1655
 	    //$buffer = $Common->getData($hosts[$id]);
1221
-	    if ($globalDebug) echo 'Get Data...'."\n";
1656
+	    if ($globalDebug) {
1657
+	    	echo 'Get Data...'."\n";
1658
+	    }
1222 1659
 	    $buffer = $Common->getData($value['host']);
1223 1660
 	    $all_data = json_decode($buffer,true);
1224 1661
 	    if ($buffer != '' && is_array($all_data)) {
@@ -1247,16 +1684,25 @@  discard block
 block discarded – undo
1247 1684
 	    	    $data['arrival_airport_icao'] = $line['arrival'];
1248 1685
     		    //$data['arrival_airport_time'] = $line['arrival_time'];
1249 1686
     		    //$data['registration'] = $line['aircraft'];
1250
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1687
+		    if (isset($line['route'])) {
1688
+		    	$data['waypoints'] = $line['route'];
1689
+		    }
1690
+		    // route
1251 1691
 	    	    $data['aircraft_icao'] = $line['plane_type'];
1252 1692
     		    $data['id_source'] = $id_source;
1253 1693
 	    	    $data['format_source'] = 'vam';
1254
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1255
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1694
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1695
+		    	$data['noarchive'] = true;
1696
+		    }
1697
+		    if (isset($value['name']) && $value['name'] != '') {
1698
+		    	$data['source_name'] = $value['name'];
1699
+		    }
1256 1700
 		    $SI->add($data);
1257 1701
 		    unset($data);
1258 1702
 		}
1259
-		if ($globalDebug) echo 'No more data...'."\n";
1703
+		if ($globalDebug) {
1704
+			echo 'No more data...'."\n";
1705
+		}
1260 1706
 		unset($buffer);
1261 1707
 		unset($all_data);
1262 1708
 	    }
@@ -1269,7 +1715,9 @@  discard block
 block discarded – undo
1269 1715
 	    )
1270 1716
 	) {
1271 1717
 	    //$buffer = $Common->getData($hosts[$id]);
1272
-	    if ($globalDebug) echo 'Get Data...'."\n";
1718
+	    if ($globalDebug) {
1719
+	    	echo 'Get Data...'."\n";
1720
+	    }
1273 1721
 	    $buffer = $Common->getData($value['host']);
1274 1722
 	    $all_data = json_decode($buffer,true);
1275 1723
 	    if ($buffer != '') {
@@ -1287,18 +1735,24 @@  discard block
 block discarded – undo
1287 1735
 			$data['id_source'] = $id_source;
1288 1736
 			$data['format_source'] = 'blitzortung';
1289 1737
 			$SI->add($data);
1290
-			if ($globalDebug) echo '☈ Lightning added'."\n";
1738
+			if ($globalDebug) {
1739
+				echo '☈ Lightning added'."\n";
1740
+			}
1291 1741
 			$Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']);
1292 1742
 			unset($data);
1293 1743
 		    }
1294 1744
 		}
1295
-		if ($globalDebug) echo 'No more data...'."\n";
1745
+		if ($globalDebug) {
1746
+			echo 'No more data...'."\n";
1747
+		}
1296 1748
 		unset($buffer);
1297 1749
 	    }
1298 1750
 	    $last_exec[$id]['last'] = time();
1299 1751
 	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') {
1300 1752
 	} elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'famaprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais' || $value['format'] == 'vrstcp') {
1301
-	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1753
+	    if (function_exists('pcntl_fork')) {
1754
+	    	pcntl_signal_dispatch();
1755
+	    }
1302 1756
     	    //$last_exec[$id]['last'] = time();
1303 1757
 
1304 1758
 	    //$read = array( $sockets[$id] );
@@ -1306,7 +1760,9 @@  discard block
 block discarded – undo
1306 1760
 	    $write = NULL;
1307 1761
 	    $e = NULL;
1308 1762
 	    $n = socket_select($read, $write, $e, $timeout);
1309
-	    if ($e != NULL) var_dump($e);
1763
+	    if ($e != NULL) {
1764
+	    	var_dump($e);
1765
+	    }
1310 1766
 	    if ($n > 0) {
1311 1767
 		$reset = 0;
1312 1768
 		foreach ($read as $nb => $r) {
@@ -1327,12 +1783,16 @@  discard block
 block discarded – undo
1327 1783
 		    //$SI::del();
1328 1784
 		    if ($format == 'vrstcp') {
1329 1785
 			$buffer = explode('},{',$buffer);
1330
-		    } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
1786
+		    } else {
1787
+		    	$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
1788
+		    }
1331 1789
 		    // SBS format is CSV format
1332 1790
 		    if ($buffer !== FALSE && $buffer != '') {
1333 1791
 			$tt[$format] = 0;
1334 1792
 			if ($format == 'acarssbs3') {
1335
-			    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1793
+			    if ($globalDebug) {
1794
+			    	echo 'ACARS : '.$buffer."\n";
1795
+			    }
1336 1796
 			    $ACARS->add(trim($buffer));
1337 1797
 			    $ACARS->deleteLiveAcarsData();
1338 1798
 			} elseif ($format == 'raw') {
@@ -1341,30 +1801,70 @@  discard block
 block discarded – undo
1341 1801
 			    if (is_array($data)) {
1342 1802
 				$data['datetime'] = date('Y-m-d H:i:s');
1343 1803
 				$data['format_source'] = 'raw';
1344
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1345
-				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1346
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1347
-				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1804
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1805
+					$data['source_name'] = $globalSources[$nb]['name'];
1806
+				}
1807
+				if (isset($globalSources[$nb]['sourcestats'])) {
1808
+					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1809
+				}
1810
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
1811
+					$data['noarchive'] = true;
1812
+				}
1813
+				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1814
+					$SI->add($data);
1815
+				}
1348 1816
 			    }
1349 1817
 			} elseif ($format == 'ais') {
1350 1818
 			    $ais_data = $AIS->parse_line(trim($buffer));
1351 1819
 			    $data = array();
1352
-			    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
1353
-			    if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi'];
1354
-			    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
1355
-			    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
1356
-			    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
1357
-			    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
1358
-			    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
1359
-			    if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
1360
-			    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
1361
-			    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
1362
-			    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
1363
-			    if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
1364
-			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1365
-			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1366
-			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1367
-			    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1820
+			    if (isset($ais_data['ident'])) {
1821
+			    	$data['ident'] = $ais_data['ident'];
1822
+			    }
1823
+			    if (isset($ais_data['mmsi'])) {
1824
+			    	$data['mmsi'] = $ais_data['mmsi'];
1825
+			    }
1826
+			    if (isset($ais_data['speed'])) {
1827
+			    	$data['speed'] = $ais_data['speed'];
1828
+			    }
1829
+			    if (isset($ais_data['heading'])) {
1830
+			    	$data['heading'] = $ais_data['heading'];
1831
+			    }
1832
+			    if (isset($ais_data['latitude'])) {
1833
+			    	$data['latitude'] = $ais_data['latitude'];
1834
+			    }
1835
+			    if (isset($ais_data['longitude'])) {
1836
+			    	$data['longitude'] = $ais_data['longitude'];
1837
+			    }
1838
+			    if (isset($ais_data['status'])) {
1839
+			    	$data['status'] = $ais_data['status'];
1840
+			    }
1841
+			    if (isset($ais_data['statusid'])) {
1842
+			    	$data['status_id'] = $ais_data['statusid'];
1843
+			    }
1844
+			    if (isset($ais_data['type'])) {
1845
+			    	$data['type'] = $ais_data['type'];
1846
+			    }
1847
+			    if (isset($ais_data['imo'])) {
1848
+			    	$data['imo'] = $ais_data['imo'];
1849
+			    }
1850
+			    if (isset($ais_data['callsign'])) {
1851
+			    	$data['callsign'] = $ais_data['callsign'];
1852
+			    }
1853
+			    if (isset($ais_data['destination'])) {
1854
+			    	$data['arrival_code'] = $ais_data['destination'];
1855
+			    }
1856
+			    if (isset($ais_data['eta_ts'])) {
1857
+			    	$data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1858
+			    }
1859
+			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
1860
+			    	$data['noarchive'] = true;
1861
+			    }
1862
+			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1863
+			    	$data['source_name'] = $globalSources[$nb]['name'];
1864
+			    }
1865
+			    if (isset($globalSources[$nb]['sourcestats'])) {
1866
+			    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1867
+			    }
1368 1868
 
1369 1869
 			    if (isset($ais_data['timestamp'])) {
1370 1870
 				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
@@ -1373,7 +1873,9 @@  discard block
 block discarded – undo
1373 1873
 			    }
1374 1874
 			    $data['format_source'] = 'aisnmea';
1375 1875
     			    $data['id_source'] = $id_source;
1376
-			    if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
1876
+			    if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') {
1877
+			    	$MI->add($data);
1878
+			    }
1377 1879
 			    unset($data);
1378 1880
                         } elseif ($format == 'flightgearsp') {
1379 1881
                     	    //echo $buffer."\n";
@@ -1391,12 +1893,18 @@  discard block
 block discarded – undo
1391 1893
 				$data['speed'] = round($line[5]*1.94384);
1392 1894
 				$data['datetime'] = date('Y-m-d H:i:s');
1393 1895
 				$data['format_source'] = 'flightgearsp';
1394
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1395
-				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1896
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
1897
+					$data['noarchive'] = true;
1898
+				}
1899
+				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1900
+					$SI->add($data);
1901
+				}
1396 1902
 				//$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1397 1903
 			    }
1398 1904
                         } elseif ($format == 'acars') {
1399
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1905
+                    	    if ($globalDebug) {
1906
+                    	    	echo 'ACARS : '.$buffer."\n";
1907
+                    	    }
1400 1908
 			    $ACARS->add(trim($buffer));
1401 1909
 			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
1402 1910
 			    $ACARS->deleteLiveAcarsData();
@@ -1417,8 +1925,12 @@  discard block
 block discarded – undo
1417 1925
 				    $aircraft_type = $line[10];
1418 1926
 				    $aircraft_type = preg_split(':/:',$aircraft_type);
1419 1927
 				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
1420
-				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1421
-				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1928
+				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
1929
+				    	$data['noarchive'] = true;
1930
+				    }
1931
+				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1932
+				    	$SI->add($data);
1933
+				    }
1422 1934
 				}
1423 1935
 			    }
1424 1936
 			} elseif ($format == 'beast') {
@@ -1428,28 +1940,62 @@  discard block
 block discarded – undo
1428 1940
 			    foreach($buffer as $all_data) {
1429 1941
 				$line = json_decode('{'.$all_data.'}',true);
1430 1942
 				$data = array();
1431
-				if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex
1432
-				if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
1433
-				if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
1434
-				if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
1435
-				if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
1436
-				if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
1437
-				if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
1943
+				if (isset($line['Icao'])) {
1944
+					$data['hex'] = $line['Icao'];
1945
+				}
1946
+				// hex
1947
+				if (isset($line['Call'])) {
1948
+					$data['ident'] = $line['Call'];
1949
+				}
1950
+				// ident
1951
+				if (isset($line['Alt'])) {
1952
+					$data['altitude'] = $line['Alt'];
1953
+				}
1954
+				// altitude
1955
+				if (isset($line['Spd'])) {
1956
+					$data['speed'] = $line['Spd'];
1957
+				}
1958
+				// speed
1959
+				if (isset($line['Trak'])) {
1960
+					$data['heading'] = $line['Trak'];
1961
+				}
1962
+				// heading
1963
+				if (isset($line['Lat'])) {
1964
+					$data['latitude'] = $line['Lat'];
1965
+				}
1966
+				// lat
1967
+				if (isset($line['Long'])) {
1968
+					$data['longitude'] = $line['Long'];
1969
+				}
1970
+				// long
1438 1971
 				//$data['verticalrate'] = $line['']; // verticale rate
1439
-				if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
1972
+				if (isset($line['Sqk'])) {
1973
+					$data['squawk'] = $line['Sqk'];
1974
+				}
1975
+				// squawk
1440 1976
 				$data['emergency'] = ''; // emergency
1441
-				if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
1977
+				if (isset($line['Reg'])) {
1978
+					$data['registration'] = $line['Reg'];
1979
+				}
1442 1980
 				/*
1443 1981
 				if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000);
1444 1982
 				else $data['datetime'] = date('Y-m-d H:i:s');
1445 1983
 				*/
1446 1984
 				$data['datetime'] = date('Y-m-d H:i:s');
1447
-				if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
1985
+				if (isset($line['Type'])) {
1986
+					$data['aircraft_icao'] = $line['Type'];
1987
+				}
1448 1988
 		    		$data['format_source'] = 'vrstcp';
1449 1989
 				$data['id_source'] = $id_source;
1450
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1451
-				if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1452
-				if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data);
1990
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
1991
+					$data['noarchive'] = true;
1992
+				}
1993
+				if (isset($value['name']) && $value['name'] != '') {
1994
+					$data['source_name'] = $value['name'];
1995
+				}
1996
+				if (isset($data['latitude']) && isset($data['hex'])) {
1997
+					$SI->add($data);
1998
+				}
1453 1999
 				unset($data);
1454 2000
 			    }
1455 2001
 			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') {
@@ -1462,22 +2008,46 @@  discard block
 block discarded – undo
1462 2008
     				$data['hex'] = $lined['hexid'];
1463 2009
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
1464 2010
     				$data['datetime'] = date('Y-m-d H:i:s');;
1465
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
1466
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
1467
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
1468
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
1469
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
1470
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
1471
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
2011
+    				if (isset($lined['ident'])) {
2012
+    					$data['ident'] = $lined['ident'];
2013
+    				}
2014
+    				if (isset($lined['lat'])) {
2015
+    					$data['latitude'] = $lined['lat'];
2016
+    				}
2017
+    				if (isset($lined['lon'])) {
2018
+    					$data['longitude'] = $lined['lon'];
2019
+    				}
2020
+    				if (isset($lined['speed'])) {
2021
+    					$data['speed'] = $lined['speed'];
2022
+    				}
2023
+    				if (isset($lined['squawk'])) {
2024
+    					$data['squawk'] = $lined['squawk'];
2025
+    				}
2026
+    				if (isset($lined['alt'])) {
2027
+    					$data['altitude'] = $lined['alt'];
2028
+    				}
2029
+    				if (isset($lined['heading'])) {
2030
+    					$data['heading'] = $lined['heading'];
2031
+    				}
1472 2032
     				$data['id_source'] = $id_source;
1473 2033
     				$data['format_source'] = 'tsv';
1474
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1475
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1476
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1477
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
2034
+    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
2035
+    					$data['source_name'] = $globalSources[$nb]['name'];
2036
+    				}
2037
+    				if (isset($globalSources[$nb]['sourcestats'])) {
2038
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2039
+    				}
2040
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2041
+					$data['noarchive'] = true;
2042
+				}
2043
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2044
+    					$SI->add($data);
2045
+    				}
1478 2046
     				unset($lined);
1479 2047
     				unset($data);
1480
-    			    } else $error = true;
2048
+    			    } else {
2049
+    			    	$error = true;
2050
+    			    }
1481 2051
 			} elseif ($format == 'aprs' && $use_aprs) {
1482 2052
 			    if ($aprs_connect == 0) {
1483 2053
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
@@ -1502,62 +2072,120 @@  discard block
 block discarded – undo
1502 2072
 				    $aprs_last_tx = time();
1503 2073
 				    $data = array();
1504 2074
 				    //print_r($line);
1505
-				    if (isset($line['address'])) $data['hex'] = $line['address'];
1506
-				    if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi'];
1507
-				    if (isset($line['imo'])) $data['imo'] = $line['imo'];
1508
-				    if (isset($line['squawk'])) $data['squawk'] = $line['squawk'];
1509
-				    if (isset($line['arrival_code'])) $data['arrical_code'] = $line['arrival_code'];
1510
-				    if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date'];
1511
-				    if (isset($line['type_id'])) $data['type_id'] = $line['typeid'];
1512
-				    if (isset($line['status_id'])) $data['status_id'] = $line['statusid'];
1513
-				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
1514
-				    else $data['datetime'] = date('Y-m-d H:i:s');
2075
+				    if (isset($line['address'])) {
2076
+				    	$data['hex'] = $line['address'];
2077
+				    }
2078
+				    if (isset($line['mmsi'])) {
2079
+				    	$data['mmsi'] = $line['mmsi'];
2080
+				    }
2081
+				    if (isset($line['imo'])) {
2082
+				    	$data['imo'] = $line['imo'];
2083
+				    }
2084
+				    if (isset($line['squawk'])) {
2085
+				    	$data['squawk'] = $line['squawk'];
2086
+				    }
2087
+				    if (isset($line['arrival_code'])) {
2088
+				    	$data['arrical_code'] = $line['arrival_code'];
2089
+				    }
2090
+				    if (isset($line['arrival_date'])) {
2091
+				    	$data['arrical_date'] = $line['arrival_date'];
2092
+				    }
2093
+				    if (isset($line['type_id'])) {
2094
+				    	$data['type_id'] = $line['typeid'];
2095
+				    }
2096
+				    if (isset($line['status_id'])) {
2097
+				    	$data['status_id'] = $line['statusid'];
2098
+				    }
2099
+				    if (isset($line['timestamp'])) {
2100
+				    	$data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
2101
+				    } else {
2102
+				    	$data['datetime'] = date('Y-m-d H:i:s');
2103
+				    }
1515 2104
 				    //$data['datetime'] = date('Y-m-d H:i:s');
1516
-				    if (isset($line['ident'])) $data['ident'] = $line['ident'];
2105
+				    if (isset($line['ident'])) {
2106
+				    	$data['ident'] = $line['ident'];
2107
+				    }
1517 2108
 				    $data['latitude'] = $line['latitude'];
1518 2109
 				    $data['longitude'] = $line['longitude'];
1519 2110
 				    //$data['verticalrate'] = $line[16];
1520
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
2111
+				    if (isset($line['speed'])) {
2112
+				    	$data['speed'] = $line['speed'];
2113
+				    }
1521 2114
 				    //else $data['speed'] = 0;
1522
-				    if (isset($line['altitude'])) $data['altitude'] = $line['altitude'];
1523
-				    if (isset($line['comment'])) $data['comment'] = $line['comment'];
1524
-				    if (isset($line['symbol'])) $data['type'] = $line['symbol'];
2115
+				    if (isset($line['altitude'])) {
2116
+				    	$data['altitude'] = $line['altitude'];
2117
+				    }
2118
+				    if (isset($line['comment'])) {
2119
+				    	$data['comment'] = $line['comment'];
2120
+				    }
2121
+				    if (isset($line['symbol'])) {
2122
+				    	$data['type'] = $line['symbol'];
2123
+				    }
1525 2124
 				    //if (isset($line['heading'])) $data['heading'] = $line['heading'];
1526 2125
 				    
1527
-				    if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading'];
2126
+				    if (isset($line['heading']) && isset($line['format_source'])) {
2127
+				    	$data['heading'] = $line['heading'];
2128
+				    }
1528 2129
 				    //else echo 'No heading...'."\n";
1529 2130
 				    //else $data['heading'] = 0;
1530
-				    if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth'];
2131
+				    if (isset($line['stealth'])) {
2132
+				    	$data['aircraft_type'] = $line['stealth'];
2133
+				    }
1531 2134
 				    //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true;
1532
-				    if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true;
1533
-				    elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false;
1534
-				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1535
-				    elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false;
2135
+				    if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) {
2136
+				    	$data['noarchive'] = true;
2137
+				    } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) {
2138
+				    	$data['noarchive'] = false;
2139
+				    }
2140
+				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2141
+				    	$data['noarchive'] = true;
2142
+				    } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) {
2143
+				    	$data['noarchive'] = false;
2144
+				    }
1536 2145
     				    $data['id_source'] = $id_source;
1537
-    				    if (isset($line['format_source'])) $data['format_source'] = $line['format_source'];
1538
-				    else $data['format_source'] = 'aprs';
2146
+    				    if (isset($line['format_source'])) {
2147
+    				    	$data['format_source'] = $line['format_source'];
2148
+    				    } else {
2149
+				    	$data['format_source'] = 'aprs';
2150
+				    }
1539 2151
 				    $data['source_name'] = $line['source'];
1540
-				    if (isset($line['source_type'])) $data['source_type'] = $line['source_type'];
1541
-				    else $data['source_type'] = 'flarm';
1542
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2152
+				    if (isset($line['source_type'])) {
2153
+				    	$data['source_type'] = $line['source_type'];
2154
+				    } else {
2155
+				    	$data['source_type'] = 'flarm';
2156
+				    }
2157
+    				    if (isset($globalSources[$nb]['sourcestats'])) {
2158
+    				    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2159
+    				    }
1543 2160
 				    $currentdate = date('Y-m-d H:i:s');
1544 2161
 				    $aprsdate = strtotime($data['datetime']);
1545
-				    if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL';
2162
+				    if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') {
2163
+				    	$data['altitude_relative'] = 'AMSL';
2164
+				    }
1546 2165
 				    // Accept data if time <= system time + 20s
1547 2166
 				    //if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1548 2167
 				    if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1549 2168
 					$send = $SI->add($data);
1550 2169
 				    } elseif ($data['source_type'] == 'ais') {
1551
-					if (isset($globalMarine) && $globalMarine) $send = $MI->add($data);
2170
+					if (isset($globalMarine) && $globalMarine) {
2171
+						$send = $MI->add($data);
2172
+					}
1552 2173
 				    } elseif (isset($line['stealth'])) {
1553
-					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
1554
-					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
2174
+					if ($line['stealth'] != 0) {
2175
+						echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
2176
+					} else {
2177
+						echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
2178
+					}
1555 2179
 				    } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1556 2180
 					    //$line['symbol'] == 'Balloon' ||
1557 2181
 					    $line['symbol'] == 'Glider' || 
1558 2182
 					    $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) {
1559
-					    if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL';
1560
-					    if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER';
2183
+					    if ($line['symbol'] == 'Ballon') {
2184
+					    	$data['aircraft_icao'] = 'BALL';
2185
+					    }
2186
+					    if ($line['symbol'] == 'Glider') {
2187
+					    	$data['aircraft_icao'] = 'PARAGLIDER';
2188
+					    }
1561 2189
 					    $send = $SI->add($data);
1562 2190
 				    } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1563 2191
 					    $line['symbol'] == 'Yacht (Sail)' || 
@@ -1588,9 +2216,13 @@  discard block
 block discarded – undo
1588 2216
 				    //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1589 2217
 				//    } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1590 2218
 					//echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n";
1591
-					if (isset($globalTracker) && $globalTracker) $send = $TI->add($data);
2219
+					if (isset($globalTracker) && $globalTracker) {
2220
+						$send = $TI->add($data);
2221
+					}
1592 2222
 				    } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) {
1593
-					if (!isset($data['altitude'])) $data['altitude'] = 0;
2223
+					if (!isset($data['altitude'])) {
2224
+						$data['altitude'] = 0;
2225
+					}
1594 2226
 					$Source->deleteOldLocationByType('gs');
1595 2227
 					if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) {
1596 2228
 						$Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']);
@@ -1599,7 +2231,9 @@  discard block
 block discarded – undo
1599 2231
 					}
1600 2232
 				    } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') {
1601 2233
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1602
-					if ($globalDebug) echo '# Weather Station added'."\n";
2234
+					if ($globalDebug) {
2235
+						echo '# Weather Station added'."\n";
2236
+					}
1603 2237
 					$Source->deleteOldLocationByType('wx');
1604 2238
 					$weather_data = json_encode($line);
1605 2239
 					if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) {
@@ -1609,7 +2243,9 @@  discard block
 block discarded – undo
1609 2243
 					}
1610 2244
 				    } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) {
1611 2245
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1612
-					if ($globalDebug) echo '☈ Lightning added'."\n";
2246
+					if ($globalDebug) {
2247
+						echo '☈ Lightning added'."\n";
2248
+					}
1613 2249
 					$Source->deleteOldLocationByType('lightning');
1614 2250
 					if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) {
1615 2251
 						$Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']);
@@ -1621,8 +2257,7 @@  discard block
 block discarded – undo
1621 2257
 				    	print_r($line);
1622 2258
 				    }
1623 2259
 				    unset($data);
1624
-				}
1625
-				elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') {
2260
+				} elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') {
1626 2261
 					$Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']);
1627 2262
 				}
1628 2263
 				/*
@@ -1631,7 +2266,9 @@  discard block
 block discarded – undo
1631 2266
 				}
1632 2267
 				*/
1633 2268
 				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
1634
-				elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
2269
+				elseif ($line == true && $globalDebug) {
2270
+					echo '!! Failed : '.$buffer."!!\n";
2271
+				}
1635 2272
 				if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) {
1636 2273
 					$Source->deleteOldLocationByType('lightning');
1637 2274
 					$Source->deleteOldLocationByType('wx');
@@ -1667,26 +2304,45 @@  discard block
 block discarded – undo
1667 2304
     				$data['ground'] = $line[21];
1668 2305
     				$data['emergency'] = $line[19];
1669 2306
     				$data['format_source'] = 'sbs';
1670
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1671
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1672
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
2307
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
2308
+					$data['source_name'] = $globalSources[$nb]['name'];
2309
+				}
2310
+    				if (isset($globalSources[$nb]['sourcestats'])) {
2311
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2312
+    				}
2313
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2314
+					$data['noarchive'] = true;
2315
+				}
1673 2316
     				$data['id_source'] = $id_source;
1674
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
1675
-    				else $error = true;
2317
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2318
+    					$send = $SI->add($data);
2319
+    				} else {
2320
+    					$error = true;
2321
+    				}
1676 2322
     				unset($data);
1677
-    			    } else $error = true;
2323
+    			    } else {
2324
+    			    	$error = true;
2325
+    			    }
1678 2326
 			    if ($error) {
1679 2327
 				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { 
1680
-					if ($globalDebug) echo "Not a message. Ignoring... \n";
2328
+					if ($globalDebug) {
2329
+						echo "Not a message. Ignoring... \n";
2330
+					}
1681 2331
 				} else {
1682
-					if ($globalDebug) echo "Wrong line format. Ignoring... \n";
2332
+					if ($globalDebug) {
2333
+						echo "Wrong line format. Ignoring... \n";
2334
+					}
1683 2335
 					if ($globalDebug) {
1684 2336
 						echo $buffer;
1685 2337
 						//print_r($line);
1686 2338
 					}
1687 2339
 					//socket_close($r);
1688
-					if ($globalDebug) echo "Reconnect after an error...\n";
1689
-					if ($format == 'aprs') $aprs_connect = 0;
2340
+					if ($globalDebug) {
2341
+						echo "Reconnect after an error...\n";
2342
+					}
2343
+					if ($format == 'aprs') {
2344
+						$aprs_connect = 0;
2345
+					}
1690 2346
 					$sourceer[$nb] = $globalSources[$nb];
1691 2347
 					connect_all($sourceer);
1692 2348
 					$sourceer = array();
@@ -1694,10 +2350,14 @@  discard block
 block discarded – undo
1694 2350
 			    }
1695 2351
 			}
1696 2352
 			// Sleep for xxx microseconds
1697
-			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
2353
+			if (isset($globalSBSSleep)) {
2354
+				usleep($globalSBSSleep);
2355
+			}
1698 2356
 		    } else {
1699 2357
 			if ($format == 'flightgearmp') {
1700
-			    	if ($globalDebug) echo "Reconnect FlightGear MP...";
2358
+			    	if ($globalDebug) {
2359
+			    		echo "Reconnect FlightGear MP...";
2360
+			    	}
1701 2361
 				//@socket_close($r);
1702 2362
 				sleep($globalMinFetch);
1703 2363
 				$sourcefg[$nb] = $globalSources[$nb];
@@ -1706,10 +2366,15 @@  discard block
 block discarded – undo
1706 2366
 				break;
1707 2367
 				
1708 2368
 			} elseif ($format != 'acars' && $format != 'flightgearsp') {
1709
-			    if (isset($tt[$format])) $tt[$format]++;
1710
-			    else $tt[$format] = 0;
2369
+			    if (isset($tt[$format])) {
2370
+			    	$tt[$format]++;
2371
+			    } else {
2372
+			    	$tt[$format] = 0;
2373
+			    }
1711 2374
 			    if ($tt[$format] > 30) {
1712
-				if ($globalDebug) echo "ERROR : Reconnect ".$format."...";
2375
+				if ($globalDebug) {
2376
+					echo "ERROR : Reconnect ".$format."...";
2377
+				}
1713 2378
 				//@socket_close($r);
1714 2379
 				sleep(2);
1715 2380
 				$aprs_connect = 0;
@@ -1726,11 +2391,17 @@  discard block
 block discarded – undo
1726 2391
 	    } else {
1727 2392
 		$error = socket_strerror(socket_last_error());
1728 2393
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) {
1729
-			if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1730
-			if (isset($globalDebug)) echo "Restarting...\n";
2394
+			if ($globalDebug) {
2395
+				echo "ERROR : socket_select give this error ".$error . "\n";
2396
+			}
2397
+			if (isset($globalDebug)) {
2398
+				echo "Restarting...\n";
2399
+			}
1731 2400
 			// Restart the script if possible
1732 2401
 			if (is_array($sockets)) {
1733
-			    if ($globalDebug) echo "Shutdown all sockets...";
2402
+			    if ($globalDebug) {
2403
+			    	echo "Shutdown all sockets...";
2404
+			    }
1734 2405
 			    
1735 2406
 			    foreach ($sockets as $sock) {
1736 2407
 				@socket_shutdown($sock,2);
@@ -1738,25 +2409,45 @@  discard block
 block discarded – undo
1738 2409
 			    }
1739 2410
 			    
1740 2411
 			}
1741
-			if ($globalDebug) echo "Waiting...";
2412
+			if ($globalDebug) {
2413
+				echo "Waiting...";
2414
+			}
1742 2415
 			sleep(2);
1743 2416
 			$time = time();
1744 2417
 			//connect_all($hosts);
1745 2418
 			$aprs_connect = 0;
1746
-			if ($reset%5 == 0) sleep(20);
1747
-			if ($reset%10 == 0) sleep(100);
1748
-			if ($reset%20 == 0) sleep(200);
1749
-			if ($reset > 100) exit('Too many attempts...');
1750
-			if ($globalDebug) echo "Restart all connections...";
2419
+			if ($reset%5 == 0) {
2420
+				sleep(20);
2421
+			}
2422
+			if ($reset%10 == 0) {
2423
+				sleep(100);
2424
+			}
2425
+			if ($reset%20 == 0) {
2426
+				sleep(200);
2427
+			}
2428
+			if ($reset > 100) {
2429
+				exit('Too many attempts...');
2430
+			}
2431
+			if ($globalDebug) {
2432
+				echo "Restart all connections...";
2433
+			}
1751 2434
 			connect_all($globalSources);
1752 2435
 		}
1753 2436
 	    }
1754 2437
 	}
1755 2438
 	if ($globalDaemon === false) {
1756
-	    if ($globalDebug) echo 'Check all...'."\n";
1757
-	    if (isset($SI)) $SI->checkAll();
1758
-	    if (isset($TI)) $TI->checkAll();
1759
-	    if (isset($MI)) $MI->checkAll();
2439
+	    if ($globalDebug) {
2440
+	    	echo 'Check all...'."\n";
2441
+	    }
2442
+	    if (isset($SI)) {
2443
+	    	$SI->checkAll();
2444
+	    }
2445
+	    if (isset($TI)) {
2446
+	    	$TI->checkAll();
2447
+	    }
2448
+	    if (isset($MI)) {
2449
+	    	$MI->checkAll();
2450
+	    }
1760 2451
 	}
1761 2452
     }
1762 2453
 }
Please login to merge, or discard this patch.