@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | die(); |
24 | 24 | } |
25 | 25 | |
26 | -$ACARS=new ACARS(null,true); |
|
26 | +$ACARS = new ACARS(null, true); |
|
27 | 27 | date_default_timezone_set('UTC'); |
28 | 28 | // signal handler - playing nice with sockets and dump1090 |
29 | -pcntl_signal(SIGINT, function($signo) { |
|
29 | +pcntl_signal(SIGINT, function($signo) { |
|
30 | 30 | global $sock; |
31 | 31 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
32 | 32 | socket_shutdown($sock, 0); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $sock = socket_create(AF_INET, SOCK_DGRAM, 0) or die("Unable to create socket\n"); |
43 | 43 | |
44 | 44 | // Bind the source address |
45 | -if( !socket_bind($sock, $globalACARSHost , $globalACARSPort) ) |
|
45 | +if (!socket_bind($sock, $globalACARSHost, $globalACARSPort)) |
|
46 | 46 | { |
47 | 47 | $errorcode = socket_last_error(); |
48 | 48 | $errormsg = socket_strerror($errorcode); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | if ($globalDebug) echo "LISTEN UDP MODE \n\n"; |
54 | -while(1) { |
|
54 | +while (1) { |
|
55 | 55 | $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port); |
56 | 56 | |
57 | 57 | // lets play nice and handle signals such as ctrl-c/kill properly |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | // (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 | 61 | if ($globalDebug) echo $buffer."\n"; |
62 | 62 | $ACARS->add(trim($buffer)); |
63 | - socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
63 | + socket_sendto($sock, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
64 | 64 | $ACARS->deleteLiveAcarsData(); |
65 | 65 | } |
66 | -pcntl_exec($_,$argv); |
|
66 | +pcntl_exec($_, $argv); |
|
67 | 67 | ?> |
@@ -12,10 +12,10 @@ |
||
12 | 12 | } |
13 | 13 | // Check if script is not already running... (dirty) |
14 | 14 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN' && (!isset($globalDisableUpdateCheck) || $globalDisableUpdateCheck === FALSE)) { |
15 | - if(function_exists('exec')) { |
|
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) if (strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++; |
|
19 | 19 | if ($j > 1) { |
20 | 20 | echo "Script is already runnning..."; |
21 | 21 | die(); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once('../require/settings.php'); |
3 | 3 | require_once('../require/class.Language.php'); |
4 | -setcookie("MapFormat",'2d'); |
|
4 | +setcookie("MapFormat", '2d'); |
|
5 | 5 | ?> |
6 | 6 | /** |
7 | 7 | * This javascript is part of FlightAirmap. |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | <?php |
109 | 109 | } |
110 | 110 | if (isset($_GET['ident'])) { |
111 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
111 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
112 | 112 | } |
113 | 113 | if (isset($_GET['flightaware_id'])) { |
114 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
114 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
115 | 115 | } |
116 | 116 | if (isset($_GET['latitude'])) { |
117 | - $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING); |
|
117 | + $latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING); |
|
118 | 118 | } |
119 | 119 | if (isset($_GET['longitude'])) { |
120 | - $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING); |
|
120 | + $longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING); |
|
121 | 121 | } |
122 | 122 | ?> |
123 | 123 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } else { |
146 | 146 | if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) { |
147 | 147 | if (isset($_COOKIE['lastcentercoord'])) { |
148 | - $lastcentercoord = explode(',',$_COOKIE['lastcentercoord']); |
|
148 | + $lastcentercoord = explode(',', $_COOKIE['lastcentercoord']); |
|
149 | 149 | $viewcenterlatitude = $lastcentercoord[0]; |
150 | 150 | $viewcenterlongitude = $lastcentercoord[1]; |
151 | 151 | $viewzoom = $lastcentercoord[2]; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | || navigator.userAgent.match(/BlackBerry/i) |
167 | 167 | || navigator.userAgent.match(/Windows Phone/i)) |
168 | 168 | { |
169 | - var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>; |
|
169 | + var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom - 1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>; |
|
170 | 170 | } else { |
171 | 171 | var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>; |
172 | 172 | } |
@@ -310,19 +310,19 @@ discard block |
||
310 | 310 | map.addLayer(yandexLayer); |
311 | 311 | <?php |
312 | 312 | } elseif ($MapType == 'Bing-Aerial') { |
313 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
313 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
314 | 314 | ?> |
315 | 315 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
316 | 316 | map.addLayer(bingLayer); |
317 | 317 | <?php |
318 | 318 | } elseif ($MapType == 'Bing-Hybrid') { |
319 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
319 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
320 | 320 | ?> |
321 | 321 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
322 | 322 | map.addLayer(bingLayer); |
323 | 323 | <?php |
324 | 324 | } elseif ($MapType == 'Bing-Road') { |
325 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
325 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
326 | 326 | ?> |
327 | 327 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
328 | 328 | map.addLayer(bingLayer); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | |
461 | 461 | function update_tsk() { |
462 | 462 | var bbox = map.getBounds().toBBoxString(); |
463 | - var tskLayerQuery = $.getJSON("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php echo filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); ?>",function (data) { |
|
463 | + var tskLayerQuery = $.getJSON("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php echo filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); ?>",function (data) { |
|
464 | 464 | tskLayer = L.geoJson(data,{ |
465 | 465 | onEachFeature: function (feature, layer) { |
466 | 466 | tskPopup(feature, layer); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once('../require/settings.php'); |
3 | 3 | require_once('../require/class.Language.php'); |
4 | -setcookie("MapFormat",'2d'); |
|
4 | +setcookie("MapFormat", '2d'); |
|
5 | 5 | ?> |
6 | 6 | /** |
7 | 7 | * This javascript is part of FlightAirmap. |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | |
28 | 28 | <?php |
29 | 29 | if (isset($_GET['famtrackid'])) { |
30 | - $famtrackid = filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING); |
|
30 | + $famtrackid = filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING); |
|
31 | 31 | } |
32 | 32 | if (isset($_GET['ident'])) { |
33 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
33 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
34 | 34 | } |
35 | 35 | if (!isset($ident) && !isset($famtrackid)) { |
36 | 36 | ?> |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | <?php |
211 | 211 | } else { |
212 | 212 | ?> |
213 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
213 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
214 | 214 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
215 | 215 | <?php |
216 | 216 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | /* |
227 | 227 | shadowUrl: iconURLShadowpath, |
228 | 228 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
229 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
229 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
230 | 230 | */ |
231 | 231 | }) |
232 | 232 | }) |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | <?php |
268 | 268 | } else { |
269 | 269 | ?> |
270 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
270 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
271 | 271 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
272 | 272 | <?php |
273 | 273 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | <?php |
324 | 324 | } else { |
325 | 325 | ?> |
326 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
326 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
327 | 327 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
328 | 328 | <?php |
329 | 329 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once('../require/settings.php'); |
3 | 3 | require_once('../require/class.Language.php'); |
4 | -setcookie("MapFormat",'2d'); |
|
4 | +setcookie("MapFormat", '2d'); |
|
5 | 5 | ?> |
6 | 6 | /** |
7 | 7 | * This javascript is part of FlightAirmap. |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | |
39 | 39 | <?php |
40 | 40 | if (isset($_GET['fammarine_id'])) { |
41 | - $fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING); |
|
41 | + $fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING); |
|
42 | 42 | } |
43 | 43 | if (isset($_GET['ident'])) { |
44 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
44 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
45 | 45 | } |
46 | 46 | if (!isset($ident) && !isset($fammarine_id)) { |
47 | 47 | ?> |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | <?php |
202 | 202 | } else { |
203 | 203 | ?> |
204 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
204 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
205 | 205 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
206 | 206 | <?php |
207 | 207 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | /* |
218 | 218 | shadowUrl: iconURLShadowpath, |
219 | 219 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
220 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
220 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
221 | 221 | */ |
222 | 222 | }) |
223 | 223 | }) |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | <?php |
259 | 259 | } else { |
260 | 260 | ?> |
261 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
261 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
262 | 262 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
263 | 263 | <?php |
264 | 264 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | <?php |
315 | 315 | } else { |
316 | 316 | ?> |
317 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
317 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
318 | 318 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
319 | 319 | <?php |
320 | 320 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once('../require/settings.php'); |
3 | 3 | require_once('../require/class.Language.php'); |
4 | -setcookie("MapFormat",'2d'); |
|
4 | +setcookie("MapFormat", '2d'); |
|
5 | 5 | ?> |
6 | 6 | /** |
7 | 7 | * This javascript is part of FlightAirmap. |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | |
27 | 27 | <?php |
28 | 28 | if (isset($_GET['famsatid'])) { |
29 | - $famsatid = filter_input(INPUT_GET,'famsatid',FILTER_SANITIZE_STRING); |
|
29 | + $famsatid = filter_input(INPUT_GET, 'famsatid', FILTER_SANITIZE_STRING); |
|
30 | 30 | } |
31 | 31 | if (isset($_GET['ident'])) { |
32 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
32 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
33 | 33 | } |
34 | 34 | if (!isset($ident) && !isset($famsatid)) { |
35 | 35 | ?> |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | <?php |
175 | 175 | } else { |
176 | 176 | ?> |
177 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
177 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
178 | 178 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
179 | 179 | <?php |
180 | 180 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | /* |
191 | 191 | shadowUrl: iconURLShadowpath, |
192 | 192 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
193 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
193 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
194 | 194 | */ |
195 | 195 | }) |
196 | 196 | }) |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | <?php |
232 | 232 | } else { |
233 | 233 | ?> |
234 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
234 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
235 | 235 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
236 | 236 | <?php |
237 | 237 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | <?php |
288 | 288 | } else { |
289 | 289 | ?> |
290 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
290 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
291 | 291 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
292 | 292 | <?php |
293 | 293 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING); |
|
2 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); |
|
3 | 3 | if ($id == "") |
4 | 4 | { |
5 | 5 | header('Location: /'); |
@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | |
17 | 17 | if (!empty($spotter_array)) |
18 | 18 | { |
19 | - if(isset($spotter_array[0]['flightaware_id'])) { |
|
19 | + if (isset($spotter_array[0]['flightaware_id'])) { |
|
20 | 20 | $flightaware_id = $spotter_array[0]['flightaware_id']; |
21 | 21 | } |
22 | - if(isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') { |
|
22 | + if (isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') { |
|
23 | 23 | $latitude = $spotter_array[0]['last_latitude']; |
24 | - } elseif(isset($spotter_array[0]['latitude'])) { |
|
24 | + } elseif (isset($spotter_array[0]['latitude'])) { |
|
25 | 25 | $latitude = $spotter_array[0]['latitude']; |
26 | 26 | } |
27 | - if(isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') { |
|
27 | + if (isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') { |
|
28 | 28 | $longitude = $spotter_array[0]['last_longitude']; |
29 | - } elseif(isset($spotter_array[0]['longitude'])) { |
|
29 | + } elseif (isset($spotter_array[0]['longitude'])) { |
|
30 | 30 | $longitude = $spotter_array[0]['longitude']; |
31 | 31 | } |
32 | 32 | |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | $title = ''; |
42 | - if(isset($spotter_array[0]['ident'])) { |
|
42 | + if (isset($spotter_array[0]['ident'])) { |
|
43 | 43 | $title .= $spotter_array[0]['ident']; |
44 | 44 | } |
45 | - if(isset($spotter_array[0]['airline_name'])) { |
|
45 | + if (isset($spotter_array[0]['airline_name'])) { |
|
46 | 46 | $title .= ' - '.$spotter_array[0]['airline_name']; |
47 | 47 | } |
48 | - if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
48 | + if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
49 | 49 | $title .= ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')'; |
50 | 50 | } |
51 | - if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') { |
|
51 | + if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') { |
|
52 | 52 | $title .= ' - '.$spotter_array[0]['registration']; |
53 | 53 | } |
54 | 54 | //$facebook_meta_image = $spotter_array[0]['image']; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $altitude_data = ''; |
69 | 69 | $hour_data = ''; |
70 | 70 | $speed_data = ''; |
71 | - foreach($all_data as $data) |
|
71 | + foreach ($all_data as $data) |
|
72 | 72 | { |
73 | 73 | $hour_data .= '"'.$data['date'].'",'; |
74 | 74 | if (isset($data['real_altitude']) && $data['real_altitude'] != '') { |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | $speed_data .= $speed.','; |
97 | 97 | } |
98 | 98 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
99 | - $altitude_data = "['altitude',".substr($altitude_data,0,-1)."]"; |
|
100 | - $speed_data = "['speed',".substr($speed_data,0,-1)."]"; |
|
99 | + $altitude_data = "['altitude',".substr($altitude_data, 0, -1)."]"; |
|
100 | + $speed_data = "['speed',".substr($speed_data, 0, -1)."]"; |
|
101 | 101 | print 'c3.generate({ |
102 | 102 | bindto: "#chart", |
103 | 103 | data: { |
@@ -143,16 +143,16 @@ discard block |
||
143 | 143 | print '<a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a> '; |
144 | 144 | } |
145 | 145 | } |
146 | - if(isset($spotter_array[0]['ident'])) { |
|
146 | + if (isset($spotter_array[0]['ident'])) { |
|
147 | 147 | print $spotter_array[0]['ident']; |
148 | 148 | } |
149 | - if(isset($spotter_array[0]['airline_name'])) { |
|
149 | + if (isset($spotter_array[0]['airline_name'])) { |
|
150 | 150 | print ' - '.$spotter_array[0]['airline_name']; |
151 | 151 | } |
152 | - if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
152 | + if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
153 | 153 | print ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')'; |
154 | 154 | } |
155 | - if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') { |
|
155 | + if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') { |
|
156 | 156 | print ' - '.$spotter_array[0]['registration']; |
157 | 157 | } |
158 | 158 | print '</h1>'; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | print '</div>'; |
307 | 307 | */ |
308 | 308 | |
309 | - foreach($spotter_array as $spotter_item) |
|
309 | + foreach ($spotter_array as $spotter_item) |
|
310 | 310 | { |
311 | 311 | print '<div class="details">'; |
312 | 312 | print '<h3>'._("Flight Information").'</h3>'; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') { |
407 | 407 | if ($spotter_item['departure_airport_time'] > 2460) { |
408 | 408 | print '<div class="time">'; |
409 | - print 'at '.date('H:m',$spotter_item['departure_airport_time']); |
|
409 | + print 'at '.date('H:m', $spotter_item['departure_airport_time']); |
|
410 | 410 | print '</div>'; |
411 | 411 | } else { |
412 | 412 | print '<div class="time">'; |
@@ -556,19 +556,19 @@ discard block |
||
556 | 556 | if (count($departure_airport_info) > 0) { |
557 | 557 | if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') { |
558 | 558 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
559 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm'; |
|
559 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm'; |
|
560 | 560 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
561 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi'; |
|
561 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi'; |
|
562 | 562 | } else { |
563 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km'; |
|
563 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km'; |
|
564 | 564 | } |
565 | 565 | } else { |
566 | 566 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
567 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm'; |
|
567 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm'; |
|
568 | 568 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
569 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi'; |
|
569 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi'; |
|
570 | 570 | } else { |
571 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km'; |
|
571 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km'; |
|
572 | 572 | } |
573 | 573 | } |
574 | 574 | } |
@@ -584,19 +584,19 @@ discard block |
||
584 | 584 | if (count($arrival_airport_info) > 0) { |
585 | 585 | if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') { |
586 | 586 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
587 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm'; |
|
587 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm'; |
|
588 | 588 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
589 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi'; |
|
589 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi'; |
|
590 | 590 | } else { |
591 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km'; |
|
591 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km'; |
|
592 | 592 | } |
593 | 593 | } else { |
594 | 594 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
595 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm'; |
|
595 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm'; |
|
596 | 596 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
597 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi'; |
|
597 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi'; |
|
598 | 598 | } else { |
599 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km'; |
|
599 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km'; |
|
600 | 600 | } |
601 | 601 | } |
602 | 602 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | print '<div class="last-flights">'; |
617 | 617 | print '<h3>'._("Last 5 Flights of this Aircraft").' ('.$registration.')</h3>'; |
618 | 618 | $hide_th_links = true; |
619 | - $spotter_array = $Spotter->getSpotterDataByRegistration($registration,"0,5", ""); |
|
619 | + $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,5", ""); |
|
620 | 620 | include('table-output.php'); |
621 | 621 | print '<div class="more">'; |
622 | 622 | print '<a href="'.$globalURL.'/registration/'.$registration.'" class="btn btn-default btn" role="button">See all Flights»</a>'; |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | $globalDebug = FALSE; |
71 | 71 | $dbroot = $_SESSION['database_root']; |
72 | 72 | $dbrootpass = $_SESSION['database_rootpass']; |
73 | - $error .= create_db::create_database($dbroot,$dbrootpass,$globalDBuser,$globalDBpass,$globalDBname,$globalDBdriver,$globalDBhost); |
|
73 | + $error .= create_db::create_database($dbroot, $dbrootpass, $globalDBuser, $globalDBpass, $globalDBname, $globalDBdriver, $globalDBhost); |
|
74 | 74 | sleep(5); |
75 | 75 | if ($error != '') { |
76 | 76 | $_SESSION['error'] = $error; |
77 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database')); |
|
78 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
77 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create database')); |
|
78 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create database')); |
|
79 | 79 | $_SESSION['install'] = 'database_import'; |
80 | 80 | $_SESSION['next'] = 'Create and import tables'; |
81 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
81 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
82 | 82 | print json_encode($result); |
83 | 83 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') { |
84 | 84 | $globalDebug = FALSE; |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | } |
93 | 93 | if ($error != '') { |
94 | 94 | $_SESSION['error'] = $error; |
95 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
96 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
95 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
96 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create and import tables')); |
|
97 | 97 | if ((!isset($globalAircraft) || $globalAircraft === TRUE) && (!isset($globalVA) || $globalVA === FALSE)) { |
98 | 98 | $_SESSION['install'] = 'populate'; |
99 | 99 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
@@ -101,24 +101,24 @@ discard block |
||
101 | 101 | $_SESSION['install'] = 'sources'; |
102 | 102 | $_SESSION['next'] = 'Insert data in source table'; |
103 | 103 | } |
104 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
104 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
105 | 105 | print json_encode($result); |
106 | 106 | } elseif (!is_numeric($check_version)) { |
107 | 107 | $error .= $check_version; |
108 | 108 | $_SESSION['error'] = $error; |
109 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
109 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
110 | 110 | if (!isset($_SESSION['next'])) $_SESSION['next'] = ''; |
111 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
111 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
112 | 112 | print json_encode($result); |
113 | 113 | } else { |
114 | 114 | $error .= update_schema::check_version(true); |
115 | 115 | if ($error != '') { |
116 | 116 | $_SESSION['error'] = $error; |
117 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed')); |
|
118 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
117 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Update schema if needed')); |
|
118 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Update schema if needed')); |
|
119 | 119 | $_SESSION['install'] = 'sources'; |
120 | 120 | $_SESSION['next'] = 'Insert data in source table'; |
121 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
121 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
122 | 122 | print json_encode($result); |
123 | 123 | } |
124 | 124 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'waypoints') { |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | $error .= update_db::update_waypoints(); |
128 | 128 | if ($error != '') { |
129 | 129 | $_SESSION['error'] = $error; |
130 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database')); |
|
131 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
130 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate waypoints database')); |
|
131 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate waypoints database')); |
|
132 | 132 | /* |
133 | 133 | $_SESSION['install'] = 'airspace'; |
134 | 134 | $_SESSION['next'] = 'Populate airspace table'; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | $_SESSION['install'] = 'countries'; |
147 | 147 | $_SESSION['next'] = 'Populate countries table'; |
148 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
148 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
149 | 149 | print json_encode($result); |
150 | 150 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'countries') { |
151 | 151 | include_once('class.update_db.php'); |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | $error .= update_db::update_countries(); |
154 | 154 | if ($error != '') { |
155 | 155 | $_SESSION['error'] = $error; |
156 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
|
157 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
156 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate countries database')); |
|
157 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate countries database')); |
|
158 | 158 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
159 | 159 | $_SESSION['install'] = 'notam'; |
160 | 160 | $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
161 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
161 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
162 | 162 | print json_encode($result); |
163 | 163 | /* |
164 | 164 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | } else { |
172 | 172 | $_SESSION['install'] = 'sources'; |
173 | 173 | $_SESSION['next'] = 'Insert data in source table'; |
174 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
174 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
175 | 175 | print json_encode($result); |
176 | 176 | } |
177 | 177 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
178 | 178 | if (!is_writable('tmp')) { |
179 | 179 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
180 | 180 | $_SESSION['error'] = $error; |
181 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
182 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
181 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
182 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
183 | 183 | print json_encode($result); |
184 | 184 | } else { |
185 | 185 | include_once('class.update_db.php'); |
@@ -187,19 +187,19 @@ discard block |
||
187 | 187 | $error .= update_db::update_ModeS_fam(); |
188 | 188 | if ($error != '') { |
189 | 189 | $_SESSION['error'] = $error; |
190 | - $_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')); |
|
190 | + $_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')); |
|
192 | 192 | $_SESSION['install'] = 'populate_flarm'; |
193 | 193 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM'; |
194 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
194 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
195 | 195 | print json_encode($result); |
196 | 196 | } |
197 | 197 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') { |
198 | 198 | if (!is_writable('tmp')) { |
199 | 199 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
200 | 200 | $_SESSION['error'] = $error; |
201 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
202 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
201 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
202 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
203 | 203 | print json_encode($result); |
204 | 204 | } else { |
205 | 205 | include_once('class.update_db.php'); |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | $error .= update_db::update_ModeS_ogn(); |
209 | 209 | if ($error != '') { |
210 | 210 | $_SESSION['error'] = $error; |
211 | - $_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')); |
|
211 | + $_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')); |
|
213 | 213 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
214 | 214 | $_SESSION['install'] = 'vatsim'; |
215 | 215 | if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
@@ -228,15 +228,15 @@ discard block |
||
228 | 228 | $_SESSION['install'] = 'routes'; |
229 | 229 | $_SESSION['next'] = 'Populate routes table with externals data'; |
230 | 230 | } |
231 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
231 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
232 | 232 | print json_encode($result); |
233 | 233 | } |
234 | 234 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') { |
235 | 235 | if (!is_writable('tmp')) { |
236 | 236 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
237 | 237 | $_SESSION['error'] = $error; |
238 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
239 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
238 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
239 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
240 | 240 | print json_encode($result); |
241 | 241 | } else { |
242 | 242 | include_once('class.update_db.php'); |
@@ -244,19 +244,19 @@ discard block |
||
244 | 244 | $error .= update_db::update_routes_fam(); |
245 | 245 | if ($error != '') { |
246 | 246 | $_SESSION['error'] = $error; |
247 | - $_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')); |
|
247 | + $_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')); |
|
249 | 249 | $_SESSION['install'] = 'translation'; |
250 | 250 | $_SESSION['next'] = 'Populate translation table with externals data'; |
251 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
251 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
252 | 252 | print json_encode($result); |
253 | 253 | } |
254 | 254 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') { |
255 | 255 | if (!is_writable('tmp')) { |
256 | 256 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
257 | 257 | $_SESSION['error'] = $error; |
258 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
|
259 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
258 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data')); |
|
259 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
260 | 260 | print json_encode($result); |
261 | 261 | } else { |
262 | 262 | include_once('class.update_db.php'); |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | $error .= update_db::update_translation_fam(); |
265 | 265 | if ($error != '') { |
266 | 266 | $_SESSION['error'] = $error; |
267 | - $_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')); |
|
267 | + $_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')); |
|
269 | 269 | if ($_SESSION['waypoints'] == 1) { |
270 | 270 | $_SESSION['install'] = 'waypoints'; |
271 | 271 | $_SESSION['next'] = 'Populate waypoints table'; |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | $_SESSION['install'] = 'sources'; |
284 | 284 | $_SESSION['next'] = 'Insert data in source table'; |
285 | 285 | } |
286 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
286 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
287 | 287 | print json_encode($result); |
288 | 288 | } |
289 | 289 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') { |
290 | 290 | if (!is_writable('tmp')) { |
291 | 291 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
292 | 292 | $_SESSION['error'] = $error; |
293 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
|
294 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
293 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data')); |
|
294 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
295 | 295 | print json_encode($result); |
296 | 296 | } else { |
297 | 297 | include_once('class.update_db.php'); |
@@ -299,19 +299,19 @@ discard block |
||
299 | 299 | $error = update_db::update_owner_fam(); |
300 | 300 | if ($error != '') { |
301 | 301 | $_SESSION['error'] = $error; |
302 | - $_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')); |
|
302 | + $_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')); |
|
304 | 304 | $_SESSION['install'] = 'sources'; |
305 | 305 | $_SESSION['next'] = 'Insert data in source table'; |
306 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
306 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
307 | 307 | print json_encode($result); |
308 | 308 | } |
309 | 309 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') { |
310 | 310 | if (!is_writable('tmp')) { |
311 | 311 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
312 | 312 | $_SESSION['error'] = $error; |
313 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
|
314 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
313 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data')); |
|
314 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
315 | 315 | print json_encode($result); |
316 | 316 | } else { |
317 | 317 | include_once('class.update_db.php'); |
@@ -320,13 +320,13 @@ discard block |
||
320 | 320 | $error .= update_db::update_notam(); |
321 | 321 | if ($error != '') { |
322 | 322 | $_SESSION['error'] = $error; |
323 | - $_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')); |
|
323 | + $_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')); |
|
325 | 325 | } else { |
326 | 326 | if ($error != '') { |
327 | 327 | $_SESSION['error'] = $error; |
328 | - $_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)')); |
|
328 | + $_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)')); |
|
330 | 330 | } |
331 | 331 | /* |
332 | 332 | if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | $_SESSION['install'] = 'sources'; |
341 | 341 | $_SESSION['next'] = 'Insert data in source table'; |
342 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
342 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
343 | 343 | print json_encode($result); |
344 | 344 | //} |
345 | 345 | } |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | $Source = new Source(); |
377 | 377 | $Source->deleteAllLocation(); |
378 | 378 | 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'); |
|
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'); |
|
380 | 380 | } |
381 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
381 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert data in source table')); |
|
382 | 382 | unset($_SESSION['sources']); |
383 | 383 | } |
384 | 384 | /* |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $_SESSION['install'] = 'finish'; |
404 | 404 | $_SESSION['next'] = 'finish'; |
405 | 405 | } |
406 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
406 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
407 | 407 | print json_encode($result); |
408 | 408 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'vatsim') { |
409 | 409 | include_once('../install/class.create_db.php'); |
@@ -415,48 +415,48 @@ discard block |
||
415 | 415 | $error .= update_db::update_IVAO(); |
416 | 416 | if ($error != '') { |
417 | 417 | $_SESSION['error'] = $error; |
418 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
419 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
418 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
419 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
420 | 420 | } else { |
421 | 421 | $error .= update_db::update_vatsim(); |
422 | 422 | if ($error != '') { |
423 | 423 | $_SESSION['error'] = $error; |
424 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
425 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
424 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
425 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
426 | 426 | } |
427 | 427 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
428 | 428 | $error .= update_db::update_vatsim(); |
429 | 429 | if ($error != '') { |
430 | 430 | $_SESSION['error'] = $error; |
431 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
432 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
431 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
432 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
433 | 433 | } elseif (isset($globalIVAO) && $globalIVAO) { |
434 | 434 | if (file_exists('tmp/ivae_feb2013.zip')) { |
435 | 435 | $error .= update_db::update_IVAO(); |
436 | 436 | if ($error != '') { |
437 | 437 | $_SESSION['error'] = $error; |
438 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
439 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
438 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
439 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
440 | 440 | } else { |
441 | 441 | $error .= update_db::update_vatsim(); |
442 | 442 | if ($error != '') { |
443 | 443 | $_SESSION['error'] = $error; |
444 | - $_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)')); |
|
444 | + $_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)')); |
|
446 | 446 | } |
447 | 447 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
448 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data')); |
|
448 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert phpVMS data')); |
|
449 | 449 | } |
450 | 450 | //$_SESSION['install'] = 'routes'; |
451 | 451 | //$_SESSION['next'] = 'Populate routes table with externals data'; |
452 | 452 | $_SESSION['install'] = 'finish'; |
453 | 453 | $_SESSION['next'] = 'finish'; |
454 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
454 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
455 | 455 | print json_encode($result); |
456 | 456 | } else { |
457 | 457 | //unset($_SESSION['install']); |
458 | 458 | $_SESSION['error'] = 'Unknwon task : '.$_SESSION['install']; |
459 | - $result = array('error' => 'Unknwon task : '.$_SESSION['install'],'done' => $_SESSION['done'],'next' => 'finish','install' => 'finish'); |
|
459 | + $result = array('error' => 'Unknwon task : '.$_SESSION['install'], 'done' => $_SESSION['done'], 'next' => 'finish', 'install' => 'finish'); |
|
460 | 460 | print json_encode($result); |
461 | 461 | } |
462 | 462 | ?> |
463 | 463 | \ No newline at end of file |
@@ -117,31 +117,31 @@ discard block |
||
117 | 117 | |
118 | 118 | private function make_latf($temp) { // unsigned long |
119 | 119 | $flat = 0.0; // float |
120 | - $temp = $temp & 0x07FFFFFF; |
|
121 | - if ($temp & 0x04000000) { |
|
122 | - $temp = $temp ^ 0x07FFFFFF; |
|
120 | + $temp = $temp&0x07FFFFFF; |
|
121 | + if ($temp&0x04000000) { |
|
122 | + $temp = $temp^0x07FFFFFF; |
|
123 | 123 | $temp += 1; |
124 | - $flat = (float)($temp / (60.0 * 10000.0)); |
|
124 | + $flat = (float) ($temp/(60.0*10000.0)); |
|
125 | 125 | $flat *= -1.0; |
126 | - } else $flat = (float)($temp / (60.0 * 10000.0)); |
|
126 | + } else $flat = (float) ($temp/(60.0*10000.0)); |
|
127 | 127 | return $flat; // float |
128 | 128 | } |
129 | 129 | |
130 | 130 | private function make_lonf($temp) { // unsigned long |
131 | 131 | $flon = 0.0; // float |
132 | - $temp = $temp & 0x0FFFFFFF; |
|
133 | - if ($temp & 0x08000000) { |
|
134 | - $temp = $temp ^ 0x0FFFFFFF; |
|
132 | + $temp = $temp&0x0FFFFFFF; |
|
133 | + if ($temp&0x08000000) { |
|
134 | + $temp = $temp^0x0FFFFFFF; |
|
135 | 135 | $temp += 1; |
136 | - $flon = (float)($temp / (60.0 * 10000.0)); |
|
136 | + $flon = (float) ($temp/(60.0*10000.0)); |
|
137 | 137 | $flon *= -1.0; |
138 | - } else $flon = (float)($temp / (60.0 * 10000.0)); |
|
138 | + } else $flon = (float) ($temp/(60.0*10000.0)); |
|
139 | 139 | return $flon; |
140 | 140 | } |
141 | 141 | |
142 | 142 | private function ascii_2_dec($chr) { |
143 | - $dec=ord($chr);//get decimal ascii code |
|
144 | - $hex=dechex($dec);//convert decimal to hex |
|
143 | + $dec = ord($chr); //get decimal ascii code |
|
144 | + $hex = dechex($dec); //convert decimal to hex |
|
145 | 145 | return ($dec); |
146 | 146 | } |
147 | 147 | |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | //only process in the following range: 48-87, 96-119 |
161 | 161 | if ($ascii < 48) { } |
162 | 162 | else { |
163 | - if($ascii>119) { } |
|
163 | + if ($ascii > 119) { } |
|
164 | 164 | else { |
165 | - if ($ascii>87 && $ascii<96) ; |
|
165 | + if ($ascii > 87 && $ascii < 96); |
|
166 | 166 | else { |
167 | - $ascii=$ascii+40; |
|
168 | - if ($ascii>128){ |
|
169 | - $ascii=$ascii+32; |
|
167 | + $ascii = $ascii + 40; |
|
168 | + if ($ascii > 128) { |
|
169 | + $ascii = $ascii + 32; |
|
170 | 170 | } else { |
171 | - $ascii=$ascii+40; |
|
171 | + $ascii = $ascii + 40; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | private function dec_2_6bit($dec) { |
180 | - $bin=decbin($dec); |
|
180 | + $bin = decbin($dec); |
|
181 | 181 | return(substr($bin, -6)); |
182 | 182 | } |
183 | 183 | |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | ); |
196 | 196 | // " |
197 | 197 | $rv = ''; |
198 | - if ($_size % 6 == 0) { |
|
199 | - $len = $_size / 6; |
|
200 | - for ($i=0; $i<$len; $i++) { |
|
201 | - $offset = $i * 6; |
|
202 | - $rv .= $ais_chars[ bindec(substr($_str,$_start + $offset,6)) ]; |
|
198 | + if ($_size%6 == 0) { |
|
199 | + $len = $_size/6; |
|
200 | + for ($i = 0; $i < $len; $i++) { |
|
201 | + $offset = $i*6; |
|
202 | + $rv .= $ais_chars[bindec(substr($_str, $_start + $offset, 6))]; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | return $rv; |
@@ -226,93 +226,93 @@ discard block |
||
226 | 226 | $ro->eta_hour = ''; |
227 | 227 | $ro->eta_minute = ''; |
228 | 228 | $ro->ts = time(); |
229 | - $ro->id = bindec(substr($_aisdata,0,6)); |
|
230 | - $ro->mmsi = bindec(substr($_aisdata,8,30)); |
|
229 | + $ro->id = bindec(substr($_aisdata, 0, 6)); |
|
230 | + $ro->mmsi = bindec(substr($_aisdata, 8, 30)); |
|
231 | 231 | if ($ro->id >= 1 && $ro->id <= 3) { |
232 | - $ro->cog = bindec(substr($_aisdata,116,12))/10; |
|
233 | - $ro->sog = bindec(substr($_aisdata,50,10))/10; |
|
234 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28))); |
|
235 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27))); |
|
232 | + $ro->cog = bindec(substr($_aisdata, 116, 12))/10; |
|
233 | + $ro->sog = bindec(substr($_aisdata, 50, 10))/10; |
|
234 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28))); |
|
235 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27))); |
|
236 | 236 | $ro->cls = 1; // class A |
237 | 237 | } else if ($ro->id == 4) { |
238 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,79,28))); |
|
239 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,107,27))); |
|
238 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 79, 28))); |
|
239 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 107, 27))); |
|
240 | 240 | $ro->cls = 1; // class A |
241 | 241 | } else if ($ro->id == 5) { |
242 | - $ro->imo = bindec(substr($_aisdata,40,30)); |
|
243 | - $ro->callsign = $this->binchar($_aisdata,70,42); |
|
244 | - $ro->name = $this->binchar($_aisdata,112,120); |
|
245 | - $ro->typeid = bindec(substr($_aisdata,232,8)); |
|
242 | + $ro->imo = bindec(substr($_aisdata, 40, 30)); |
|
243 | + $ro->callsign = $this->binchar($_aisdata, 70, 42); |
|
244 | + $ro->name = $this->binchar($_aisdata, 112, 120); |
|
245 | + $ro->typeid = bindec(substr($_aisdata, 232, 8)); |
|
246 | 246 | $ro->type = $this->getShipType($ro->typeid); |
247 | 247 | //$ro->to_bow = bindec(substr($_aisdata,240,9)); |
248 | 248 | //$ro->to_stern = bindec(substr($_aisdata,249,9)); |
249 | 249 | //$ro->to_port = bindec(substr($_aisdata,258,6)); |
250 | 250 | //$ro->to_starboard = bindec(substr($_aisdata,264,6)); |
251 | - $ro->eta_month = bindec(substr($_aisdata,274,4)); |
|
252 | - $ro->eta_day = bindec(substr($_aisdata,278,5)); |
|
253 | - $ro->eta_hour = bindec(substr($_aisdata,283,5)); |
|
254 | - $ro->eta_minute = bindec(substr($_aisdata,288,6)); |
|
251 | + $ro->eta_month = bindec(substr($_aisdata, 274, 4)); |
|
252 | + $ro->eta_day = bindec(substr($_aisdata, 278, 5)); |
|
253 | + $ro->eta_hour = bindec(substr($_aisdata, 283, 5)); |
|
254 | + $ro->eta_minute = bindec(substr($_aisdata, 288, 6)); |
|
255 | 255 | //$ro->draught = bindec(substr($_aisdata,294,8)); |
256 | - $ro->destination = $this->binchar($_aisdata,302,120); |
|
256 | + $ro->destination = $this->binchar($_aisdata, 302, 120); |
|
257 | 257 | $ro->cls = 1; // class A |
258 | 258 | } else if ($ro->id == 9) { |
259 | 259 | // Search and Rescue aircraft position report |
260 | 260 | } else if ($ro->id == 18) { |
261 | - $ro->cog = bindec(substr($_aisdata,112,12))/10; |
|
262 | - $ro->sog = bindec(substr($_aisdata,46,10))/10; |
|
263 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28))); |
|
264 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27))); |
|
265 | - $ro->heading = bindec(substr($_aisdata,124,9)); |
|
261 | + $ro->cog = bindec(substr($_aisdata, 112, 12))/10; |
|
262 | + $ro->sog = bindec(substr($_aisdata, 46, 10))/10; |
|
263 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 57, 28))); |
|
264 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 85, 27))); |
|
265 | + $ro->heading = bindec(substr($_aisdata, 124, 9)); |
|
266 | 266 | if ($ro->heading == 511) $ro->heading = ''; |
267 | 267 | $ro->cls = 2; // class B |
268 | 268 | } else if ($ro->id == 19) { |
269 | - $ro->cog = bindec(substr($_aisdata,112,12))/10; |
|
270 | - $ro->sog = bindec(substr($_aisdata,46,10))/10; |
|
271 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28))); |
|
272 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27))); |
|
273 | - $ro->name = $this->binchar($_aisdata,143,120); |
|
269 | + $ro->cog = bindec(substr($_aisdata, 112, 12))/10; |
|
270 | + $ro->sog = bindec(substr($_aisdata, 46, 10))/10; |
|
271 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28))); |
|
272 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27))); |
|
273 | + $ro->name = $this->binchar($_aisdata, 143, 120); |
|
274 | 274 | $ro->cls = 2; // class B |
275 | - $ro->heading = bindec(substr($_aisdata,124,9)); |
|
275 | + $ro->heading = bindec(substr($_aisdata, 124, 9)); |
|
276 | 276 | if ($ro->heading == 511) $ro->heading = ''; |
277 | - $ro->typeid = bindec(substr($_aisdata,263,8)); |
|
277 | + $ro->typeid = bindec(substr($_aisdata, 263, 8)); |
|
278 | 278 | $ro->type = $this->getShipType($ro->typeid); |
279 | 279 | //$ro->to_bow = bindec(substr($_aisdata,271,9)); |
280 | 280 | //$ro->to_stern = bindec(substr($_aisdata,280,9)); |
281 | 281 | //$ro->to_port = bindec(substr($_aisdata,289,6)); |
282 | 282 | //$ro->to_starboard = bindec(substr($_aisdata,295,6)); |
283 | 283 | } else if ($ro->id == 21) { |
284 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,164,28))); |
|
285 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,192,27))); |
|
286 | - $ro->name = $this->binchar($_aisdata,43,120); |
|
284 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 164, 28))); |
|
285 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 192, 27))); |
|
286 | + $ro->name = $this->binchar($_aisdata, 43, 120); |
|
287 | 287 | //$ro->to_bow = bindec(substr($_aisdata,219,9)); |
288 | 288 | //$ro->to_stern = bindec(substr($_aisdata,228,9)); |
289 | 289 | //$ro->to_port = bindec(substr($_aisdata,237,6)); |
290 | 290 | //$ro->to_starboard = bindec(substr($_aisdata,243,6)); |
291 | 291 | $ro->cls = 2; // class B |
292 | 292 | } else if ($ro->id == 24) { |
293 | - $pn = bindec(substr($_aisdata,38,2)); |
|
293 | + $pn = bindec(substr($_aisdata, 38, 2)); |
|
294 | 294 | if ($pn == 0) { |
295 | - $ro->name = $this->binchar($_aisdata,40,120); |
|
295 | + $ro->name = $this->binchar($_aisdata, 40, 120); |
|
296 | 296 | } |
297 | - $ro->typeid = bindec(substr($_aisdata,40,8)); |
|
297 | + $ro->typeid = bindec(substr($_aisdata, 40, 8)); |
|
298 | 298 | $ro->type = $this->getShipType($ro->typeid); |
299 | - $ro->callsign = $this->binchar($_aisdata,90,42); |
|
299 | + $ro->callsign = $this->binchar($_aisdata, 90, 42); |
|
300 | 300 | //$ro->to_bow = bindec(substr($_aisdata,132,9)); |
301 | 301 | //$ro->to_stern = bindec(substr($_aisdata,141,9)); |
302 | 302 | //$ro->to_port = bindec(substr($_aisdata,150,6)); |
303 | 303 | //$ro->to_starboard = bindec(substr($_aisdata,156,6)); |
304 | 304 | $ro->cls = 2; // class B |
305 | 305 | } else if ($ro->id == 27) { |
306 | - $ro->cog = bindec(substr($_aisdata,85,9)); |
|
306 | + $ro->cog = bindec(substr($_aisdata, 85, 9)); |
|
307 | 307 | if ($ro->cog == 511) $ro->cog = 0.0; |
308 | - $ro->sog = bindec(substr($_aisdata,79,6)); |
|
308 | + $ro->sog = bindec(substr($_aisdata, 79, 6)); |
|
309 | 309 | if ($ro->sog == 63) $ro->sog = 0.0; |
310 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10); |
|
311 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10); |
|
310 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 44, 18))*10); |
|
311 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 62, 17))*10); |
|
312 | 312 | $ro->cls = 1; // class A |
313 | 313 | |
314 | 314 | } |
315 | - $ro->statusid = bindec(substr($_aisdata,38,4)); |
|
315 | + $ro->statusid = bindec(substr($_aisdata, 38, 4)); |
|
316 | 316 | $ro->status = $this->getStatus($ro->statusid); |
317 | 317 | return $ro; |
318 | 318 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | } |
360 | 360 | |
361 | 361 | public function getShipTypeID($type) { |
362 | - $typeid = array_search($type,$this->shiptype); |
|
362 | + $typeid = array_search($type, $this->shiptype); |
|
363 | 363 | if ($typeid !== FALSE) return $typeid; |
364 | 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 | 365 | elseif ($type == 'Passengers Ship' || $type == 'Passenger' || $type == 'Ro-Ro/Passenger Ship' || $type == 'Motor Passenger') return 60; |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) { |
382 | 382 | global $port; // tcpip port... |
383 | 383 | static $debug_counter = 0; |
384 | - $aisdata168='';//six bit array of ascii characters |
|
384 | + $aisdata168 = ''; //six bit array of ascii characters |
|
385 | 385 | $ais_nmea_array = str_split($_itu); // convert to an array |
386 | 386 | foreach ($ais_nmea_array as $value) { |
387 | 387 | $dec = $this->ascii_2_dec($value); |
388 | 388 | $bit8 = $this->asciidec_2_8bit($dec); |
389 | 389 | $bit6 = $this->dec_2_6bit($bit8); |
390 | 390 | //echo $value ."-" .$bit6 .""; |
391 | - $aisdata168 .=$bit6; |
|
391 | + $aisdata168 .= $bit6; |
|
392 | 392 | } |
393 | 393 | //echo $aisdata168 . "<br/>"; |
394 | 394 | //return $this->decode_ais($aisdata168, $aux); |
@@ -411,24 +411,24 @@ discard block |
||
411 | 411 | // calculate checksum after ! till * |
412 | 412 | // assume 1st ! is valid |
413 | 413 | // find * ensure that it is at correct position |
414 | - $end = strrpos ( $rawdata , '*' ); |
|
414 | + $end = strrpos($rawdata, '*'); |
|
415 | 415 | if ($end === FALSE) return -1; // check for NULLS!!! |
416 | - $cs = substr( $rawdata, $end + 1 ); |
|
417 | - if ( strlen($cs) != 2 ) return -1; // correct cs length |
|
418 | - $dcs = (int)hexdec( $cs ); |
|
419 | - for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum |
|
420 | - if ( $chksum == $dcs ) { // NMEA checksum pass |
|
416 | + $cs = substr($rawdata, $end + 1); |
|
417 | + if (strlen($cs) != 2) return -1; // correct cs length |
|
418 | + $dcs = (int) hexdec($cs); |
|
419 | + for ($alias = 1; $alias < $end; $alias++) $chksum ^= ord($rawdata[$alias]); // perform XOR for NMEA checksum |
|
420 | + if ($chksum == $dcs) { // NMEA checksum pass |
|
421 | 421 | $pcs = explode(',', $rawdata); |
422 | 422 | // !AI??? identifier |
423 | 423 | if (!isset($pcs[1])) { |
424 | 424 | echo "ERROR,INVALID_DATA ".time()." $rawdata\n"; |
425 | 425 | return -1; |
426 | 426 | } |
427 | - $num_seq = (int)$pcs[1]; // number of sequences |
|
428 | - $seq = (int)$pcs[2]; // get sequence |
|
427 | + $num_seq = (int) $pcs[1]; // number of sequences |
|
428 | + $seq = (int) $pcs[2]; // get sequence |
|
429 | 429 | // get msg sequence id |
430 | 430 | if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1 |
431 | - else $msg_sid = (int)$pcs[3]; // multipart message |
|
431 | + else $msg_sid = (int) $pcs[3]; // multipart message |
|
432 | 432 | $ais_ch = $pcs[4]; // get AIS channel |
433 | 433 | // message sequence checking |
434 | 434 | if ($num_seq < 1 || $num_seq > 9) { |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | } |
462 | 462 | } |
463 | 463 | $itu = $itu.$pcs[5]; // get itu message |
464 | - $filler += (int)$pcs[6][0]; // get filler |
|
464 | + $filler += (int) $pcs[6][0]; // get filler |
|
465 | 465 | if ($num_seq == 1 // valid single message |
466 | 466 | || $num_seq == $pseq // valid multi-part message |
467 | 467 | ) { |
@@ -483,13 +483,13 @@ discard block |
||
483 | 483 | $cbuf = $cbuf.$ibuf; |
484 | 484 | $last_pos = 0; |
485 | 485 | $result = new stdClass(); |
486 | - while ( ($start = strpos($cbuf,"VDM",$last_pos)) !== FALSE) { |
|
486 | + while (($start = strpos($cbuf, "VDM", $last_pos)) !== FALSE) { |
|
487 | 487 | //while ( ($start = strpos($cbuf,"!AI",$last_pos)) !== FALSE) { |
488 | 488 | //DEBUG echo $cbuf; |
489 | - if ( ($end = strpos($cbuf,"\r\n", $start)) !== FALSE) { //TBD need to trim? |
|
489 | + if (($end = strpos($cbuf, "\r\n", $start)) !== FALSE) { //TBD need to trim? |
|
490 | 490 | $tst = substr($cbuf, $start - 3, ($end - $start + 3)); |
491 | 491 | //DEBUG echo "[$start $end $tst]\n"; |
492 | - $result = $this->process_ais_raw( $tst, "" ); |
|
492 | + $result = $this->process_ais_raw($tst, ""); |
|
493 | 493 | $last_pos = $end + 1; |
494 | 494 | } else break; |
495 | 495 | } |
@@ -501,41 +501,41 @@ discard block |
||
501 | 501 | // incoming data from serial or IP comms |
502 | 502 | public function process_ais_line($cbuf) { |
503 | 503 | $result = new stdClass(); |
504 | - $start = strpos($cbuf,"VDM"); |
|
504 | + $start = strpos($cbuf, "VDM"); |
|
505 | 505 | $tst = substr($cbuf, $start - 3); |
506 | - $result = $this->process_ais_raw( $tst, "" ); |
|
506 | + $result = $this->process_ais_raw($tst, ""); |
|
507 | 507 | return $result; |
508 | 508 | } |
509 | 509 | |
510 | 510 | /* AIS Encoding |
511 | 511 | */ |
512 | - private function mk_ais_lat( $lat ) { |
|
512 | + private function mk_ais_lat($lat) { |
|
513 | 513 | //$lat = 1.2569; |
514 | - if ($lat<0.0) { |
|
514 | + if ($lat < 0.0) { |
|
515 | 515 | $lat = -$lat; |
516 | - $neg=true; |
|
517 | - } else $neg=false; |
|
516 | + $neg = true; |
|
517 | + } else $neg = false; |
|
518 | 518 | $latd = 0x00000000; |
519 | - $latd = intval ($lat * 600000.0); |
|
520 | - if ($neg==true) { |
|
519 | + $latd = intval($lat*600000.0); |
|
520 | + if ($neg == true) { |
|
521 | 521 | $latd = ~$latd; |
522 | - $latd+=1; |
|
522 | + $latd += 1; |
|
523 | 523 | $latd &= 0x07FFFFFF; |
524 | 524 | } |
525 | 525 | return $latd; |
526 | 526 | } |
527 | 527 | |
528 | - private function mk_ais_lon( $lon ) { |
|
528 | + private function mk_ais_lon($lon) { |
|
529 | 529 | //$lon = 103.851; |
530 | - if ($lon<0.0) { |
|
530 | + if ($lon < 0.0) { |
|
531 | 531 | $lon = -$lon; |
532 | - $neg=true; |
|
533 | - } else $neg=false; |
|
532 | + $neg = true; |
|
533 | + } else $neg = false; |
|
534 | 534 | $lond = 0x00000000; |
535 | - $lond = intval ($lon * 600000.0); |
|
536 | - if ($neg==true) { |
|
535 | + $lond = intval($lon*600000.0); |
|
536 | + if ($neg == true) { |
|
537 | 537 | $lond = ~$lond; |
538 | - $lond+=1; |
|
538 | + $lond += 1; |
|
539 | 539 | $lond &= 0x0FFFFFFF; |
540 | 540 | } |
541 | 541 | return $lond; |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | |
544 | 544 | private function char2bin($name, $max_len) { |
545 | 545 | $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); |
|
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 | 548 | else $pad = ''; |
549 | 549 | $rv = ''; |
550 | 550 | $ais_chars = array( |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | foreach ($_a as $_1) { |
563 | 563 | if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1]; |
564 | 564 | else $dec = 0; |
565 | - $bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT); |
|
565 | + $bin = str_pad(decbin($dec), 6, '0', STR_PAD_LEFT); |
|
566 | 566 | $rv .= $bin; |
567 | 567 | //echo "$_1 $dec ($bin)<br/>"; |
568 | 568 | } |
@@ -570,19 +570,19 @@ discard block |
||
570 | 570 | return $rv.$pad; |
571 | 571 | } |
572 | 572 | |
573 | - private function mk_ais($_enc, $_part=1,$_total=1,$_seq='',$_ch='A') { |
|
573 | + private function mk_ais($_enc, $_part = 1, $_total = 1, $_seq = '', $_ch = 'A') { |
|
574 | 574 | $len_bit = strlen($_enc); |
575 | - $rem6 = $len_bit % 6; |
|
575 | + $rem6 = $len_bit%6; |
|
576 | 576 | $pad6_len = 0; |
577 | 577 | if ($rem6) $pad6_len = 6 - $rem6; |
578 | 578 | //echo $pad6_len.'<br>'; |
579 | 579 | $_enc .= str_repeat("0", $pad6_len); // pad the text... |
580 | - $len_enc = strlen($_enc) / 6; |
|
580 | + $len_enc = strlen($_enc)/6; |
|
581 | 581 | //echo $_enc.' '.$len_enc.'<br/>'; |
582 | 582 | $itu = ''; |
583 | - for ($i=0; $i<$len_enc; $i++) { |
|
584 | - $offset = $i * 6; |
|
585 | - $dec = bindec(substr($_enc,$offset,6)); |
|
583 | + for ($i = 0; $i < $len_enc; $i++) { |
|
584 | + $offset = $i*6; |
|
585 | + $dec = bindec(substr($_enc, $offset, 6)); |
|
586 | 586 | if ($dec < 40) $dec += 48; |
587 | 587 | else $dec += 56; |
588 | 588 | //echo chr($dec)." $dec<br/>"; |
@@ -592,15 +592,15 @@ discard block |
||
592 | 592 | $chksum = 0; |
593 | 593 | $itu = "AIVDM,$_part,$_total,$_seq,$_ch,".$itu.",0"; |
594 | 594 | $len_itu = strlen($itu); |
595 | - for ($i=0; $i<$len_itu; $i++) { |
|
596 | - $chksum ^= ord( $itu[$i] ); |
|
595 | + for ($i = 0; $i < $len_itu; $i++) { |
|
596 | + $chksum ^= ord($itu[$i]); |
|
597 | 597 | } |
598 | - $hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); |
|
599 | - $lsb = $chksum & 0x0F; |
|
600 | - if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb]; |
|
598 | + $hex_arr = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); |
|
599 | + $lsb = $chksum&0x0F; |
|
600 | + if ($lsb >= 0 && $lsb <= 15) $lsbc = $hex_arr[$lsb]; |
|
601 | 601 | else $lsbc = '0'; |
602 | - $msb = (($chksum & 0xF0) >> 4) & 0x0F; |
|
603 | - if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb]; |
|
602 | + $msb = (($chksum&0xF0) >> 4)&0x0F; |
|
603 | + if ($msb >= 0 && $msb <= 15) $msbc = $hex_arr[$msb]; |
|
604 | 604 | else $msbc = '0'; |
605 | 605 | $itu = '!'.$itu."*{$msbc}{$lsbc}\r\n"; |
606 | 606 | return $itu; |
@@ -626,14 +626,14 @@ discard block |
||
626 | 626 | |
627 | 627 | public function mmsitype($mmsi) { |
628 | 628 | 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'; |
|
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 | 637 | else return 'Ship'; |
638 | 638 | } |
639 | 639 | |
@@ -643,19 +643,19 @@ discard block |
||
643 | 643 | public function parse_line($buffer) { |
644 | 644 | global $globalDebug; |
645 | 645 | $result = array(); |
646 | - $start = strpos($buffer,"VDM"); |
|
646 | + $start = strpos($buffer, "VDM"); |
|
647 | 647 | $tst = substr($buffer, $start - 3); |
648 | - $data = $this->process_ais_raw( $tst, "" ); |
|
648 | + $data = $this->process_ais_raw($tst, ""); |
|
649 | 649 | if (!is_object($data)) { |
650 | 650 | //if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n"; |
651 | 651 | return array(); |
652 | 652 | } |
653 | 653 | if ($data->lon != 0) $result['longitude'] = $data->lon; |
654 | 654 | if ($data->lat != 0) $result['latitude'] = $data->lat; |
655 | - $result['ident'] = trim(str_replace('@','',$data->name)); |
|
655 | + $result['ident'] = trim(str_replace('@', '', $data->name)); |
|
656 | 656 | $result['timestamp'] = $data->ts; |
657 | 657 | $result['mmsi'] = $data->mmsi; |
658 | - if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi']; |
|
658 | + if (strlen($result['mmsi']) == 8 && substr($result['mmsi'], 0, 3) == '669') $result['mmsi'] = '3'.$result['mmsi']; |
|
659 | 659 | $result['mmsi_type'] = $this->mmsitype($result['mmsi']); |
660 | 660 | if ($data->sog != -1.0) $result['speed'] = $data->sog; |
661 | 661 | if ($data->heading !== '') $result['heading'] = $data->heading; |
@@ -665,16 +665,16 @@ discard block |
||
665 | 665 | if ($data->type !== '') $result['type'] = $data->type; |
666 | 666 | if ($data->typeid !== '') $result['typeid'] = $data->typeid; |
667 | 667 | if ($data->imo !== '') $result['imo'] = $data->imo; |
668 | - if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign)); |
|
668 | + if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@', '', $data->callsign)); |
|
669 | 669 | 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 | - $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'); |
|
670 | + $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 | 671 | if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
672 | 672 | } elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) { |
673 | - $eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00'); |
|
673 | + $eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00'); |
|
674 | 674 | if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
675 | 675 | } |
676 | 676 | if ($data->destination != '') { |
677 | - $dest = trim(str_replace('@','',$data->destination)); |
|
677 | + $dest = trim(str_replace('@', '', $data->destination)); |
|
678 | 678 | if ($dest != '') $result['destination'] = $dest; |
679 | 679 | } |
680 | 680 | $result['all'] = (array) $data; |