Completed
Pull Request — master (#448)
by
unknown
10:23
created
scripts/daemon-acars.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
 
39 39
 // let's try and connect
40
-if ($globalDebug) echo "Listen to acarsdec ... ";
40
+if ($globalDebug) {
41
+	echo "Listen to acarsdec ... ";
42
+}
41 43
 // create our socket and set it to non-blocking
42 44
 $sock = socket_create(AF_INET, SOCK_DGRAM, 0) or die("Unable to create socket\n");
43 45
 
@@ -50,7 +52,9 @@  discard block
 block discarded – undo
50 52
     die("Could not bind socket : [$errorcode] $errormsg \n");
51 53
 }
52 54
 
53
-if ($globalDebug) echo "LISTEN UDP MODE \n\n";
55
+if ($globalDebug) {
56
+	echo "LISTEN UDP MODE \n\n";
57
+}
54 58
 while(1) {
55 59
     $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port);
56 60
 
@@ -58,7 +62,9 @@  discard block
 block discarded – undo
58 62
     pcntl_signal_dispatch();
59 63
     $dataFound = false;
60 64
     //  (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1
61
-    if ($globalDebug) echo $buffer."\n";
65
+    if ($globalDebug) {
66
+    	echo $buffer."\n";
67
+    }
62 68
     $ACARS->add(trim($buffer));
63 69
     socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
64 70
     $ACARS->deleteLiveAcarsData();
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 1 patch
Braces   +60 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,16 +13,27 @@  discard block
 block discarded – undo
13 13
 <?php
14 14
 
15 15
 // Compressed GeoJson is used if true
16
-if (!isset($globalJsonCompress)) $compress = true;
17
-else $compress = $globalJsonCompress;
16
+if (!isset($globalJsonCompress)) {
17
+	$compress = true;
18
+} else {
19
+	$compress = $globalJsonCompress;
20
+}
18 21
 
19
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
20
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
22
+if (isset($_GET['ident'])) {
23
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
24
+}
25
+if (isset($_GET['flightaware_id'])) {
26
+	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
27
+}
21 28
 ?>
22 29
 <?php
23
-if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
24
-elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
25
-else $IconColor = '1a3151';
30
+if (isset($_COOKIE['IconColor'])) {
31
+	$IconColor = $_COOKIE['IconColor'];
32
+} elseif (isset($globalAircraftIconColor)) {
33
+	$IconColor = $globalAircraftIconColor;
34
+} else {
35
+	$IconColor = '1a3151';
36
+}
26 37
 ?>
27 38
 <?php
28 39
 if (isset($globalDebug) && $globalDebug === TRUE) {
@@ -99,9 +110,12 @@  discard block
 block discarded – undo
99 110
 
100 111
 function update_airportsLayer() {
101 112
 <?php
102
-	if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
103
-	else $getZoom = '7';
104
-?>
113
+	if (isset($_COOKIE['AirportZoom'])) {
114
+		$getZoom = $_COOKIE['AirportZoom'];
115
+	} else {
116
+		$getZoom = '7';
117
+	}
118
+	?>
105 119
 	if (typeof airportsLayer != 'undefined') {
106 120
 		if (map.hasLayer(airportsLayer) == true) {
107 121
 			map.removeLayer(airportsLayer);
@@ -382,7 +396,12 @@  discard block
 block discarded – undo
382 396
 <?php
383 397
 		} else {
384 398
 ?>
385
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
399
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
400
+	print $archiveupdatetime*1000;
401
+} else {
402
+	print $globalMapRefresh*1000+20000;
403
+}
404
+?>+feature.properties.sqt*1000);
386 405
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
387 406
 <?php
388 407
 		}
@@ -433,7 +452,12 @@  discard block
 block discarded – undo
433 452
 <?php
434 453
 		} else {
435 454
 ?>
436
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
455
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
456
+	print $archiveupdatetime*1000;
457
+} else {
458
+	print $globalMapRefresh*1000+20000;
459
+}
460
+?>+feature.properties.sqt*1000);
437 461
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
438 462
 <?php
439 463
 		}
@@ -481,7 +505,12 @@  discard block
 block discarded – undo
481 505
 <?php
482 506
 		} else {
483 507
 ?>
484
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
508
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
509
+	print $archiveupdatetime*1000;
510
+} else {
511
+	print $globalMapRefresh*1000+20000;
512
+}
513
+?>+feature.properties.sqt*1000);
485 514
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
486 515
 <?php
487 516
 		}
@@ -1000,12 +1029,22 @@  discard block
 block discarded – undo
1000 1029
 		update_archiveLayer(0);
1001 1030
 	} else {
1002 1031
 		//then load it again every 30 seconds
1003
-		var reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
1032
+		var reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
1033
+	print $globalMapRefresh*1000;
1034
+} else {
1035
+	print '30000';
1036
+}
1037
+?>);
1004 1038
 <?php
1005 1039
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
1006 1040
 ?>
1007 1041
 		update_polarLayer();
1008
-		setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1042
+		setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
1043
+	print $globalMapRefresh*1000*2;
1044
+} else {
1045
+	print '60000';
1046
+}
1047
+?>);
1009 1048
 <?php
1010 1049
 		}
1011 1050
 ?>
@@ -1018,7 +1057,12 @@  discard block
 block discarded – undo
1018 1057
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
1019 1058
 ?>
1020 1059
 	update_atcLayer();
1021
-	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1060
+	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
1061
+	print $globalMapRefresh*1000*2;
1062
+} else {
1063
+	print '60000';
1064
+}
1065
+?>);
1022 1066
 <?php
1023 1067
 	}
1024 1068
 ?>
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 1 patch
Braces   +39 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,10 +13,15 @@  discard block
 block discarded – undo
13 13
 <?php
14 14
 
15 15
 // Compressed GeoJson is used if true
16
-if (!isset($globalJsonCompress)) $compress = true;
17
-else $compress = $globalJsonCompress;
16
+if (!isset($globalJsonCompress)) {
17
+	$compress = true;
18
+} else {
19
+	$compress = $globalJsonCompress;
20
+}
18 21
 $archive = false;
19
-if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') $archive = true;
22
+if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
23
+	$archive = true;
24
+}
20 25
 ?>
21 26
 
22 27
 
@@ -174,9 +179,13 @@  discard block
 block discarded – undo
174 179
 		    if (callsign != ""){ markerTrackerLabel += callsign; }
175 180
 		    if (type != ""){ markerTrackerLabel += ' - '+type; }
176 181
 <?php
177
-	if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor'];
178
-	elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor;
179
-	else $IconColor = '1a3151';
182
+	if (isset($_COOKIE['TrackerIconColor'])) {
183
+		$IconColor = $_COOKIE['TrackerIconColor'];
184
+	} elseif (isset($globalTrackerIconColor)) {
185
+		$IconColor = $globalTrackerIconColor;
186
+	} else {
187
+		$IconColor = '1a3151';
188
+	}
180 189
 	if (!isset($ident) && !isset($famtrackid)) {
181 190
 ?>
182 191
 		    //info_tracker_update(feature.properties.fc);
@@ -210,7 +219,12 @@  discard block
 block discarded – undo
210 219
 <?php
211 220
 		} else {
212 221
 ?>
213
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
222
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
223
+	print $archiveupdatetime*1000;
224
+} else {
225
+	print $globalMapRefresh*1000+20000;
226
+}
227
+?>+feature.properties.sqt*1000);
214 228
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
215 229
 <?php
216 230
 		}
@@ -267,7 +281,12 @@  discard block
 block discarded – undo
267 281
 <?php
268 282
 		} else {
269 283
 ?>
270
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
284
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
285
+	print $archiveupdatetime*1000;
286
+} else {
287
+	print $globalMapRefresh*1000+20000;
288
+}
289
+?>+feature.properties.sqt*1000);
271 290
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
272 291
 <?php
273 292
 		}
@@ -323,7 +342,12 @@  discard block
 block discarded – undo
323 342
 <?php
324 343
 		} else {
325 344
 ?>
326
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
345
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
346
+	print $archiveupdatetime*1000;
347
+} else {
348
+	print $globalMapRefresh*1000+20000;
349
+}
350
+?>+feature.properties.sqt*1000);
327 351
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
328 352
 <?php
329 353
 		}
@@ -780,7 +804,12 @@  discard block
 block discarded – undo
780 804
 getLiveTrackerData(0);
781 805
 //then load it again every 30 seconds
782 806
 var reloadTrackerPage = setInterval(
783
-    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
807
+    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
808
+	print $globalMapRefresh*1000;
809
+} else {
810
+	print '30000';
811
+}
812
+?>);
784 813
 <?php
785 814
 	}
786 815
 ?>
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 1 patch
Braces   +36 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,11 +14,18 @@  discard block
 block discarded – undo
14 14
 <?php
15 15
 
16 16
 // Compressed GeoJson is used if true
17
-if (!isset($globalJsonCompress)) $compress = true;
18
-else $compress = $globalJsonCompress;
19
-if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor'];
20
-elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor;
21
-else $MarineIconColor = '43d1d8';
17
+if (!isset($globalJsonCompress)) {
18
+	$compress = true;
19
+} else {
20
+	$compress = $globalJsonCompress;
21
+}
22
+if (isset($_COOKIE['MarineIconColor'])) {
23
+	$MarineIconColor = $_COOKIE['MarineIconColor'];
24
+} elseif (isset($globalMarineIconColor)) {
25
+	$MarineIconColor = $globalMarineIconColor;
26
+} else {
27
+	$MarineIconColor = '43d1d8';
28
+}
22 29
 
23 30
 if (isset($globalVM) && $globalVM) {
24 31
 ?>
@@ -201,7 +208,12 @@  discard block
 block discarded – undo
201 208
 <?php
202 209
 		} else {
203 210
 ?>
204
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
211
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
212
+	print $archiveupdatetime*1000;
213
+} else {
214
+	print $globalMapRefresh*1000+20000;
215
+}
216
+?>+feature.properties.sqt*1000);
205 217
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
206 218
 <?php
207 219
 		}
@@ -258,7 +270,12 @@  discard block
 block discarded – undo
258 270
 <?php
259 271
 		} else {
260 272
 ?>
261
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
273
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
274
+	print $archiveupdatetime*1000;
275
+} else {
276
+	print $globalMapRefresh*1000+20000;
277
+}
278
+?>+feature.properties.sqt*1000);
262 279
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
263 280
 <?php
264 281
 		}
@@ -314,7 +331,12 @@  discard block
 block discarded – undo
314 331
 <?php
315 332
 		} else {
316 333
 ?>
317
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
334
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
335
+	print $archiveupdatetime*1000;
336
+} else {
337
+	print $globalMapRefresh*1000+20000;
338
+}
339
+?>+feature.properties.sqt*1000);
318 340
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
319 341
 <?php
320 342
 		}
@@ -746,7 +768,12 @@  discard block
 block discarded – undo
746 768
 } else {
747 769
 	//then load it again every 30 seconds
748 770
 	var reloadMarinePage = setInterval(
749
-	function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
771
+	function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
772
+	print $globalMapRefresh*1000;
773
+} else {
774
+	print '30000';
775
+}
776
+?>);
750 777
 }
751 778
 
752 779
 if (getCookie('openseamap') == 'true') loadOpenSeaMap(getCookie('openseamap'));
Please login to merge, or discard this patch.
js/map-satellite.2d.js.php 1 patch
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,8 +13,11 @@  discard block
 block discarded – undo
13 13
 <?php
14 14
 
15 15
 // Compressed GeoJson is used if true
16
-if (!isset($globalJsonCompress)) $compress = true;
17
-else $compress = $globalJsonCompress;
16
+if (!isset($globalJsonCompress)) {
17
+	$compress = true;
18
+} else {
19
+	$compress = $globalJsonCompress;
20
+}
18 21
 $compress = false;
19 22
 ?>
20 23
 
@@ -145,9 +148,13 @@  discard block
 block discarded – undo
145 148
 		    if (callsign != ""){ markerSatelliteLabel += callsign; }
146 149
 		    if (type != ""){ markerSatelliteLabel += ' - '+type; }
147 150
 <?php
148
-	if (isset($_COOKIE['SatelliteIconColor'])) $IconColor = $_COOKIE['SatelliteIconColor'];
149
-	elseif (isset($globalSatelliteIconColor)) $IconColor = $globalSatelliteIconColor;
150
-	else $IconColor = '1a3151';
151
+	if (isset($_COOKIE['SatelliteIconColor'])) {
152
+		$IconColor = $_COOKIE['SatelliteIconColor'];
153
+	} elseif (isset($globalSatelliteIconColor)) {
154
+		$IconColor = $globalSatelliteIconColor;
155
+	} else {
156
+		$IconColor = '1a3151';
157
+	}
151 158
 	if (!isset($ident) && !isset($famsatid)) {
152 159
 ?>
153 160
 		    info_satellite_update(feature.properties.fc);
@@ -174,7 +181,12 @@  discard block
 block discarded – undo
174 181
 <?php
175 182
 		} else {
176 183
 ?>
177
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
184
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
185
+	print $archiveupdatetime*1000;
186
+} else {
187
+	print $globalMapRefresh*1000+20000;
188
+}
189
+?>+feature.properties.sqt*1000);
178 190
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
179 191
 <?php
180 192
 		}
@@ -231,7 +243,12 @@  discard block
 block discarded – undo
231 243
 <?php
232 244
 		} else {
233 245
 ?>
234
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
246
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
247
+	print $archiveupdatetime*1000;
248
+} else {
249
+	print $globalMapRefresh*1000+20000;
250
+}
251
+?>+feature.properties.sqt*1000);
235 252
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
236 253
 <?php
237 254
 		}
@@ -287,7 +304,12 @@  discard block
 block discarded – undo
287 304
 <?php
288 305
 		} else {
289 306
 ?>
290
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
307
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
308
+	print $archiveupdatetime*1000;
309
+} else {
310
+	print $globalMapRefresh*1000+20000;
311
+}
312
+?>+feature.properties.sqt*1000);
291 313
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
292 314
 <?php
293 315
 		}
@@ -456,14 +478,24 @@  discard block
 block discarded – undo
456 478
 	if (isset($archive) && $archive) {
457 479
 ?>
458 480
 //then load it again every 30 seconds
459
-//  var reload = setInterval(function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
481
+//  var reload = setInterval(function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) {
482
+	print ($globalMapRefresh*1000)/2;
483
+} else {
484
+	print '15000';
485
+}
486
+?>);
460 487
 var reloadSatellitePage = setInterval(function(){if (noTimeout) updateSat(0)},<?php print $archiveupdatetime*1000; ?>);
461 488
 <?php
462 489
 	} else {
463 490
 ?>
464 491
 //then load it again every 30 seconds
465 492
 var reloadSatellitePage = setInterval(
466
-    function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
493
+    function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) {
494
+	print $globalMapRefresh*1000;
495
+} else {
496
+	print '30000';
497
+}
498
+?>);
467 499
 <?php
468 500
 	}
469 501
 ?>
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Braces   +134 added lines, -30 removed lines patch added patch discarded remove patch
@@ -13,10 +13,15 @@  discard block
 block discarded – undo
13 13
 "use strict";
14 14
 <?php
15 15
 
16
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
16
+if (!isset($globalOpenWeatherMapKey)) {
17
+	$globalOpenWeatherMapKey = '';
18
+}
17 19
 // Compressed GeoJson is used if true
18
-if (!isset($globalJsonCompress)) $compress = true;
19
-else $compress = $globalJsonCompress;
20
+if (!isset($globalJsonCompress)) {
21
+	$compress = true;
22
+} else {
23
+	$compress = $globalJsonCompress;
24
+}
20 25
 
21 26
 /*
22 27
 if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
@@ -142,7 +147,17 @@  discard block
 block discarded – undo
142 147
 	}
143 148
 
144 149
 	//create the map
145
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
150
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
151
+	print $latitude;
152
+} else {
153
+	print $globalCenterLatitude;
154
+}
155
+?>,<?php if (isset($longitude)) {
156
+	print $longitude;
157
+} else {
158
+	print $globalCenterLongitude;
159
+}
160
+?>], zoom);
146 161
 <?php
147 162
 	} else {
148 163
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -168,9 +183,21 @@  discard block
 block discarded – undo
168 183
 	     || navigator.userAgent.match(/BlackBerry/i)
169 184
 	     || navigator.userAgent.match(/Windows Phone/i))
170 185
 	{
171
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
186
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
187
+	print $viewzoom-1;
188
+} elseif (isset($viewzoom)) {
189
+	print $viewzoom;
190
+} else {
191
+	print '8';
192
+}
193
+?>;
172 194
 	} else {
173
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
195
+		var zoom = <?php if (isset($viewzoom)) {
196
+	print $viewzoom;
197
+} else {
198
+	print '9';
199
+}
200
+?>;
174 201
 	}
175 202
 
176 203
 	//create the map
@@ -196,16 +223,27 @@  discard block
 block discarded – undo
196 223
 	var bounds = L.latLngBounds(southWest,northEast);
197 224
 	//a few title layers
198 225
 <?php
199
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
200
-	else $MapType = $globalMapProvider;
226
+	if (isset($_COOKIE['MapType'])) {
227
+		$MapType = $_COOKIE['MapType'];
228
+	} else {
229
+		$MapType = $globalMapProvider;
230
+	}
201 231
 
202 232
 	if ($MapType == 'Mapbox') {
203
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
204
-		else $MapBoxId = $_COOKIE['MapTypeId'];
205
-?>
233
+		if ($_COOKIE['MapTypeId'] == 'default') {
234
+			$MapBoxId = $globalMapboxId;
235
+		} else {
236
+			$MapBoxId = $_COOKIE['MapTypeId'];
237
+		}
238
+		?>
206 239
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
207 240
 	    maxZoom: 18,
208
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
241
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
242
+	print 'false';
243
+} else {
244
+	print 'true';
245
+}
246
+?>,
209 247
 	    attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
210 248
 	    id: '<?php print $MapBoxId; ?>',
211 249
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -224,7 +262,12 @@  discard block
 block discarded – undo
224 262
 ?>
225 263
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
226 264
 	    maxZoom: 18,
227
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
265
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
266
+	print 'false';
267
+} else {
268
+	print 'true';
269
+}
270
+?>,
228 271
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
229 272
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
230 273
 	}).addTo(map);
@@ -233,7 +276,12 @@  discard block
 block discarded – undo
233 276
 ?>
234 277
 	L.tileLayer('https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', {
235 278
 	    maxZoom: 18,
236
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
279
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
280
+	print 'false';
281
+} else {
282
+	print 'true';
283
+}
284
+?>,
237 285
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
238 286
 		'&copy; <a href="http://openseamap.org">OpenSeaMap</a> contributors, ' +
239 287
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
@@ -243,7 +291,12 @@  discard block
 block discarded – undo
243 291
 ?>
244 292
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
245 293
 	    maxZoom: 18,
246
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
294
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
295
+	print 'false';
296
+} else {
297
+	print 'true';
298
+}
299
+?>,
247 300
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
248 301
 	}).addTo(map);
249 302
 <?php
@@ -251,7 +304,12 @@  discard block
 block discarded – undo
251 304
 ?>
252 305
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
253 306
 	    maxZoom: 18,
254
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
307
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
308
+	print 'false';
309
+} else {
310
+	print 'true';
311
+}
312
+?>,
255 313
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
256 314
 	}).addTo(map);
257 315
 <?php
@@ -259,7 +317,12 @@  discard block
 block discarded – undo
259 317
 ?>
260 318
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}', {
261 319
 	    maxZoom: 18,
262
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
320
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
321
+	print 'false';
322
+} else {
323
+	print 'true';
324
+}
325
+?>,
263 326
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
264 327
 	}).addTo(map);
265 328
 <?php
@@ -267,7 +330,12 @@  discard block
 block discarded – undo
267 330
 ?>
268 331
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
269 332
 	    maxZoom: 18,
270
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
333
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
334
+	print 'false';
335
+} else {
336
+	print 'true';
337
+}
338
+?>,
271 339
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
272 340
 	}).addTo(map);
273 341
 <?php
@@ -312,20 +380,26 @@  discard block
 block discarded – undo
312 380
 	map.addLayer(yandexLayer);
313 381
 <?php
314 382
 	} elseif ($MapType == 'Bing-Aerial') {
315
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
316
-?>
383
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
384
+			setcookie('MapType','OpenStreetMap');
385
+		}
386
+		?>
317 387
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
318 388
 	map.addLayer(bingLayer);
319 389
 <?php
320 390
 	} elseif ($MapType == 'Bing-Hybrid') {
321
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
322
-?>
391
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
392
+			setcookie('MapType','OpenStreetMap');
393
+		}
394
+		?>
323 395
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
324 396
 	map.addLayer(bingLayer);
325 397
 <?php
326 398
 	} elseif ($MapType == 'Bing-Road') {
327
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
328
-?>
399
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
400
+			setcookie('MapType','OpenStreetMap');
401
+		}
402
+		?>
329 403
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
330 404
 	map.addLayer(bingLayer);
331 405
 <?php
@@ -354,7 +428,12 @@  discard block
 block discarded – undo
354 428
 	    maxZoom: 5,
355 429
 	    tms : true,
356 430
 	    zindex : 3,
357
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
431
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
432
+	print 'false';
433
+} else {
434
+	print 'true';
435
+}
436
+?>,
358 437
 	    attribution: 'Natural Earth'
359 438
 	}).addTo(map);
360 439
 <?php
@@ -362,9 +441,24 @@  discard block
 block discarded – undo
362 441
 		$customid = $MapType;
363 442
 ?>
364 443
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
365
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
366
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
367
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
444
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
445
+	print $globalMapCustomLayer[$customid]['maxZoom'];
446
+} else {
447
+	print '18';
448
+}
449
+?>,
450
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
451
+	print $globalMapCustomLayer[$customid]['minZoom'];
452
+} else {
453
+	print '0';
454
+}
455
+?>,
456
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
457
+	print 'false';
458
+} else {
459
+	print 'true';
460
+}
461
+?>,
368 462
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
369 463
 	}).addTo(map);
370 464
 
@@ -404,7 +498,12 @@  discard block
 block discarded – undo
404 498
 		}
405 499
 	} elseif ($globalBounding == 'circle') {
406 500
 ?>
407
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
501
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
502
+	print $globalBoundingCircleSize;
503
+} else {
504
+	print '70000';
505
+}
506
+?>,{
408 507
 	    color: '#92C7D1',
409 508
 	    fillColor: '#92C7D1',
410 509
 	    fillOpacity: 0.3,
@@ -494,7 +593,12 @@  discard block
 block discarded – undo
494 593
 	});
495 594
 	if (archive === false) {
496 595
 		update_locationsLayer();
497
-		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
596
+		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) {
597
+	print $globalMapRefresh*1000*2;
598
+} else {
599
+	print '60000';
600
+}
601
+?>);
498 602
 	}
499 603
 	var currentdate = new Date();
500 604
 	var currentyear = new Date().getFullYear();
Please login to merge, or discard this patch.
install/install-action.php 1 patch
Braces   +78 added lines, -28 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@  discard block
 block discarded – undo
75 75
 	if ($error != '') {
76 76
 		$_SESSION['error'] = $error;
77 77
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database'));
78
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database'));
78
+	} else {
79
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Create database'));
80
+	}
79 81
 	$_SESSION['install'] = 'database_import';
80 82
 	$_SESSION['next'] = 'Create and import tables';
81 83
 	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -93,7 +95,9 @@  discard block
 block discarded – undo
93 95
 		if ($error != '') {
94 96
 			$_SESSION['error'] = $error;
95 97
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables'));
96
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
98
+		} else {
99
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
100
+		}
97 101
 		if ((!isset($globalAircraft) || $globalAircraft === TRUE) && (!isset($globalVA) || $globalVA === FALSE)) {
98 102
 			$_SESSION['install'] = 'populate';
99 103
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
 		$error .= $check_version;
108 112
 		$_SESSION['error'] = $error;
109 113
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables'));
110
-		if (!isset($_SESSION['next'])) $_SESSION['next'] = '';
114
+		if (!isset($_SESSION['next'])) {
115
+			$_SESSION['next'] = '';
116
+		}
111 117
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
112 118
 		print json_encode($result);
113 119
 	} else {
@@ -115,7 +121,9 @@  discard block
 block discarded – undo
115 121
 		if ($error != '') {
116 122
 			$_SESSION['error'] = $error;
117 123
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed'));
118
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
124
+		} else {
125
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
126
+		}
119 127
 		$_SESSION['install'] = 'sources';
120 128
 		$_SESSION['next'] = 'Insert data in source table';
121 129
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -128,8 +136,10 @@  discard block
 block discarded – undo
128 136
 	if ($error != '') {
129 137
 		$_SESSION['error'] = $error;
130 138
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database'));
131
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database'));
132
-/*
139
+	} else {
140
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database'));
141
+	}
142
+	/*
133 143
 	$_SESSION['install'] = 'airspace';
134 144
 	$_SESSION['next'] = 'Populate airspace table';
135 145
 	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -154,7 +164,9 @@  discard block
 block discarded – undo
154 164
 	if ($error != '') {
155 165
 		$_SESSION['error'] = $error;
156 166
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database'));
157
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
167
+	} else {
168
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
169
+	}
158 170
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
159 171
 	    $_SESSION['install'] = 'notam';
160 172
 	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
@@ -188,7 +200,9 @@  discard block
 block discarded – undo
188 200
 		if ($error != '') {
189 201
 			$_SESSION['error'] = $error;
190 202
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B'));
191
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B'));
203
+		} else {
204
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B'));
205
+		}
192 206
 		$_SESSION['install'] = 'populate_flarm';
193 207
 		$_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM';
194 208
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -209,18 +223,26 @@  discard block
 block discarded – undo
209 223
 		if ($error != '') {
210 224
 			$_SESSION['error'] = $error;
211 225
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM'));
212
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM'));
226
+		} else {
227
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM'));
228
+		}
213 229
 		if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
214 230
 			$_SESSION['install'] = 'vatsim';
215
-			if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
216
-			else $_SESSION['next'] = 'Insert VATSIM data';
231
+			if (file_exists('tmp/ivae_feb2013.zip')) {
232
+				$_SESSION['next'] = 'Insert IVAO data';
233
+			} else {
234
+				$_SESSION['next'] = 'Insert VATSIM data';
235
+			}
217 236
 		} elseif (isset($globalVATSIM) && $globalVATSIM) {
218 237
 			$_SESSION['install'] = 'vatsim';
219 238
 			$_SESSION['next'] = 'Insert VATSIM data';
220 239
 		} elseif (isset($globalIVAO) && $globalIVAO) {
221 240
 			$_SESSION['install'] = 'vatsim';
222
-			if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
223
-			else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
241
+			if (file_exists('tmp/ivae_feb2013.zip')) {
242
+				$_SESSION['next'] = 'Insert IVAO data';
243
+			} else {
244
+				$_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
245
+			}
224 246
 		} elseif (isset($globalphpVMS) && $globalphpVMS) {
225 247
 			$_SESSION['install'] = 'vatsim';
226 248
 			$_SESSION['next'] = 'Insert phpVMS data';
@@ -245,7 +267,9 @@  discard block
 block discarded – undo
245 267
 		if ($error != '') {
246 268
 			$_SESSION['error'] = $error;
247 269
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data'));
248
-		} else 	$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data'));
270
+		} else {
271
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data'));
272
+		}
249 273
 		$_SESSION['install'] = 'translation';
250 274
 		$_SESSION['next'] = 'Populate translation table with externals data';
251 275
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -265,7 +289,9 @@  discard block
 block discarded – undo
265 289
 		if ($error != '') {
266 290
 			$_SESSION['error'] = $error;
267 291
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data'));
268
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data'));
292
+		} else {
293
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data'));
294
+		}
269 295
 		if ($_SESSION['waypoints'] == 1) {
270 296
 			$_SESSION['install'] = 'waypoints';
271 297
 			$_SESSION['next'] = 'Populate waypoints table';
@@ -300,7 +326,9 @@  discard block
 block discarded – undo
300 326
 		if ($error != '') {
301 327
 			$_SESSION['error'] = $error;
302 328
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data'));
303
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data'));
329
+		} else {
330
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data'));
331
+		}
304 332
 		$_SESSION['install'] = 'sources';
305 333
 		$_SESSION['next'] = 'Insert data in source table';
306 334
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -321,12 +349,16 @@  discard block
 block discarded – undo
321 349
 			if ($error != '') {
322 350
 				$_SESSION['error'] = $error;
323 351
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data'));
324
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data'));
352
+			} else {
353
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data'));
354
+			}
325 355
 		} else {
326 356
 			if ($error != '') {
327 357
 				$_SESSION['error'] = $error;
328 358
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)'));
329
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)'));
359
+			} else {
360
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)'));
361
+			}
330 362
 		}
331 363
 		/*
332 364
 		if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
@@ -376,7 +408,9 @@  discard block
 block discarded – undo
376 408
 		$Source = new Source();
377 409
 		$Source->deleteAllLocation();
378 410
 		foreach ($sources as $src) {
379
-			if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
411
+			if (isset($src['latitude']) && $src['latitude'] != '') {
412
+				$Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
413
+			}
380 414
 		}
381 415
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table'));
382 416
 		unset($_SESSION['sources']);
@@ -387,15 +421,21 @@  discard block
 block discarded – undo
387 421
 	*/
388 422
 	if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
389 423
 		$_SESSION['install'] = 'vatsim';
390
-		if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
391
-		else $_SESSION['next'] = 'Insert VATSIM data';
424
+		if (file_exists('tmp/ivae_feb2013.zip')) {
425
+			$_SESSION['next'] = 'Insert IVAO data';
426
+		} else {
427
+			$_SESSION['next'] = 'Insert VATSIM data';
428
+		}
392 429
 	} elseif (isset($globalVATSIM) && $globalVATSIM) {
393 430
 		$_SESSION['install'] = 'vatsim';
394 431
 		$_SESSION['next'] = 'Insert VATSIM data';
395 432
 	} elseif (isset($globalIVAO) && $globalIVAO) {
396 433
 		$_SESSION['install'] = 'vatsim';
397
-		if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
398
-		else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
434
+		if (file_exists('tmp/ivae_feb2013.zip')) {
435
+			$_SESSION['next'] = 'Insert IVAO data';
436
+		} else {
437
+			$_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
438
+		}
399 439
 	} elseif (isset($globalphpVMS) && $globalphpVMS) {
400 440
 		$_SESSION['install'] = 'vatsim';
401 441
 		$_SESSION['next'] = 'Insert phpVMS data';
@@ -416,33 +456,43 @@  discard block
 block discarded – undo
416 456
 			if ($error != '') {
417 457
 				$_SESSION['error'] = $error;
418 458
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
419
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
459
+			} else {
460
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
461
+			}
420 462
 		} else {
421 463
 			$error .= update_db::update_vatsim();
422 464
 			if ($error != '') {
423 465
 				$_SESSION['error'] = $error;
424 466
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
425
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
467
+			} else {
468
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
469
+			}
426 470
 		}
427 471
 	} elseif (isset($globalVATSIM) && $globalVATSIM) {
428 472
 		$error .= update_db::update_vatsim();
429 473
 		if ($error != '') {
430 474
 			$_SESSION['error'] = $error;
431 475
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
432
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
476
+		} else {
477
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
478
+		}
433 479
 	} elseif (isset($globalIVAO) && $globalIVAO) {
434 480
 		if (file_exists('tmp/ivae_feb2013.zip')) {
435 481
 			$error .= update_db::update_IVAO();
436 482
 			if ($error != '') {
437 483
 				$_SESSION['error'] = $error;
438 484
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
439
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
485
+			} else {
486
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
487
+			}
440 488
 		} else {
441 489
 			$error .= update_db::update_vatsim();
442 490
 			if ($error != '') {
443 491
 				$_SESSION['error'] = $error;
444 492
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)'));
445
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)'));
493
+			} else {
494
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)'));
495
+			}
446 496
 		}
447 497
 	} elseif (isset($globalphpVMS) && $globalphpVMS) {
448 498
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data'));
Please login to merge, or discard this patch.
require/class.AIS.php 1 patch
Braces   +204 added lines, -79 removed lines patch added patch discarded remove patch
@@ -123,7 +123,9 @@  discard block
 block discarded – undo
123 123
 			$temp += 1;
124 124
 			$flat = (float)($temp / (60.0 * 10000.0));
125 125
 			$flat *= -1.0;
126
-		} else $flat = (float)($temp / (60.0 * 10000.0));
126
+		} else {
127
+			$flat = (float)($temp / (60.0 * 10000.0));
128
+		}
127 129
 		return $flat; // float
128 130
 	}
129 131
 
@@ -135,7 +137,9 @@  discard block
 block discarded – undo
135 137
 			$temp += 1;
136 138
 			$flon = (float)($temp / (60.0 * 10000.0));
137 139
 			$flon *= -1.0;
138
-		} else $flon = (float)($temp / (60.0 * 10000.0));
140
+		} else {
141
+			$flon = (float)($temp / (60.0 * 10000.0));
142
+		}
139 143
 		return $flon;
140 144
 	}
141 145
 
@@ -158,10 +162,8 @@  discard block
 block discarded – undo
158 162
     */
159 163
 	private function asciidec_2_8bit($ascii) {
160 164
 		//only process in the following range: 48-87, 96-119
161
-		if ($ascii < 48) { }
162
-		else {
163
-			if($ascii>119) { }
164
-			else {
165
+		if ($ascii < 48) { } else {
166
+			if($ascii>119) { } else {
165 167
 				if ($ascii>87 && $ascii<96) ;
166 168
 				else {
167 169
 					$ascii=$ascii+40;
@@ -263,7 +265,9 @@  discard block
 block discarded – undo
263 265
 			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28)));
264 266
 			$ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27)));
265 267
 			$ro->heading = bindec(substr($_aisdata,124,9));
266
-			if ($ro->heading == 511) $ro->heading = '';
268
+			if ($ro->heading == 511) {
269
+				$ro->heading = '';
270
+			}
267 271
 			$ro->cls = 2; // class B
268 272
 		} else if ($ro->id == 19) {
269 273
 			$ro->cog = bindec(substr($_aisdata,112,12))/10;
@@ -273,7 +277,9 @@  discard block
 block discarded – undo
273 277
 			$ro->name = $this->binchar($_aisdata,143,120);
274 278
 			$ro->cls = 2; // class B
275 279
 			$ro->heading = bindec(substr($_aisdata,124,9));
276
-			if ($ro->heading == 511) $ro->heading = '';
280
+			if ($ro->heading == 511) {
281
+				$ro->heading = '';
282
+			}
277 283
 			$ro->typeid = bindec(substr($_aisdata,263,8));
278 284
 			$ro->type = $this->getShipType($ro->typeid);
279 285
 			//$ro->to_bow = bindec(substr($_aisdata,271,9));
@@ -304,9 +310,13 @@  discard block
 block discarded – undo
304 310
 			$ro->cls = 2; // class B
305 311
 		} else if ($ro->id == 27) {
306 312
 			$ro->cog = bindec(substr($_aisdata,85,9));
307
-			if ($ro->cog == 511) $ro->cog = 0.0;
313
+			if ($ro->cog == 511) {
314
+				$ro->cog = 0.0;
315
+			}
308 316
 			$ro->sog = bindec(substr($_aisdata,79,6));
309
-			if ($ro->sog == 63) $ro->sog = 0.0;
317
+			if ($ro->sog == 63) {
318
+				$ro->sog = 0.0;
319
+			}
310 320
 			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10);
311 321
 			$ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10);
312 322
 			$ro->cls = 1; // class A
@@ -354,28 +364,48 @@  discard block
 block discarded – undo
354 364
 	}
355 365
 	
356 366
 	public function getShipType($code) {
357
-		if (isset($this->shiptype[$code])) return $this->shiptype[$code];
358
-		else return '';
367
+		if (isset($this->shiptype[$code])) {
368
+			return $this->shiptype[$code];
369
+		} else {
370
+			return '';
371
+		}
359 372
 	}
360 373
 
361 374
 	public function getShipTypeID($type) {
362 375
 		$typeid = array_search($type,$this->shiptype);
363
-		if ($typeid !== FALSE) return $typeid;
364
-		elseif ($type == 'Cargo' || $type == 'General Cargo' || $type == 'Bulk Carrier' || $type == 'Container Ship' || $type == 'Cargo A' || $type == 'Reefer' || $type == 'Vehicles Carrier' || $type == 'Ro-Ro Cargo') return 70;
365
-		elseif ($type == 'Passengers Ship' || $type == 'Passenger' || $type == 'Ro-Ro/Passenger Ship' || $type == 'Motor Passenger') return 60;
366
-		elseif ($type == 'Tanker' || $type == 'Crude Oil Tanker' || $type == 'Oil Products Tanker' || $type == 'Oil/Chemical Tanker' || $type == 'Bunkering Tanker') return 80;
367
-		elseif ($type == 'Lpg Tanker' || $type == 'Lng Tanker') return 84;
368
-		elseif ($type == 'Sailing Vessel') return 36;
369
-		elseif ($type == 'Yacht') return 37;
370
-		elseif ($type == 'Trailing Suction Hopper Dredger' || $type == 'Drilling Jack Up' || $type == 'Suction Dredger' || $type == 'Hopper Dredger') return 33;
371
-		elseif ($type == 'High speed craft') return 40;
372
-		elseif ($type == 'Crew Boat') return 53;
373
-		elseif ($type == 'Icebreaker') return 52;
374
-		elseif ($type == 'Pollution Control Vessel') return 54;
375
-		elseif ($type == 'Other Type') return 90;
376
-		elseif ($type == 'Anchor Handling Vessel' || $type == 'Offshore Supply Ship' || $type == 'Research/Survey Vessel' || $type == 'Utility Vessel' || $type == 'Pipe Burying Vessel' || $type == 'Heavy Lift Vessel' || $type == 'Crane Ship' || $type == 'Buoy-laying Vessel') return 59;
377
-		elseif ($type == 'Fish Carrier' || $type == 'Trawler' || $type == 'Trawlers' || $type == 'Fishing Vessel' || $type == 'Trawlers|unknown Not Fishing' || $type == 'Purse Seines|trawlers' || $type == 'Purse Seines' || $type == 'Trollers' || $type == 'Set Longlines' || $type == 'Set Gillnets|trawlers') return 30;
378
-		else return 0;
376
+		if ($typeid !== FALSE) {
377
+			return $typeid;
378
+		} elseif ($type == 'Cargo' || $type == 'General Cargo' || $type == 'Bulk Carrier' || $type == 'Container Ship' || $type == 'Cargo A' || $type == 'Reefer' || $type == 'Vehicles Carrier' || $type == 'Ro-Ro Cargo') {
379
+			return 70;
380
+		} elseif ($type == 'Passengers Ship' || $type == 'Passenger' || $type == 'Ro-Ro/Passenger Ship' || $type == 'Motor Passenger') {
381
+			return 60;
382
+		} elseif ($type == 'Tanker' || $type == 'Crude Oil Tanker' || $type == 'Oil Products Tanker' || $type == 'Oil/Chemical Tanker' || $type == 'Bunkering Tanker') {
383
+			return 80;
384
+		} elseif ($type == 'Lpg Tanker' || $type == 'Lng Tanker') {
385
+			return 84;
386
+		} elseif ($type == 'Sailing Vessel') {
387
+			return 36;
388
+		} elseif ($type == 'Yacht') {
389
+			return 37;
390
+		} elseif ($type == 'Trailing Suction Hopper Dredger' || $type == 'Drilling Jack Up' || $type == 'Suction Dredger' || $type == 'Hopper Dredger') {
391
+			return 33;
392
+		} elseif ($type == 'High speed craft') {
393
+			return 40;
394
+		} elseif ($type == 'Crew Boat') {
395
+			return 53;
396
+		} elseif ($type == 'Icebreaker') {
397
+			return 52;
398
+		} elseif ($type == 'Pollution Control Vessel') {
399
+			return 54;
400
+		} elseif ($type == 'Other Type') {
401
+			return 90;
402
+		} elseif ($type == 'Anchor Handling Vessel' || $type == 'Offshore Supply Ship' || $type == 'Research/Survey Vessel' || $type == 'Utility Vessel' || $type == 'Pipe Burying Vessel' || $type == 'Heavy Lift Vessel' || $type == 'Crane Ship' || $type == 'Buoy-laying Vessel') {
403
+			return 59;
404
+		} elseif ($type == 'Fish Carrier' || $type == 'Trawler' || $type == 'Trawlers' || $type == 'Fishing Vessel' || $type == 'Trawlers|unknown Not Fishing' || $type == 'Purse Seines|trawlers' || $type == 'Purse Seines' || $type == 'Trollers' || $type == 'Set Longlines' || $type == 'Set Gillnets|trawlers') {
405
+			return 30;
406
+		} else {
407
+			return 0;
408
+		}
379 409
 	}
380 410
 
381 411
 	public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) {
@@ -412,11 +442,20 @@  discard block
 block discarded – undo
412 442
 		// assume 1st ! is valid
413 443
 		// find * ensure that it is at correct position
414 444
 		$end = strrpos ( $rawdata , '*' );
415
-		if ($end === FALSE) return -1; // check for NULLS!!!
445
+		if ($end === FALSE) {
446
+			return -1;
447
+		}
448
+		// check for NULLS!!!
416 449
 		$cs = substr( $rawdata, $end + 1 );
417
-		if ( strlen($cs) != 2 ) return -1; // correct cs length
450
+		if ( strlen($cs) != 2 ) {
451
+			return -1;
452
+		}
453
+		// correct cs length
418 454
 		$dcs = (int)hexdec( $cs );
419
-		for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum
455
+		for ( $alias=1; $alias<$end; $alias++) {
456
+			$chksum ^= ord( $rawdata[$alias] );
457
+		}
458
+		// perform XOR for NMEA checksum
420 459
 		if ( $chksum == $dcs ) { // NMEA checksum pass
421 460
 			$pcs = explode(',', $rawdata);
422 461
 			// !AI??? identifier
@@ -427,8 +466,14 @@  discard block
 block discarded – undo
427 466
 			$num_seq = (int)$pcs[1]; // number of sequences
428 467
 			$seq = (int)$pcs[2]; // get sequence
429 468
 			// get msg sequence id
430
-			if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1
431
-			else $msg_sid = (int)$pcs[3]; // multipart message
469
+			if ($pcs[3] == '') {
470
+				$msg_sid = -1;
471
+			}
472
+			// non-multipart message, set to -1
473
+			else {
474
+				$msg_sid = (int)$pcs[3];
475
+			}
476
+			// multipart message
432 477
 			$ais_ch = $pcs[4]; // get AIS channel
433 478
 			// message sequence checking
434 479
 			if ($num_seq < 1 || $num_seq > 9) {
@@ -491,10 +536,18 @@  discard block
 block discarded – undo
491 536
 				//DEBUG echo "[$start $end $tst]\n";
492 537
 				$result = $this->process_ais_raw( $tst, "" );
493 538
 				$last_pos = $end + 1;
494
-			} else break;
539
+			} else {
540
+				break;
541
+			}
542
+		}
543
+		if ($last_pos > 0) {
544
+			$cbuf = substr($cbuf, $last_pos);
495 545
 		}
496
-		if ($last_pos > 0) $cbuf = substr($cbuf, $last_pos); // move...
497
-		if (strlen($cbuf) > 1024) $cbuf = ""; // prevent overflow simple mode...
546
+		// move...
547
+		if (strlen($cbuf) > 1024) {
548
+			$cbuf = "";
549
+		}
550
+		// prevent overflow simple mode...
498 551
 		return $result;
499 552
 	}
500 553
 
@@ -514,7 +567,9 @@  discard block
 block discarded – undo
514 567
 		if ($lat<0.0) {
515 568
 			$lat = -$lat;
516 569
 			$neg=true;
517
-		} else $neg=false;
570
+		} else {
571
+			$neg=false;
572
+		}
518 573
 		$latd = 0x00000000;
519 574
 		$latd = intval ($lat * 600000.0);
520 575
 		if ($neg==true) {
@@ -530,7 +585,9 @@  discard block
 block discarded – undo
530 585
 		if ($lon<0.0) {
531 586
 			$lon = -$lon;
532 587
 			$neg=true;
533
-		} else $neg=false;
588
+		} else {
589
+			$neg=false;
590
+		}
534 591
 		$lond = 0x00000000;
535 592
 		$lond = intval ($lon * 600000.0);
536 593
 		if ($neg==true) {
@@ -543,9 +600,14 @@  discard block
 block discarded – undo
543 600
 
544 601
 	private function char2bin($name, $max_len) {
545 602
 		$len = strlen($name);
546
-		if ($len > $max_len) $name = substr($name,0,$max_len);
547
-		if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len) * 6);
548
-		else $pad = '';
603
+		if ($len > $max_len) {
604
+			$name = substr($name,0,$max_len);
605
+		}
606
+		if ($len < $max_len) {
607
+			$pad = str_repeat('0', ($max_len - $len) * 6);
608
+		} else {
609
+			$pad = '';
610
+		}
549 611
 		$rv = '';
550 612
 		$ais_chars = array(
551 613
 		    '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
@@ -560,8 +622,11 @@  discard block
 block discarded – undo
560 622
 		$_a = str_split($name);
561 623
 		if (!empty($_a)) {
562 624
 			foreach ($_a as $_1) {
563
-				if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1];
564
-				else $dec = 0;
625
+				if (isset($ais_chars[$_1])) {
626
+					$dec = $ais_chars[$_1];
627
+				} else {
628
+					$dec = 0;
629
+				}
565 630
 				$bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT);
566 631
 				$rv .= $bin;
567 632
 				//echo "$_1 $dec ($bin)<br/>";
@@ -574,7 +639,9 @@  discard block
 block discarded – undo
574 639
 		$len_bit = strlen($_enc);
575 640
 		$rem6 = $len_bit % 6;
576 641
 		$pad6_len = 0;
577
-		if ($rem6) $pad6_len = 6 - $rem6;
642
+		if ($rem6) {
643
+			$pad6_len = 6 - $rem6;
644
+		}
578 645
 		//echo  $pad6_len.'<br>';
579 646
 		$_enc .= str_repeat("0", $pad6_len); // pad the text...
580 647
 		$len_enc = strlen($_enc) / 6;
@@ -583,8 +650,11 @@  discard block
 block discarded – undo
583 650
 		for ($i=0; $i<$len_enc; $i++) {
584 651
 			$offset = $i * 6;
585 652
 			$dec = bindec(substr($_enc,$offset,6));
586
-			if ($dec < 40) $dec += 48;
587
-			else $dec += 56;
653
+			if ($dec < 40) {
654
+				$dec += 48;
655
+			} else {
656
+				$dec += 56;
657
+			}
588 658
 			//echo chr($dec)." $dec<br/>";
589 659
 			$itu .= chr($dec);
590 660
 		}
@@ -597,26 +667,42 @@  discard block
 block discarded – undo
597 667
 		}
598 668
 		$hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
599 669
 		$lsb = $chksum & 0x0F;
600
-		if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb];
601
-		else $lsbc = '0';
670
+		if ($lsb >=0 && $lsb <= 15 ) {
671
+			$lsbc = $hex_arr[$lsb];
672
+		} else {
673
+			$lsbc = '0';
674
+		}
602 675
 		$msb = (($chksum & 0xF0) >> 4) & 0x0F;
603
-		if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb];
604
-		else $msbc = '0';
676
+		if ($msb >=0 && $msb <= 15 ) {
677
+			$msbc = $hex_arr[$msb];
678
+		} else {
679
+			$msbc = '0';
680
+		}
605 681
 		$itu = '!'.$itu."*{$msbc}{$lsbc}\r\n";
606 682
 		return $itu;
607 683
 	}
608 684
 
609 685
 	public function parse($buffer) {
610 686
 		$data = $this->process_ais_buf($buffer);
611
-		if (!is_object($data)) return array();
687
+		if (!is_object($data)) {
688
+			return array();
689
+		}
612 690
 		$result = array();
613
-		if ($data->lon != 0) $result['longitude'] = $data->lon;
614
-		if ($data->lat != 0) $result['latitude'] = $data->lat;
691
+		if ($data->lon != 0) {
692
+			$result['longitude'] = $data->lon;
693
+		}
694
+		if ($data->lat != 0) {
695
+			$result['latitude'] = $data->lat;
696
+		}
615 697
 		$result['ident'] = trim($data->name);
616 698
 		$result['timestamp'] = $data->ts;
617 699
 		$result['mmsi'] = $data->mmsi;
618
-		if ($data->sog != -1.0) $result['speed'] = $data->sog;
619
-		if ($data->cog != 0) $result['heading'] = $data->cog;
700
+		if ($data->sog != -1.0) {
701
+			$result['speed'] = $data->sog;
702
+		}
703
+		if ($data->cog != 0) {
704
+			$result['heading'] = $data->cog;
705
+		}
620 706
 		/*
621 707
 		    $ro->cls = 0; // AIS class undefined, also indicate unparsed msg
622 708
 		    $ro->id = bindec(substr($_aisdata,0,6));
@@ -626,15 +712,25 @@  discard block
 block discarded – undo
626 712
 
627 713
 	public function mmsitype($mmsi) {
628 714
 		if (strlen($mmsi) == 9) {
629
-			if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
630
-			elseif (substr($mmsi,0,3) == '972') return 'MOB (Man Overboard) device';
631
-			elseif (substr($mmsi,0,3) == '970') return 'AIS SART (Search and Rescue Transmitter)';
632
-			elseif (substr($mmsi,0,3) == '111') return 'SAR (Search and Rescue) aircraft';
633
-			elseif (substr($mmsi,0,2) == '98') return 'Auxiliary craft associated with a parent ship';
634
-			elseif (substr($mmsi,0,2) == '99') return 'Aids to Navigation';
635
-			elseif (substr($mmsi,0,2) == '00') return 'Coastal stations';
636
-			elseif (substr($mmsi,0,1) == '0') return 'Group of ships';
637
-			else return 'Ship';
715
+			if (substr($mmsi,0,3) == '974') {
716
+				return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
717
+			} elseif (substr($mmsi,0,3) == '972') {
718
+				return 'MOB (Man Overboard) device';
719
+			} elseif (substr($mmsi,0,3) == '970') {
720
+				return 'AIS SART (Search and Rescue Transmitter)';
721
+			} elseif (substr($mmsi,0,3) == '111') {
722
+				return 'SAR (Search and Rescue) aircraft';
723
+			} elseif (substr($mmsi,0,2) == '98') {
724
+				return 'Auxiliary craft associated with a parent ship';
725
+			} elseif (substr($mmsi,0,2) == '99') {
726
+				return 'Aids to Navigation';
727
+			} elseif (substr($mmsi,0,2) == '00') {
728
+				return 'Coastal stations';
729
+			} elseif (substr($mmsi,0,1) == '0') {
730
+				return 'Group of ships';
731
+			} else {
732
+				return 'Ship';
733
+			}
638 734
 		}
639 735
 
640 736
 	
@@ -650,32 +746,61 @@  discard block
 block discarded – undo
650 746
 			//if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n";
651 747
 			return array();
652 748
 		}
653
-		if ($data->lon != 0) $result['longitude'] = $data->lon;
654
-		if ($data->lat != 0) $result['latitude'] = $data->lat;
749
+		if ($data->lon != 0) {
750
+			$result['longitude'] = $data->lon;
751
+		}
752
+		if ($data->lat != 0) {
753
+			$result['latitude'] = $data->lat;
754
+		}
655 755
 		$result['ident'] = trim(str_replace('@','',$data->name));
656 756
 		$result['timestamp'] = $data->ts;
657 757
 		$result['mmsi'] = $data->mmsi;
658
-		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi'];
758
+		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') {
759
+			$result['mmsi'] = '3'.$result['mmsi'];
760
+		}
659 761
 		$result['mmsi_type'] = $this->mmsitype($result['mmsi']);
660
-		if ($data->sog != -1.0) $result['speed'] = $data->sog;
661
-		if ($data->heading !== '') $result['heading'] = $data->heading;
662
-		elseif ($data->cog != 0) $result['heading'] = $data->cog;
663
-		if ($data->status != '') $result['status'] = $data->status;
664
-		if ($data->statusid !== '') $result['statusid'] = $data->statusid;
665
-		if ($data->type !== '') $result['type'] = $data->type;
666
-		if ($data->typeid !== '') $result['typeid'] = $data->typeid;
667
-		if ($data->imo !== '') $result['imo'] = $data->imo;
668
-		if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign));
762
+		if ($data->sog != -1.0) {
763
+			$result['speed'] = $data->sog;
764
+		}
765
+		if ($data->heading !== '') {
766
+			$result['heading'] = $data->heading;
767
+		} elseif ($data->cog != 0) {
768
+			$result['heading'] = $data->cog;
769
+		}
770
+		if ($data->status != '') {
771
+			$result['status'] = $data->status;
772
+		}
773
+		if ($data->statusid !== '') {
774
+			$result['statusid'] = $data->statusid;
775
+		}
776
+		if ($data->type !== '') {
777
+			$result['type'] = $data->type;
778
+		}
779
+		if ($data->typeid !== '') {
780
+			$result['typeid'] = $data->typeid;
781
+		}
782
+		if ($data->imo !== '') {
783
+			$result['imo'] = $data->imo;
784
+		}
785
+		if ($data->callsign !== '') {
786
+			$result['callsign'] = trim(str_replace('@','',$data->callsign));
787
+		}
669 788
 		if (is_numeric($data->eta_month) && $data->eta_month != 0 && is_numeric($data->eta_day) && $data->eta_day != 0 && $data->eta_hour !== '' && $data->eta_minute !== '') {
670 789
 			$eta_ts = strtotime(date('Y').'-'.sprintf("%02d",$data->eta_month).'-'.sprintf("%02d",$data->eta_day).' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
671
-			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
790
+			if ($eta_ts != '') {
791
+				$result['eta_ts'] = $eta_ts;
792
+			}
672 793
 		} elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) {
673 794
 			$eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
674
-			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
795
+			if ($eta_ts != '') {
796
+				$result['eta_ts'] = $eta_ts;
797
+			}
675 798
 		}
676 799
 		if ($data->destination != '') {
677 800
 			$dest = trim(str_replace('@','',$data->destination));
678
-			if ($dest != '') $result['destination'] = $dest;
801
+			if ($dest != '') {
802
+				$result['destination'] = $dest;
803
+			}
679 804
 		}
680 805
 		$result['all'] = (array) $data;
681 806
 		/*
Please login to merge, or discard this patch.
scripts/update_db.php 1 patch
Braces   +33 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@  discard block
 block discarded – undo
15 15
 	if(function_exists('exec')) {
16 16
 		exec("ps ux", $output, $result);
17 17
 		$j = 0;
18
-		foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
18
+		foreach ($output as $line) {
19
+			if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
20
+		}
19 21
 		if ($j > 1) {
20 22
 			echo "Script is already runnning...";
21 23
 			die();
@@ -25,7 +27,9 @@  discard block
 block discarded – undo
25 27
 require(dirname(__FILE__).'/../install/class.update_db.php');
26 28
 $update_db = new update_db();
27 29
 
28
-if ($update_db->check() === false) die();
30
+if ($update_db->check() === false) {
31
+	die();
32
+}
29 33
 
30 34
 if ((!isset($globalMasterServer) || !$globalMasterServer) && (!isset($globalOffline) || $globalOffline === FALSE)) {
31 35
 	if (isset($globalNOTAM) && $globalNOTAM && $update_db->check_last_notam_update()) {
@@ -36,14 +40,18 @@  discard block
 block discarded – undo
36 40
 			$update_db->update_notam();
37 41
 		}
38 42
 		$update_db->insert_last_notam_update();
39
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
43
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
44
+		echo "NOTAM are only updated once a day.\n";
45
+	}
40 46
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
41 47
 		$update_db->update_all();
42 48
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
43 49
 	//	$Spotter = new Spotter();
44 50
 	//	$Spotter->updateFieldsFromOtherTables();
45 51
 		$update_db->insert_last_update();
46
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
52
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
53
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
54
+	}
47 55
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
48 56
 		echo "Check if new airspace version exist...";
49 57
 		echo $update_db->update_airspace_fam();
@@ -52,8 +60,11 @@  discard block
 block discarded – undo
52 60
 	if (isset($globalGeoid) && $globalGeoid && $update_db->check_last_geoid_update()) {
53 61
 		echo "Check if new geoid version exist...";
54 62
 		$error = $update_db->update_geoid_fam();
55
-		if ($error == '') $update_db->insert_last_geoid_update();
56
-		else echo $error;
63
+		if ($error == '') {
64
+			$update_db->insert_last_geoid_update();
65
+		} else {
66
+			echo $error;
67
+		}
57 68
 	}
58 69
 	if (isset($globalMarine) && $globalMarine && (!isset($globalVM) || $globalVM === FALSE) && $update_db->check_last_marine_identity_update()) {
59 70
 		echo "Check if new marine identity version exist...";
@@ -71,13 +82,17 @@  discard block
 block discarded – undo
71 82
 			//echo "Done";
72 83
 		}
73 84
 		$update_db->insert_last_owner_update();
74
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
85
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
86
+		echo "Owner are only updated every 15 days.\n";
87
+	}
75 88
 
76 89
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && ($update_db->check_last_airlines_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
77 90
 		echo "Updating airlines...\n";
78 91
 		echo $update_db->update_airlines_fam();
79 92
 		$update_db->insert_last_airlines_update();
80
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Airlines are only updated every 15 days.\n";
93
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
94
+		echo "Airlines are only updated every 15 days.\n";
95
+	}
81 96
 
82 97
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
83 98
 		require_once(dirname(__FILE__).'/../require/class.Accident.php');
@@ -86,7 +101,9 @@  discard block
 block discarded – undo
86 101
 		if ($Accident->check_last_accidents_update()) {
87 102
 			$Accident->download_update();
88 103
 			$Accident->insert_last_accidents_update();
89
-		} else echo "Accidents are updated once a day.\n";
104
+		} else {
105
+			echo "Accidents are updated once a day.\n";
106
+		}
90 107
 	}
91 108
   
92 109
 }
@@ -99,7 +116,9 @@  discard block
 block discarded – undo
99 116
 		if ($METAR->check_last_update()) {
100 117
 			$METAR->addMETARCycle();
101 118
 			$METAR->insert_last_update();
102
-		} else echo "METAR are only updated every 30 minutes.\n";
119
+		} else {
120
+			echo "METAR are only updated every 30 minutes.\n";
121
+		}
103 122
 	}
104 123
 
105 124
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
@@ -107,8 +126,10 @@  discard block
 block discarded – undo
107 126
 		//$update_db->update_oneworld();
108 127
 		$update_db->update_skyteam();
109 128
 		$update_db->insert_last_schedules_update();
110
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
111
-}
129
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
130
+		echo "Schedules are only updated every 15 days.\n";
131
+	}
132
+	}
112 133
 
113 134
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
114 135
 	echo "Updating statistics and archive old data...\n";
Please login to merge, or discard this patch.