@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | } |
371 | 371 | |
372 | - var tsk_geojson = Cesium.loadJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); ?>"); |
|
372 | + var tsk_geojson = Cesium.loadJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); ?>"); |
|
373 | 373 | tsk_geojson.then(function(geojsondata) { |
374 | 374 | tsk = new Cesium.CustomDataSource('tsk'); |
375 | 375 | for (var i =0;i < geojsondata.features.length; i++) { |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | <?php |
457 | 457 | if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) { |
458 | 458 | if (isset($_COOKIE['lastcentercoord'])) { |
459 | - $lastcentercoord = explode(',',$_COOKIE['lastcentercoord']); |
|
459 | + $lastcentercoord = explode(',', $_COOKIE['lastcentercoord']); |
|
460 | 460 | if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0; |
461 | 461 | else $zoom = $lastcentercoord[3]; |
462 | 462 | $viewcenterlatitude = $lastcentercoord[0]; |
@@ -331,15 +331,15 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | <?php |
334 | - if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
334 | + if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
335 | 335 | ?> |
336 | 336 | var loc_geojson = Cesium.loadJson("<?php print $globalURL; ?>/location-geojson.php?coord="+bbox()); |
337 | 337 | <?php |
338 | - } else { |
|
338 | + } else { |
|
339 | 339 | ?> |
340 | 340 | var loc_geojson = Cesium.loadJson("<?php print $globalURL; ?>/location-geojson.php"); |
341 | 341 | <?php |
342 | - } |
|
342 | + } |
|
343 | 343 | ?> |
344 | 344 | loc_geojson.then(function(geojsondata) { |
345 | 345 | loc = new Cesium.CustomDataSource('location'); |
@@ -512,15 +512,15 @@ discard block |
||
512 | 512 | // if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
513 | 513 | ?> |
514 | 514 | <?php |
515 | - if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
|
515 | + if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
|
516 | 516 | ?> |
517 | 517 | var MapTerrain = 'ellipsoid'; |
518 | 518 | <?php |
519 | - } else { |
|
519 | + } else { |
|
520 | 520 | ?> |
521 | 521 | var MapTerrain = getCookie('MapTerrain'); |
522 | 522 | <?php |
523 | - } |
|
523 | + } |
|
524 | 524 | ?> |
525 | 525 | |
526 | 526 | |
@@ -574,11 +574,11 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | <?php |
577 | - if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
577 | + if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
578 | 578 | ?> |
579 | 579 | update_tsk(); |
580 | 580 | <?php |
581 | - } |
|
581 | + } |
|
582 | 582 | ?> |
583 | 583 | |
584 | 584 | update_locationsLayer(); |
@@ -5,21 +5,30 @@ discard block |
||
5 | 5 | |
6 | 6 | document.cookie = 'MapFormat=3d; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
7 | 7 | <?php |
8 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
9 | - else $MapType = $globalMapProvider; |
|
8 | + if (isset($_COOKIE['MapType'])) { |
|
9 | + $MapType = $_COOKIE['MapType']; |
|
10 | + } else { |
|
11 | + $MapType = $globalMapProvider; |
|
12 | + } |
|
10 | 13 | |
11 | 14 | // unset($_COOKIE['MapType']); |
12 | 15 | if ($MapType != 'Mapbox' && $MapType != 'OpenStreetMap' && $MapType != 'Bing-Aerial' && $MapType != 'Bing-Hybrid' && $MapType != 'Bing-Road' && $MapType != 'offline' && $MapType != 'ArcGIS-Streetmap' && $MapType != 'ArcGIS-Satellite' && $MapType != 'NatGeo-Street') { |
13 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') $MapType = 'Bing-Aerial'; |
|
14 | - else $MapType = 'OpenStreetMap'; |
|
16 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
17 | + $MapType = 'Bing-Aerial'; |
|
18 | + } else { |
|
19 | + $MapType = 'OpenStreetMap'; |
|
20 | + } |
|
15 | 21 | } |
16 | 22 | if (($MapType == 'Bing-Aerial' || $MapType == 'Bing-Hybrid' || $MapType == 'Bing-Road') && (!isset($globalBingMapKey) || $globalBingMapKey == '')) { |
17 | 23 | $MapType = 'OpenStreetMap'; |
18 | 24 | } |
19 | 25 | if ($MapType == 'Mapbox') { |
20 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
21 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
22 | -?> |
|
26 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
27 | + $MapBoxId = $globalMapboxId; |
|
28 | + } else { |
|
29 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
30 | + } |
|
31 | + ?> |
|
23 | 32 | var imProv = Cesium.MapboxImageryProvider({ |
24 | 33 | credit: 'Map data © OpenStreetMap contributors, ' + |
25 | 34 | 'CC-BY-SA, ' + |
@@ -147,13 +156,23 @@ discard block |
||
147 | 156 | */ |
148 | 157 | ?> |
149 | 158 | <?php |
150 | - } elseif (isset($globalMapCustomLayer[$MapType])) { |
|
159 | + } elseif (isset($globalMapCustomLayer[$MapType])) { |
|
151 | 160 | $customid = $MapType; |
152 | 161 | ?> |
153 | 162 | var imProv = Cesium.createOpenStreetMapImageryProvider({ |
154 | 163 | url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>', |
155 | - maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>, |
|
156 | - minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
164 | + maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
165 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
166 | +} else { |
|
167 | + print '99'; |
|
168 | +} |
|
169 | +?>, |
|
170 | + minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
171 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
172 | +} else { |
|
173 | + print '0'; |
|
174 | +} |
|
175 | +?>, |
|
157 | 176 | credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
158 | 177 | }); |
159 | 178 | <?php |
@@ -480,8 +499,11 @@ discard block |
||
480 | 499 | if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) { |
481 | 500 | if (isset($_COOKIE['lastcentercoord'])) { |
482 | 501 | $lastcentercoord = explode(',',$_COOKIE['lastcentercoord']); |
483 | - if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0; |
|
484 | - else $zoom = $lastcentercoord[3]; |
|
502 | + if (!isset($lastcentercoord[3])) { |
|
503 | + $zoom = $lastcentercoord[2]*1000000.0; |
|
504 | + } else { |
|
505 | + $zoom = $lastcentercoord[3]; |
|
506 | + } |
|
485 | 507 | $viewcenterlatitude = $lastcentercoord[0]; |
486 | 508 | $viewcenterlongitude = $lastcentercoord[1]; |
487 | 509 | } else { |
@@ -602,7 +624,12 @@ discard block |
||
602 | 624 | ?> |
603 | 625 | |
604 | 626 | update_locationsLayer(); |
605 | -setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
627 | +setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) { |
|
628 | + print $globalMapRefresh*1000*2; |
|
629 | +} else { |
|
630 | + print '60000'; |
|
631 | +} |
|
632 | +?>); |
|
606 | 633 | /* |
607 | 634 | var handlera = new Cesium.ScreenSpaceEventHandler(viewer.canvas, false); |
608 | 635 | handlera.setInputAction( |
@@ -174,6 +174,10 @@ |
||
174 | 174 | '\|' => 'TNC Stream SW', |
175 | 175 | '\~' => 'TNC Stream SW'); |
176 | 176 | |
177 | + /** |
|
178 | + * @param integer $n |
|
179 | + * @param integer $s |
|
180 | + */ |
|
177 | 181 | private function urshift($n, $s) { |
178 | 182 | return ($n >= 0) ? ($n >> $s) : |
179 | 183 | (($n & 0x7fffffff) >> $s) | |
@@ -176,8 +176,8 @@ |
||
176 | 176 | |
177 | 177 | private function urshift($n, $s) { |
178 | 178 | return ($n >= 0) ? ($n >> $s) : |
179 | - (($n & 0x7fffffff) >> $s) | |
|
180 | - (0x40000000 >> ($s - 1)); |
|
179 | + (($n & 0x7fffffff) >> $s) | |
|
180 | + (0x40000000 >> ($s - 1)); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /* |
@@ -175,8 +175,7 @@ discard block |
||
175 | 175 | '\~' => 'TNC Stream SW'); |
176 | 176 | |
177 | 177 | private function urshift($n, $s) { |
178 | - return ($n >= 0) ? ($n >> $s) : |
|
179 | - (($n & 0x7fffffff) >> $s) | |
|
178 | + return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| |
|
180 | 179 | (0x40000000 >> ($s - 1)); |
181 | 180 | } |
182 | 181 | |
@@ -192,7 +191,7 @@ discard block |
||
192 | 191 | $input_len = strlen($input); |
193 | 192 | |
194 | 193 | /* Find the end of header checking for NULL bytes while doing it. */ |
195 | - $splitpos = strpos($input,':'); |
|
194 | + $splitpos = strpos($input, ':'); |
|
196 | 195 | |
197 | 196 | /* Check that end was found and body has at least one byte. */ |
198 | 197 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
@@ -202,14 +201,14 @@ discard block |
||
202 | 201 | |
203 | 202 | if ($debug) echo 'input : '.$input."\n"; |
204 | 203 | /* Save header and body. */ |
205 | - $body = substr($input,$splitpos+1,$input_len); |
|
204 | + $body = substr($input, $splitpos + 1, $input_len); |
|
206 | 205 | $body_len = strlen($body); |
207 | - $header = substr($input,0,$splitpos); |
|
206 | + $header = substr($input, 0, $splitpos); |
|
208 | 207 | if ($debug) echo 'header : '.$header."\n"; |
209 | 208 | |
210 | 209 | /* Parse source, target and path. */ |
211 | 210 | //FLRDF0A52>APRS,qAS,LSTB |
212 | - if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) { |
|
211 | + if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) { |
|
213 | 212 | $ident = $matches[1]; |
214 | 213 | $all_elements = $matches[2]; |
215 | 214 | if ($ident == 'AIRCRAFT') { |
@@ -226,13 +225,13 @@ discard block |
||
226 | 225 | if ($debug) 'No ident'."\n"; |
227 | 226 | return false; |
228 | 227 | } |
229 | - $elements = explode(',',$all_elements); |
|
228 | + $elements = explode(',', $all_elements); |
|
230 | 229 | $source = end($elements); |
231 | 230 | $result['source'] = $source; |
232 | 231 | foreach ($elements as $element) { |
233 | - if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
232 | + if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) { |
|
234 | 233 | //if ($element == 'TCPIP*') return false; |
235 | - } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
234 | + } elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) { |
|
236 | 235 | if ($debug) echo 'element : '.$element."\n"; |
237 | 236 | return false; |
238 | 237 | } |
@@ -245,14 +244,14 @@ discard block |
||
245 | 244 | */ |
246 | 245 | } |
247 | 246 | |
248 | - $type = substr($body,0,1); |
|
247 | + $type = substr($body, 0, 1); |
|
249 | 248 | if ($debug) echo 'type : '.$type."\n"; |
250 | 249 | if ($type == ';') { |
251 | 250 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
252 | - $result['address'] = trim(substr($body,1,9)); |
|
251 | + $result['address'] = trim(substr($body, 1, 9)); |
|
253 | 252 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
254 | - $result['mmsi'] = trim(substr($body,1,9)); |
|
255 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
253 | + $result['mmsi'] = trim(substr($body, 1, 9)); |
|
254 | + } else $result['ident'] = trim(substr($body, 1, 9)); |
|
256 | 255 | } elseif ($type == ',') { |
257 | 256 | // Invalid data or test data |
258 | 257 | return false; |
@@ -260,20 +259,20 @@ discard block |
||
260 | 259 | |
261 | 260 | // Check for Timestamp |
262 | 261 | $find = false; |
263 | - $body_parse = substr($body,1); |
|
264 | - if (preg_match('/^;(.){9}\*/',$body,$matches)) { |
|
265 | - $body_parse = substr($body_parse,10); |
|
262 | + $body_parse = substr($body, 1); |
|
263 | + if (preg_match('/^;(.){9}\*/', $body, $matches)) { |
|
264 | + $body_parse = substr($body_parse, 10); |
|
266 | 265 | $find = true; |
267 | 266 | } |
268 | - if (preg_match('/^`(.*)\//',$body,$matches)) { |
|
269 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
267 | + if (preg_match('/^`(.*)\//', $body, $matches)) { |
|
268 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
270 | 269 | $find = true; |
271 | 270 | } |
272 | - if (preg_match("/^'(.*)\//",$body,$matches)) { |
|
273 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
271 | + if (preg_match("/^'(.*)\//", $body, $matches)) { |
|
272 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
274 | 273 | $find = true; |
275 | 274 | } |
276 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) { |
|
275 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) { |
|
277 | 276 | $find = true; |
278 | 277 | $timestamp = $matches[0]; |
279 | 278 | if ($matches[4] == 'h') { |
@@ -286,17 +285,17 @@ discard block |
||
286 | 285 | // This work or not ? |
287 | 286 | $timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]); |
288 | 287 | } |
289 | - $body_parse = substr($body_parse,7); |
|
288 | + $body_parse = substr($body_parse, 7); |
|
290 | 289 | $result['timestamp'] = $timestamp; |
291 | 290 | } |
292 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) { |
|
291 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $body_parse, $matches)) { |
|
293 | 292 | $find = true; |
294 | 293 | $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
295 | - $body_parse = substr($body_parse,8); |
|
294 | + $body_parse = substr($body_parse, 8); |
|
296 | 295 | $result['timestamp'] = $timestamp; |
297 | 296 | } |
298 | 297 | //if (strlen($body_parse) > 19) { |
299 | - if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
298 | + if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/', $body_parse, $matches)) { |
|
300 | 299 | $find = true; |
301 | 300 | // 4658.70N/00707.78Ez |
302 | 301 | $sind = strtoupper($matches[3]); |
@@ -318,11 +317,11 @@ discard block |
||
318 | 317 | */ |
319 | 318 | $latitude = $lat + floatval($lat_min)/60; |
320 | 319 | $longitude = $lon + floatval($lon_min)/60; |
321 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
322 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
320 | + if ($sind == 'S') $latitude = 0 - $latitude; |
|
321 | + if ($wind == 'W') $longitude = 0 - $longitude; |
|
323 | 322 | $result['latitude'] = $latitude; |
324 | 323 | $result['longitude'] = $longitude; |
325 | - $body_parse = substr($body_parse,18); |
|
324 | + $body_parse = substr($body_parse, 18); |
|
326 | 325 | $body_parse_len = strlen($body_parse); |
327 | 326 | } |
328 | 327 | $body_parse_len = strlen($body_parse); |
@@ -349,22 +348,22 @@ discard block |
||
349 | 348 | //' |
350 | 349 | //if ($type != ';' && $type != '>') { |
351 | 350 | if ($type != '') { |
352 | - $body_parse = substr($body_parse,1); |
|
351 | + $body_parse = substr($body_parse, 1); |
|
353 | 352 | $body_parse_len = strlen($body_parse); |
354 | 353 | $result['symbol_code'] = $symbol_code; |
355 | 354 | if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
356 | 355 | if ($symbol_code != '_') { |
357 | 356 | } |
358 | 357 | if ($body_parse_len >= 7) { |
359 | - if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
360 | - $course = substr($body_parse,0,3); |
|
358 | + if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) { |
|
359 | + $course = substr($body_parse, 0, 3); |
|
361 | 360 | $tmp_s = intval($course); |
362 | 361 | if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
363 | - $speed = substr($body_parse,4,3); |
|
362 | + $speed = substr($body_parse, 4, 3); |
|
364 | 363 | if ($speed != '...') { |
365 | 364 | $result['speed'] = intval($speed); |
366 | 365 | } |
367 | - $body_parse = substr($body_parse,7); |
|
366 | + $body_parse = substr($body_parse, 7); |
|
368 | 367 | } |
369 | 368 | // Check PHGR, PHG, RNG |
370 | 369 | } |
@@ -374,11 +373,11 @@ discard block |
||
374 | 373 | } |
375 | 374 | */ |
376 | 375 | if (strlen($body_parse) > 0) { |
377 | - if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
376 | + if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) { |
|
378 | 377 | $altitude = intval($matches[1]); |
379 | 378 | $result['altitude'] = $altitude; |
380 | 379 | //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
381 | - $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
380 | + $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/', '', $body_parse)); |
|
382 | 381 | } |
383 | 382 | } |
384 | 383 | // Telemetry |
@@ -388,58 +387,58 @@ discard block |
||
388 | 387 | } |
389 | 388 | */ |
390 | 389 | // DAO |
391 | - if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
390 | + if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) { |
|
392 | 391 | $dao = $matches[1]; |
393 | - if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
392 | + if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) { |
|
394 | 393 | $dao_split = str_split($dao); |
395 | - $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
396 | - $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
394 | + $lat_off = (($dao_split[1]) - 48.0)*0.001/60.0; |
|
395 | + $lon_off = (($dao_split[2]) - 48.0)*0.001/60.0; |
|
397 | 396 | if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
398 | 397 | else $result['latitude'] += $lat_off; |
399 | 398 | if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
400 | 399 | else $result['longitude'] += $lon_off; |
401 | 400 | } |
402 | - $body_parse = substr($body_parse,6); |
|
401 | + $body_parse = substr($body_parse, 6); |
|
403 | 402 | } |
404 | - if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
405 | - $result['ident'] = str_replace('_',' ',$matches[1]); |
|
403 | + if (preg_match('/CS=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
404 | + $result['ident'] = str_replace('_', ' ', $matches[1]); |
|
406 | 405 | } |
407 | - if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
406 | + if (preg_match('/SQ=([0-9]{4})/', $body_parse, $matches)) { |
|
408 | 407 | $result['squawk'] = $matches[1]; |
409 | 408 | } |
410 | - if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
409 | + if (preg_match('/AI=([0-9A-Z]{4})/', $body_parse, $matches)) { |
|
411 | 410 | $result['aircraft_icao'] = $matches[1]; |
412 | 411 | } |
413 | - if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) { |
|
412 | + if (preg_match('/VR=([0-9]*)/', $body_parse, $matches)) { |
|
414 | 413 | $result['verticalrate'] = $matches[1]; |
415 | 414 | } |
416 | - if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
415 | + if (preg_match('/TI=([0-9]*)/', $body_parse, $matches)) { |
|
417 | 416 | $result['typeid'] = $matches[1]; |
418 | 417 | } |
419 | - if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
418 | + if (preg_match('/SI=([0-9]*)/', $body_parse, $matches)) { |
|
420 | 419 | $result['statusid'] = $matches[1]; |
421 | 420 | } |
422 | - if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
421 | + if (preg_match('/IMO=([0-9]{7})/', $body_parse, $matches)) { |
|
423 | 422 | $result['imo'] = $matches[1]; |
424 | 423 | } |
425 | - if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
424 | + if (preg_match('/AD=([0-9]*)/', $body_parse, $matches)) { |
|
426 | 425 | $result['arrival_date'] = $matches[1]; |
427 | 426 | } |
428 | - if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
429 | - $result['arrival_code'] = str_replace('_',' ',$matches[1]); |
|
427 | + if (preg_match('/AC=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
428 | + $result['arrival_code'] = str_replace('_', ' ', $matches[1]); |
|
430 | 429 | } |
431 | 430 | // OGN comment |
432 | 431 | //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
433 | - if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
432 | + if (preg_match('/^id([0-9A-F]{8})/', $body_parse, $matches)) { |
|
434 | 433 | $id = $matches[1]; |
435 | 434 | //$mode = substr($id,0,2); |
436 | - $address = substr($id,2); |
|
437 | - $addressType = (intval(substr($id,0,2),16))&3; |
|
435 | + $address = substr($id, 2); |
|
436 | + $addressType = (intval(substr($id, 0, 2), 16))&3; |
|
438 | 437 | if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
439 | 438 | elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
440 | 439 | elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
441 | 440 | elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
442 | - $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
|
441 | + $aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2); |
|
443 | 442 | $result['aircrafttype_code'] = $aircraftType; |
444 | 443 | if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
445 | 444 | elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
@@ -456,110 +455,110 @@ discard block |
||
456 | 455 | elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
457 | 456 | elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
458 | 457 | elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
459 | - $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
|
458 | + $stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0; |
|
460 | 459 | $result['stealth'] = $stealth; |
461 | 460 | $result['address'] = $address; |
462 | 461 | } |
463 | 462 | //Comment |
464 | 463 | $result['comment'] = trim($body_parse); |
465 | 464 | // parse weather |
466 | - if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
465 | + if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
467 | 466 | $result['wind_dir'] = intval($matches[1]); |
468 | - $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
469 | - $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
470 | - $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
471 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
472 | - } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
467 | + $result['wind_speed'] = round(intval($matches[2])*1.60934, 1); |
|
468 | + $result['wind_gust'] = round(intval($matches[3])*1.60934, 1); |
|
469 | + $result['temp'] = round(5/9*((intval($matches[4])) - 32), 1); |
|
470 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
471 | + } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
473 | 472 | $result['wind_dir'] = intval($matches[1]); |
474 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
475 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
476 | - $result['temp'] = round(5/9*(($matches[4])-32),1); |
|
477 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
478 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
473 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
474 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
475 | + $result['temp'] = round(5/9*(($matches[4]) - 32), 1); |
|
476 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
477 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
479 | 478 | $result['wind_dir'] = intval($matches[1]); |
480 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
481 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
482 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
483 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
479 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
480 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
481 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
482 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/', $body_parse, $matches)) { |
|
484 | 483 | $result['wind_dir'] = intval($matches[1]); |
485 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
486 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
487 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
484 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
485 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
486 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
488 | 487 | } |
489 | 488 | // temperature |
490 | 489 | //g012t088r000p000P000h38b10110 |
491 | 490 | //g011t086r000p000P000h29b10198 |
492 | - if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
493 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
494 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
495 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
496 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
497 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
491 | + if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
492 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
493 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
494 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
495 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
496 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
498 | 497 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
499 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
500 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
501 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
502 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
503 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
504 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
505 | - if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
506 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
498 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
499 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
500 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
501 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
502 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
503 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
504 | + if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1, 1); |
|
505 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
507 | 506 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
508 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
509 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
510 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
511 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
512 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
513 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
514 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
515 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
507 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
508 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
509 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
510 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
511 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
512 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
513 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
514 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
516 | 515 | if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
517 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
518 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
519 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
520 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
521 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
522 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
523 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
516 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
517 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
518 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
519 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
520 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
521 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
522 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
524 | 523 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
525 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
526 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
527 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
528 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
529 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
530 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
531 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
524 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
525 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
526 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
527 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
528 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
529 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
530 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
532 | 531 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
533 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
534 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
535 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
536 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
537 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
538 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
539 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
532 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
533 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
534 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
535 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
536 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
537 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
538 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
540 | 539 | if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
541 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
542 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
543 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
544 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
545 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
540 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
541 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
542 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
543 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
544 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
546 | 545 | if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
547 | - if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
|
548 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
549 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
550 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
551 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
552 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
546 | + if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10), 1); |
|
547 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
548 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
549 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
550 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
551 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
553 | 552 | if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
554 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
555 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
553 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
554 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
556 | 555 | } |
557 | 556 | $result['comment'] = trim($body_parse); |
558 | 557 | } |
559 | 558 | } else $result['comment'] = trim($body_parse); |
560 | 559 | } |
561 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
562 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
560 | + if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4); |
|
561 | + if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4); |
|
563 | 562 | if ($debug) print_r($result); |
564 | 563 | return $result; |
565 | 564 | } |
@@ -568,34 +567,34 @@ discard block |
||
568 | 567 | * Connect to APRS server |
569 | 568 | */ |
570 | 569 | public function connect() { |
571 | - global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
570 | + global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass, $globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
572 | 571 | $aprs_connect = 0; |
573 | 572 | $aprs_keep = 120; |
574 | 573 | $aprs_last_tx = time(); |
575 | 574 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
576 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
575 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
577 | 576 | if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
578 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
577 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
579 | 578 | if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
580 | 579 | else $aprs_pass = '-1'; |
581 | - $aprs_filter = ''; |
|
580 | + $aprs_filter = ''; |
|
582 | 581 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
583 | 582 | $Common = new Common(); |
584 | - $s = $Common->create_socket($globalServerAPRShost,$globalServerAPRSport,$errno,$errstr); |
|
583 | + $s = $Common->create_socket($globalServerAPRShost, $globalServerAPRSport, $errno, $errstr); |
|
585 | 584 | if ($s !== false) { |
586 | 585 | echo 'Connected to APRS server! '."\n"; |
587 | 586 | $authstart = time(); |
588 | 587 | $this->socket = $s; |
589 | - $send = socket_send( $this->socket , $aprs_login , strlen($aprs_login) , 0 ); |
|
590 | - socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1); |
|
591 | - while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) { |
|
588 | + $send = socket_send($this->socket, $aprs_login, strlen($aprs_login), 0); |
|
589 | + socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1); |
|
590 | + while ($msgin = socket_read($this->socket, 1000, PHP_NORMAL_READ)) { |
|
592 | 591 | if (strpos($msgin, "$aprs_ssid verified") !== FALSE) { |
593 | 592 | echo 'APRS user verified !'."\n"; |
594 | 593 | $this->connected = true; |
595 | 594 | return true; |
596 | 595 | break; |
597 | 596 | } |
598 | - if (time()-$authstart > 5) { |
|
597 | + if (time() - $authstart > 5) { |
|
599 | 598 | echo 'APRS timeout'."\n"; |
600 | 599 | break; |
601 | 600 | } |
@@ -617,7 +616,7 @@ discard block |
||
617 | 616 | public function send($data) { |
618 | 617 | global $globalDebug; |
619 | 618 | if ($this->connected === false) $this->connect(); |
620 | - $send = socket_send( $this->socket , $data , strlen($data),0); |
|
619 | + $send = socket_send($this->socket, $data, strlen($data), 0); |
|
621 | 620 | if ($send === FALSE) { |
622 | 621 | if ($globalDebug) echo 'Reconnect...'; |
623 | 622 | socket_close($this->socket); |
@@ -627,17 +626,17 @@ discard block |
||
627 | 626 | } |
628 | 627 | |
629 | 628 | class APRSSpotter extends APRS { |
630 | - public function addLiveSpotterData($id,$ident,$aircraft_icao,$departure_airport,$arrival_airport,$latitude,$longitude,$waypoints,$altitude,$altitude_real,$heading,$speed,$datetime,$departure_airport_time,$arrival_airport_time,$squawk,$route_stop,$hex,$putinarchive,$registration,$pilot_id,$pilot_name, $verticalrate, $noarchive, $ground,$format_source,$source_name,$over_country) { |
|
629 | + public function addLiveSpotterData($id, $ident, $aircraft_icao, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $speed, $datetime, $departure_airport_time, $arrival_airport_time, $squawk, $route_stop, $hex, $putinarchive, $registration, $pilot_id, $pilot_name, $verticalrate, $noarchive, $ground, $format_source, $source_name, $over_country) { |
|
631 | 630 | $Common = new Common(); |
632 | 631 | date_default_timezone_set('UTC'); |
633 | 632 | if ($latitude != '' && $longitude != '') { |
634 | 633 | $lat = $latitude; |
635 | 634 | $long = $longitude; |
636 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
637 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
638 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
639 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
640 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
635 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
636 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
637 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
638 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
639 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
641 | 640 | $w = $w1.$w2; |
642 | 641 | //$w = '00'; |
643 | 642 | $custom = ''; |
@@ -664,26 +663,26 @@ discard block |
||
664 | 663 | $geoid= round($GeoidClass->get($lat,$long)*3.28084,2); |
665 | 664 | $altitude_real = round($altitude_real + $geoid); |
666 | 665 | */ |
667 | - $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
666 | + $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His', strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude_real, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
668 | 667 | } |
669 | 668 | } |
670 | 669 | } |
671 | 670 | class APRSMarine extends APRS { |
672 | - public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed,$datetime, $putinarchive,$mmsi,$type,$typeid,$imo,$callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source,$source_name,$over_country) { |
|
671 | + public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed, $datetime, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country) { |
|
673 | 672 | $Common = new Common(); |
674 | 673 | date_default_timezone_set('UTC'); |
675 | 674 | if ($latitude != '' && $longitude != '') { |
676 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
677 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
678 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
679 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
680 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
675 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
676 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
677 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
678 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
679 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
681 | 680 | $w = $w1.$w2; |
682 | 681 | //$w = '00'; |
683 | 682 | $custom = ''; |
684 | 683 | if ($ident != '') { |
685 | 684 | if ($custom != '') $custom .= '/'; |
686 | - $custom .= 'CS='.str_replace(' ','_',$ident); |
|
685 | + $custom .= 'CS='.str_replace(' ', '_', $ident); |
|
687 | 686 | } |
688 | 687 | if ($typeid != '') { |
689 | 688 | if ($custom != '') $custom .= '/'; |
@@ -703,11 +702,11 @@ discard block |
||
703 | 702 | } |
704 | 703 | if ($arrival_code != '') { |
705 | 704 | if ($custom != '') $custom .= '/'; |
706 | - $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
|
705 | + $custom .= 'AC='.str_replace(' ', '_', $arrival_code); |
|
707 | 706 | } |
708 | 707 | if ($custom != '') $custom = ' '.$custom; |
709 | 708 | $altitude = 0; |
710 | - $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
709 | + $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His', strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
711 | 710 | } |
712 | 711 | } |
713 | 712 | } |
@@ -196,16 +196,22 @@ discard block |
||
196 | 196 | |
197 | 197 | /* Check that end was found and body has at least one byte. */ |
198 | 198 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
199 | - if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
199 | + if ($globalDebug) { |
|
200 | + echo '!!! APRS invalid : '.$input."\n"; |
|
201 | + } |
|
200 | 202 | return false; |
201 | 203 | } |
202 | 204 | |
203 | - if ($debug) echo 'input : '.$input."\n"; |
|
205 | + if ($debug) { |
|
206 | + echo 'input : '.$input."\n"; |
|
207 | + } |
|
204 | 208 | /* Save header and body. */ |
205 | 209 | $body = substr($input,$splitpos+1,$input_len); |
206 | 210 | $body_len = strlen($body); |
207 | 211 | $header = substr($input,0,$splitpos); |
208 | - if ($debug) echo 'header : '.$header."\n"; |
|
212 | + if ($debug) { |
|
213 | + echo 'header : '.$header."\n"; |
|
214 | + } |
|
209 | 215 | |
210 | 216 | /* Parse source, target and path. */ |
211 | 217 | //FLRDF0A52>APRS,qAS,LSTB |
@@ -219,11 +225,15 @@ discard block |
||
219 | 225 | $result['format_source'] = 'famaprs'; |
220 | 226 | $result['source_type'] = 'ais'; |
221 | 227 | } else { |
222 | - if ($debug) echo 'ident : '.$ident."\n"; |
|
228 | + if ($debug) { |
|
229 | + echo 'ident : '.$ident."\n"; |
|
230 | + } |
|
223 | 231 | $result['ident'] = $ident; |
224 | 232 | } |
225 | 233 | } else { |
226 | - if ($debug) 'No ident'."\n"; |
|
234 | + if ($debug) { |
|
235 | + 'No ident'."\n"; |
|
236 | + } |
|
227 | 237 | return false; |
228 | 238 | } |
229 | 239 | $elements = explode(',',$all_elements); |
@@ -233,7 +243,9 @@ discard block |
||
233 | 243 | if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
234 | 244 | //if ($element == 'TCPIP*') return false; |
235 | 245 | } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
236 | - if ($debug) echo 'element : '.$element."\n"; |
|
246 | + if ($debug) { |
|
247 | + echo 'element : '.$element."\n"; |
|
248 | + } |
|
237 | 249 | return false; |
238 | 250 | } |
239 | 251 | /* |
@@ -246,13 +258,17 @@ discard block |
||
246 | 258 | } |
247 | 259 | |
248 | 260 | $type = substr($body,0,1); |
249 | - if ($debug) echo 'type : '.$type."\n"; |
|
261 | + if ($debug) { |
|
262 | + echo 'type : '.$type."\n"; |
|
263 | + } |
|
250 | 264 | if ($type == ';') { |
251 | 265 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
252 | 266 | $result['address'] = trim(substr($body,1,9)); |
253 | 267 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
254 | 268 | $result['mmsi'] = trim(substr($body,1,9)); |
255 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
269 | + } else { |
|
270 | + $result['ident'] = trim(substr($body,1,9)); |
|
271 | + } |
|
256 | 272 | } elseif ($type == ',') { |
257 | 273 | // Invalid data or test data |
258 | 274 | return false; |
@@ -309,7 +325,9 @@ discard block |
||
309 | 325 | //$symbol_table = $matches[4]; |
310 | 326 | $lat = intval($lat_deg); |
311 | 327 | $lon = intval($lon_deg); |
312 | - if ($lat > 89 || $lon > 179) return false; |
|
328 | + if ($lat > 89 || $lon > 179) { |
|
329 | + return false; |
|
330 | + } |
|
313 | 331 | /* |
314 | 332 | $tmp_5b = str_replace('.','',$lat_min); |
315 | 333 | if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) { |
@@ -318,8 +336,12 @@ discard block |
||
318 | 336 | */ |
319 | 337 | $latitude = $lat + floatval($lat_min)/60; |
320 | 338 | $longitude = $lon + floatval($lon_min)/60; |
321 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
322 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
339 | + if ($sind == 'S') { |
|
340 | + $latitude = 0-$latitude; |
|
341 | + } |
|
342 | + if ($wind == 'W') { |
|
343 | + $longitude = 0-$longitude; |
|
344 | + } |
|
323 | 345 | $result['latitude'] = $latitude; |
324 | 346 | $result['longitude'] = $longitude; |
325 | 347 | $body_parse = substr($body_parse,18); |
@@ -344,22 +366,29 @@ discard block |
||
344 | 366 | if ($find) { |
345 | 367 | $body_split = str_split($body_parse); |
346 | 368 | $symbol_code = $body_split[0]; |
347 | - if (!isset($symbolll) || $symbolll == '/') $symbol_code = '/'.$symbol_code; |
|
348 | - else $symbol_code = '\\'.$symbol_code; |
|
369 | + if (!isset($symbolll) || $symbolll == '/') { |
|
370 | + $symbol_code = '/'.$symbol_code; |
|
371 | + } else { |
|
372 | + $symbol_code = '\\'.$symbol_code; |
|
373 | + } |
|
349 | 374 | //' |
350 | 375 | //if ($type != ';' && $type != '>') { |
351 | 376 | if ($type != '') { |
352 | 377 | $body_parse = substr($body_parse,1); |
353 | 378 | $body_parse_len = strlen($body_parse); |
354 | 379 | $result['symbol_code'] = $symbol_code; |
355 | - if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
|
380 | + if (isset($this->symbols[$symbol_code])) { |
|
381 | + $result['symbol'] = $this->symbols[$symbol_code]; |
|
382 | + } |
|
356 | 383 | if ($symbol_code != '_') { |
357 | 384 | } |
358 | 385 | if ($body_parse_len >= 7) { |
359 | 386 | if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
360 | 387 | $course = substr($body_parse,0,3); |
361 | 388 | $tmp_s = intval($course); |
362 | - if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
389 | + if ($tmp_s >= 1 && $tmp_s <= 360) { |
|
390 | + $result['heading'] = intval($course); |
|
391 | + } |
|
363 | 392 | $speed = substr($body_parse,4,3); |
364 | 393 | if ($speed != '...') { |
365 | 394 | $result['speed'] = intval($speed); |
@@ -394,10 +423,16 @@ discard block |
||
394 | 423 | $dao_split = str_split($dao); |
395 | 424 | $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
396 | 425 | $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
397 | - if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
|
398 | - else $result['latitude'] += $lat_off; |
|
399 | - if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
|
400 | - else $result['longitude'] += $lon_off; |
|
426 | + if ($result['latitude'] < 0) { |
|
427 | + $result['latitude'] -= $lat_off; |
|
428 | + } else { |
|
429 | + $result['latitude'] += $lat_off; |
|
430 | + } |
|
431 | + if ($result['longitude'] < 0) { |
|
432 | + $result['longitude'] -= $lon_off; |
|
433 | + } else { |
|
434 | + $result['longitude'] += $lon_off; |
|
435 | + } |
|
401 | 436 | } |
402 | 437 | $body_parse = substr($body_parse,6); |
403 | 438 | } |
@@ -435,27 +470,48 @@ discard block |
||
435 | 470 | //$mode = substr($id,0,2); |
436 | 471 | $address = substr($id,2); |
437 | 472 | $addressType = (intval(substr($id,0,2),16))&3; |
438 | - if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
|
439 | - elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
|
440 | - elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
|
441 | - elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
|
473 | + if ($addressType == 0) { |
|
474 | + $result['addresstype'] = "RANDOM"; |
|
475 | + } elseif ($addressType == 1) { |
|
476 | + $result['addresstype'] = "ICAO"; |
|
477 | + } elseif ($addressType == 2) { |
|
478 | + $result['addresstype'] = "FLARM"; |
|
479 | + } elseif ($addressType == 3) { |
|
480 | + $result['addresstype'] = "OGN"; |
|
481 | + } |
|
442 | 482 | $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
443 | 483 | $result['aircrafttype_code'] = $aircraftType; |
444 | - if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
|
445 | - elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
|
446 | - elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE"; |
|
447 | - elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
448 | - elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE"; |
|
449 | - elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE"; |
|
450 | - elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER"; |
|
451 | - elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER"; |
|
452 | - elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
453 | - elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
454 | - elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO"; |
|
455 | - elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON"; |
|
456 | - elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
|
457 | - elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
|
458 | - elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
|
484 | + if ($aircraftType == 0) { |
|
485 | + $result['aircrafttype'] = "UNKNOWN"; |
|
486 | + } elseif ($aircraftType == 1) { |
|
487 | + $result['aircrafttype'] = "GLIDER"; |
|
488 | + } elseif ($aircraftType == 2) { |
|
489 | + $result['aircrafttype'] = "TOW_PLANE"; |
|
490 | + } elseif ($aircraftType == 3) { |
|
491 | + $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
492 | + } elseif ($aircraftType == 4) { |
|
493 | + $result['aircrafttype'] = "PARACHUTE"; |
|
494 | + } elseif ($aircraftType == 5) { |
|
495 | + $result['aircrafttype'] = "DROP_PLANE"; |
|
496 | + } elseif ($aircraftType == 6) { |
|
497 | + $result['aircrafttype'] = "HANG_GLIDER"; |
|
498 | + } elseif ($aircraftType == 7) { |
|
499 | + $result['aircrafttype'] = "PARA_GLIDER"; |
|
500 | + } elseif ($aircraftType == 8) { |
|
501 | + $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
502 | + } elseif ($aircraftType == 9) { |
|
503 | + $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
504 | + } elseif ($aircraftType == 10) { |
|
505 | + $result['aircrafttype'] = "UFO"; |
|
506 | + } elseif ($aircraftType == 11) { |
|
507 | + $result['aircrafttype'] = "BALLOON"; |
|
508 | + } elseif ($aircraftType == 12) { |
|
509 | + $result['aircrafttype'] = "AIRSHIP"; |
|
510 | + } elseif ($aircraftType == 13) { |
|
511 | + $result['aircrafttype'] = "UAV"; |
|
512 | + } elseif ($aircraftType == 15) { |
|
513 | + $result['aircrafttype'] = "STATIC_OBJECT"; |
|
514 | + } |
|
459 | 515 | $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
460 | 516 | $result['stealth'] = $stealth; |
461 | 517 | $result['address'] = $address; |
@@ -490,77 +546,181 @@ discard block |
||
490 | 546 | //g012t088r000p000P000h38b10110 |
491 | 547 | //g011t086r000p000P000h29b10198 |
492 | 548 | if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
493 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
494 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
495 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
496 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
497 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
498 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
499 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
549 | + if ($matches[1] != '...') { |
|
550 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
551 | + } |
|
552 | + if ($matches[2] != '...') { |
|
553 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
554 | + } |
|
555 | + if ($matches[3] != '...') { |
|
556 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
557 | + } |
|
558 | + if ($matches[4] != '...') { |
|
559 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
560 | + } |
|
561 | + if ($matches[5] != '...') { |
|
562 | + $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
563 | + } |
|
564 | + if ($matches[6] != '...') { |
|
565 | + $result['humidity'] = intval($matches[6]); |
|
566 | + } |
|
567 | + if ($matches[7] != '...') { |
|
568 | + $result['pressure'] = round((intval($matches[7])/10),1); |
|
569 | + } |
|
500 | 570 | $body_parse = substr($body_parse,strlen($matches[0])); |
501 | 571 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
502 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
503 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
504 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
505 | - if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
506 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
507 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
508 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
572 | + if ($matches[1] != '...') { |
|
573 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
574 | + } |
|
575 | + if ($matches[2] != '...') { |
|
576 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
577 | + } |
|
578 | + if ($matches[3] != '...') { |
|
579 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
580 | + } |
|
581 | + if ($matches[5] != '...') { |
|
582 | + $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
583 | + } |
|
584 | + if ($matches[4] != '...') { |
|
585 | + $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
586 | + } |
|
587 | + if ($matches[6] != '...') { |
|
588 | + $result['humidity'] = intval($matches[6]); |
|
589 | + } |
|
590 | + if ($matches[7] != '...') { |
|
591 | + $result['pressure'] = round((intval($matches[7])/10),1); |
|
592 | + } |
|
509 | 593 | $body_parse = substr($body_parse,strlen($matches[0])); |
510 | 594 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
511 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
512 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
513 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
514 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
515 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
516 | - if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
|
517 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
595 | + if ($matches[1] != '...') { |
|
596 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
597 | + } |
|
598 | + if ($matches[2] != '...') { |
|
599 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
600 | + } |
|
601 | + if ($matches[3] != '...') { |
|
602 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
603 | + } |
|
604 | + if ($matches[4] != '...') { |
|
605 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
606 | + } |
|
607 | + if ($matches[5] != '...') { |
|
608 | + $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
609 | + } |
|
610 | + if ($matches[7] != '...') { |
|
611 | + $result['humidity'] = intval($matches[7]); |
|
612 | + } |
|
613 | + if ($matches[6] != '...') { |
|
614 | + $result['pressure'] = round((intval($matches[6])/10),1); |
|
615 | + } |
|
518 | 616 | $body_parse = substr($body_parse,strlen($matches[0])); |
519 | 617 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
520 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
521 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
522 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
523 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
524 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
525 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
618 | + if ($matches[1] != '...') { |
|
619 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
620 | + } |
|
621 | + if ($matches[2] != '...') { |
|
622 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
623 | + } |
|
624 | + if ($matches[3] != '...') { |
|
625 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
626 | + } |
|
627 | + if ($matches[4] != '...') { |
|
628 | + $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
629 | + } |
|
630 | + if ($matches[6] != '...') { |
|
631 | + $result['humidity'] = intval($matches[6]); |
|
632 | + } |
|
633 | + if ($matches[5] != '...') { |
|
634 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
635 | + } |
|
526 | 636 | $body_parse = substr($body_parse,strlen($matches[0])); |
527 | 637 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
528 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
529 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
530 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
531 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
532 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
533 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
638 | + if ($matches[1] != '...') { |
|
639 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
640 | + } |
|
641 | + if ($matches[2] != '...') { |
|
642 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
643 | + } |
|
644 | + if ($matches[3] != '...') { |
|
645 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
646 | + } |
|
647 | + if ($matches[4] != '...') { |
|
648 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
649 | + } |
|
650 | + if ($matches[6] != '...') { |
|
651 | + $result['humidity'] = intval($matches[6]); |
|
652 | + } |
|
653 | + if ($matches[5] != '...') { |
|
654 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
655 | + } |
|
534 | 656 | $body_parse = substr($body_parse,strlen($matches[0])); |
535 | 657 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
536 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
537 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
538 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
539 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
540 | - if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
|
541 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
658 | + if ($matches[1] != '...') { |
|
659 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
660 | + } |
|
661 | + if ($matches[2] != '...') { |
|
662 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
663 | + } |
|
664 | + if ($matches[3] != '...') { |
|
665 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
666 | + } |
|
667 | + if ($matches[4] != '...') { |
|
668 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
669 | + } |
|
670 | + if ($matches[5] != '...') { |
|
671 | + $result['humidity'] = intval($matches[5]); |
|
672 | + } |
|
673 | + if ($matches[6] != '...') { |
|
674 | + $result['pressure'] = round((intval($matches[6])/10),1); |
|
675 | + } |
|
542 | 676 | $body_parse = substr($body_parse,strlen($matches[0])); |
543 | 677 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
544 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
545 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
546 | - if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
|
547 | - if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
|
678 | + if ($matches[1] != '...') { |
|
679 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
680 | + } |
|
681 | + if ($matches[2] != '...') { |
|
682 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
683 | + } |
|
684 | + if ($matches[2] != '...') { |
|
685 | + $result['humidity'] = intval($matches[3]); |
|
686 | + } |
|
687 | + if ($matches[4] != '...') { |
|
688 | + $result['pressure'] = round((intval($matches[4])/10),1); |
|
689 | + } |
|
548 | 690 | $body_parse = substr($body_parse,strlen($matches[0])); |
549 | 691 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
550 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
551 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
552 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
553 | - if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
|
554 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
692 | + if ($matches[1] != '...') { |
|
693 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
694 | + } |
|
695 | + if ($matches[2] != '...') { |
|
696 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
697 | + } |
|
698 | + if ($matches[3] != '...') { |
|
699 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
700 | + } |
|
701 | + if ($matches[4] != '...') { |
|
702 | + $result['humidity'] = intval($matches[4]); |
|
703 | + } |
|
704 | + if ($matches[5] != '...') { |
|
705 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
706 | + } |
|
555 | 707 | $body_parse = substr($body_parse,strlen($matches[0])); |
556 | 708 | } |
557 | 709 | $result['comment'] = trim($body_parse); |
558 | 710 | } |
559 | - } else $result['comment'] = trim($body_parse); |
|
711 | + } else { |
|
712 | + $result['comment'] = trim($body_parse); |
|
713 | + } |
|
714 | + } |
|
715 | + if (isset($result['latitude'])) { |
|
716 | + $result['latitude'] = round($result['latitude'],4); |
|
717 | + } |
|
718 | + if (isset($result['longitude'])) { |
|
719 | + $result['longitude'] = round($result['longitude'],4); |
|
720 | + } |
|
721 | + if ($debug) { |
|
722 | + print_r($result); |
|
560 | 723 | } |
561 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
562 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
563 | - if ($debug) print_r($result); |
|
564 | 724 | return $result; |
565 | 725 | } |
566 | 726 | |
@@ -572,12 +732,21 @@ discard block |
||
572 | 732 | $aprs_connect = 0; |
573 | 733 | $aprs_keep = 120; |
574 | 734 | $aprs_last_tx = time(); |
575 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
576 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
577 | - if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
|
578 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
579 | - if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
|
580 | - else $aprs_pass = '-1'; |
|
735 | + if (isset($globalAPRSversion)) { |
|
736 | + $aprs_version = $globalAPRSversion; |
|
737 | + } else { |
|
738 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
739 | + } |
|
740 | + if (isset($globalServerAPRSssid)) { |
|
741 | + $aprs_ssid = $globalServerAPRSssid; |
|
742 | + } else { |
|
743 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
744 | + } |
|
745 | + if (isset($globalServerAPRSpass)) { |
|
746 | + $aprs_pass = $globalServerAPRSpass; |
|
747 | + } else { |
|
748 | + $aprs_pass = '-1'; |
|
749 | + } |
|
581 | 750 | $aprs_filter = ''; |
582 | 751 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
583 | 752 | $Common = new Common(); |
@@ -616,10 +785,14 @@ discard block |
||
616 | 785 | */ |
617 | 786 | public function send($data) { |
618 | 787 | global $globalDebug; |
619 | - if ($this->connected === false) $this->connect(); |
|
788 | + if ($this->connected === false) { |
|
789 | + $this->connect(); |
|
790 | + } |
|
620 | 791 | $send = socket_send( $this->socket , $data , strlen($data),0); |
621 | 792 | if ($send === FALSE) { |
622 | - if ($globalDebug) echo 'Reconnect...'; |
|
793 | + if ($globalDebug) { |
|
794 | + echo 'Reconnect...'; |
|
795 | + } |
|
623 | 796 | socket_close($this->socket); |
624 | 797 | $this->connect(); |
625 | 798 | } |
@@ -642,22 +815,32 @@ discard block |
||
642 | 815 | //$w = '00'; |
643 | 816 | $custom = ''; |
644 | 817 | if ($ident != '') { |
645 | - if ($custom != '') $custom .= '/'; |
|
818 | + if ($custom != '') { |
|
819 | + $custom .= '/'; |
|
820 | + } |
|
646 | 821 | $custom .= 'CS='.$ident; |
647 | 822 | } |
648 | 823 | if ($squawk != '') { |
649 | - if ($custom != '') $custom .= '/'; |
|
824 | + if ($custom != '') { |
|
825 | + $custom .= '/'; |
|
826 | + } |
|
650 | 827 | $custom .= 'SQ='.$squawk; |
651 | 828 | } |
652 | 829 | if ($verticalrate != '') { |
653 | - if ($custom != '') $custom .= '/'; |
|
830 | + if ($custom != '') { |
|
831 | + $custom .= '/'; |
|
832 | + } |
|
654 | 833 | $custom .= 'VR='.$verticalrate; |
655 | 834 | } |
656 | 835 | if ($aircraft_icao != '' && $aircraft_icao != 'NA') { |
657 | - if ($custom != '') $custom .= '/'; |
|
836 | + if ($custom != '') { |
|
837 | + $custom .= '/'; |
|
838 | + } |
|
658 | 839 | $custom .= 'AI='.$aircraft_icao; |
659 | 840 | } |
660 | - if ($custom != '') $custom = ' '.$custom; |
|
841 | + if ($custom != '') { |
|
842 | + $custom = ' '.$custom; |
|
843 | + } |
|
661 | 844 | /* |
662 | 845 | // Use AMSL altitude |
663 | 846 | $GeoidClass = new GeoidHeight(); |
@@ -682,30 +865,44 @@ discard block |
||
682 | 865 | //$w = '00'; |
683 | 866 | $custom = ''; |
684 | 867 | if ($ident != '') { |
685 | - if ($custom != '') $custom .= '/'; |
|
868 | + if ($custom != '') { |
|
869 | + $custom .= '/'; |
|
870 | + } |
|
686 | 871 | $custom .= 'CS='.str_replace(' ','_',$ident); |
687 | 872 | } |
688 | 873 | if ($typeid != '') { |
689 | - if ($custom != '') $custom .= '/'; |
|
874 | + if ($custom != '') { |
|
875 | + $custom .= '/'; |
|
876 | + } |
|
690 | 877 | $custom .= 'TI='.$typeid; |
691 | 878 | } |
692 | 879 | if ($statusid != '') { |
693 | - if ($custom != '') $custom .= '/'; |
|
880 | + if ($custom != '') { |
|
881 | + $custom .= '/'; |
|
882 | + } |
|
694 | 883 | $custom .= 'SI='.$statusid; |
695 | 884 | } |
696 | 885 | if ($imo != '') { |
697 | - if ($custom != '') $custom .= '/'; |
|
886 | + if ($custom != '') { |
|
887 | + $custom .= '/'; |
|
888 | + } |
|
698 | 889 | $custom .= 'IMO='.$imo; |
699 | 890 | } |
700 | 891 | if ($arrival_date != '') { |
701 | - if ($custom != '') $custom .= '/'; |
|
892 | + if ($custom != '') { |
|
893 | + $custom .= '/'; |
|
894 | + } |
|
702 | 895 | $custom .= 'AD='.strtotime($arrival_date); |
703 | 896 | } |
704 | 897 | if ($arrival_code != '') { |
705 | - if ($custom != '') $custom .= '/'; |
|
898 | + if ($custom != '') { |
|
899 | + $custom .= '/'; |
|
900 | + } |
|
706 | 901 | $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
707 | 902 | } |
708 | - if ($custom != '') $custom = ' '.$custom; |
|
903 | + if ($custom != '') { |
|
904 | + $custom = ' '.$custom; |
|
905 | + } |
|
709 | 906 | $altitude = 0; |
710 | 907 | $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
711 | 908 | } |
@@ -190,12 +190,20 @@ |
||
190 | 190 | return 1; |
191 | 191 | } |
192 | 192 | |
193 | + /** |
|
194 | + * @param double $lat |
|
195 | + * @param integer $isodd |
|
196 | + */ |
|
193 | 197 | private function cprN($lat,$isodd) { |
194 | 198 | $nl = $this->cprNL($lat) - $isodd; |
195 | 199 | if ($nl > 1) return $nl; |
196 | 200 | else return 1; |
197 | 201 | } |
198 | 202 | |
203 | + /** |
|
204 | + * @param string $msg |
|
205 | + * @param string $bin |
|
206 | + */ |
|
199 | 207 | private function parityCheck($msg, $bin) { |
200 | 208 | $modes_checksum_table = array( |
201 | 209 | 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
@@ -198,20 +198,20 @@ |
||
198 | 198 | |
199 | 199 | private function parityCheck($msg, $bin) { |
200 | 200 | $modes_checksum_table = array( |
201 | - 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
|
202 | - 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14, |
|
203 | - 0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449, |
|
204 | - 0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22, |
|
205 | - 0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7, |
|
206 | - 0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612, |
|
207 | - 0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace, |
|
208 | - 0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53, |
|
209 | - 0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441, |
|
210 | - 0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80, |
|
211 | - 0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409, |
|
212 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
213 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
214 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
|
201 | + 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
|
202 | + 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14, |
|
203 | + 0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449, |
|
204 | + 0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22, |
|
205 | + 0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7, |
|
206 | + 0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612, |
|
207 | + 0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace, |
|
208 | + 0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53, |
|
209 | + 0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441, |
|
210 | + 0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80, |
|
211 | + 0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409, |
|
212 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
213 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
214 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
|
215 | 215 | ); |
216 | 216 | $crc = 0; |
217 | 217 | $checksum = intval(substr($msg,22,6),16); |
@@ -18,82 +18,82 @@ discard block |
||
18 | 18 | public function parse($buffer) { |
19 | 19 | // Not yet finished, no CRC checks |
20 | 20 | $data = array(); |
21 | - $typehex = substr($buffer,0,1); |
|
22 | - if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1,-1); |
|
23 | - elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13); |
|
24 | - else $hex = substr($buffer,1,-1); |
|
25 | - $bin = gmp_strval( gmp_init($hex,16), 2); |
|
21 | + $typehex = substr($buffer, 0, 1); |
|
22 | + if ($typehex == '*' || $typehex == ':') $hex = substr($buffer, 1, -1); |
|
23 | + elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer, 13, -13); |
|
24 | + else $hex = substr($buffer, 1, -1); |
|
25 | + $bin = gmp_strval(gmp_init($hex, 16), 2); |
|
26 | 26 | //if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) { |
27 | 27 | if (strlen($hex) == 28) { |
28 | - $df = intval(substr($bin,0,5),2); |
|
28 | + $df = intval(substr($bin, 0, 5), 2); |
|
29 | 29 | //$ca = intval(substr($bin,5,3),2); |
30 | 30 | // Only support DF17 for now |
31 | 31 | //if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) { |
32 | - if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) { |
|
33 | - $icao = substr($hex,2,6); |
|
32 | + if (($df == 17 || $df == 18) && ($this->parityCheck($hex, $bin) || $typehex == '@')) { |
|
33 | + $icao = substr($hex, 2, 6); |
|
34 | 34 | $data['hex'] = $icao; |
35 | - $tc = intval(substr($bin,32,5),2); |
|
35 | + $tc = intval(substr($bin, 32, 5), 2); |
|
36 | 36 | if ($tc >= 1 && $tc <= 4) { |
37 | 37 | //callsign |
38 | - $csbin = substr($bin,40,56); |
|
38 | + $csbin = substr($bin, 40, 56); |
|
39 | 39 | $charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######'); |
40 | 40 | $cs = ''; |
41 | - $cs .= $charset[intval(substr($csbin,0,6),2)]; |
|
42 | - $cs .= $charset[intval(substr($csbin,6,6),2)]; |
|
43 | - $cs .= $charset[intval(substr($csbin,12,6),2)]; |
|
44 | - $cs .= $charset[intval(substr($csbin,18,6),2)]; |
|
45 | - $cs .= $charset[intval(substr($csbin,24,6),2)]; |
|
46 | - $cs .= $charset[intval(substr($csbin,30,6),2)]; |
|
47 | - $cs .= $charset[intval(substr($csbin,36,6),2)]; |
|
48 | - $cs .= $charset[intval(substr($csbin,42,6),2)]; |
|
49 | - $cs = str_replace('_','',$cs); |
|
50 | - $cs = str_replace('#','',$cs); |
|
41 | + $cs .= $charset[intval(substr($csbin, 0, 6), 2)]; |
|
42 | + $cs .= $charset[intval(substr($csbin, 6, 6), 2)]; |
|
43 | + $cs .= $charset[intval(substr($csbin, 12, 6), 2)]; |
|
44 | + $cs .= $charset[intval(substr($csbin, 18, 6), 2)]; |
|
45 | + $cs .= $charset[intval(substr($csbin, 24, 6), 2)]; |
|
46 | + $cs .= $charset[intval(substr($csbin, 30, 6), 2)]; |
|
47 | + $cs .= $charset[intval(substr($csbin, 36, 6), 2)]; |
|
48 | + $cs .= $charset[intval(substr($csbin, 42, 6), 2)]; |
|
49 | + $cs = str_replace('_', '', $cs); |
|
50 | + $cs = str_replace('#', '', $cs); |
|
51 | 51 | $callsign = $cs; |
52 | 52 | $data['ident'] = $callsign; |
53 | 53 | } elseif ($tc >= 9 && $tc <= 18) { |
54 | 54 | // Check Q-bit |
55 | - $q = substr($bin,47,1); |
|
55 | + $q = substr($bin, 47, 1); |
|
56 | 56 | if ($q) { |
57 | - $n = intval(substr($bin,40,7).substr($bin,48,4),2); |
|
58 | - $alt = $n*25-1000; |
|
57 | + $n = intval(substr($bin, 40, 7).substr($bin, 48, 4), 2); |
|
58 | + $alt = $n*25 - 1000; |
|
59 | 59 | $data['altitude'] = $alt; |
60 | 60 | } |
61 | 61 | // Check odd/even flag |
62 | - $oe = substr($bin,53,1); |
|
62 | + $oe = substr($bin, 53, 1); |
|
63 | 63 | //if ($oe) => odd else even |
64 | 64 | // 131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits. |
65 | - $cprlat = intval(substr($bin,54,17),2)/131072.0; |
|
66 | - $cprlon = intval(substr($bin,71,17),2)/131072.0; |
|
67 | - if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
65 | + $cprlat = intval(substr($bin, 54, 17), 2)/131072.0; |
|
66 | + $cprlon = intval(substr($bin, 71, 17), 2)/131072.0; |
|
67 | + if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat, 'longitude' => $cprlon, 'created' => time()); |
|
68 | 68 | elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
69 | 69 | $cprlat_odd = $cprlat; |
70 | 70 | $cprlon_odd = $cprlon; |
71 | 71 | $cprlat_even = $this::$latlon[$icao]['latitude']; |
72 | 72 | $cprlon_even = $this::$latlon[$icao]['longitude']; |
73 | - $j = 59*$cprlat_even-60*$cprlat_odd+0.5; |
|
74 | - $lat_even = (360.0/60)*($j%60+$cprlat_even); |
|
75 | - $lat_odd = (360.0/59)*($j%59+$cprlat_odd); |
|
73 | + $j = 59*$cprlat_even - 60*$cprlat_odd + 0.5; |
|
74 | + $lat_even = (360.0/60)*($j%60 + $cprlat_even); |
|
75 | + $lat_odd = (360.0/59)*($j%59 + $cprlat_odd); |
|
76 | 76 | if ($lat_even >= 270) $lat_even = $lat_even - 360; |
77 | 77 | if ($lat_odd >= 270) $lat_odd = $lat_odd - 360; |
78 | 78 | // check latitude zone |
79 | 79 | if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) { |
80 | 80 | if ($this::$latlon[$icao]['created'] > time()) { |
81 | - $ni = $this->cprN($lat_even,0); |
|
82 | - $m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5); |
|
83 | - $lon = (360.0/$ni)*($m%$ni+$cprlon_even); |
|
81 | + $ni = $this->cprN($lat_even, 0); |
|
82 | + $m = floor($cprlon_even*($this->cprNL($lat_even) - 1) - $cprlon_odd*$this->cprNL($lat_even) + 0.5); |
|
83 | + $lon = (360.0/$ni)*($m%$ni + $cprlon_even); |
|
84 | 84 | $lat = $lat_even; |
85 | - if ($lon > 180) $lon = $lon -360; |
|
85 | + if ($lon > 180) $lon = $lon - 360; |
|
86 | 86 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
87 | 87 | //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon; |
88 | 88 | $data['latitude'] = $lat; |
89 | 89 | $data['longitude'] = $lon; |
90 | 90 | } |
91 | 91 | } else { |
92 | - $ni = $this->cprN($lat_odd,1); |
|
93 | - $m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5); |
|
94 | - $lon = (360.0/$ni)*($m%$ni+$cprlon_odd); |
|
92 | + $ni = $this->cprN($lat_odd, 1); |
|
93 | + $m = floor($cprlon_even*($this->cprNL($lat_odd) - 1) - $cprlon_odd*$this->cprNL($lat_odd) + 0.5); |
|
94 | + $lon = (360.0/$ni)*($m%$ni + $cprlon_odd); |
|
95 | 95 | $lat = $lat_odd; |
96 | - if ($lon > 180) $lon = $lon -360; |
|
96 | + if ($lon > 180) $lon = $lon - 360; |
|
97 | 97 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
98 | 98 | //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n"; |
99 | 99 | $data['latitude'] = $lat; |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | } |
106 | 106 | } elseif ($tc == 19) { |
107 | 107 | // speed & heading |
108 | - $v_ew_dir = intval(substr($bin,45,1)); |
|
109 | - $v_ew = intval(substr($bin,46,10),2); |
|
110 | - $v_ns_dir = intval(substr($bin,56,1)); |
|
111 | - $v_ns = intval(substr($bin,57,10),2); |
|
108 | + $v_ew_dir = intval(substr($bin, 45, 1)); |
|
109 | + $v_ew = intval(substr($bin, 46, 10), 2); |
|
110 | + $v_ns_dir = intval(substr($bin, 56, 1)); |
|
111 | + $v_ns = intval(substr($bin, 57, 10), 2); |
|
112 | 112 | if ($v_ew_dir) $v_ew = -1*$v_ew; |
113 | 113 | if ($v_ns_dir) $v_ns = -1*$v_ns; |
114 | - $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew); |
|
115 | - $heading = atan2($v_ew,$v_ns)*360.0/(2*pi()); |
|
116 | - if ($heading <0) $heading = $heading+360; |
|
114 | + $speed = sqrt($v_ns*$v_ns + $v_ew*$v_ew); |
|
115 | + $heading = atan2($v_ew, $v_ns)*360.0/(2*pi()); |
|
116 | + if ($heading < 0) $heading = $heading + 360; |
|
117 | 117 | $data['speed'] = $speed; |
118 | 118 | $data['heading'] = $heading; |
119 | 119 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * Lookup table to convert the latitude to index. |
129 | 129 | */ |
130 | 130 | private function cprNL($lat) { |
131 | - if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
131 | + if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
132 | 132 | if ($lat < 10.47047130) return 59; |
133 | 133 | if ($lat < 14.82817437) return 58; |
134 | 134 | if ($lat < 18.18626357) return 57; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return 1; |
191 | 191 | } |
192 | 192 | |
193 | - private function cprN($lat,$isodd) { |
|
193 | + private function cprN($lat, $isodd) { |
|
194 | 194 | $nl = $this->cprNL($lat) - $isodd; |
195 | 195 | if ($nl > 1) return $nl; |
196 | 196 | else return 1; |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
215 | 215 | ); |
216 | 216 | $crc = 0; |
217 | - $checksum = intval(substr($msg,22,6),16); |
|
217 | + $checksum = intval(substr($msg, 22, 6), 16); |
|
218 | 218 | for ($j = 0; $j < strlen($bin); $j++) { |
219 | - if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0); |
|
219 | + if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j], 0); |
|
220 | 220 | } |
221 | 221 | if ($crc == $checksum) return true; |
222 | 222 | else { |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | $msg['aircraftid'] = hexdec($data['address']); |
239 | 239 | $msg['hex'] = $data['address']; |
240 | 240 | $msg['flightid'] = hexdec($data['address']); |
241 | - $msg['date_gen'] = date('Y/m/d',$data['timestamp']); |
|
242 | - $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180'; |
|
243 | - $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
|
244 | - $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
|
241 | + $msg['date_gen'] = date('Y/m/d', $data['timestamp']); |
|
242 | + $msg['time_gen'] = date('H:i:s', $data['timestamp']).'.180'; |
|
243 | + $msg['date_log'] = date('Y/m/d', $data['timestamp']); |
|
244 | + $msg['time_log'] = date('H:i:s', $data['timestamp']).'.180'; |
|
245 | 245 | $msg['callsign'] = $data['ident']; |
246 | 246 | $msg['altitude'] = ''; |
247 | 247 | $msg['speed'] = ''; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $msg['emergency'] = ''; |
255 | 255 | $msg['SPI'] = ''; |
256 | 256 | $msg['ground'] = ''; |
257 | - $result[] = implode(',',$msg); |
|
257 | + $result[] = implode(',', $msg); |
|
258 | 258 | } |
259 | 259 | if (isset($data['latitude']) && $data['latitude'] != 0) { |
260 | 260 | $msg = array(); |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | $msg['aircraftid'] = hexdec($data['address']); |
265 | 265 | $msg['hex'] = $data['address']; |
266 | 266 | $msg['flightid'] = hexdec($data['address']); |
267 | - $msg['date_gen'] = date('Y/m/d',$data['timestamp']); |
|
268 | - $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180'; |
|
269 | - $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
|
270 | - $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
|
267 | + $msg['date_gen'] = date('Y/m/d', $data['timestamp']); |
|
268 | + $msg['time_gen'] = date('H:i:s', $data['timestamp']).'.180'; |
|
269 | + $msg['date_log'] = date('Y/m/d', $data['timestamp']); |
|
270 | + $msg['time_log'] = date('H:i:s', $data['timestamp']).'.180'; |
|
271 | 271 | $msg['callsign'] = ''; |
272 | 272 | if (isset($data['altitude'])) $msg['altitude'] = $data['altitude']; |
273 | 273 | else $msg['altitude'] = ''; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $msg['SPI'] = 0; |
286 | 286 | if (isset($data['ground'])) $msg['ground'] = 1; |
287 | 287 | else $msg['ground'] = 0; |
288 | - $result[] = implode(',',$msg); |
|
288 | + $result[] = implode(',', $msg); |
|
289 | 289 | } |
290 | 290 | return $result; |
291 | 291 | } |
@@ -19,9 +19,13 @@ discard block |
||
19 | 19 | // Not yet finished, no CRC checks |
20 | 20 | $data = array(); |
21 | 21 | $typehex = substr($buffer,0,1); |
22 | - if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1,-1); |
|
23 | - elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13); |
|
24 | - else $hex = substr($buffer,1,-1); |
|
22 | + if ($typehex == '*' || $typehex == ':') { |
|
23 | + $hex = substr($buffer,1,-1); |
|
24 | + } elseif ($typehex == '@' || $typehex == '%') { |
|
25 | + $hex = substr($buffer,13,-13); |
|
26 | + } else { |
|
27 | + $hex = substr($buffer,1,-1); |
|
28 | + } |
|
25 | 29 | $bin = gmp_strval( gmp_init($hex,16), 2); |
26 | 30 | //if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) { |
27 | 31 | if (strlen($hex) == 28) { |
@@ -64,8 +68,9 @@ discard block |
||
64 | 68 | // 131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits. |
65 | 69 | $cprlat = intval(substr($bin,54,17),2)/131072.0; |
66 | 70 | $cprlon = intval(substr($bin,71,17),2)/131072.0; |
67 | - if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
68 | - elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
|
71 | + if ($oe == 0) { |
|
72 | + $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
73 | + } elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
|
69 | 74 | $cprlat_odd = $cprlat; |
70 | 75 | $cprlon_odd = $cprlon; |
71 | 76 | $cprlat_even = $this::$latlon[$icao]['latitude']; |
@@ -73,8 +78,12 @@ discard block |
||
73 | 78 | $j = 59*$cprlat_even-60*$cprlat_odd+0.5; |
74 | 79 | $lat_even = (360.0/60)*($j%60+$cprlat_even); |
75 | 80 | $lat_odd = (360.0/59)*($j%59+$cprlat_odd); |
76 | - if ($lat_even >= 270) $lat_even = $lat_even - 360; |
|
77 | - if ($lat_odd >= 270) $lat_odd = $lat_odd - 360; |
|
81 | + if ($lat_even >= 270) { |
|
82 | + $lat_even = $lat_even - 360; |
|
83 | + } |
|
84 | + if ($lat_odd >= 270) { |
|
85 | + $lat_odd = $lat_odd - 360; |
|
86 | + } |
|
78 | 87 | // check latitude zone |
79 | 88 | if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) { |
80 | 89 | if ($this::$latlon[$icao]['created'] > time()) { |
@@ -82,7 +91,9 @@ discard block |
||
82 | 91 | $m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5); |
83 | 92 | $lon = (360.0/$ni)*($m%$ni+$cprlon_even); |
84 | 93 | $lat = $lat_even; |
85 | - if ($lon > 180) $lon = $lon -360; |
|
94 | + if ($lon > 180) { |
|
95 | + $lon = $lon -360; |
|
96 | + } |
|
86 | 97 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
87 | 98 | //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon; |
88 | 99 | $data['latitude'] = $lat; |
@@ -93,14 +104,18 @@ discard block |
||
93 | 104 | $m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5); |
94 | 105 | $lon = (360.0/$ni)*($m%$ni+$cprlon_odd); |
95 | 106 | $lat = $lat_odd; |
96 | - if ($lon > 180) $lon = $lon -360; |
|
107 | + if ($lon > 180) { |
|
108 | + $lon = $lon -360; |
|
109 | + } |
|
97 | 110 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
98 | 111 | //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n"; |
99 | 112 | $data['latitude'] = $lat; |
100 | 113 | $data['longitude'] = $lon; |
101 | 114 | } |
102 | 115 | } |
103 | - } else echo "Not cprNL"; |
|
116 | + } else { |
|
117 | + echo "Not cprNL"; |
|
118 | + } |
|
104 | 119 | unset($this::$latlon[$icao]); |
105 | 120 | } |
106 | 121 | } elseif ($tc == 19) { |
@@ -109,11 +124,17 @@ discard block |
||
109 | 124 | $v_ew = intval(substr($bin,46,10),2); |
110 | 125 | $v_ns_dir = intval(substr($bin,56,1)); |
111 | 126 | $v_ns = intval(substr($bin,57,10),2); |
112 | - if ($v_ew_dir) $v_ew = -1*$v_ew; |
|
113 | - if ($v_ns_dir) $v_ns = -1*$v_ns; |
|
127 | + if ($v_ew_dir) { |
|
128 | + $v_ew = -1*$v_ew; |
|
129 | + } |
|
130 | + if ($v_ns_dir) { |
|
131 | + $v_ns = -1*$v_ns; |
|
132 | + } |
|
114 | 133 | $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew); |
115 | 134 | $heading = atan2($v_ew,$v_ns)*360.0/(2*pi()); |
116 | - if ($heading <0) $heading = $heading+360; |
|
135 | + if ($heading <0) { |
|
136 | + $heading = $heading+360; |
|
137 | + } |
|
117 | 138 | $data['speed'] = $speed; |
118 | 139 | $data['heading'] = $heading; |
119 | 140 | } |
@@ -128,72 +149,194 @@ discard block |
||
128 | 149 | * Lookup table to convert the latitude to index. |
129 | 150 | */ |
130 | 151 | private function cprNL($lat) { |
131 | - if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
132 | - if ($lat < 10.47047130) return 59; |
|
133 | - if ($lat < 14.82817437) return 58; |
|
134 | - if ($lat < 18.18626357) return 57; |
|
135 | - if ($lat < 21.02939493) return 56; |
|
136 | - if ($lat < 23.54504487) return 55; |
|
137 | - if ($lat < 25.82924707) return 54; |
|
138 | - if ($lat < 27.93898710) return 53; |
|
139 | - if ($lat < 29.91135686) return 52; |
|
140 | - if ($lat < 31.77209708) return 51; |
|
141 | - if ($lat < 33.53993436) return 50; |
|
142 | - if ($lat < 35.22899598) return 49; |
|
143 | - if ($lat < 36.85025108) return 48; |
|
144 | - if ($lat < 38.41241892) return 47; |
|
145 | - if ($lat < 39.92256684) return 46; |
|
146 | - if ($lat < 41.38651832) return 45; |
|
147 | - if ($lat < 42.80914012) return 44; |
|
148 | - if ($lat < 44.19454951) return 43; |
|
149 | - if ($lat < 45.54626723) return 42; |
|
150 | - if ($lat < 46.86733252) return 41; |
|
151 | - if ($lat < 48.16039128) return 40; |
|
152 | - if ($lat < 49.42776439) return 39; |
|
153 | - if ($lat < 50.67150166) return 38; |
|
154 | - if ($lat < 51.89342469) return 37; |
|
155 | - if ($lat < 53.09516153) return 36; |
|
156 | - if ($lat < 54.27817472) return 35; |
|
157 | - if ($lat < 55.44378444) return 34; |
|
158 | - if ($lat < 56.59318756) return 33; |
|
159 | - if ($lat < 57.72747354) return 32; |
|
160 | - if ($lat < 58.84763776) return 31; |
|
161 | - if ($lat < 59.95459277) return 30; |
|
162 | - if ($lat < 61.04917774) return 29; |
|
163 | - if ($lat < 62.13216659) return 28; |
|
164 | - if ($lat < 63.20427479) return 27; |
|
165 | - if ($lat < 64.26616523) return 26; |
|
166 | - if ($lat < 65.31845310) return 25; |
|
167 | - if ($lat < 66.36171008) return 24; |
|
168 | - if ($lat < 67.39646774) return 23; |
|
169 | - if ($lat < 68.42322022) return 22; |
|
170 | - if ($lat < 69.44242631) return 21; |
|
171 | - if ($lat < 70.45451075) return 20; |
|
172 | - if ($lat < 71.45986473) return 19; |
|
173 | - if ($lat < 72.45884545) return 18; |
|
174 | - if ($lat < 73.45177442) return 17; |
|
175 | - if ($lat < 74.43893416) return 16; |
|
176 | - if ($lat < 75.42056257) return 15; |
|
177 | - if ($lat < 76.39684391) return 14; |
|
178 | - if ($lat < 77.36789461) return 13; |
|
179 | - if ($lat < 78.33374083) return 12; |
|
180 | - if ($lat < 79.29428225) return 11; |
|
181 | - if ($lat < 80.24923213) return 10; |
|
182 | - if ($lat < 81.19801349) return 9; |
|
183 | - if ($lat < 82.13956981) return 8; |
|
184 | - if ($lat < 83.07199445) return 7; |
|
185 | - if ($lat < 83.99173563) return 6; |
|
186 | - if ($lat < 84.89166191) return 5; |
|
187 | - if ($lat < 85.75541621) return 4; |
|
188 | - if ($lat < 86.53536998) return 3; |
|
189 | - if ($lat < 87.00000000) return 2; |
|
152 | + if ($lat < 0) { |
|
153 | + $lat = -$lat; |
|
154 | + } |
|
155 | + // Table is simmetric about the equator. |
|
156 | + if ($lat < 10.47047130) { |
|
157 | + return 59; |
|
158 | + } |
|
159 | + if ($lat < 14.82817437) { |
|
160 | + return 58; |
|
161 | + } |
|
162 | + if ($lat < 18.18626357) { |
|
163 | + return 57; |
|
164 | + } |
|
165 | + if ($lat < 21.02939493) { |
|
166 | + return 56; |
|
167 | + } |
|
168 | + if ($lat < 23.54504487) { |
|
169 | + return 55; |
|
170 | + } |
|
171 | + if ($lat < 25.82924707) { |
|
172 | + return 54; |
|
173 | + } |
|
174 | + if ($lat < 27.93898710) { |
|
175 | + return 53; |
|
176 | + } |
|
177 | + if ($lat < 29.91135686) { |
|
178 | + return 52; |
|
179 | + } |
|
180 | + if ($lat < 31.77209708) { |
|
181 | + return 51; |
|
182 | + } |
|
183 | + if ($lat < 33.53993436) { |
|
184 | + return 50; |
|
185 | + } |
|
186 | + if ($lat < 35.22899598) { |
|
187 | + return 49; |
|
188 | + } |
|
189 | + if ($lat < 36.85025108) { |
|
190 | + return 48; |
|
191 | + } |
|
192 | + if ($lat < 38.41241892) { |
|
193 | + return 47; |
|
194 | + } |
|
195 | + if ($lat < 39.92256684) { |
|
196 | + return 46; |
|
197 | + } |
|
198 | + if ($lat < 41.38651832) { |
|
199 | + return 45; |
|
200 | + } |
|
201 | + if ($lat < 42.80914012) { |
|
202 | + return 44; |
|
203 | + } |
|
204 | + if ($lat < 44.19454951) { |
|
205 | + return 43; |
|
206 | + } |
|
207 | + if ($lat < 45.54626723) { |
|
208 | + return 42; |
|
209 | + } |
|
210 | + if ($lat < 46.86733252) { |
|
211 | + return 41; |
|
212 | + } |
|
213 | + if ($lat < 48.16039128) { |
|
214 | + return 40; |
|
215 | + } |
|
216 | + if ($lat < 49.42776439) { |
|
217 | + return 39; |
|
218 | + } |
|
219 | + if ($lat < 50.67150166) { |
|
220 | + return 38; |
|
221 | + } |
|
222 | + if ($lat < 51.89342469) { |
|
223 | + return 37; |
|
224 | + } |
|
225 | + if ($lat < 53.09516153) { |
|
226 | + return 36; |
|
227 | + } |
|
228 | + if ($lat < 54.27817472) { |
|
229 | + return 35; |
|
230 | + } |
|
231 | + if ($lat < 55.44378444) { |
|
232 | + return 34; |
|
233 | + } |
|
234 | + if ($lat < 56.59318756) { |
|
235 | + return 33; |
|
236 | + } |
|
237 | + if ($lat < 57.72747354) { |
|
238 | + return 32; |
|
239 | + } |
|
240 | + if ($lat < 58.84763776) { |
|
241 | + return 31; |
|
242 | + } |
|
243 | + if ($lat < 59.95459277) { |
|
244 | + return 30; |
|
245 | + } |
|
246 | + if ($lat < 61.04917774) { |
|
247 | + return 29; |
|
248 | + } |
|
249 | + if ($lat < 62.13216659) { |
|
250 | + return 28; |
|
251 | + } |
|
252 | + if ($lat < 63.20427479) { |
|
253 | + return 27; |
|
254 | + } |
|
255 | + if ($lat < 64.26616523) { |
|
256 | + return 26; |
|
257 | + } |
|
258 | + if ($lat < 65.31845310) { |
|
259 | + return 25; |
|
260 | + } |
|
261 | + if ($lat < 66.36171008) { |
|
262 | + return 24; |
|
263 | + } |
|
264 | + if ($lat < 67.39646774) { |
|
265 | + return 23; |
|
266 | + } |
|
267 | + if ($lat < 68.42322022) { |
|
268 | + return 22; |
|
269 | + } |
|
270 | + if ($lat < 69.44242631) { |
|
271 | + return 21; |
|
272 | + } |
|
273 | + if ($lat < 70.45451075) { |
|
274 | + return 20; |
|
275 | + } |
|
276 | + if ($lat < 71.45986473) { |
|
277 | + return 19; |
|
278 | + } |
|
279 | + if ($lat < 72.45884545) { |
|
280 | + return 18; |
|
281 | + } |
|
282 | + if ($lat < 73.45177442) { |
|
283 | + return 17; |
|
284 | + } |
|
285 | + if ($lat < 74.43893416) { |
|
286 | + return 16; |
|
287 | + } |
|
288 | + if ($lat < 75.42056257) { |
|
289 | + return 15; |
|
290 | + } |
|
291 | + if ($lat < 76.39684391) { |
|
292 | + return 14; |
|
293 | + } |
|
294 | + if ($lat < 77.36789461) { |
|
295 | + return 13; |
|
296 | + } |
|
297 | + if ($lat < 78.33374083) { |
|
298 | + return 12; |
|
299 | + } |
|
300 | + if ($lat < 79.29428225) { |
|
301 | + return 11; |
|
302 | + } |
|
303 | + if ($lat < 80.24923213) { |
|
304 | + return 10; |
|
305 | + } |
|
306 | + if ($lat < 81.19801349) { |
|
307 | + return 9; |
|
308 | + } |
|
309 | + if ($lat < 82.13956981) { |
|
310 | + return 8; |
|
311 | + } |
|
312 | + if ($lat < 83.07199445) { |
|
313 | + return 7; |
|
314 | + } |
|
315 | + if ($lat < 83.99173563) { |
|
316 | + return 6; |
|
317 | + } |
|
318 | + if ($lat < 84.89166191) { |
|
319 | + return 5; |
|
320 | + } |
|
321 | + if ($lat < 85.75541621) { |
|
322 | + return 4; |
|
323 | + } |
|
324 | + if ($lat < 86.53536998) { |
|
325 | + return 3; |
|
326 | + } |
|
327 | + if ($lat < 87.00000000) { |
|
328 | + return 2; |
|
329 | + } |
|
190 | 330 | return 1; |
191 | 331 | } |
192 | 332 | |
193 | 333 | private function cprN($lat,$isodd) { |
194 | 334 | $nl = $this->cprNL($lat) - $isodd; |
195 | - if ($nl > 1) return $nl; |
|
196 | - else return 1; |
|
335 | + if ($nl > 1) { |
|
336 | + return $nl; |
|
337 | + } else { |
|
338 | + return 1; |
|
339 | + } |
|
197 | 340 | } |
198 | 341 | |
199 | 342 | private function parityCheck($msg, $bin) { |
@@ -216,10 +359,13 @@ discard block |
||
216 | 359 | $crc = 0; |
217 | 360 | $checksum = intval(substr($msg,22,6),16); |
218 | 361 | for ($j = 0; $j < strlen($bin); $j++) { |
219 | - if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0); |
|
362 | + if ($bin[$j]) { |
|
363 | + $crc = $crc^intval($modes_checksum_table[$j],0); |
|
364 | + } |
|
220 | 365 | } |
221 | - if ($crc == $checksum) return true; |
|
222 | - else { |
|
366 | + if ($crc == $checksum) { |
|
367 | + return true; |
|
368 | + } else { |
|
223 | 369 | //echo "**** CRC ERROR ****\n"; |
224 | 370 | return false; |
225 | 371 | } |
@@ -269,22 +415,37 @@ discard block |
||
269 | 415 | $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
270 | 416 | $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
271 | 417 | $msg['callsign'] = ''; |
272 | - if (isset($data['altitude'])) $msg['altitude'] = $data['altitude']; |
|
273 | - else $msg['altitude'] = ''; |
|
418 | + if (isset($data['altitude'])) { |
|
419 | + $msg['altitude'] = $data['altitude']; |
|
420 | + } else { |
|
421 | + $msg['altitude'] = ''; |
|
422 | + } |
|
274 | 423 | $msg['speed'] = $data['speed']; |
275 | - if (isset($data['heading'])) $msg['track'] = $data['heading']; |
|
276 | - else $msg['track'] = ''; |
|
424 | + if (isset($data['heading'])) { |
|
425 | + $msg['track'] = $data['heading']; |
|
426 | + } else { |
|
427 | + $msg['track'] = ''; |
|
428 | + } |
|
277 | 429 | $msg['latitude'] = $data['latitude']; |
278 | 430 | $msg['longitude'] = $data['longitude']; |
279 | - if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate']; |
|
280 | - else $msg['verticalrate'] = ''; |
|
281 | - if (isset($data['squawk'])) $msg['squawk'] = $data['squawk']; |
|
282 | - else $msg['squawk'] = 0; |
|
431 | + if (isset($data['verticalrate'])) { |
|
432 | + $msg['verticalrate'] = $data['verticalrate']; |
|
433 | + } else { |
|
434 | + $msg['verticalrate'] = ''; |
|
435 | + } |
|
436 | + if (isset($data['squawk'])) { |
|
437 | + $msg['squawk'] = $data['squawk']; |
|
438 | + } else { |
|
439 | + $msg['squawk'] = 0; |
|
440 | + } |
|
283 | 441 | $msg['alert'] = 0; |
284 | 442 | $msg['emergency'] = 0; |
285 | 443 | $msg['SPI'] = 0; |
286 | - if (isset($data['ground'])) $msg['ground'] = 1; |
|
287 | - else $msg['ground'] = 0; |
|
444 | + if (isset($data['ground'])) { |
|
445 | + $msg['ground'] = 1; |
|
446 | + } else { |
|
447 | + $msg['ground'] = 0; |
|
448 | + } |
|
288 | 449 | $result[] = implode(',',$msg); |
289 | 450 | } |
290 | 451 | return $result; |
@@ -14,35 +14,35 @@ discard block |
||
14 | 14 | public $db; |
15 | 15 | |
16 | 16 | protected $texts = Array( |
17 | - 'MI' => 'Shallow', |
|
18 | - 'PR' => 'Partial', |
|
19 | - 'BC' => 'Low drifting', |
|
20 | - 'BL' => 'Blowing', |
|
21 | - 'SH' => 'Showers', |
|
22 | - 'TS' => 'Thunderstorm', |
|
23 | - 'FZ' => 'Freezing', |
|
24 | - 'DZ' => 'Drizzle', |
|
25 | - 'RA' => 'Rain', |
|
26 | - 'SN' => 'Snow', |
|
27 | - 'SG' => 'Snow Grains', |
|
28 | - 'IC' => 'Ice crystals', |
|
29 | - 'PL' => 'Ice pellets', |
|
30 | - 'GR' => 'Hail', |
|
31 | - 'GS' => 'Small hail', |
|
32 | - 'UP' => 'Unknown', |
|
33 | - 'BR' => 'Mist', |
|
34 | - 'FG' => 'Fog', |
|
35 | - 'FU' => 'Smoke', |
|
36 | - 'VA' => 'Volcanic ash', |
|
37 | - 'DU' => 'Widespread dust', |
|
38 | - 'SA' => 'Sand', |
|
39 | - 'HZ' => 'Haze', |
|
40 | - 'PY' => 'Spray', |
|
41 | - 'PO' => 'Well developed dust / sand whirls', |
|
42 | - 'SQ' => 'Squalls', |
|
43 | - 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | - 'SS' => 'Sandstorm', |
|
45 | - 'DS' => 'Duststorm' |
|
17 | + 'MI' => 'Shallow', |
|
18 | + 'PR' => 'Partial', |
|
19 | + 'BC' => 'Low drifting', |
|
20 | + 'BL' => 'Blowing', |
|
21 | + 'SH' => 'Showers', |
|
22 | + 'TS' => 'Thunderstorm', |
|
23 | + 'FZ' => 'Freezing', |
|
24 | + 'DZ' => 'Drizzle', |
|
25 | + 'RA' => 'Rain', |
|
26 | + 'SN' => 'Snow', |
|
27 | + 'SG' => 'Snow Grains', |
|
28 | + 'IC' => 'Ice crystals', |
|
29 | + 'PL' => 'Ice pellets', |
|
30 | + 'GR' => 'Hail', |
|
31 | + 'GS' => 'Small hail', |
|
32 | + 'UP' => 'Unknown', |
|
33 | + 'BR' => 'Mist', |
|
34 | + 'FG' => 'Fog', |
|
35 | + 'FU' => 'Smoke', |
|
36 | + 'VA' => 'Volcanic ash', |
|
37 | + 'DU' => 'Widespread dust', |
|
38 | + 'SA' => 'Sand', |
|
39 | + 'HZ' => 'Haze', |
|
40 | + 'PY' => 'Spray', |
|
41 | + 'PO' => 'Well developed dust / sand whirls', |
|
42 | + 'SQ' => 'Squalls', |
|
43 | + 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | + 'SS' => 'Sandstorm', |
|
45 | + 'DS' => 'Duststorm' |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | /* |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg'; |
178 | 178 | */ |
179 | 179 | } |
180 | - /* |
|
180 | + /* |
|
181 | 181 | // Wind Direction |
182 | 182 | if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) { |
183 | 183 | $result['wind_direction'] = $matches[1]; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $result['speed_variable'] = $matches[1]; |
189 | 189 | } |
190 | 190 | */ |
191 | - // Visibility |
|
191 | + // Visibility |
|
192 | 192 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
193 | 193 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
194 | 194 | $result['visibility'] = (float)$matches[3] * 1609.34; |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
247 | 247 | if (isset($matches[3])) { |
248 | 248 | $range = Array( |
249 | - 'from' => (float)$matches[2], |
|
250 | - 'to' => (float)$matches[4], |
|
251 | - 'unit' => $matches[5] ? 'FT' : 'M' |
|
249 | + 'from' => (float)$matches[2], |
|
250 | + 'to' => (float)$matches[4], |
|
251 | + 'unit' => $matches[5] ? 'FT' : 'M' |
|
252 | 252 | ); |
253 | 253 | } |
254 | 254 | $result['RVR'] = $matches[1]; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $Connection = new Connection(); |
69 | 69 | $sth = $Connection->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error : ".$e->getMessage(); |
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $Connection = new Connection(); |
88 | 88 | $sth = $Connection->db->prepare($query); |
89 | 89 | $sth->execute(); |
90 | - } catch(PDOException $e) { |
|
90 | + } catch (PDOException $e) { |
|
91 | 91 | return "error : ".$e->getMessage(); |
92 | 92 | } |
93 | 93 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | public function parse($data) { |
101 | 101 | //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
102 | 102 | $codes = implode('|', array_keys($this->texts)); |
103 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
103 | + $regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#'; |
|
104 | 104 | //$pieces = explode(' ',$data); |
105 | - $pieces = preg_split('/\s/',$data); |
|
105 | + $pieces = preg_split('/\s/', $data); |
|
106 | 106 | $pos = 0; |
107 | 107 | if ($pieces[0] == 'METAR') $pos++; |
108 | 108 | elseif ($pieces[0] == 'SPECI') $pos++; |
@@ -112,25 +112,25 @@ discard block |
||
112 | 112 | $result['location'] = $pieces[$pos]; |
113 | 113 | $pos++; |
114 | 114 | if (!isset($pieces[$pos])) return $result; |
115 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
116 | - $result['time'] = substr($pieces[$pos],2,4); |
|
115 | + $result['dayofmonth'] = substr($pieces[$pos], 0, 2); |
|
116 | + $result['time'] = substr($pieces[$pos], 2, 4); |
|
117 | 117 | $c = count($pieces); |
118 | - for($pos++; $pos < $c; $pos++) { |
|
118 | + for ($pos++; $pos < $c; $pos++) { |
|
119 | 119 | $piece = $pieces[$pos]; |
120 | 120 | if ($piece == 'RMK') break; |
121 | 121 | if ($piece == 'AUTO') $result['auto'] = true; |
122 | 122 | if ($piece == 'COR') $result['correction'] = true; |
123 | 123 | // Wind Speed |
124 | 124 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | - $result['wind']['direction'] = (float)$matches[1]; |
|
125 | + $result['wind']['direction'] = (float) $matches[1]; |
|
126 | 126 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
130 | - $result['wind']['gust'] = (float)$matches[3]; |
|
127 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2); |
|
128 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2); |
|
129 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2); |
|
130 | + $result['wind']['gust'] = (float) $matches[3]; |
|
131 | 131 | $result['wind']['unit'] = $matches[4]; |
132 | - $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
|
133 | - $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
|
132 | + $result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0; |
|
133 | + $result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | |
152 | 152 | // Temperature |
153 | 153 | if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
154 | - $temp = (float)$matches[1]; |
|
154 | + $temp = (float) $matches[1]; |
|
155 | 155 | if ($matches[1]{0} == 'M') { |
156 | - $temp = ((float)substr($matches[1], 1)) * -1; |
|
156 | + $temp = ((float) substr($matches[1], 1))*-1; |
|
157 | 157 | } |
158 | 158 | $result['temperature'] = $temp; |
159 | - $dew = (float)$matches[2]; |
|
159 | + $dew = (float) $matches[2]; |
|
160 | 160 | if ($matches[2]{0} == 'M') { |
161 | - $dew = ((float)substr($matches[2], 1)) * -1; |
|
161 | + $dew = ((float) substr($matches[2], 1))*-1; |
|
162 | 162 | } |
163 | 163 | $result['dew'] = $dew; |
164 | 164 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $result['QNH'] = $matches[2]; |
171 | 171 | } else { |
172 | 172 | // inHg |
173 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
173 | + $result['QNH'] = round(($matches[2]/100)*33.86389, 2); |
|
174 | 174 | } |
175 | 175 | /* |
176 | 176 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | // Visibility |
192 | 192 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
193 | 193 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
194 | - $result['visibility'] = (float)$matches[3] * 1609.34; |
|
194 | + $result['visibility'] = (float) $matches[3]*1609.34; |
|
195 | 195 | } else { |
196 | 196 | if ($matches[1] == '9999') { |
197 | 197 | $result['visibility'] = '> 10000'; |
198 | 198 | } else { |
199 | - $result['visibility'] = (float)$matches[1]; |
|
199 | + $result['visibility'] = (float) $matches[1]; |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | if (preg_match('#^CAVOK$#', $piece, $matches)) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
219 | 219 | elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
220 | 220 | $cloud['type_code'] = $type; |
221 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
221 | + $cloud['level'] = round(((float) $matches[2])*100*0.3048); |
|
222 | 222 | $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
223 | 223 | $result['cloud'][] = $cloud; |
224 | 224 | } |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $rvr['runway'] = $matches[1]; |
229 | 229 | $rvr['assessment'] = $matches[2]; |
230 | 230 | $rvr['rvr'] = $matches[3]; |
231 | - $rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0; |
|
232 | - $rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : ''; |
|
231 | + $rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0; |
|
232 | + $rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : ''; |
|
233 | 233 | $result['RVR'] = $rvr; |
234 | 234 | } |
235 | 235 | //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | $result['RVR']['friction'] = $matches[5]; |
243 | 243 | } |
244 | 244 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
245 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
246 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
245 | + if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
246 | + else $range = array('exact' => (float) $matches[2], 'unit' => 'M'); |
|
247 | 247 | if (isset($matches[3])) { |
248 | 248 | $range = Array( |
249 | - 'from' => (float)$matches[2], |
|
250 | - 'to' => (float)$matches[4], |
|
249 | + 'from' => (float) $matches[2], |
|
250 | + 'to' => (float) $matches[4], |
|
251 | 251 | 'unit' => $matches[5] ? 'FT' : 'M' |
252 | 252 | ); |
253 | 253 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | try { |
301 | 301 | $sth = $this->db->prepare($query); |
302 | 302 | $sth->execute($query_values); |
303 | - } catch(PDOException $e) { |
|
303 | + } catch (PDOException $e) { |
|
304 | 304 | return "error : ".$e->getMessage(); |
305 | 305 | } |
306 | 306 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -316,19 +316,19 @@ discard block |
||
316 | 316 | * @param String $metar METAR text |
317 | 317 | * @param String $date date of the METAR |
318 | 318 | */ |
319 | - public function addMETAR($location,$metar,$date) { |
|
319 | + public function addMETAR($location, $metar, $date) { |
|
320 | 320 | global $globalDBdriver; |
321 | - $date = date('Y-m-d H:i:s',strtotime($date)); |
|
321 | + $date = date('Y-m-d H:i:s', strtotime($date)); |
|
322 | 322 | if ($globalDBdriver == 'mysql') { |
323 | 323 | $query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar"; |
324 | 324 | } else { |
325 | 325 | $query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);"; |
326 | 326 | } |
327 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
327 | + $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar)); |
|
328 | 328 | try { |
329 | 329 | $sth = $this->db->prepare($query); |
330 | 330 | $sth->execute($query_values); |
331 | - } catch(PDOException $e) { |
|
331 | + } catch (PDOException $e) { |
|
332 | 332 | return "error : ".$e->getMessage(); |
333 | 333 | } |
334 | 334 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | try { |
344 | 344 | $sth = $this->db->prepare($query); |
345 | 345 | $sth->execute($query_values); |
346 | - } catch(PDOException $e) { |
|
346 | + } catch (PDOException $e) { |
|
347 | 347 | return "error : ".$e->getMessage(); |
348 | 348 | } |
349 | 349 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | try { |
357 | 357 | $sth = $this->db->prepare($query); |
358 | 358 | $sth->execute(); |
359 | - } catch(PDOException $e) { |
|
359 | + } catch (PDOException $e) { |
|
360 | 360 | return "error : ".$e->getMessage(); |
361 | 361 | } |
362 | 362 | } |
@@ -370,27 +370,27 @@ discard block |
||
370 | 370 | date_default_timezone_set("UTC"); |
371 | 371 | $Common = new Common(); |
372 | 372 | if (isset($globalIVAO) && $globalIVAO) { |
373 | - $Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
374 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
373 | + $Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
374 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r"); |
|
375 | 375 | } else { |
376 | - $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
377 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
376 | + $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
377 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r"); |
|
378 | 378 | } |
379 | 379 | if ($handle) { |
380 | 380 | if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
381 | 381 | $date = ''; |
382 | 382 | if ($globalTransaction) $this->db->beginTransaction(); |
383 | - while(($line = fgets($handle,4096)) !== false) { |
|
384 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
383 | + while (($line = fgets($handle, 4096)) !== false) { |
|
384 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
385 | 385 | $date = $line; |
386 | 386 | } elseif ($line != '') { |
387 | 387 | if ($date == '') $date = date('Y/m/d H:m'); |
388 | 388 | $pos = 0; |
389 | - $pieces = preg_split('/\s/',$line); |
|
389 | + $pieces = preg_split('/\s/', $line); |
|
390 | 390 | if ($pieces[0] == 'METAR') $pos++; |
391 | 391 | if (strlen($pieces[$pos]) != 4) $pos++; |
392 | 392 | $location = $pieces[$pos]; |
393 | - echo $this->addMETAR($location,$line,$date); |
|
393 | + echo $this->addMETAR($location, $line, $date); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | fclose($handle); |
@@ -409,22 +409,22 @@ discard block |
||
409 | 409 | if ($globalMETARurl == '') return array(); |
410 | 410 | date_default_timezone_set("UTC"); |
411 | 411 | $Common = new Common(); |
412 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
412 | + $url = str_replace('{icao}', $icao, $globalMETARurl); |
|
413 | 413 | $cycle = $Common->getData($url); |
414 | 414 | $date = ''; |
415 | - foreach(explode("\n",$cycle) as $line) { |
|
416 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
415 | + foreach (explode("\n", $cycle) as $line) { |
|
416 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
417 | 417 | $date = $line; |
418 | 418 | } |
419 | 419 | if ($line != '') { |
420 | 420 | if ($date == '') $date = date('Y/m/d H:m'); |
421 | 421 | $pos = 0; |
422 | - $pieces = preg_split('/\s/',$line); |
|
422 | + $pieces = preg_split('/\s/', $line); |
|
423 | 423 | if ($pieces[0] == 'METAR') $pos++; |
424 | 424 | if (strlen($pieces[$pos]) != 4) $pos++; |
425 | 425 | $location = $pieces[$pos]; |
426 | 426 | if (strlen($location == 4)) { |
427 | - $this->addMETAR($location,$line,$date); |
|
427 | + $this->addMETAR($location, $line, $date); |
|
428 | 428 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
429 | 429 | } else return array(); |
430 | 430 | } |
@@ -73,8 +73,11 @@ discard block |
||
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
75 | 75 | $sth->closeCursor(); |
76 | - if ($row['nb'] > 0) return false; |
|
77 | - else return true; |
|
76 | + if ($row['nb'] > 0) { |
|
77 | + return false; |
|
78 | + } else { |
|
79 | + return true; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | /* |
@@ -104,29 +107,48 @@ discard block |
||
104 | 107 | //$pieces = explode(' ',$data); |
105 | 108 | $pieces = preg_split('/\s/',$data); |
106 | 109 | $pos = 0; |
107 | - if ($pieces[0] == 'METAR') $pos++; |
|
108 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
109 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
110 | + if ($pieces[0] == 'METAR') { |
|
111 | + $pos++; |
|
112 | + } elseif ($pieces[0] == 'SPECI') { |
|
113 | + $pos++; |
|
114 | + } |
|
115 | + if (strlen($pieces[$pos]) != 4) { |
|
116 | + $pos++; |
|
117 | + } |
|
110 | 118 | $result = array(); |
111 | - if (!isset($pieces[$pos])) return $result; |
|
119 | + if (!isset($pieces[$pos])) { |
|
120 | + return $result; |
|
121 | + } |
|
112 | 122 | $result['location'] = $pieces[$pos]; |
113 | 123 | $pos++; |
114 | - if (!isset($pieces[$pos])) return $result; |
|
124 | + if (!isset($pieces[$pos])) { |
|
125 | + return $result; |
|
126 | + } |
|
115 | 127 | $result['dayofmonth'] = substr($pieces[$pos],0,2); |
116 | 128 | $result['time'] = substr($pieces[$pos],2,4); |
117 | 129 | $c = count($pieces); |
118 | 130 | for($pos++; $pos < $c; $pos++) { |
119 | 131 | $piece = $pieces[$pos]; |
120 | - if ($piece == 'RMK') break; |
|
121 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
122 | - if ($piece == 'COR') $result['correction'] = true; |
|
132 | + if ($piece == 'RMK') { |
|
133 | + break; |
|
134 | + } |
|
135 | + if ($piece == 'AUTO') { |
|
136 | + $result['auto'] = true; |
|
137 | + } |
|
138 | + if ($piece == 'COR') { |
|
139 | + $result['correction'] = true; |
|
140 | + } |
|
123 | 141 | // Wind Speed |
124 | 142 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | 143 | $result['wind']['direction'] = (float)$matches[1]; |
126 | 144 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
145 | + if ($result['wind']['unit'] == 'KT') { |
|
146 | + $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
147 | + } elseif ($result['wind']['unit'] == 'KPH') { |
|
148 | + $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
149 | + } elseif ($result['wind']['unit'] == 'MPS') { |
|
150 | + $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
151 | + } |
|
130 | 152 | $result['wind']['gust'] = (float)$matches[3]; |
131 | 153 | $result['wind']['unit'] = $matches[4]; |
132 | 154 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
@@ -209,14 +231,23 @@ discard block |
||
209 | 231 | //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
210 | 232 | $type = $matches[1]; |
211 | 233 | $cloud = array(); |
212 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
213 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
214 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
215 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
216 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
217 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
218 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
219 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
234 | + if ($type == 'SKC') { |
|
235 | + $cloud['type'] = 'No cloud/Sky clear'; |
|
236 | + } elseif ($type == 'CLR') { |
|
237 | + $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
238 | + } elseif ($type == 'NSC') { |
|
239 | + $cloud['type'] = 'No significant cloud'; |
|
240 | + } elseif ($type == 'FEW') { |
|
241 | + $cloud['type'] = 'Few'; |
|
242 | + } elseif ($type == 'SCT') { |
|
243 | + $cloud['type'] = 'Scattered'; |
|
244 | + } elseif ($type == 'BKN') { |
|
245 | + $cloud['type'] = 'Broken'; |
|
246 | + } elseif ($type == 'OVC') { |
|
247 | + $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
248 | + } elseif ($type == 'VV') { |
|
249 | + $cloud['type'] = 'Vertical visibility'; |
|
250 | + } |
|
220 | 251 | $cloud['type_code'] = $type; |
221 | 252 | $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
222 | 253 | $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
@@ -242,8 +273,11 @@ discard block |
||
242 | 273 | $result['RVR']['friction'] = $matches[5]; |
243 | 274 | } |
244 | 275 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
245 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
246 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
276 | + if (isset($matches[5])) { |
|
277 | + $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
278 | + } else { |
|
279 | + $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
280 | + } |
|
247 | 281 | if (isset($matches[3])) { |
248 | 282 | $range = Array( |
249 | 283 | 'from' => (float)$matches[2], |
@@ -276,8 +310,11 @@ discard block |
||
276 | 310 | if (isset($matches[3])) { |
277 | 311 | $text[] = $this->texts[$matches[3]]; |
278 | 312 | } |
279 | - if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
|
280 | - else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
313 | + if (!isset($result['weather'])) { |
|
314 | + $result['weather'] = implode(' ', $text); |
|
315 | + } else { |
|
316 | + $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
317 | + } |
|
281 | 318 | } |
282 | 319 | } |
283 | 320 | return $result; |
@@ -293,8 +330,11 @@ discard block |
||
293 | 330 | if (isset($globalMETARcycle) && $globalMETARcycle) { |
294 | 331 | $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
295 | 332 | } else { |
296 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
297 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
333 | + if ($globalDBdriver == 'mysql') { |
|
334 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
335 | + } else { |
|
336 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
337 | + } |
|
298 | 338 | } |
299 | 339 | $query_values = array(':icao' => $icao); |
300 | 340 | try { |
@@ -366,7 +406,9 @@ discard block |
||
366 | 406 | */ |
367 | 407 | public function addMETARCycle() { |
368 | 408 | global $globalDebug, $globalIVAO, $globalTransaction; |
369 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
409 | + if (isset($globalDebug) && $globalDebug) { |
|
410 | + echo "Downloading METAR cycle..."; |
|
411 | + } |
|
370 | 412 | date_default_timezone_set("UTC"); |
371 | 413 | $Common = new Common(); |
372 | 414 | if (isset($globalIVAO) && $globalIVAO) { |
@@ -377,26 +419,40 @@ discard block |
||
377 | 419 | $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
378 | 420 | } |
379 | 421 | if ($handle) { |
380 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
422 | + if (isset($globalDebug) && $globalDebug) { |
|
423 | + echo "Done - Updating DB..."; |
|
424 | + } |
|
381 | 425 | $date = ''; |
382 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
426 | + if ($globalTransaction) { |
|
427 | + $this->db->beginTransaction(); |
|
428 | + } |
|
383 | 429 | while(($line = fgets($handle,4096)) !== false) { |
384 | 430 | if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
385 | 431 | $date = $line; |
386 | 432 | } elseif ($line != '') { |
387 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
433 | + if ($date == '') { |
|
434 | + $date = date('Y/m/d H:m'); |
|
435 | + } |
|
388 | 436 | $pos = 0; |
389 | 437 | $pieces = preg_split('/\s/',$line); |
390 | - if ($pieces[0] == 'METAR') $pos++; |
|
391 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
438 | + if ($pieces[0] == 'METAR') { |
|
439 | + $pos++; |
|
440 | + } |
|
441 | + if (strlen($pieces[$pos]) != 4) { |
|
442 | + $pos++; |
|
443 | + } |
|
392 | 444 | $location = $pieces[$pos]; |
393 | 445 | echo $this->addMETAR($location,$line,$date); |
394 | 446 | } |
395 | 447 | } |
396 | 448 | fclose($handle); |
397 | - if ($globalTransaction) $this->db->commit(); |
|
449 | + if ($globalTransaction) { |
|
450 | + $this->db->commit(); |
|
451 | + } |
|
452 | + } |
|
453 | + if (isset($globalDebug) && $globalDebug) { |
|
454 | + echo "Done\n"; |
|
398 | 455 | } |
399 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
400 | 456 | } |
401 | 457 | |
402 | 458 | /* |
@@ -406,7 +462,9 @@ discard block |
||
406 | 462 | */ |
407 | 463 | public function downloadMETAR($icao) { |
408 | 464 | global $globalMETARurl; |
409 | - if ($globalMETARurl == '') return array(); |
|
465 | + if ($globalMETARurl == '') { |
|
466 | + return array(); |
|
467 | + } |
|
410 | 468 | date_default_timezone_set("UTC"); |
411 | 469 | $Common = new Common(); |
412 | 470 | $url = str_replace('{icao}',$icao,$globalMETARurl); |
@@ -417,16 +475,24 @@ discard block |
||
417 | 475 | $date = $line; |
418 | 476 | } |
419 | 477 | if ($line != '') { |
420 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
478 | + if ($date == '') { |
|
479 | + $date = date('Y/m/d H:m'); |
|
480 | + } |
|
421 | 481 | $pos = 0; |
422 | 482 | $pieces = preg_split('/\s/',$line); |
423 | - if ($pieces[0] == 'METAR') $pos++; |
|
424 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
483 | + if ($pieces[0] == 'METAR') { |
|
484 | + $pos++; |
|
485 | + } |
|
486 | + if (strlen($pieces[$pos]) != 4) { |
|
487 | + $pos++; |
|
488 | + } |
|
425 | 489 | $location = $pieces[$pos]; |
426 | 490 | if (strlen($location == 4)) { |
427 | 491 | $this->addMETAR($location,$line,$date); |
428 | 492 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
429 | - } else return array(); |
|
493 | + } else { |
|
494 | + return array(); |
|
495 | + } |
|
430 | 496 | } |
431 | 497 | } |
432 | 498 | return array(); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function parse_xml($url) { |
17 | 17 | $Common = new Common(); |
18 | - $filedata = $Common->getData($url,'get','','','','','','',true); |
|
18 | + $filedata = $Common->getData($url, 'get', '', '', '', '', '', '', true); |
|
19 | 19 | if ($filedata != '' && $filedata !== false) { |
20 | 20 | $xml = simplexml_load_string($filedata); |
21 | 21 | if ($xml !== false) { |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | if ($check_version == '0') { |
87 | 87 | |
88 | 88 | if ($globalDBdriver == 'mysql') { |
89 | - $error .= create_db::import_all_db('../db/'); |
|
89 | + $error .= create_db::import_all_db('../db/'); |
|
90 | 90 | } elseif ($globalDBdriver == 'pgsql') { |
91 | - $error .= create_db::import_all_db('../db/pgsql/'); |
|
91 | + $error .= create_db::import_all_db('../db/pgsql/'); |
|
92 | 92 | } |
93 | 93 | if ($error != '') { |
94 | 94 | $_SESSION['error'] = $error; |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | $_SESSION['install'] = 'populate'; |
99 | 99 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
100 | 100 | } else { |
101 | - $_SESSION['install'] = 'sources'; |
|
102 | - $_SESSION['next'] = 'Insert data in source table'; |
|
101 | + $_SESSION['install'] = 'sources'; |
|
102 | + $_SESSION['next'] = 'Insert data in source table'; |
|
103 | 103 | } |
104 | 104 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
105 | 105 | print json_encode($result); |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
157 | 157 | } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
158 | 158 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
159 | - $_SESSION['install'] = 'notam'; |
|
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']); |
|
162 | - print json_encode($result); |
|
159 | + $_SESSION['install'] = 'notam'; |
|
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']); |
|
162 | + print json_encode($result); |
|
163 | 163 | /* |
164 | 164 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
165 | 165 | $_SESSION['install'] = 'owner'; |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | print json_encode($result); |
170 | 170 | */ |
171 | 171 | } else { |
172 | - $_SESSION['install'] = 'sources'; |
|
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']); |
|
175 | - print json_encode($result); |
|
172 | + $_SESSION['install'] = 'sources'; |
|
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']); |
|
175 | + print json_encode($result); |
|
176 | 176 | } |
177 | 177 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
178 | 178 | if (!is_writable('tmp')) { |
@@ -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,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
81 | + $result = array('error' => $error, '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 ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
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,'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, '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 |
@@ -75,7 +75,9 @@ discard block |
||
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,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -93,7 +95,9 @@ discard block |
||
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 ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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')); |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | <p> |
189 | 189 | <label for="siteurl">Site directory</label> |
190 | 190 | <?php |
191 | - // Try to detect site directory |
|
192 | - if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
191 | + // Try to detect site directory |
|
192 | + if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
193 | 193 | if (isset($_SERVER['REQUEST_URI'])) { |
194 | 194 | $URL = $_SERVER['REQUEST_URI']; |
195 | 195 | $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
196 | 196 | } |
197 | - } |
|
197 | + } |
|
198 | 198 | ?> |
199 | 199 | <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
200 | 200 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
@@ -373,17 +373,17 @@ discard block |
||
373 | 373 | </tr> |
374 | 374 | |
375 | 375 | <?php |
376 | - if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
376 | + if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
377 | 377 | ?> |
378 | 378 | <!-- |
379 | 379 | <?php |
380 | - require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
381 | - $Connection = new Connection(); |
|
380 | + require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
381 | + $Connection = new Connection(); |
|
382 | 382 | ?> |
383 | 383 | --> |
384 | 384 | <?php |
385 | 385 | if ($Connection->db != NULL) { |
386 | - if ($Connection->tableExists('source_location')) { |
|
386 | + if ($Connection->tableExists('source_location')) { |
|
387 | 387 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
388 | 388 | $Source = new Source(); |
389 | 389 | //$alllocations = $Source->getAllLocationInfo(); |
@@ -403,9 +403,9 @@ discard block |
||
403 | 403 | |
404 | 404 | <?php |
405 | 405 | } |
406 | - } |
|
406 | + } |
|
407 | + } |
|
407 | 408 | } |
408 | - } |
|
409 | 409 | ?> |
410 | 410 | |
411 | 411 | <tr> |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | ?> |
516 | 516 | <tr> |
517 | 517 | <?php |
518 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
518 | + if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
519 | 519 | ?> |
520 | 520 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
521 | 521 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
522 | 522 | <?php |
523 | - } else { |
|
523 | + } else { |
|
524 | 524 | $hostport = explode(':',$source['host']); |
525 | 525 | if (isset($hostport[1])) { |
526 | 526 | $host = $hostport[0]; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | <td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td> |
534 | 534 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php print $port; ?>" /></td> |
535 | 535 | <?php |
536 | - } |
|
536 | + } |
|
537 | 537 | ?> |
538 | 538 | <td> |
539 | 539 | <select name="format[]" id="format"> |
@@ -673,9 +673,9 @@ discard block |
||
673 | 673 | </thead> |
674 | 674 | <tbody> |
675 | 675 | <?php |
676 | - if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
676 | + if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
677 | 677 | foreach ($globalNewsFeeds as $type => $feedslng) { |
678 | - foreach ($feedslng as $lng => $feeds) { |
|
678 | + foreach ($feedslng as $lng => $feeds) { |
|
679 | 679 | foreach ($feeds as $feed) { |
680 | 680 | ?> |
681 | 681 | <tr> |
@@ -700,9 +700,9 @@ discard block |
||
700 | 700 | |
701 | 701 | <?php |
702 | 702 | } |
703 | - } |
|
703 | + } |
|
704 | + } |
|
704 | 705 | } |
705 | - } |
|
706 | 706 | ?> |
707 | 707 | <tr> |
708 | 708 | <td><input type="url" name="newsurl[]" /></td> |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | <br /> |
1093 | 1093 | <p> |
1094 | 1094 | <?php |
1095 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1095 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1096 | 1096 | ?> |
1097 | 1097 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
1098 | 1098 | <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
@@ -1102,11 +1102,11 @@ discard block |
||
1102 | 1102 | <b>The directory cache is not writable, aircraft icon will not be cached</b> |
1103 | 1103 | <?php |
1104 | 1104 | } |
1105 | - } else { |
|
1105 | + } else { |
|
1106 | 1106 | ?> |
1107 | 1107 | <b>PHP GD is not installed, you can't change color of aircraft icon on map</b> |
1108 | 1108 | <?php |
1109 | - } |
|
1109 | + } |
|
1110 | 1110 | ?> |
1111 | 1111 | </p> |
1112 | 1112 | <br /> |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | </p> |
1131 | 1131 | <?php |
1132 | 1132 | require('../footer.php'); |
1133 | - exit; |
|
1133 | + exit; |
|
1134 | 1134 | } |
1135 | 1135 | // ' |
1136 | 1136 | $settings = array(); |
@@ -1221,8 +1221,8 @@ discard block |
||
1221 | 1221 | |
1222 | 1222 | $sources = array(); |
1223 | 1223 | foreach ($source_name as $keys => $name) { |
1224 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1225 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1224 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1225 | + else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1226 | 1226 | } |
1227 | 1227 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1228 | 1228 | |
@@ -1232,13 +1232,13 @@ discard block |
||
1232 | 1232 | |
1233 | 1233 | $newsfeeds = array(); |
1234 | 1234 | foreach($newsurl as $newskey => $url) { |
1235 | - if ($url != '') { |
|
1235 | + if ($url != '') { |
|
1236 | 1236 | $type = $newstype[$newskey]; |
1237 | 1237 | $lng = $newslng[$newskey]; |
1238 | 1238 | if (isset($newsfeeds[$type][$lng])) { |
1239 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1239 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1240 | 1240 | } else $newsfeeds[$type][$lng] = array($url); |
1241 | - } |
|
1241 | + } |
|
1242 | 1242 | } |
1243 | 1243 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
1244 | 1244 | |
@@ -1681,14 +1681,14 @@ discard block |
||
1681 | 1681 | |
1682 | 1682 | // Set some defaults values... |
1683 | 1683 | if (!isset($globalAircraftImageSources)) { |
1684 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1685 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1684 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1685 | + $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | if (!isset($globalSchedulesSources)) { |
1689 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1690 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1691 | - } |
|
1689 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1690 | + $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1691 | + } |
|
1692 | 1692 | |
1693 | 1693 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1694 | 1694 | |
@@ -1736,21 +1736,21 @@ discard block |
||
1736 | 1736 | $popi = false; |
1737 | 1737 | $popw = false; |
1738 | 1738 | foreach ($_SESSION['done'] as $done) { |
1739 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1740 | - if ($done == 'Create database') $pop = true; |
|
1741 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1742 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1743 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1739 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1740 | + if ($done == 'Create database') $pop = true; |
|
1741 | + if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1742 | + if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1743 | + if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1744 | 1744 | } |
1745 | 1745 | if ($pop) { |
1746 | - sleep(5); |
|
1747 | - print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1746 | + sleep(5); |
|
1747 | + print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1748 | 1748 | } else if ($popi) { |
1749 | - sleep(5); |
|
1750 | - print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1749 | + sleep(5); |
|
1750 | + print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1751 | 1751 | } else if ($popw) { |
1752 | - sleep(5); |
|
1753 | - print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1752 | + sleep(5); |
|
1753 | + print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1754 | 1754 | } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
1755 | 1755 | print '</div></ul>'; |
1756 | 1756 | print '<div id="error"></div>'; |
@@ -1816,7 +1816,7 @@ discard block |
||
1816 | 1816 | unset($_COOKIE['install']); |
1817 | 1817 | print '<div class="info column"><ul>'; |
1818 | 1818 | foreach ($_SESSION['done'] as $done) { |
1819 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1819 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1820 | 1820 | } |
1821 | 1821 | print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>'; |
1822 | 1822 | print '</ul></div>'; |
@@ -4,11 +4,19 @@ discard block |
||
4 | 4 | if (isset($_SESSION['error'])) { |
5 | 5 | header('Content-Encoding: none;'); |
6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
11 | -} |
|
7 | + if (isset($_SESSION['error'])) { |
|
8 | + unset($_SESSION['error']); |
|
9 | + } |
|
10 | + if (isset($_SESSION['errorlst'])) { |
|
11 | + unset($_SESSION['errorlst']); |
|
12 | + } |
|
13 | + if (isset($_SESSION['next'])) { |
|
14 | + unset($_SESSION['next']); |
|
15 | + } |
|
16 | + if (isset($_SESSION['install'])) { |
|
17 | + unset($_SESSION['install']); |
|
18 | + } |
|
19 | + } |
|
12 | 20 | /* |
13 | 21 | if (isset($_SESSION['errorlst'])) { |
14 | 22 | header('Content-Encoding: none;'); |
@@ -168,31 +176,49 @@ discard block |
||
168 | 176 | </div> |
169 | 177 | <p> |
170 | 178 | <label for="dbhost">Database hostname</label> |
171 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
179 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
180 | + print $globalDBhost; |
|
181 | +} |
|
182 | +?>" /> |
|
172 | 183 | </p> |
173 | 184 | <p> |
174 | 185 | <label for="dbport">Database port</label> |
175 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
186 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
187 | + print $globalDBport; |
|
188 | +} |
|
189 | +?>" /> |
|
176 | 190 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
177 | 191 | </p> |
178 | 192 | <p> |
179 | 193 | <label for="dbname">Database name</label> |
180 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
194 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
195 | + print $globalDBname; |
|
196 | +} |
|
197 | +?>" /> |
|
181 | 198 | </p> |
182 | 199 | <p> |
183 | 200 | <label for="dbuser">Database user</label> |
184 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
201 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
202 | + print $globalDBuser; |
|
203 | +} |
|
204 | +?>" /> |
|
185 | 205 | </p> |
186 | 206 | <p> |
187 | 207 | <label for="dbuserpass">Database user password</label> |
188 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
208 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
209 | + print $globalDBpass; |
|
210 | +} |
|
211 | +?>" /> |
|
189 | 212 | </p> |
190 | 213 | </fieldset> |
191 | 214 | <fieldset id="site"> |
192 | 215 | <legend>Site configuration</legend> |
193 | 216 | <p> |
194 | 217 | <label for="sitename">Site name</label> |
195 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
218 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
219 | + print $globalName; |
|
220 | +} |
|
221 | +?>" /> |
|
196 | 222 | </p> |
197 | 223 | <p> |
198 | 224 | <label for="siteurl">Site directory</label> |
@@ -205,18 +231,27 @@ discard block |
||
205 | 231 | } |
206 | 232 | } |
207 | 233 | ?> |
208 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
234 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
235 | + print $globalURL; |
|
236 | +} |
|
237 | +?>" /> |
|
209 | 238 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
210 | 239 | <p class="help-block">Can be empty</p> |
211 | 240 | </p> |
212 | 241 | <p> |
213 | 242 | <label for="timezone">Timezone</label> |
214 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
243 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
244 | + print $globalTimezone; |
|
245 | +} |
|
246 | +?>" /> |
|
215 | 247 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
216 | 248 | </p> |
217 | 249 | <p> |
218 | 250 | <label for="language">Language</label> |
219 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
251 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
252 | + print $globalLanguage; |
|
253 | +} |
|
254 | +?>" /> |
|
220 | 255 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
221 | 256 | </p> |
222 | 257 | </fieldset> |
@@ -236,11 +271,17 @@ discard block |
||
236 | 271 | <div id="mapbox_data"> |
237 | 272 | <p> |
238 | 273 | <label for="mapboxid">Mapbox id</label> |
239 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
274 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
275 | + print $globalMapboxId; |
|
276 | +} |
|
277 | +?>" /> |
|
240 | 278 | </p> |
241 | 279 | <p> |
242 | 280 | <label for="mapboxtoken">Mapbox token</label> |
243 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
281 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
282 | + print $globalMapboxToken; |
|
283 | +} |
|
284 | +?>" /> |
|
244 | 285 | </p> |
245 | 286 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
246 | 287 | </div> |
@@ -248,7 +289,10 @@ discard block |
||
248 | 289 | <div id="google_data"> |
249 | 290 | <p> |
250 | 291 | <label for="googlekey">Google API key</label> |
251 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
292 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
293 | + print $globalGoogleAPIKey; |
|
294 | +} |
|
295 | +?>" /> |
|
252 | 296 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
253 | 297 | </p> |
254 | 298 | </div> |
@@ -256,7 +300,10 @@ discard block |
||
256 | 300 | <div id="bing_data"> |
257 | 301 | <p> |
258 | 302 | <label for="bingkey">Bing Map key</label> |
259 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
303 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
304 | + print $globalBingMapKey; |
|
305 | +} |
|
306 | +?>" /> |
|
260 | 307 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
261 | 308 | </p> |
262 | 309 | </div> |
@@ -264,7 +311,10 @@ discard block |
||
264 | 311 | <div id="mapquest_data"> |
265 | 312 | <p> |
266 | 313 | <label for="mapquestkey">MapQuest key</label> |
267 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
314 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
315 | + print $globalMapQuestKey; |
|
316 | +} |
|
317 | +?>" /> |
|
268 | 318 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
269 | 319 | </p> |
270 | 320 | </div> |
@@ -272,11 +322,17 @@ discard block |
||
272 | 322 | <div id="here_data"> |
273 | 323 | <p> |
274 | 324 | <label for="hereappid">Here App_Id</label> |
275 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
325 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
326 | + print $globalHereappId; |
|
327 | +} |
|
328 | +?>" /> |
|
276 | 329 | </p> |
277 | 330 | <p> |
278 | 331 | <label for="hereappcode">Here App_Code</label> |
279 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
332 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
333 | + print $globalHereappCode; |
|
334 | +} |
|
335 | +?>" /> |
|
280 | 336 | </p> |
281 | 337 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
282 | 338 | </div> |
@@ -284,7 +340,10 @@ discard block |
||
284 | 340 | <div id="openweathermap_data"> |
285 | 341 | <p> |
286 | 342 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
287 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
343 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
344 | + print $globalOpenWeatherMapKey; |
|
345 | +} |
|
346 | +?>" /> |
|
288 | 347 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
289 | 348 | </p> |
290 | 349 | </div> |
@@ -313,42 +372,86 @@ discard block |
||
313 | 372 | <legend>Coverage area</legend> |
314 | 373 | <p> |
315 | 374 | <label for="latitudemax">The maximum latitude (north)</label> |
316 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
375 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
376 | + print $globalLatitudeMax; |
|
377 | +} |
|
378 | +?>" /> |
|
317 | 379 | </p> |
318 | 380 | <p> |
319 | 381 | <label for="latitudemin">The minimum latitude (south)</label> |
320 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
382 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
383 | + print $globalLatitudeMin; |
|
384 | +} |
|
385 | +?>" /> |
|
321 | 386 | </p> |
322 | 387 | <p> |
323 | 388 | <label for="longitudemax">The maximum longitude (west)</label> |
324 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
389 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
390 | + print $globalLongitudeMax; |
|
391 | +} |
|
392 | +?>" /> |
|
325 | 393 | </p> |
326 | 394 | <p> |
327 | 395 | <label for="longitudemin">The minimum longitude (east)</label> |
328 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
396 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
397 | + print $globalLongitudeMin; |
|
398 | +} |
|
399 | +?>" /> |
|
329 | 400 | </p> |
330 | 401 | <p> |
331 | 402 | <label for="latitudecenter">The latitude center</label> |
332 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
403 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
404 | + print $globalCenterLatitude; |
|
405 | +} |
|
406 | +?>" /> |
|
333 | 407 | </p> |
334 | 408 | <p> |
335 | 409 | <label for="longitudecenter">The longitude center</label> |
336 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
410 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
411 | + print $globalCenterLongitude; |
|
412 | +} |
|
413 | +?>" /> |
|
337 | 414 | </p> |
338 | 415 | <p> |
339 | 416 | <label for="livezoom">Default Zoom on live map</label> |
340 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
417 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
418 | + print $globalLiveZoom; |
|
419 | +} else { |
|
420 | + print '9'; |
|
421 | +} |
|
422 | +?>" /> |
|
341 | 423 | </p> |
342 | 424 | <p> |
343 | 425 | <label for="squawk_country">Country for squawk usage</label> |
344 | 426 | <select name="squawk_country" id="squawk_country"> |
345 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
346 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
347 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
348 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
349 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
350 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
351 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
427 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
428 | + print ' selected '; |
|
429 | +} |
|
430 | +?>>UK</option> |
|
431 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
432 | + print ' selected '; |
|
433 | +} |
|
434 | +?>>NZ</option> |
|
435 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
436 | + print ' selected '; |
|
437 | +} |
|
438 | +?>>US</option> |
|
439 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
440 | + print ' selected '; |
|
441 | +} |
|
442 | +?>>AU</option> |
|
443 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
444 | + print ' selected '; |
|
445 | +} |
|
446 | +?>>NL</option> |
|
447 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
448 | + print ' selected '; |
|
449 | +} |
|
450 | +?>>FR</option> |
|
451 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
452 | + print ' selected '; |
|
453 | +} |
|
454 | +?>>TR</option> |
|
352 | 455 | </select> |
353 | 456 | </p> |
354 | 457 | </fieldset> |
@@ -357,15 +460,24 @@ discard block |
||
357 | 460 | <p><i>Only put in DB flights that are inside a circle</i></p> |
358 | 461 | <p> |
359 | 462 | <label for="latitude">Center latitude</label> |
360 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
463 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
464 | + echo $globalDistanceIgnore['latitude']; |
|
465 | +} |
|
466 | +?>" /> |
|
361 | 467 | </p> |
362 | 468 | <p> |
363 | 469 | <label for="longitude">Center longitude</label> |
364 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
470 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
471 | + echo $globalDistanceIgnore['longitude']; |
|
472 | +} |
|
473 | +?>" /> |
|
365 | 474 | </p> |
366 | 475 | <p> |
367 | 476 | <label for="Distance">Distance (in km)</label> |
368 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
477 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
478 | + echo $globalDistanceIgnore['distance']; |
|
479 | +} |
|
480 | +?>" /> |
|
369 | 481 | </p> |
370 | 482 | </fieldset> |
371 | 483 | <fieldset id="sourceloc"> |
@@ -481,11 +593,17 @@ discard block |
||
481 | 593 | <div id="flightaware_data"> |
482 | 594 | <p> |
483 | 595 | <label for="flightawareusername">FlightAware username</label> |
484 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
596 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
597 | + print $globalFlightAwareUsername; |
|
598 | +} |
|
599 | +?>" /> |
|
485 | 600 | </p> |
486 | 601 | <p> |
487 | 602 | <label for="flightawarepassword">FlightAware password/API key</label> |
488 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
603 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
604 | + print $globalFlightAwarePassword; |
|
605 | +} |
|
606 | +?>" /> |
|
489 | 607 | </p> |
490 | 608 | </div> |
491 | 609 | --> |
@@ -527,7 +645,10 @@ discard block |
||
527 | 645 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
528 | 646 | ?> |
529 | 647 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
530 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
648 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
649 | + print $source['port']; |
|
650 | +} |
|
651 | +?>" /></td> |
|
531 | 652 | <?php |
532 | 653 | } else { |
533 | 654 | $hostport = explode(':',$source['host']); |
@@ -546,36 +667,114 @@ discard block |
||
546 | 667 | ?> |
547 | 668 | <td> |
548 | 669 | <select name="format[]" id="format"> |
549 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
550 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
551 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
552 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
553 | - <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option> |
|
554 | - <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option> |
|
555 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
556 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
557 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
558 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
559 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
560 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
561 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
562 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
563 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
564 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
565 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
566 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
567 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
568 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
569 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
570 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
571 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
670 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
671 | + print 'selected'; |
|
672 | +} |
|
673 | +?>>Auto</option> |
|
674 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
675 | + print 'selected'; |
|
676 | +} |
|
677 | +?>>SBS</option> |
|
678 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
679 | + print 'selected'; |
|
680 | +} |
|
681 | +?>>TSV</option> |
|
682 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
683 | + print 'selected'; |
|
684 | +} |
|
685 | +?>>Raw</option> |
|
686 | + <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') { |
|
687 | + print 'selected'; |
|
688 | +} |
|
689 | +?>>Dump1090 aircraft.json</option> |
|
690 | + <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') { |
|
691 | + print 'selected'; |
|
692 | +} |
|
693 | +?>>Planefinder client</option> |
|
694 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
695 | + print 'selected'; |
|
696 | +} |
|
697 | +?>>APRS</option> |
|
698 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
699 | + print 'selected'; |
|
700 | +} |
|
701 | +?>>Radarcape deltadb.txt</option> |
|
702 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
703 | + print 'selected'; |
|
704 | +} |
|
705 | +?>>Vatsim</option> |
|
706 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
707 | + print 'selected'; |
|
708 | +} |
|
709 | +?>>Virtual Radar Server AircraftList.json</option> |
|
710 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
711 | + print 'selected'; |
|
712 | +} |
|
713 | +?>>Virtual Radar Server TCP</option> |
|
714 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
715 | + print 'selected'; |
|
716 | +} |
|
717 | +?>>phpVMS</option> |
|
718 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
719 | + print 'selected'; |
|
720 | +} |
|
721 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
722 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
723 | + print 'selected'; |
|
724 | +} |
|
725 | +?>>Virtual Airlines Manager</option> |
|
726 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
727 | + print 'selected'; |
|
728 | +} |
|
729 | +?>>IVAO</option> |
|
730 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
731 | + print 'selected'; |
|
732 | +} |
|
733 | +?>>FlightGear Multiplayer</option> |
|
734 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
735 | + print 'selected'; |
|
736 | +} |
|
737 | +?>>FlightGear Singleplayer</option> |
|
738 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
739 | + print 'selected'; |
|
740 | +} |
|
741 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
742 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
743 | + print 'selected'; |
|
744 | +} |
|
745 | +?>>ACARS SBS-3 over TCP</option> |
|
746 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
747 | + print 'selected'; |
|
748 | +} |
|
749 | +?>>NMEA AIS over TCP</option> |
|
750 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
751 | + print 'selected'; |
|
752 | +} |
|
753 | +?>>AirWhere website</option> |
|
754 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
755 | + print 'selected'; |
|
756 | +} |
|
757 | +?>>HidnSeek Callback</option> |
|
758 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
759 | + print 'selected'; |
|
760 | +} |
|
761 | +?>>Blitzortung</option> |
|
572 | 762 | </select> |
573 | 763 | </td> |
574 | 764 | <td> |
575 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
765 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
766 | + print $source['name']; |
|
767 | +} |
|
768 | +?>" /> |
|
576 | 769 | </td> |
577 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
578 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
770 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
771 | + print 'checked'; |
|
772 | +} |
|
773 | +?> /></td> |
|
774 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
775 | + print 'checked'; |
|
776 | +} |
|
777 | +?> /></td> |
|
579 | 778 | <td> |
580 | 779 | <select name="timezones[]" id="timezones"> |
581 | 780 | <?php |
@@ -585,7 +784,9 @@ discard block |
||
585 | 784 | print '<option selected>'.$timezones.'</option>'; |
586 | 785 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
587 | 786 | print '<option selected>'.$timezones.'</option>'; |
588 | - } else print '<option>'.$timezones.'</option>'; |
|
787 | + } else { |
|
788 | + print '<option>'.$timezones.'</option>'; |
|
789 | + } |
|
589 | 790 | } |
590 | 791 | ?> |
591 | 792 | </select> |
@@ -638,7 +839,9 @@ discard block |
||
638 | 839 | foreach($timezonelist as $timezones){ |
639 | 840 | if ($timezones == 'UTC') { |
640 | 841 | print '<option selected>'.$timezones.'</option>'; |
641 | - } else print '<option>'.$timezones.'</option>'; |
|
842 | + } else { |
|
843 | + print '<option>'.$timezones.'</option>'; |
|
844 | + } |
|
642 | 845 | } |
643 | 846 | ?> |
644 | 847 | </select> |
@@ -663,11 +866,17 @@ discard block |
||
663 | 866 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
664 | 867 | <p> |
665 | 868 | <label for="acarshost">ACARS UDP host</label> |
666 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
869 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
870 | + print $globalACARSHost; |
|
871 | +} |
|
872 | +?>" /> |
|
667 | 873 | </p> |
668 | 874 | <p> |
669 | 875 | <label for="acarsport">ACARS UDP port</label> |
670 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
876 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
877 | + print $globalACARSPort; |
|
878 | +} |
|
879 | +?>" /> |
|
671 | 880 | </p> |
672 | 881 | </fieldset> |
673 | 882 | </div> |
@@ -693,17 +902,38 @@ discard block |
||
693 | 902 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
694 | 903 | <td> |
695 | 904 | <select name="newslang[]"> |
696 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
697 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
905 | + <option value="en"<?php if ($lng == 'en') { |
|
906 | + print ' selected'; |
|
907 | +} |
|
908 | +?>>English</option> |
|
909 | + <option value="fr"<?php if ($lng == 'fr') { |
|
910 | + print ' selected'; |
|
911 | +} |
|
912 | +?>>French</option> |
|
698 | 913 | </select> |
699 | 914 | </td> |
700 | 915 | <td> |
701 | 916 | <select name="newstype[]"> |
702 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
703 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
704 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
705 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
706 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
917 | + <option value="global"<?php if ($type == 'global') { |
|
918 | + print ' selected'; |
|
919 | +} |
|
920 | +?>>Global</option> |
|
921 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
922 | + print ' selected'; |
|
923 | +} |
|
924 | +?>>Aircraft</option> |
|
925 | + <option value="marine"<?php if ($type == 'marine') { |
|
926 | + print ' selected'; |
|
927 | +} |
|
928 | +?>>Marine</option> |
|
929 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
930 | + print ' selected'; |
|
931 | +} |
|
932 | +?>>Tracker</option> |
|
933 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
934 | + print ' selected'; |
|
935 | +} |
|
936 | +?>>Satellite</option> |
|
707 | 937 | </select> |
708 | 938 | </td> |
709 | 939 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -836,13 +1066,19 @@ discard block |
||
836 | 1066 | <div id="schedules_options"> |
837 | 1067 | <p> |
838 | 1068 | <label for="britishairways">British Airways API Key</label> |
839 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
1069 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
1070 | + print $globalBritishAirwaysKey; |
|
1071 | +} |
|
1072 | +?>" /> |
|
840 | 1073 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
841 | 1074 | </p> |
842 | 1075 | <!-- |
843 | 1076 | <p> |
844 | 1077 | <label for="transavia">Transavia Test API Consumer Key</label> |
845 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
1078 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
1079 | + print $globalTransaviaKey; |
|
1080 | +} |
|
1081 | +?>" /> |
|
846 | 1082 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
847 | 1083 | </p> |
848 | 1084 | --> |
@@ -851,10 +1087,16 @@ discard block |
||
851 | 1087 | <b>Lufthansa API Key</b> |
852 | 1088 | <p> |
853 | 1089 | <label for="lufthansakey">Key</label> |
854 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
1090 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
1091 | + print $globalLufthansaKey['key']; |
|
1092 | +} |
|
1093 | +?>" /> |
|
855 | 1094 | </p><p> |
856 | 1095 | <label for="lufthansasecret">Secret</label> |
857 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
1096 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
1097 | + print $globalLufthansaKey['secret']; |
|
1098 | +} |
|
1099 | +?>" /> |
|
858 | 1100 | </p> |
859 | 1101 | </div> |
860 | 1102 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -864,11 +1106,17 @@ discard block |
||
864 | 1106 | <b>FlightAware API Key</b> |
865 | 1107 | <p> |
866 | 1108 | <label for="flightawareusername">Username</label> |
867 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
1109 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
1110 | + print $globalFlightAwareUsername; |
|
1111 | +} |
|
1112 | +?>" /> |
|
868 | 1113 | </p> |
869 | 1114 | <p> |
870 | 1115 | <label for="flightawarepassword">API key</label> |
871 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
1116 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
1117 | + print $globalFlightAwarePassword; |
|
1118 | +} |
|
1119 | +?>" /> |
|
872 | 1120 | </p> |
873 | 1121 | </div> |
874 | 1122 | <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p> |
@@ -885,10 +1133,22 @@ discard block |
||
885 | 1133 | <p> |
886 | 1134 | <label for="mapmatchingsource">Map Matching source</label> |
887 | 1135 | <select name="mapmatchingsource" id="mapmatchingsource"> |
888 | - <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option> |
|
889 | - <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option> |
|
890 | - <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option> |
|
891 | - <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option> |
|
1136 | + <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) { |
|
1137 | + print 'selected="selected" '; |
|
1138 | +} |
|
1139 | +?>>FlightAirMap Map Matching</option> |
|
1140 | + <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') { |
|
1141 | + print 'selected="selected" '; |
|
1142 | +} |
|
1143 | +?>>GraphHopper</option> |
|
1144 | + <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') { |
|
1145 | + print 'selected="selected" '; |
|
1146 | +} |
|
1147 | +?>>OSMR</option> |
|
1148 | + <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') { |
|
1149 | + print 'selected="selected" '; |
|
1150 | +} |
|
1151 | +?>>Mapbox</option> |
|
892 | 1152 | </select> |
893 | 1153 | <p class="help-block">Mapbox need the API Key defined in map section.</p> |
894 | 1154 | <p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p> |
@@ -896,7 +1156,10 @@ discard block |
||
896 | 1156 | <br /> |
897 | 1157 | <p> |
898 | 1158 | <label for="graphhopper">GraphHopper API Key</label> |
899 | - <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" /> |
|
1159 | + <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) { |
|
1160 | + print $globalGraphHopperKey; |
|
1161 | +} |
|
1162 | +?>" /> |
|
900 | 1163 | <p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p> |
901 | 1164 | </p> |
902 | 1165 | </div> |
@@ -914,7 +1177,10 @@ discard block |
||
914 | 1177 | </p> |
915 | 1178 | <p> |
916 | 1179 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
917 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
1180 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
1181 | + print $globalNOTAMSource; |
|
1182 | +} |
|
1183 | +?>" /> |
|
918 | 1184 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
919 | 1185 | </p> |
920 | 1186 | <br /> |
@@ -930,14 +1196,20 @@ discard block |
||
930 | 1196 | <div id="metarsrc"> |
931 | 1197 | <p> |
932 | 1198 | <label for="metarsource">URL of your METAR source</label> |
933 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
1199 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
1200 | + print $globalMETARurl; |
|
1201 | +} |
|
1202 | +?>" /> |
|
934 | 1203 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
935 | 1204 | </p> |
936 | 1205 | </div> |
937 | 1206 | <br /> |
938 | 1207 | <p> |
939 | 1208 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
940 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
1209 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
1210 | + print $globalBitlyAccessToken; |
|
1211 | +} |
|
1212 | +?>" /> |
|
941 | 1213 | </p> |
942 | 1214 | <br /> |
943 | 1215 | <p> |
@@ -953,11 +1225,26 @@ discard block |
||
953 | 1225 | <p> |
954 | 1226 | <label for="geoid_source">Geoid Source</label> |
955 | 1227 | <select name="geoid_source" id="geoid_source"> |
956 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
957 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
958 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
959 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
960 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
1228 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
1229 | + print ' selected="selected"'; |
|
1230 | +} |
|
1231 | +?>>EGM96 15' (2.1MB)</option> |
|
1232 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
1233 | + print ' selected="selected"'; |
|
1234 | +} |
|
1235 | +?>>EGM96 5' (19MB)</option> |
|
1236 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
1237 | + print ' selected="selected"'; |
|
1238 | +} |
|
1239 | +?>>EGM2008 5' (19MB)</option> |
|
1240 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
1241 | + print ' selected="selected"'; |
|
1242 | +} |
|
1243 | +?>>EGM2008 2.5' (75MB)</option> |
|
1244 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
1245 | + print ' selected="selected"'; |
|
1246 | +} |
|
1247 | +?>>EGM2008 1' (470MB)</option> |
|
961 | 1248 | </select> |
962 | 1249 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
963 | 1250 | </p> |
@@ -979,7 +1266,12 @@ discard block |
||
979 | 1266 | </p> |
980 | 1267 | <p> |
981 | 1268 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
982 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
1269 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
1270 | + print $globalArchiveMonths; |
|
1271 | +} else { |
|
1272 | + echo '1'; |
|
1273 | +} |
|
1274 | +?>" /> |
|
983 | 1275 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
984 | 1276 | </p> |
985 | 1277 | <p> |
@@ -989,12 +1281,22 @@ discard block |
||
989 | 1281 | </p> |
990 | 1282 | <p> |
991 | 1283 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
992 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
1284 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
1285 | + print $globalArchiveKeepMonths; |
|
1286 | +} else { |
|
1287 | + echo '1'; |
|
1288 | +} |
|
1289 | +?>" /> |
|
993 | 1290 | <p class="help-block">0 to disable</p> |
994 | 1291 | </p> |
995 | 1292 | <p> |
996 | 1293 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
997 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
1294 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
1295 | + print $globalArchiveKeepTrackMonths; |
|
1296 | +} else { |
|
1297 | + echo '1'; |
|
1298 | +} |
|
1299 | +?>" /> |
|
998 | 1300 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
999 | 1301 | </p> |
1000 | 1302 | <br /> |
@@ -1004,7 +1306,12 @@ discard block |
||
1004 | 1306 | <p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p> |
1005 | 1307 | <div id="cronends"> |
1006 | 1308 | <label for="cronend">Run script for xx seconds</label> |
1007 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
1309 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
1310 | + print $globalCronEnd; |
|
1311 | +} else { |
|
1312 | + print '0'; |
|
1313 | +} |
|
1314 | +?>" /> |
|
1008 | 1315 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
1009 | 1316 | </div> |
1010 | 1317 | </p> |
@@ -1057,20 +1364,40 @@ discard block |
||
1057 | 1364 | <br /> |
1058 | 1365 | <p> |
1059 | 1366 | <label for="refresh">Show flights detected since xxx seconds</label> |
1060 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
1367 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
1368 | + echo $globalLiveInterval; |
|
1369 | +} else { |
|
1370 | + echo '200'; |
|
1371 | +} |
|
1372 | +?>" /> |
|
1061 | 1373 | </p> |
1062 | 1374 | <p> |
1063 | 1375 | <label for="maprefresh">Live map refresh (in seconds)</label> |
1064 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
1376 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
1377 | + echo $globalMapRefresh; |
|
1378 | +} else { |
|
1379 | + echo '30'; |
|
1380 | +} |
|
1381 | +?>" /> |
|
1065 | 1382 | </p> |
1066 | 1383 | <p> |
1067 | 1384 | <label for="mapidle">Map idle timeout (in minutes)</label> |
1068 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
1385 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
1386 | + echo $globalMapIdleTimeout; |
|
1387 | +} else { |
|
1388 | + echo '30'; |
|
1389 | +} |
|
1390 | +?>" /> |
|
1069 | 1391 | <p class="help-block">0 to disable</p> |
1070 | 1392 | </p> |
1071 | 1393 | <p> |
1072 | 1394 | <label for="minfetch">HTTP/file source fetch every xxx seconds</label> |
1073 | - <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" /> |
|
1395 | + <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) { |
|
1396 | + echo $globalMinFetch; |
|
1397 | +} else { |
|
1398 | + echo '20'; |
|
1399 | +} |
|
1400 | +?>" /> |
|
1074 | 1401 | </p> |
1075 | 1402 | <p> |
1076 | 1403 | <label for="bbox">Only display flights that we can see on screen (bounding box)</label> |
@@ -1084,12 +1411,20 @@ discard block |
||
1084 | 1411 | <br /> |
1085 | 1412 | <p> |
1086 | 1413 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
1087 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
1414 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
1415 | + echo $globalClosestMinDist; |
|
1416 | +} else { |
|
1417 | + echo '50'; |
|
1418 | +} |
|
1419 | +?>" /> |
|
1088 | 1420 | </p> |
1089 | 1421 | <br /> |
1090 | 1422 | <p> |
1091 | 1423 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1092 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1424 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
1425 | + echo $globalAircraftSize; |
|
1426 | +} |
|
1427 | +?>" /> |
|
1093 | 1428 | </p> |
1094 | 1429 | <br /> |
1095 | 1430 | <p> |
@@ -1108,7 +1443,12 @@ discard block |
||
1108 | 1443 | if (extension_loaded('gd') && function_exists('gd_info')) { |
1109 | 1444 | ?> |
1110 | 1445 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
1111 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
1446 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
1447 | + echo $globalAircraftIconColor; |
|
1448 | +} else { |
|
1449 | + echo '1a3151'; |
|
1450 | +} |
|
1451 | +?>" /> |
|
1112 | 1452 | <?php |
1113 | 1453 | if (!is_writable('../cache')) { |
1114 | 1454 | ?> |
@@ -1126,14 +1466,27 @@ discard block |
||
1126 | 1466 | <p> |
1127 | 1467 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
1128 | 1468 | <div class="range"> |
1129 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
1130 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
1469 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
1470 | + echo $globalAirportZoom; |
|
1471 | +} else { |
|
1472 | + echo '7'; |
|
1473 | +} |
|
1474 | +?>" /> |
|
1475 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
1476 | + echo $globalAirportZoom; |
|
1477 | +} else { |
|
1478 | + echo '7'; |
|
1479 | +} |
|
1480 | +?></output> |
|
1131 | 1481 | </div> |
1132 | 1482 | </p> |
1133 | 1483 | <br /> |
1134 | 1484 | <p> |
1135 | 1485 | <label for="customcss">Custom CSS web path</label> |
1136 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
1486 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
1487 | + echo $globalCustomCSS; |
|
1488 | +} |
|
1489 | +?>" /> |
|
1137 | 1490 | </p> |
1138 | 1491 | </fieldset> |
1139 | 1492 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1160,8 +1513,12 @@ discard block |
||
1160 | 1513 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
1161 | 1514 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
1162 | 1515 | |
1163 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
1164 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1516 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
1517 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
1518 | + } |
|
1519 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
1520 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1521 | + } |
|
1165 | 1522 | |
1166 | 1523 | $_SESSION['database_root'] = $dbroot; |
1167 | 1524 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1229,15 +1586,23 @@ discard block |
||
1229 | 1586 | $source_city = $_POST['source_city']; |
1230 | 1587 | $source_country = $_POST['source_country']; |
1231 | 1588 | $source_ref = $_POST['source_ref']; |
1232 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
1233 | - else $source_id = array(); |
|
1589 | + if (isset($source_id)) { |
|
1590 | + $source_id = $_POST['source_id']; |
|
1591 | + } else { |
|
1592 | + $source_id = array(); |
|
1593 | + } |
|
1234 | 1594 | |
1235 | 1595 | $sources = array(); |
1236 | 1596 | foreach ($source_name as $keys => $name) { |
1237 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1238 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1597 | + if (isset($source_id[$keys])) { |
|
1598 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1599 | + } else { |
|
1600 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1601 | + } |
|
1602 | + } |
|
1603 | + if (count($sources) > 0) { |
|
1604 | + $_SESSION['sources'] = $sources; |
|
1239 | 1605 | } |
1240 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
1241 | 1606 | |
1242 | 1607 | $newsurl = $_POST['newsurl']; |
1243 | 1608 | $newslng = $_POST['newslang']; |
@@ -1250,7 +1615,9 @@ discard block |
||
1250 | 1615 | $lng = $newslng[$newskey]; |
1251 | 1616 | if (isset($newsfeeds[$type][$lng])) { |
1252 | 1617 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
1253 | - } else $newsfeeds[$type][$lng] = array($url); |
|
1618 | + } else { |
|
1619 | + $newsfeeds[$type][$lng] = array($url); |
|
1620 | + } |
|
1254 | 1621 | } |
1255 | 1622 | } |
1256 | 1623 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1274,17 +1641,29 @@ discard block |
||
1274 | 1641 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
1275 | 1642 | |
1276 | 1643 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
1277 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1278 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1644 | + if ($globalaircraft == 'aircraft') { |
|
1645 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1646 | + } else { |
|
1647 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1648 | + } |
|
1279 | 1649 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
1280 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1281 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1650 | + if ($globaltracker == 'tracker') { |
|
1651 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1652 | + } else { |
|
1653 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1654 | + } |
|
1282 | 1655 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
1283 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1284 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1656 | + if ($globalmarine == 'marine') { |
|
1657 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1658 | + } else { |
|
1659 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1660 | + } |
|
1285 | 1661 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
1286 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1287 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1662 | + if ($globalsatellite == 'satellite') { |
|
1663 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1664 | + } else { |
|
1665 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1666 | + } |
|
1288 | 1667 | |
1289 | 1668 | /* |
1290 | 1669 | $globalSBS1Hosts = array(); |
@@ -1306,23 +1685,37 @@ discard block |
||
1306 | 1685 | $name = $_POST['name']; |
1307 | 1686 | $format = $_POST['format']; |
1308 | 1687 | $timezones = $_POST['timezones']; |
1309 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
1310 | - else $sourcestats = array(); |
|
1311 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
1312 | - else $noarchive = array(); |
|
1688 | + if (isset($_POST['sourcestats'])) { |
|
1689 | + $sourcestats = $_POST['sourcestats']; |
|
1690 | + } else { |
|
1691 | + $sourcestats = array(); |
|
1692 | + } |
|
1693 | + if (isset($_POST['noarchive'])) { |
|
1694 | + $noarchive = $_POST['noarchive']; |
|
1695 | + } else { |
|
1696 | + $noarchive = array(); |
|
1697 | + } |
|
1313 | 1698 | $gSources = array(); |
1314 | 1699 | $forcepilots = false; |
1315 | 1700 | foreach ($host as $key => $h) { |
1316 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
1317 | - else $cov = 'FALSE'; |
|
1318 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
1319 | - else $arch = 'FALSE'; |
|
1701 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
1702 | + $cov = 'TRUE'; |
|
1703 | + } else { |
|
1704 | + $cov = 'FALSE'; |
|
1705 | + } |
|
1706 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
1707 | + $arch = 'TRUE'; |
|
1708 | + } else { |
|
1709 | + $arch = 'FALSE'; |
|
1710 | + } |
|
1320 | 1711 | if (strpos($format[$key],'_callback')) { |
1321 | 1712 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
1322 | 1713 | } elseif ($h != '' || $name[$key] != '') { |
1323 | 1714 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
1324 | 1715 | } |
1325 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
1716 | + if ($format[$key] == 'airwhere') { |
|
1717 | + $forcepilots = true; |
|
1718 | + } |
|
1326 | 1719 | } |
1327 | 1720 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
1328 | 1721 | |
@@ -1353,7 +1746,9 @@ discard block |
||
1353 | 1746 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
1354 | 1747 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1355 | 1748 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
1356 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1749 | + } else { |
|
1750 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1751 | + } |
|
1357 | 1752 | |
1358 | 1753 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
1359 | 1754 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1394,7 +1789,9 @@ discard block |
||
1394 | 1789 | |
1395 | 1790 | // Create in settings.php keys not yet configurable if not already here |
1396 | 1791 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1397 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1792 | + if (!isset($globalDebug)) { |
|
1793 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1794 | + } |
|
1398 | 1795 | |
1399 | 1796 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
1400 | 1797 | if ($resetyearstats == 'resetyearstats') { |
@@ -1437,37 +1834,56 @@ discard block |
||
1437 | 1834 | } |
1438 | 1835 | */ |
1439 | 1836 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
1440 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1441 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1442 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1443 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1837 | + if ($globalsbs == 'sbs') { |
|
1838 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1839 | + } else { |
|
1840 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1841 | + } |
|
1842 | + if ($globalaprs == 'aprs') { |
|
1843 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1844 | + } else { |
|
1845 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1846 | + } |
|
1444 | 1847 | $va = false; |
1445 | 1848 | if ($globalivao == 'ivao') { |
1446 | 1849 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
1447 | 1850 | $va = true; |
1448 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1851 | + } else { |
|
1852 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1853 | + } |
|
1449 | 1854 | if ($globalvatsim == 'vatsim') { |
1450 | 1855 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
1451 | 1856 | $va = true; |
1452 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1857 | + } else { |
|
1858 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1859 | + } |
|
1453 | 1860 | if ($globalphpvms == 'phpvms') { |
1454 | 1861 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
1455 | 1862 | $va = true; |
1456 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1863 | + } else { |
|
1864 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1865 | + } |
|
1457 | 1866 | if ($globalvam == 'vam') { |
1458 | 1867 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
1459 | 1868 | $va = true; |
1460 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1869 | + } else { |
|
1870 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1871 | + } |
|
1461 | 1872 | if ($va) { |
1462 | 1873 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
1463 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1874 | + } else { |
|
1875 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1876 | + } |
|
1464 | 1877 | if ($globalva == 'va' || $va) { |
1465 | 1878 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
1466 | 1879 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
1467 | 1880 | } else { |
1468 | 1881 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
1469 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1470 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1882 | + if ($forcepilots) { |
|
1883 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1884 | + } else { |
|
1885 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1886 | + } |
|
1471 | 1887 | } |
1472 | 1888 | |
1473 | 1889 | |
@@ -1690,7 +2106,9 @@ discard block |
||
1690 | 2106 | $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
1691 | 2107 | $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
1692 | 2108 | |
1693 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2109 | + if (!isset($globalTransaction)) { |
|
2110 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2111 | + } |
|
1694 | 2112 | |
1695 | 2113 | // Set some defaults values... |
1696 | 2114 | if (!isset($globalAircraftImageSources)) { |
@@ -1705,15 +2123,23 @@ discard block |
||
1705 | 2123 | |
1706 | 2124 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1707 | 2125 | |
1708 | - if ($error == '') settings::modify_settings($settings); |
|
1709 | - if ($error == '') settings::comment_settings($settings_comment); |
|
2126 | + if ($error == '') { |
|
2127 | + settings::modify_settings($settings); |
|
2128 | + } |
|
2129 | + if ($error == '') { |
|
2130 | + settings::comment_settings($settings_comment); |
|
2131 | + } |
|
1710 | 2132 | if ($error != '') { |
1711 | 2133 | print '<div class="info column">'.$error.'</div>'; |
1712 | 2134 | require('../footer.php'); |
1713 | 2135 | exit; |
1714 | 2136 | } else { |
1715 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
1716 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
2137 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
2138 | + $_SESSION['waypoints'] = 1; |
|
2139 | + } |
|
2140 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
2141 | + $_SESSION['owner'] = 1; |
|
2142 | + } |
|
1717 | 2143 | if (isset($_POST['createdb'])) { |
1718 | 2144 | $_SESSION['install'] = 'database_create'; |
1719 | 2145 | } else { |
@@ -1750,10 +2176,18 @@ discard block |
||
1750 | 2176 | $popw = false; |
1751 | 2177 | foreach ($_SESSION['done'] as $done) { |
1752 | 2178 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
1753 | - if ($done == 'Create database') $pop = true; |
|
1754 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1755 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1756 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
2179 | + if ($done == 'Create database') { |
|
2180 | + $pop = true; |
|
2181 | + } |
|
2182 | + if ($_SESSION['install'] == 'database_create') { |
|
2183 | + $pop = true; |
|
2184 | + } |
|
2185 | + if ($_SESSION['install'] == 'database_import') { |
|
2186 | + $popi = true; |
|
2187 | + } |
|
2188 | + if ($_SESSION['install'] == 'waypoints') { |
|
2189 | + $popw = true; |
|
2190 | + } |
|
1757 | 2191 | } |
1758 | 2192 | if ($pop) { |
1759 | 2193 | sleep(5); |
@@ -1764,7 +2198,9 @@ discard block |
||
1764 | 2198 | } else if ($popw) { |
1765 | 2199 | sleep(5); |
1766 | 2200 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
1767 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2201 | + } else { |
|
2202 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2203 | + } |
|
1768 | 2204 | print '</div></ul>'; |
1769 | 2205 | print '<div id="error"></div>'; |
1770 | 2206 | /* foreach ($_SESSION['done'] as $done) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
25 | -$title="Install"; |
|
25 | +$title = "Install"; |
|
26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | if (!extension_loaded('curl')) { |
94 | 94 | $error[] = "Curl is not loaded."; |
95 | 95 | } |
96 | - if(function_exists('apache_get_modules') ){ |
|
97 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
96 | + if (function_exists('apache_get_modules')) { |
|
97 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
98 | 98 | $error[] = "mod_rewrite is not available."; |
99 | 99 | } |
100 | 100 | /* |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
112 | 112 | if (function_exists('get_headers')) { |
113 | 113 | //$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
114 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
115 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
114 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
115 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
116 | 116 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
117 | 117 | } else { |
118 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
119 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
118 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
119 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
120 | 120 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
121 | 121 | } |
122 | 122 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
197 | 197 | if (isset($_SERVER['REQUEST_URI'])) { |
198 | 198 | $URL = $_SERVER['REQUEST_URI']; |
199 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
199 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | ?> |
@@ -519,13 +519,13 @@ discard block |
||
519 | 519 | ?> |
520 | 520 | <tr> |
521 | 521 | <?php |
522 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
522 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
523 | 523 | ?> |
524 | 524 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
525 | 525 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
526 | 526 | <?php |
527 | 527 | } else { |
528 | - $hostport = explode(':',$source['host']); |
|
528 | + $hostport = explode(':', $source['host']); |
|
529 | 529 | if (isset($hostport[1])) { |
530 | 530 | $host = $hostport[0]; |
531 | 531 | $port = $hostport[1]; |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | <select name="timezones[]" id="timezones"> |
576 | 576 | <?php |
577 | 577 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
578 | - foreach($timezonelist as $timezones){ |
|
578 | + foreach ($timezonelist as $timezones) { |
|
579 | 579 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
580 | 580 | print '<option selected>'.$timezones.'</option>'; |
581 | 581 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | <select name="timezones[]" id="timezones"> |
631 | 631 | <?php |
632 | 632 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
633 | - foreach($timezonelist as $timezones){ |
|
633 | + foreach ($timezonelist as $timezones) { |
|
634 | 634 | if ($timezones == 'UTC') { |
635 | 635 | print '<option selected>'.$timezones.'</option>'; |
636 | 636 | } else print '<option>'.$timezones.'</option>'; |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | <br /> |
1090 | 1090 | <p> |
1091 | 1091 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1092 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1092 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
1093 | 1093 | </p> |
1094 | 1094 | <br /> |
1095 | 1095 | <p> |
@@ -1151,14 +1151,14 @@ discard block |
||
1151 | 1151 | $error = ''; |
1152 | 1152 | |
1153 | 1153 | if (isset($_POST['dbtype'])) { |
1154 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
1155 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
1156 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
1157 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
1158 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
1159 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
1160 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
1161 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
1154 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
1155 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
1156 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
1157 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
1158 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
1159 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
1160 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
1161 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
1162 | 1162 | |
1163 | 1163 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
1164 | 1164 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1178,49 +1178,49 @@ discard block |
||
1178 | 1178 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1179 | 1179 | */ |
1180 | 1180 | |
1181 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1181 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1182 | 1182 | |
1183 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1184 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1185 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1186 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1187 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1183 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1184 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1185 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1186 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1187 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1188 | 1188 | |
1189 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1190 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1191 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1192 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1193 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1194 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1195 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1196 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1197 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1198 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1189 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1190 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1191 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1192 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1193 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1194 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1195 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1196 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1197 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1198 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1199 | 1199 | |
1200 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1201 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1202 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1203 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1204 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1205 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1200 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1201 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1202 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1203 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1204 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1205 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1206 | 1206 | |
1207 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1208 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1207 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1208 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1209 | 1209 | |
1210 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1211 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1212 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1210 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1211 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1212 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1213 | 1213 | |
1214 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1214 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1215 | 1215 | if ($acars == 'acars') { |
1216 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1216 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1217 | 1217 | } else { |
1218 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1218 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1219 | 1219 | } |
1220 | 1220 | |
1221 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1222 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1223 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1221 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1222 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1223 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1224 | 1224 | |
1225 | 1225 | $source_name = $_POST['source_name']; |
1226 | 1226 | $source_latitude = $_POST['source_latitude']; |
@@ -1234,8 +1234,8 @@ discard block |
||
1234 | 1234 | |
1235 | 1235 | $sources = array(); |
1236 | 1236 | foreach ($source_name as $keys => $name) { |
1237 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1238 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1237 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
1238 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
1239 | 1239 | } |
1240 | 1240 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1241 | 1241 | |
@@ -1244,16 +1244,16 @@ discard block |
||
1244 | 1244 | $newstype = $_POST['newstype']; |
1245 | 1245 | |
1246 | 1246 | $newsfeeds = array(); |
1247 | - foreach($newsurl as $newskey => $url) { |
|
1247 | + foreach ($newsurl as $newskey => $url) { |
|
1248 | 1248 | if ($url != '') { |
1249 | 1249 | $type = $newstype[$newskey]; |
1250 | 1250 | $lng = $newslng[$newskey]; |
1251 | 1251 | if (isset($newsfeeds[$type][$lng])) { |
1252 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1252 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url)); |
|
1253 | 1253 | } else $newsfeeds[$type][$lng] = array($url); |
1254 | 1254 | } |
1255 | 1255 | } |
1256 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
1256 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
1257 | 1257 | |
1258 | 1258 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1259 | 1259 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1264,27 +1264,27 @@ discard block |
||
1264 | 1264 | $sbsurl = $_POST['sbsurl']; |
1265 | 1265 | */ |
1266 | 1266 | |
1267 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1268 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1269 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1270 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1271 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1272 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1273 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1274 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1267 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1268 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1269 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1270 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1271 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1272 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1273 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1274 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1275 | 1275 | |
1276 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1277 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1278 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1279 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1280 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1281 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1282 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1283 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1284 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1285 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1286 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1287 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1276 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1277 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1278 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1279 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1280 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1281 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1282 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1283 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1284 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1285 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1286 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1287 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1288 | 1288 | |
1289 | 1289 | /* |
1290 | 1290 | $globalSBS1Hosts = array(); |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | } |
1301 | 1301 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1302 | 1302 | */ |
1303 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1303 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1304 | 1304 | $host = $_POST['host']; |
1305 | 1305 | $port = $_POST['port']; |
1306 | 1306 | $name = $_POST['name']; |
@@ -1317,115 +1317,115 @@ discard block |
||
1317 | 1317 | else $cov = 'FALSE'; |
1318 | 1318 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1319 | 1319 | else $arch = 'FALSE'; |
1320 | - if (strpos($format[$key],'_callback')) { |
|
1321 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1320 | + if (strpos($format[$key], '_callback')) { |
|
1321 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1322 | 1322 | } elseif ($h != '' || $name[$key] != '') { |
1323 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1323 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1324 | 1324 | } |
1325 | 1325 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1326 | 1326 | } |
1327 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1327 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1328 | 1328 | |
1329 | 1329 | /* |
1330 | 1330 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1331 | 1331 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1332 | 1332 | */ |
1333 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1334 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1335 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1333 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1334 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1335 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1336 | 1336 | |
1337 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1338 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1337 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1338 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1339 | 1339 | |
1340 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1341 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1340 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1341 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1342 | 1342 | |
1343 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1344 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1343 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1344 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1345 | 1345 | |
1346 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1347 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1348 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1349 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1346 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1347 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1348 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1349 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1350 | 1350 | |
1351 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1352 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1353 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1351 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1352 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1353 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1354 | 1354 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1355 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1356 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1355 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1356 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1357 | 1357 | |
1358 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1359 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1360 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1361 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1362 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1363 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1364 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
1365 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
1366 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1367 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1358 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1359 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1360 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1361 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1362 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1363 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1364 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
1365 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
1366 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1367 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1368 | 1368 | |
1369 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1370 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1369 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1370 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1371 | 1371 | |
1372 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1373 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1372 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1373 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1374 | 1374 | |
1375 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1375 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1376 | 1376 | if ($archiveyear == "archiveyear") { |
1377 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1377 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1378 | 1378 | } else { |
1379 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1379 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1380 | 1380 | } |
1381 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1382 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1383 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1384 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1381 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1382 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1383 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1384 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1385 | 1385 | |
1386 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1387 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1388 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1389 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1386 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1387 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1388 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1389 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1390 | 1390 | |
1391 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1392 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1393 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1391 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1392 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1393 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1394 | 1394 | |
1395 | 1395 | // Create in settings.php keys not yet configurable if not already here |
1396 | 1396 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1397 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1397 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1398 | 1398 | |
1399 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1399 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1400 | 1400 | if ($resetyearstats == 'resetyearstats') { |
1401 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1401 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1402 | 1402 | } else { |
1403 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1403 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1404 | 1404 | } |
1405 | 1405 | |
1406 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1406 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1407 | 1407 | if ($archive == 'archive') { |
1408 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1408 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1409 | 1409 | } else { |
1410 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1410 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1411 | 1411 | } |
1412 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1412 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1413 | 1413 | if ($archiveresults == 'archiveresults') { |
1414 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1414 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1415 | 1415 | } else { |
1416 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1416 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1417 | 1417 | } |
1418 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1418 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1419 | 1419 | if ($daemon == 'daemon') { |
1420 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1420 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1421 | 1421 | } else { |
1422 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1422 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1423 | 1423 | } |
1424 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1424 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1425 | 1425 | if ($schedules == 'schedules') { |
1426 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1426 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1427 | 1427 | } else { |
1428 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1428 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | /* |
@@ -1436,280 +1436,280 @@ discard block |
||
1436 | 1436 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1437 | 1437 | } |
1438 | 1438 | */ |
1439 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1440 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1441 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1442 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1443 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1439 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1440 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1441 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1442 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1443 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1444 | 1444 | $va = false; |
1445 | 1445 | if ($globalivao == 'ivao') { |
1446 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1446 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1447 | 1447 | $va = true; |
1448 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1448 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1449 | 1449 | if ($globalvatsim == 'vatsim') { |
1450 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1450 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1451 | 1451 | $va = true; |
1452 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1452 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1453 | 1453 | if ($globalphpvms == 'phpvms') { |
1454 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1454 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1455 | 1455 | $va = true; |
1456 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1456 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1457 | 1457 | if ($globalvam == 'vam') { |
1458 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1458 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1459 | 1459 | $va = true; |
1460 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1460 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1461 | 1461 | if ($va) { |
1462 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1463 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1462 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1463 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1464 | 1464 | if ($globalva == 'va' || $va) { |
1465 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1466 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1465 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1466 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1467 | 1467 | } else { |
1468 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1469 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1470 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1468 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1469 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1470 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | |
1474 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
1474 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
1475 | 1475 | if ($mapoffline == 'mapoffline') { |
1476 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
1476 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
1477 | 1477 | } else { |
1478 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
1478 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
1479 | 1479 | } |
1480 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
1480 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
1481 | 1481 | if ($globaloffline == 'globaloffline') { |
1482 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
1482 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
1483 | 1483 | } else { |
1484 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
1484 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
1485 | 1485 | } |
1486 | 1486 | |
1487 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1487 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1488 | 1488 | if ($notam == 'notam') { |
1489 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1489 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1490 | 1490 | } else { |
1491 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1491 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1492 | 1492 | } |
1493 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1493 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1494 | 1494 | if ($owner == 'owner') { |
1495 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1495 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1496 | 1496 | } else { |
1497 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1497 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1498 | 1498 | } |
1499 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1499 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1500 | 1500 | if ($map3d == 'map3d') { |
1501 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1501 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1502 | 1502 | } else { |
1503 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1503 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1504 | 1504 | } |
1505 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1505 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1506 | 1506 | if ($crash == 'crash') { |
1507 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1507 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1508 | 1508 | } else { |
1509 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1509 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1510 | 1510 | } |
1511 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1511 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1512 | 1512 | if ($fires == 'fires') { |
1513 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1513 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1514 | 1514 | } else { |
1515 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1515 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1516 | 1516 | } |
1517 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1517 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1518 | 1518 | if ($firessupport == 'firessupport') { |
1519 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1519 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1520 | 1520 | } else { |
1521 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1521 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1522 | 1522 | } |
1523 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1523 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1524 | 1524 | if ($mapsatellites == 'mapsatellites') { |
1525 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1525 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1526 | 1526 | } else { |
1527 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1527 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1528 | 1528 | } |
1529 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1529 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1530 | 1530 | if ($map3ddefault == 'map3ddefault') { |
1531 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1531 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1532 | 1532 | } else { |
1533 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1533 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1534 | 1534 | } |
1535 | - $one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING); |
|
1535 | + $one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING); |
|
1536 | 1536 | if ($one3dmodel == 'one3dmodel') { |
1537 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE')); |
|
1537 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE')); |
|
1538 | 1538 | } else { |
1539 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE')); |
|
1539 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE')); |
|
1540 | 1540 | } |
1541 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1541 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1542 | 1542 | if ($map3dliveries == 'map3dliveries') { |
1543 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1543 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1544 | 1544 | } else { |
1545 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1545 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1546 | 1546 | } |
1547 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1547 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1548 | 1548 | if ($translate == 'translate') { |
1549 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1549 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1550 | 1550 | } else { |
1551 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1551 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1552 | 1552 | } |
1553 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1553 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1554 | 1554 | if ($realairlines == 'realairlines') { |
1555 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1555 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1556 | 1556 | } else { |
1557 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1557 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1558 | 1558 | } |
1559 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1559 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1560 | 1560 | if ($estimation == 'estimation') { |
1561 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1561 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1562 | 1562 | } else { |
1563 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1563 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1564 | 1564 | } |
1565 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1565 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1566 | 1566 | if ($metar == 'metar') { |
1567 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1567 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1568 | 1568 | } else { |
1569 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1569 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1570 | 1570 | } |
1571 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1571 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1572 | 1572 | if ($metarcycle == 'metarcycle') { |
1573 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1573 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1574 | 1574 | } else { |
1575 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1575 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1576 | 1576 | } |
1577 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1577 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1578 | 1578 | if ($fork == 'fork') { |
1579 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1579 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1580 | 1580 | } else { |
1581 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1581 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1584 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1585 | 1585 | if ($colormap == 'colormap') { |
1586 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1586 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1587 | 1587 | } else { |
1588 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1588 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1589 | 1589 | } |
1590 | 1590 | |
1591 | 1591 | if (isset($_POST['aircrafticoncolor'])) { |
1592 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1593 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1592 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1593 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1594 | 1594 | } |
1595 | 1595 | |
1596 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1597 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1596 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1597 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1598 | 1598 | |
1599 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1600 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1601 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1602 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1603 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1604 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1599 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1600 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1601 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1602 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1603 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1604 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1605 | 1605 | |
1606 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1606 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1607 | 1607 | if ($mappopup == 'mappopup') { |
1608 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1608 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1609 | 1609 | } else { |
1610 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1610 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1611 | 1611 | } |
1612 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1612 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1613 | 1613 | if ($airportpopup == 'airportpopup') { |
1614 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1614 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1615 | 1615 | } else { |
1616 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1616 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1617 | 1617 | } |
1618 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1618 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1619 | 1619 | if ($maphistory == 'maphistory') { |
1620 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1620 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1621 | 1621 | } else { |
1622 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1622 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1623 | 1623 | } |
1624 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1624 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1625 | 1625 | if ($maptooltip == 'maptooltip') { |
1626 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1626 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1627 | 1627 | } else { |
1628 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1628 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1629 | 1629 | } |
1630 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1630 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1631 | 1631 | if ($flightroute == 'flightroute') { |
1632 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1632 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1633 | 1633 | } else { |
1634 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1634 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1635 | 1635 | } |
1636 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1636 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1637 | 1637 | if ($flightremainingroute == 'flightremainingroute') { |
1638 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1638 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1639 | 1639 | } else { |
1640 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1640 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1641 | 1641 | } |
1642 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1642 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1643 | 1643 | if ($allflights == 'allflights') { |
1644 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1644 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1645 | 1645 | } else { |
1646 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1646 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1647 | 1647 | } |
1648 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1648 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1649 | 1649 | if ($bbox == 'bbox') { |
1650 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1650 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1651 | 1651 | } else { |
1652 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1652 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1653 | 1653 | } |
1654 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1654 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1655 | 1655 | if ($groundaltitude == 'groundaltitude') { |
1656 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1656 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1657 | 1657 | } else { |
1658 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1658 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1659 | 1659 | } |
1660 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1660 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1661 | 1661 | if ($waypoints == 'waypoints') { |
1662 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1662 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1663 | 1663 | } else { |
1664 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1664 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1665 | 1665 | } |
1666 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1666 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1667 | 1667 | if ($geoid == 'geoid') { |
1668 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1668 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1669 | 1669 | } else { |
1670 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1670 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1671 | 1671 | } |
1672 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1673 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1672 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1673 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1674 | 1674 | |
1675 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1675 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1676 | 1676 | if ($noairlines == 'noairlines') { |
1677 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1677 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1678 | 1678 | } else { |
1679 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1679 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1680 | 1680 | } |
1681 | 1681 | |
1682 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
1682 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
1683 | 1683 | if ($tsk == 'tsk') { |
1684 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
1684 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
1685 | 1685 | } else { |
1686 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
1686 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
1687 | 1687 | } |
1688 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
1688 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
1689 | 1689 | if ($mapmatching == 'mapmatching') { |
1690 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
1690 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
1691 | 1691 | } else { |
1692 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
1692 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
1693 | 1693 | } |
1694 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
1695 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1696 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
1697 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
1694 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
1695 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1696 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
1697 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
1698 | 1698 | |
1699 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1699 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1700 | 1700 | |
1701 | 1701 | // Set some defaults values... |
1702 | 1702 | if (!isset($globalAircraftImageSources)) { |
1703 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1704 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1703 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1704 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1705 | 1705 | } |
1706 | 1706 | |
1707 | 1707 | if (!isset($globalSchedulesSources)) { |
1708 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1709 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1708 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1709 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1710 | 1710 | } |
1711 | 1711 | |
1712 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1712 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1713 | 1713 | |
1714 | 1714 | if ($error == '') settings::modify_settings($settings); |
1715 | 1715 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | require_once(dirname(__FILE__).'/class.Source.php'); |
8 | 8 | |
9 | 9 | class TrackerImport { |
10 | - private $all_tracked = array(); |
|
11 | - private $last_delete_hourly = 0; |
|
12 | - private $last_delete = 0; |
|
13 | - private $stats = array(); |
|
14 | - private $tmd = 0; |
|
15 | - private $source_location = array(); |
|
16 | - public $db = null; |
|
17 | - public $nb = 0; |
|
10 | + private $all_tracked = array(); |
|
11 | + private $last_delete_hourly = 0; |
|
12 | + private $last_delete = 0; |
|
13 | + private $stats = array(); |
|
14 | + private $tmd = 0; |
|
15 | + private $source_location = array(); |
|
16 | + public $db = null; |
|
17 | + public $nb = 0; |
|
18 | 18 | |
19 | - public function __construct($dbc = null) { |
|
19 | + public function __construct($dbc = null) { |
|
20 | 20 | global $globalBeta; |
21 | 21 | $Connection = new Connection($dbc); |
22 | 22 | $this->db = $Connection->db(); |
@@ -38,50 +38,50 @@ discard block |
||
38 | 38 | } |
39 | 39 | } |
40 | 40 | */ |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - public function checkAll() { |
|
43 | + public function checkAll() { |
|
44 | 44 | global $globalDebug; |
45 | 45 | if ($globalDebug) echo "Update last seen tracked data...\n"; |
46 | 46 | foreach ($this->all_tracked as $key => $flight) { |
47 | - if (isset($this->all_tracked[$key]['id'])) { |
|
47 | + if (isset($this->all_tracked[$key]['id'])) { |
|
48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
49 | - $Tracker = new Tracker($this->db); |
|
50 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
51 | - } |
|
49 | + $Tracker = new Tracker($this->db); |
|
50 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
51 | + } |
|
52 | + } |
|
52 | 53 | } |
53 | - } |
|
54 | 54 | |
55 | - public function del() { |
|
55 | + public function del() { |
|
56 | 56 | global $globalDebug; |
57 | 57 | // Delete old infos |
58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
60 | - if (isset($flight['lastupdate'])) { |
|
61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
62 | - if (isset($this->all_tracked[$key]['id'])) { |
|
63 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
60 | + if (isset($flight['lastupdate'])) { |
|
61 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
62 | + if (isset($this->all_tracked[$key]['id'])) { |
|
63 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
64 | 64 | /* |
65 | 65 | $TrackerLive = new TrackerLive(); |
66 | 66 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
67 | 67 | $TrackerLive->db = null; |
68 | 68 | */ |
69 | - //$real_arrival = $this->arrival($key); |
|
70 | - $Tracker = new Tracker($this->db); |
|
71 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
69 | + //$real_arrival = $this->arrival($key); |
|
70 | + $Tracker = new Tracker($this->db); |
|
71 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
72 | 72 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
73 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
74 | 74 | } |
75 | 75 | // Put in archive |
76 | 76 | // $Tracker->db = null; |
77 | - } |
|
78 | - unset($this->all_tracked[$key]); |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
82 | - } |
|
77 | + } |
|
78 | + unset($this->all_tracked[$key]); |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | - public function add($line) { |
|
84 | + public function add($line) { |
|
85 | 85 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
86 | 86 | if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015'; |
87 | 87 | date_default_timezone_set('UTC'); |
@@ -90,47 +90,47 @@ discard block |
||
90 | 90 | |
91 | 91 | // SBS format is CSV format |
92 | 92 | if(is_array($line) && isset($line['ident'])) { |
93 | - //print_r($line); |
|
94 | - if (isset($line['ident'])) { |
|
93 | + //print_r($line); |
|
94 | + if (isset($line['ident'])) { |
|
95 | 95 | |
96 | 96 | |
97 | 97 | // Increment message number |
98 | 98 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
99 | - $current_date = date('Y-m-d'); |
|
100 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
101 | - else $source = ''; |
|
102 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
103 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
104 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
105 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
106 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
99 | + $current_date = date('Y-m-d'); |
|
100 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
101 | + else $source = ''; |
|
102 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
103 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
104 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
105 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
106 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | 110 | $Common = new Common(); |
111 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | - else $id = trim($line['id']); |
|
111 | + if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | + else $id = trim($line['id']); |
|
113 | 113 | |
114 | 114 | if (!isset($this->all_tracked[$id])) { |
115 | - $this->all_tracked[$id] = array(); |
|
116 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
119 | - if (!isset($line['id'])) { |
|
115 | + $this->all_tracked[$id] = array(); |
|
116 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
119 | + if (!isset($line['id'])) { |
|
120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
121 | 121 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
122 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
127 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
127 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
128 | 128 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
129 | - } else { |
|
129 | + } else { |
|
130 | 130 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
131 | 131 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
132 | 132 | return ''; |
133 | - } |
|
133 | + } |
|
134 | 134 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
136 | 136 | return ''; |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | |
148 | 148 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
149 | 149 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
151 | - if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
151 | + if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
152 | 152 | $timeelapsed = microtime(true); |
153 | - $Tracker = new Tracker($this->db); |
|
154 | - $fromsource = NULL; |
|
155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
153 | + $Tracker = new Tracker($this->db); |
|
154 | + $fromsource = NULL; |
|
155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
157 | 157 | $Tracker->db = null; |
158 | 158 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
159 | - } |
|
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
159 | + } |
|
160 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | if (isset($line['speed']) && $line['speed'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
166 | 166 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
168 | - if ($distance > 100 && $distance < 10000) { |
|
167 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
168 | + if ($distance > 100 && $distance < 10000) { |
|
169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 170 | $speed = $speed*3.6; |
171 | 171 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
173 | - } |
|
173 | + } |
|
174 | 174 | } |
175 | 175 | |
176 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | - else unset($timediff); |
|
179 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
176 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | + else unset($timediff); |
|
179 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
180 | 180 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
181 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -192,30 +192,30 @@ discard block |
||
192 | 192 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
193 | 193 | $this->tmd = 0; |
194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
195 | - } |
|
195 | + } |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
200 | 200 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
201 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
202 | - $dataFound = true; |
|
203 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
201 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
202 | + $dataFound = true; |
|
203 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
204 | 204 | } |
205 | 205 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
206 | 206 | } |
207 | 207 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
208 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
210 | 210 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
211 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
212 | - $dataFound = true; |
|
213 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
211 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
212 | + $dataFound = true; |
|
213 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
214 | 214 | } |
215 | 215 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
216 | 216 | } |
217 | 217 | |
218 | - } else if ($globalDebug && $timediff > 20) { |
|
218 | + } else if ($globalDebug && $timediff > 20) { |
|
219 | 219 | $this->tmd = $this->tmd + 1; |
220 | 220 | if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) { |
221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
@@ -223,131 +223,131 @@ discard block |
||
223 | 223 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
225 | 225 | } |
226 | - } |
|
226 | + } |
|
227 | 227 | } |
228 | 228 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
230 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
229 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
230 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
231 | 231 | } |
232 | 232 | if (isset($line['format_source']) && $line['format_source'] != '') { |
233 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
233 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
234 | 234 | } |
235 | 235 | if (isset($line['source_name']) && $line['source_name'] != '') { |
236 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
236 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
237 | 237 | } |
238 | 238 | if (isset($line['comment']) && $line['comment'] != '') { |
239 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
240 | - //$dataFound = true; |
|
239 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
240 | + //$dataFound = true; |
|
241 | 241 | } |
242 | 242 | if (isset($line['type']) && $line['type'] != '') { |
243 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
244 | - //$dataFound = true; |
|
243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
244 | + //$dataFound = true; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | - //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
248 | + //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
249 | 249 | if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
250 | 250 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
251 | 251 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
252 | 252 | //$dataFound = true; |
253 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
253 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
257 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
257 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
264 | - //$dataFound = true; |
|
261 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
264 | + //$dataFound = true; |
|
265 | 265 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
266 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
270 | 270 | } |
271 | 271 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
272 | 272 | |
273 | 273 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
274 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
275 | - if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
276 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
274 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
275 | + if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
276 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
278 | 278 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
279 | 279 | $timeelapsed = microtime(true); |
280 | 280 | $TrackerLive = new TrackerLive($this->db); |
281 | 281 | if (isset($line['id'])) { |
282 | - $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
282 | + $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
283 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
284 | 284 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | - $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
285 | + $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
286 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
287 | 287 | } else $recent_ident = ''; |
288 | 288 | $TrackerLive->db=null; |
289 | 289 | |
290 | 290 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
291 | 291 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
292 | - } else { |
|
292 | + } else { |
|
293 | 293 | $recent_ident = ''; |
294 | 294 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
295 | - } |
|
296 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
297 | - if($recent_ident == "") |
|
298 | - { |
|
295 | + } |
|
296 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
297 | + if($recent_ident == "") |
|
298 | + { |
|
299 | 299 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
300 | 300 | //adds the spotter data for the archive |
301 | - $highlight = ''; |
|
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | - $timeelapsed = microtime(true); |
|
304 | - $Tracker = new Tracker($this->db); |
|
305 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
306 | - $Tracker->db = null; |
|
307 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
301 | + $highlight = ''; |
|
302 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | + $timeelapsed = microtime(true); |
|
304 | + $Tracker = new Tracker($this->db); |
|
305 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
306 | + $Tracker->db = null; |
|
307 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
308 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
309 | 309 | |
310 | 310 | |
311 | - // Add source stat in DB |
|
312 | - $Stats = new Stats($this->db); |
|
313 | - if (!empty($this->stats)) { |
|
311 | + // Add source stat in DB |
|
312 | + $Stats = new Stats($this->db); |
|
313 | + if (!empty($this->stats)) { |
|
314 | 314 | if ($globalDebug) echo 'Add source stats : '; |
315 | - foreach($this->stats as $date => $data) { |
|
316 | - foreach($data as $source => $sourced) { |
|
317 | - //print_r($sourced); |
|
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
320 | - if (isset($sourced['msg'])) { |
|
321 | - if (time() - $sourced['msg']['date'] > 10) { |
|
322 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
324 | - unset($this->stats[$date][$source]['msg']); |
|
325 | - } |
|
326 | - } |
|
327 | - } |
|
328 | - if ($date != date('Y-m-d')) { |
|
329 | - unset($this->stats[$date]); |
|
330 | - } |
|
331 | - } |
|
332 | - if ($globalDebug) echo 'Done'."\n"; |
|
315 | + foreach($this->stats as $date => $data) { |
|
316 | + foreach($data as $source => $sourced) { |
|
317 | + //print_r($sourced); |
|
318 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
320 | + if (isset($sourced['msg'])) { |
|
321 | + if (time() - $sourced['msg']['date'] > 10) { |
|
322 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
323 | + echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
324 | + unset($this->stats[$date][$source]['msg']); |
|
325 | + } |
|
326 | + } |
|
327 | + } |
|
328 | + if ($date != date('Y-m-d')) { |
|
329 | + unset($this->stats[$date]); |
|
330 | + } |
|
331 | + } |
|
332 | + if ($globalDebug) echo 'Done'."\n"; |
|
333 | 333 | |
334 | - } |
|
335 | - $Stats->db = null; |
|
334 | + } |
|
335 | + $Stats->db = null; |
|
336 | 336 | |
337 | - $this->del(); |
|
337 | + $this->del(); |
|
338 | 338 | //$ignoreImport = false; |
339 | 339 | $this->all_tracked[$id]['addedTracker'] = 1; |
340 | 340 | //print_r($this->all_tracked[$id]); |
341 | 341 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
342 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
343 | - //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
344 | - $TrackerLive = new TrackerLive($this->db); |
|
345 | - $TrackerLive->deleteLiveTrackerData(); |
|
346 | - $TrackerLive->db=null; |
|
347 | - if ($globalDebug) echo " Done\n"; |
|
348 | - $this->last_delete = time(); |
|
342 | + if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
343 | + //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
344 | + $TrackerLive = new TrackerLive($this->db); |
|
345 | + $TrackerLive->deleteLiveTrackerData(); |
|
346 | + $TrackerLive->db=null; |
|
347 | + if ($globalDebug) echo " Done\n"; |
|
348 | + $this->last_delete = time(); |
|
349 | 349 | } |
350 | - } else { |
|
350 | + } else { |
|
351 | 351 | $this->all_tracked[$id]['id'] = $recent_ident; |
352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; |
353 | 353 | if (isset($globalDaemon) && !$globalDaemon) { |
@@ -356,16 +356,16 @@ discard block |
||
356 | 356 | $Tracker->db = null; |
357 | 357 | } |
358 | 358 | |
359 | - } |
|
359 | + } |
|
360 | 360 | } |
361 | - } |
|
362 | - //adds the spotter LIVE data |
|
363 | - if ($globalDebug) { |
|
361 | + } |
|
362 | + //adds the spotter LIVE data |
|
363 | + if ($globalDebug) { |
|
364 | 364 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
365 | - } |
|
366 | - $ignoreImport = false; |
|
365 | + } |
|
366 | + $ignoreImport = false; |
|
367 | 367 | |
368 | - if (!$ignoreImport) { |
|
368 | + if (!$ignoreImport) { |
|
369 | 369 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
370 | 370 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
371 | 371 | $timeelapsed = microtime(true); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | if ($stats_heading == 16) $stats_heading = 0; |
404 | 404 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | 405 | for ($i=0;$i<=15;$i++) { |
406 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
406 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
407 | 407 | } |
408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
409 | 409 | } else { |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | //var_dump($this->stats); |
417 | 417 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
418 | 418 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | - end($this->stats[$current_date][$source]['hist']); |
|
420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
419 | + end($this->stats[$current_date][$source]['hist']); |
|
420 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
421 | 421 | } else $mini = 0; |
422 | 422 | for ($i=$mini;$i<=$distance;$i+=10) { |
423 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
423 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
424 | 424 | } |
425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
426 | 426 | } else { |
@@ -436,22 +436,22 @@ discard block |
||
436 | 436 | |
437 | 437 | |
438 | 438 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
440 | - $TrackerLive = new TrackerLive($this->db); |
|
441 | - $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
442 | - $TrackerLive->db = null; |
|
443 | - //TrackerLive->deleteLiveTrackerData(); |
|
444 | - if ($globalDebug) echo " Done\n"; |
|
445 | - $this->last_delete_hourly = time(); |
|
439 | + if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
440 | + $TrackerLive = new TrackerLive($this->db); |
|
441 | + $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
442 | + $TrackerLive->db = null; |
|
443 | + //TrackerLive->deleteLiveTrackerData(); |
|
444 | + if ($globalDebug) echo " Done\n"; |
|
445 | + $this->last_delete_hourly = time(); |
|
446 | 446 | } |
447 | 447 | |
448 | - } |
|
449 | - //$ignoreImport = false; |
|
448 | + } |
|
449 | + //$ignoreImport = false; |
|
450 | 450 | } |
451 | 451 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
452 | 452 | if ($send) return $this->all_tracked[$id]; |
453 | - } |
|
453 | + } |
|
454 | + } |
|
454 | 455 | } |
455 | - } |
|
456 | 456 | } |
457 | 457 | ?> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (isset($this->all_tracked[$key]['id'])) { |
48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
49 | 49 | $Tracker = new Tracker($this->db); |
50 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
50 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
60 | 60 | if (isset($flight['lastupdate'])) { |
61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
61 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
62 | 62 | if (isset($this->all_tracked[$key]['id'])) { |
63 | 63 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
64 | 64 | /* |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | //$real_arrival = $this->arrival($key); |
70 | 70 | $Tracker = new Tracker($this->db); |
71 | 71 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
72 | - $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
|
72 | + $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']); |
|
73 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
74 | 74 | } |
75 | 75 | // Put in archive |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $send = false; |
90 | 90 | |
91 | 91 | // SBS format is CSV format |
92 | - if(is_array($line) && isset($line['ident'])) { |
|
92 | + if (is_array($line) && isset($line['ident'])) { |
|
93 | 93 | //print_r($line); |
94 | 94 | if (isset($line['ident'])) { |
95 | 95 | |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | |
114 | 114 | if (!isset($this->all_tracked[$id])) { |
115 | 115 | $this->all_tracked[$id] = array(); |
116 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
116 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0)); |
|
117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '')); |
|
118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
119 | 119 | if (!isset($line['id'])) { |
120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
121 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
121 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
122 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
123 | 123 | if ($globalAllTracked !== FALSE) $dataFound = true; |
124 | 124 | } |
125 | 125 | |
126 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
126 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
127 | 127 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
128 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
128 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
129 | 129 | } else { |
130 | 130 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
131 | 131 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
132 | 132 | return ''; |
133 | 133 | } |
134 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
134 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
136 | 136 | return ''; |
137 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
137 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
138 | 138 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
139 | 139 | return ''; |
140 | 140 | } elseif (!isset($line['datetime'])) { |
141 | 141 | date_default_timezone_set('UTC'); |
142 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
142 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
143 | 143 | } else { |
144 | 144 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
145 | 145 | return ''; |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | |
148 | 148 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
149 | 149 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
151 | 151 | if ($this->all_tracked[$id]['addedTracker'] == 1) { |
152 | 152 | $timeelapsed = microtime(true); |
153 | 153 | $Tracker = new Tracker($this->db); |
154 | 154 | $fromsource = NULL; |
155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
157 | 157 | $Tracker->db = null; |
158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
158 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
159 | 159 | } |
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
160 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | if (isset($line['speed']) && $line['speed'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
166 | 166 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
167 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
168 | 168 | if ($distance > 100 && $distance < 10000) { |
169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 170 | $speed = $speed*3.6; |
171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
171 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | 176 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
178 | 178 | else unset($timediff); |
179 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
179 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { |
|
180 | 180 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
181 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'], 0.08)) { |
|
182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
187 | 187 | $timeelapsed = microtime(true); |
188 | 188 | $Tracker = new Tracker($this->db); |
189 | - $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
189 | + $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
190 | 190 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
191 | 191 | $Tracker->db = null; |
192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
192 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
193 | 193 | $this->tmd = 0; |
194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
195 | 195 | } |
@@ -197,75 +197,75 @@ discard block |
||
197 | 197 | |
198 | 198 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
200 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
200 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
201 | 201 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
202 | 202 | $dataFound = true; |
203 | 203 | $this->all_tracked[$id]['time_last_coord'] = time(); |
204 | 204 | } |
205 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
205 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
206 | 206 | } |
207 | 207 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | 208 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
210 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
210 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
211 | 211 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
212 | 212 | $dataFound = true; |
213 | 213 | $this->all_tracked[$id]['time_last_coord'] = time(); |
214 | 214 | } |
215 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
215 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | } else if ($globalDebug && $timediff > 20) { |
219 | 219 | $this->tmd = $this->tmd + 1; |
220 | 220 | if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) { |
221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
222 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
223 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
222 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
223 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
225 | 225 | } |
226 | 226 | } |
227 | 227 | } |
228 | 228 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | 229 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
230 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
230 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
231 | 231 | } |
232 | 232 | if (isset($line['format_source']) && $line['format_source'] != '') { |
233 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
233 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
234 | 234 | } |
235 | 235 | if (isset($line['source_name']) && $line['source_name'] != '') { |
236 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
236 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
237 | 237 | } |
238 | 238 | if (isset($line['comment']) && $line['comment'] != '') { |
239 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
239 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment'])); |
|
240 | 240 | //$dataFound = true; |
241 | 241 | } |
242 | 242 | if (isset($line['type']) && $line['type'] != '') { |
243 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
244 | 244 | //$dataFound = true; |
245 | 245 | } |
246 | 246 | |
247 | 247 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | 248 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
|
251 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
|
249 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => $line['altitude'])); |
|
251 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude'])); |
|
252 | 252 | //$dataFound = true; |
253 | 253 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
254 | 254 | } |
255 | 255 | |
256 | 256 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
257 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
257 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
261 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
263 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
264 | 264 | //$dataFound = true; |
265 | 265 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
266 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
267 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
268 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | 269 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
270 | 270 | } |
271 | 271 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -273,54 +273,54 @@ discard block |
||
273 | 273 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
274 | 274 | $this->all_tracked[$id]['lastupdate'] = time(); |
275 | 275 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
276 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
276 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | 277 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
278 | 278 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
279 | 279 | $timeelapsed = microtime(true); |
280 | 280 | $TrackerLive = new TrackerLive($this->db); |
281 | 281 | if (isset($line['id'])) { |
282 | 282 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
283 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
284 | 284 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | 285 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
286 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
287 | 287 | } else $recent_ident = ''; |
288 | - $TrackerLive->db=null; |
|
288 | + $TrackerLive->db = null; |
|
289 | 289 | |
290 | 290 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
291 | 291 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
292 | 292 | } else { |
293 | 293 | $recent_ident = ''; |
294 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
294 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
295 | 295 | } |
296 | 296 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
297 | - if($recent_ident == "") |
|
297 | + if ($recent_ident == "") |
|
298 | 298 | { |
299 | 299 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
300 | 300 | //adds the spotter data for the archive |
301 | 301 | $highlight = ''; |
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
302 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | 303 | $timeelapsed = microtime(true); |
304 | 304 | $Tracker = new Tracker($this->db); |
305 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
305 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); |
|
306 | 306 | $Tracker->db = null; |
307 | 307 | if ($globalDebug && isset($result)) echo $result."\n"; |
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
308 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
309 | 309 | |
310 | 310 | |
311 | 311 | // Add source stat in DB |
312 | 312 | $Stats = new Stats($this->db); |
313 | 313 | if (!empty($this->stats)) { |
314 | 314 | if ($globalDebug) echo 'Add source stats : '; |
315 | - foreach($this->stats as $date => $data) { |
|
316 | - foreach($data as $source => $sourced) { |
|
315 | + foreach ($this->stats as $date => $data) { |
|
316 | + foreach ($data as $source => $sourced) { |
|
317 | 317 | //print_r($sourced); |
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
318 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_tracker', $date); |
|
319 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_tracker', $date); |
|
320 | 320 | if (isset($sourced['msg'])) { |
321 | 321 | if (time() - $sourced['msg']['date'] > 10) { |
322 | 322 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
323 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_tracker', $date); |
|
324 | 324 | unset($this->stats[$date][$source]['msg']); |
325 | 325 | } |
326 | 326 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
344 | 344 | $TrackerLive = new TrackerLive($this->db); |
345 | 345 | $TrackerLive->deleteLiveTrackerData(); |
346 | - $TrackerLive->db=null; |
|
346 | + $TrackerLive->db = null; |
|
347 | 347 | if ($globalDebug) echo " Done\n"; |
348 | 348 | $this->last_delete = time(); |
349 | 349 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; |
353 | 353 | if (isset($globalDaemon) && !$globalDaemon) { |
354 | 354 | $Tracker = new Tracker($this->db); |
355 | - $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
|
355 | + $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); |
|
356 | 356 | $Tracker->db = null; |
357 | 357 | } |
358 | 358 | |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | $ignoreImport = false; |
367 | 367 | |
368 | 368 | if (!$ignoreImport) { |
369 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
369 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
370 | 370 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
371 | 371 | $timeelapsed = microtime(true); |
372 | 372 | $TrackerLive = new TrackerLive($this->db); |
373 | - $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
373 | + $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
374 | 374 | $TrackerLive->db = null; |
375 | 375 | $this->all_tracked[$id]['putinarchive'] = false; |
376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
376 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
377 | 377 | |
378 | 378 | // Put statistics in $this->stats variable |
379 | 379 | |
@@ -390,19 +390,19 @@ discard block |
||
390 | 390 | $latitude = $globalCenterLatitude; |
391 | 391 | $longitude = $globalCenterLongitude; |
392 | 392 | } |
393 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
393 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
394 | 394 | } else { |
395 | 395 | $latitude = $this->source_location[$source]['latitude']; |
396 | 396 | $longitude = $this->source_location[$source]['longitude']; |
397 | 397 | } |
398 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
398 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
399 | 399 | //$stats_heading = $stats_heading%22.5; |
400 | 400 | $stats_heading = round($stats_heading/22.5); |
401 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
401 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
402 | 402 | $current_date = date('Y-m-d'); |
403 | 403 | if ($stats_heading == 16) $stats_heading = 0; |
404 | 404 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | - for ($i=0;$i<=15;$i++) { |
|
405 | + for ($i = 0; $i <= 15; $i++) { |
|
406 | 406 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
407 | 407 | } |
408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
418 | 418 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | 419 | end($this->stats[$current_date][$source]['hist']); |
420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
420 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
421 | 421 | } else $mini = 0; |
422 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
422 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
423 | 423 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
424 | 424 | } |
425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $this->all_tracked[$id]['lastupdate'] = time(); |
432 | 432 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
433 | 433 | if ($globalDebug) echo $result."\n"; |
434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
434 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
435 | 435 | //$this->del(); |
436 | 436 | |
437 | 437 |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | |
43 | 43 | public function checkAll() { |
44 | 44 | global $globalDebug; |
45 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
45 | + if ($globalDebug) { |
|
46 | + echo "Update last seen tracked data...\n"; |
|
47 | + } |
|
46 | 48 | foreach ($this->all_tracked as $key => $flight) { |
47 | 49 | if (isset($this->all_tracked[$key]['id'])) { |
48 | 50 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
@@ -55,12 +57,16 @@ discard block |
||
55 | 57 | public function del() { |
56 | 58 | global $globalDebug; |
57 | 59 | // Delete old infos |
58 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
60 | + if ($globalDebug) { |
|
61 | + echo 'Delete old values and update latest data...'."\n"; |
|
62 | + } |
|
59 | 63 | foreach ($this->all_tracked as $key => $flight) { |
60 | 64 | if (isset($flight['lastupdate'])) { |
61 | 65 | if ($flight['lastupdate'] < (time()-3000)) { |
62 | 66 | if (isset($this->all_tracked[$key]['id'])) { |
63 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
67 | + if ($globalDebug) { |
|
68 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
69 | + } |
|
64 | 70 | /* |
65 | 71 | $TrackerLive = new TrackerLive(); |
66 | 72 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
@@ -70,7 +76,9 @@ discard block |
||
70 | 76 | $Tracker = new Tracker($this->db); |
71 | 77 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
72 | 78 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
73 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
79 | + if ($globalDebug && $result != 'success') { |
|
80 | + echo '!!! ERROR : '.$result."\n"; |
|
81 | + } |
|
74 | 82 | } |
75 | 83 | // Put in archive |
76 | 84 | // $Tracker->db = null; |
@@ -83,7 +91,9 @@ discard block |
||
83 | 91 | |
84 | 92 | public function add($line) { |
85 | 93 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
86 | - if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015'; |
|
94 | + if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') { |
|
95 | + $globalCoordMinChangeTracker = '0.015'; |
|
96 | + } |
|
87 | 97 | date_default_timezone_set('UTC'); |
88 | 98 | $dataFound = false; |
89 | 99 | $send = false; |
@@ -97,19 +107,29 @@ discard block |
||
97 | 107 | // Increment message number |
98 | 108 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
99 | 109 | $current_date = date('Y-m-d'); |
100 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
101 | - else $source = ''; |
|
102 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
110 | + if (isset($line['source_name'])) { |
|
111 | + $source = $line['source_name']; |
|
112 | + } else { |
|
113 | + $source = ''; |
|
114 | + } |
|
115 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
116 | + $source = $line['format_source']; |
|
117 | + } |
|
103 | 118 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
104 | 119 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
105 | 120 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
106 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
121 | + } else { |
|
122 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
123 | + } |
|
107 | 124 | } |
108 | 125 | |
109 | 126 | |
110 | 127 | $Common = new Common(); |
111 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | - else $id = trim($line['id']); |
|
128 | + if (!isset($line['id'])) { |
|
129 | + $id = trim($line['ident']); |
|
130 | + } else { |
|
131 | + $id = trim($line['id']); |
|
132 | + } |
|
113 | 133 | |
114 | 134 | if (!isset($this->all_tracked[$id])) { |
115 | 135 | $this->all_tracked[$id] = array(); |
@@ -117,31 +137,46 @@ discard block |
||
117 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
118 | 138 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
119 | 139 | if (!isset($line['id'])) { |
120 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
140 | + if (!isset($globalDaemon)) { |
|
141 | + $globalDaemon = TRUE; |
|
142 | + } |
|
121 | 143 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
144 | + } else { |
|
145 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
146 | + } |
|
147 | + if ($globalAllTracked !== FALSE) { |
|
148 | + $dataFound = true; |
|
149 | + } |
|
124 | 150 | } |
125 | 151 | |
126 | 152 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
127 | 153 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
128 | 154 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
129 | 155 | } else { |
130 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
131 | - elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
156 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
157 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
158 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
159 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
160 | + } |
|
132 | 161 | return ''; |
133 | 162 | } |
134 | 163 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
135 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
164 | + if ($globalDebug) { |
|
165 | + echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
166 | + } |
|
136 | 167 | return ''; |
137 | 168 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
138 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
169 | + if ($globalDebug) { |
|
170 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
171 | + } |
|
139 | 172 | return ''; |
140 | 173 | } elseif (!isset($line['datetime'])) { |
141 | 174 | date_default_timezone_set('UTC'); |
142 | 175 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
143 | 176 | } else { |
144 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
177 | + if ($globalDebug) { |
|
178 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
|
179 | + } |
|
145 | 180 | return ''; |
146 | 181 | } |
147 | 182 | |
@@ -153,11 +188,17 @@ discard block |
||
153 | 188 | $Tracker = new Tracker($this->db); |
154 | 189 | $fromsource = NULL; |
155 | 190 | $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
156 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
191 | + if ($globalDebug && $result != 'success') { |
|
192 | + echo '!!! ERROR : '.$result."\n"; |
|
193 | + } |
|
157 | 194 | $Tracker->db = null; |
158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
195 | + if ($globalDebugTimeElapsed) { |
|
196 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
197 | + } |
|
198 | + } |
|
199 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
159 | 201 | } |
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 202 | } |
162 | 203 | |
163 | 204 | if (isset($line['speed']) && $line['speed'] != '') { |
@@ -168,14 +209,21 @@ discard block |
||
168 | 209 | if ($distance > 100 && $distance < 10000) { |
169 | 210 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 211 | $speed = $speed*3.6; |
171 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
172 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
|
212 | + if ($speed < 1000) { |
|
213 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
214 | + } |
|
215 | + if ($globalDebug) { |
|
216 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
|
217 | + } |
|
173 | 218 | } |
174 | 219 | } |
175 | 220 | |
176 | 221 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | - else unset($timediff); |
|
222 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
223 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
224 | + } else { |
|
225 | + unset($timediff); |
|
226 | + } |
|
179 | 227 | if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
180 | 228 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | 229 | if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
@@ -183,20 +231,30 @@ discard block |
||
183 | 231 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 232 | $this->all_tracked[$id]['putinarchive'] = true; |
185 | 233 | |
186 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
234 | + if ($globalDebug) { |
|
235 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
236 | + } |
|
187 | 237 | $timeelapsed = microtime(true); |
188 | 238 | $Tracker = new Tracker($this->db); |
189 | 239 | $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
190 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
240 | + if (!empty($all_country)) { |
|
241 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
242 | + } |
|
191 | 243 | $Tracker->db = null; |
192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
244 | + if ($globalDebugTimeElapsed) { |
|
245 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
246 | + } |
|
193 | 247 | $this->tmd = 0; |
194 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
248 | + if ($globalDebug) { |
|
249 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
250 | + } |
|
195 | 251 | } |
196 | 252 | } |
197 | 253 | |
198 | 254 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
255 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
256 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
257 | + } |
|
200 | 258 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
201 | 259 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
202 | 260 | $dataFound = true; |
@@ -205,8 +263,12 @@ discard block |
||
205 | 263 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
206 | 264 | } |
207 | 265 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
209 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
266 | + if ($line['longitude'] > 180) { |
|
267 | + $line['longitude'] = $line['longitude'] - 360; |
|
268 | + } |
|
269 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
270 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
271 | + } |
|
210 | 272 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
211 | 273 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
212 | 274 | $dataFound = true; |
@@ -226,7 +288,9 @@ discard block |
||
226 | 288 | } |
227 | 289 | } |
228 | 290 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
291 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
292 | + $dataFound = true; |
|
293 | + } |
|
230 | 294 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
231 | 295 | } |
232 | 296 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -246,7 +310,9 @@ discard block |
||
246 | 310 | |
247 | 311 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | 312 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
313 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) { |
|
314 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
315 | + } |
|
250 | 316 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
251 | 317 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
252 | 318 | //$dataFound = true; |
@@ -258,15 +324,21 @@ discard block |
||
258 | 324 | } |
259 | 325 | |
260 | 326 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
327 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
328 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
329 | + } |
|
262 | 330 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
263 | 331 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
264 | 332 | //$dataFound = true; |
265 | 333 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | 334 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
267 | 335 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
336 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
337 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
338 | + } |
|
339 | + if ($globalDebug) { |
|
340 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
341 | + } |
|
270 | 342 | } |
271 | 343 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
272 | 344 | |
@@ -275,20 +347,31 @@ discard block |
||
275 | 347 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
276 | 348 | if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
277 | 349 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
278 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
350 | + if ($globalDebug) { |
|
351 | + echo "Check if aircraft is already in DB..."; |
|
352 | + } |
|
279 | 353 | $timeelapsed = microtime(true); |
280 | 354 | $TrackerLive = new TrackerLive($this->db); |
281 | 355 | if (isset($line['id'])) { |
282 | 356 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
357 | + if ($globalDebugTimeElapsed) { |
|
358 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
359 | + } |
|
284 | 360 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | 361 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
287 | - } else $recent_ident = ''; |
|
362 | + if ($globalDebugTimeElapsed) { |
|
363 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
364 | + } |
|
365 | + } else { |
|
366 | + $recent_ident = ''; |
|
367 | + } |
|
288 | 368 | $TrackerLive->db=null; |
289 | 369 | |
290 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
291 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
370 | + if ($globalDebug && $recent_ident == '') { |
|
371 | + echo " Not in DB.\n"; |
|
372 | + } elseif ($globalDebug && $recent_ident != '') { |
|
373 | + echo " Already in DB.\n"; |
|
374 | + } |
|
292 | 375 | } else { |
293 | 376 | $recent_ident = ''; |
294 | 377 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -296,27 +379,41 @@ discard block |
||
296 | 379 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
297 | 380 | if($recent_ident == "") |
298 | 381 | { |
299 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
382 | + if ($globalDebug) { |
|
383 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
384 | + } |
|
300 | 385 | //adds the spotter data for the archive |
301 | 386 | $highlight = ''; |
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
387 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
388 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
389 | + } |
|
303 | 390 | $timeelapsed = microtime(true); |
304 | 391 | $Tracker = new Tracker($this->db); |
305 | 392 | $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
306 | 393 | $Tracker->db = null; |
307 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
394 | + if ($globalDebug && isset($result)) { |
|
395 | + echo $result."\n"; |
|
396 | + } |
|
397 | + if ($globalDebugTimeElapsed) { |
|
398 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
399 | + } |
|
309 | 400 | |
310 | 401 | |
311 | 402 | // Add source stat in DB |
312 | 403 | $Stats = new Stats($this->db); |
313 | 404 | if (!empty($this->stats)) { |
314 | - if ($globalDebug) echo 'Add source stats : '; |
|
405 | + if ($globalDebug) { |
|
406 | + echo 'Add source stats : '; |
|
407 | + } |
|
315 | 408 | foreach($this->stats as $date => $data) { |
316 | 409 | foreach($data as $source => $sourced) { |
317 | 410 | //print_r($sourced); |
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
411 | + if (isset($sourced['polar'])) { |
|
412 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
413 | + } |
|
414 | + if (isset($sourced['hist'])) { |
|
415 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
416 | + } |
|
320 | 417 | if (isset($sourced['msg'])) { |
321 | 418 | if (time() - $sourced['msg']['date'] > 10) { |
322 | 419 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -329,7 +426,9 @@ discard block |
||
329 | 426 | unset($this->stats[$date]); |
330 | 427 | } |
331 | 428 | } |
332 | - if ($globalDebug) echo 'Done'."\n"; |
|
429 | + if ($globalDebug) { |
|
430 | + echo 'Done'."\n"; |
|
431 | + } |
|
333 | 432 | |
334 | 433 | } |
335 | 434 | $Stats->db = null; |
@@ -339,12 +438,16 @@ discard block |
||
339 | 438 | $this->all_tracked[$id]['addedTracker'] = 1; |
340 | 439 | //print_r($this->all_tracked[$id]); |
341 | 440 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
342 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
441 | + if ($globalDebug) { |
|
442 | + echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
443 | + } |
|
343 | 444 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
344 | 445 | $TrackerLive = new TrackerLive($this->db); |
345 | 446 | $TrackerLive->deleteLiveTrackerData(); |
346 | 447 | $TrackerLive->db=null; |
347 | - if ($globalDebug) echo " Done\n"; |
|
448 | + if ($globalDebug) { |
|
449 | + echo " Done\n"; |
|
450 | + } |
|
348 | 451 | $this->last_delete = time(); |
349 | 452 | } |
350 | 453 | } else { |
@@ -367,19 +470,25 @@ discard block |
||
367 | 470 | |
368 | 471 | if (!$ignoreImport) { |
369 | 472 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
370 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
473 | + if ($globalDebug) { |
|
474 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
475 | + } |
|
371 | 476 | $timeelapsed = microtime(true); |
372 | 477 | $TrackerLive = new TrackerLive($this->db); |
373 | 478 | $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
374 | 479 | $TrackerLive->db = null; |
375 | 480 | $this->all_tracked[$id]['putinarchive'] = false; |
376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
481 | + if ($globalDebugTimeElapsed) { |
|
482 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
483 | + } |
|
377 | 484 | |
378 | 485 | // Put statistics in $this->stats variable |
379 | 486 | |
380 | 487 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
381 | 488 | $source = $this->all_tracked[$id]['source_name']; |
382 | - if ($source == '') $source = $this->all_tracked[$id]['format_source']; |
|
489 | + if ($source == '') { |
|
490 | + $source = $this->all_tracked[$id]['format_source']; |
|
491 | + } |
|
383 | 492 | if (!isset($this->source_location[$source])) { |
384 | 493 | $Location = new Source($this->db); |
385 | 494 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -400,7 +509,9 @@ discard block |
||
400 | 509 | $stats_heading = round($stats_heading/22.5); |
401 | 510 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
402 | 511 | $current_date = date('Y-m-d'); |
403 | - if ($stats_heading == 16) $stats_heading = 0; |
|
512 | + if ($stats_heading == 16) { |
|
513 | + $stats_heading = 0; |
|
514 | + } |
|
404 | 515 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | 516 | for ($i=0;$i<=15;$i++) { |
406 | 517 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -418,7 +529,9 @@ discard block |
||
418 | 529 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | 530 | end($this->stats[$current_date][$source]['hist']); |
420 | 531 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
421 | - } else $mini = 0; |
|
532 | + } else { |
|
533 | + $mini = 0; |
|
534 | + } |
|
422 | 535 | for ($i=$mini;$i<=$distance;$i+=10) { |
423 | 536 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
424 | 537 | } |
@@ -429,19 +542,29 @@ discard block |
||
429 | 542 | } |
430 | 543 | |
431 | 544 | $this->all_tracked[$id]['lastupdate'] = time(); |
432 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
433 | - if ($globalDebug) echo $result."\n"; |
|
434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
545 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
546 | + $send = true; |
|
547 | + } |
|
548 | + if ($globalDebug) { |
|
549 | + echo $result."\n"; |
|
550 | + } |
|
551 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
552 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
553 | + } |
|
435 | 554 | //$this->del(); |
436 | 555 | |
437 | 556 | |
438 | 557 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
558 | + if ($globalDebug) { |
|
559 | + echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
560 | + } |
|
440 | 561 | $TrackerLive = new TrackerLive($this->db); |
441 | 562 | $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
442 | 563 | $TrackerLive->db = null; |
443 | 564 | //TrackerLive->deleteLiveTrackerData(); |
444 | - if ($globalDebug) echo " Done\n"; |
|
565 | + if ($globalDebug) { |
|
566 | + echo " Done\n"; |
|
567 | + } |
|
445 | 568 | $this->last_delete_hourly = time(); |
446 | 569 | } |
447 | 570 | |
@@ -449,7 +572,9 @@ discard block |
||
449 | 572 | //$ignoreImport = false; |
450 | 573 | } |
451 | 574 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
452 | - if ($send) return $this->all_tracked[$id]; |
|
575 | + if ($send) { |
|
576 | + return $this->all_tracked[$id]; |
|
577 | + } |
|
453 | 578 | } |
454 | 579 | } |
455 | 580 | } |
@@ -14,35 +14,35 @@ discard block |
||
14 | 14 | if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline'; |
15 | 15 | |
16 | 16 | if (isset($_GET['3d'])) { |
17 | - setcookie('MapFormat','3d'); |
|
17 | + setcookie('MapFormat', '3d'); |
|
18 | 18 | } else if (isset($_GET['2d'])) { |
19 | - setcookie('MapFormat','2d'); |
|
19 | + setcookie('MapFormat', '2d'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
23 | - $tsk = filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); |
|
23 | + $tsk = filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | if (isset($_POST['archive'])) { |
27 | - setcookie('archive','true'); |
|
28 | - setcookie('archive_begin',strtotime($_POST['start_date'])); |
|
29 | - setcookie('archive_end',strtotime($_POST['end_date'])); |
|
30 | - setcookie('archive_speed',$_POST['archivespeed']); |
|
27 | + setcookie('archive', 'true'); |
|
28 | + setcookie('archive_begin', strtotime($_POST['start_date'])); |
|
29 | + setcookie('archive_end', strtotime($_POST['end_date'])); |
|
30 | + setcookie('archive_speed', $_POST['archivespeed']); |
|
31 | 31 | } |
32 | 32 | if (isset($_POST['noarchive'])) { |
33 | - setcookie('archive','false',-1); |
|
34 | - setcookie('archive_begin','',-1); |
|
35 | - setcookie('archive_end','',-1); |
|
36 | - setcookie('archive_speed','',-1); |
|
33 | + setcookie('archive', 'false', -1); |
|
34 | + setcookie('archive_begin', '', -1); |
|
35 | + setcookie('archive_end', '', -1); |
|
36 | + setcookie('archive_speed', '', -1); |
|
37 | 37 | } |
38 | 38 | // When button "Remove all filters" is clicked |
39 | 39 | if (isset($_POST['removefilters'])) { |
40 | - $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
|
41 | - return strpos($key,'filter_') === 0; |
|
40 | + $allfilters = array_filter(array_keys($_COOKIE), function($key) { |
|
41 | + return strpos($key, 'filter_') === 0; |
|
42 | 42 | }); |
43 | 43 | foreach ($allfilters as $filt) { |
44 | 44 | unset($_COOKIE[$filt]); |
45 | - setcookie($filt,null,-1); |
|
45 | + setcookie($filt, null, -1); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | ?> |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
265 | 265 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
266 | 266 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
267 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
267 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
268 | 268 | <?php |
269 | 269 | if (!isset($type) || $type == 'aircraft') { |
270 | 270 | ?> |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
338 | 338 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
339 | 339 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
340 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
340 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
341 | 341 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
342 | 342 | <?php |
343 | 343 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | ?> |
743 | 743 | <div class="search"> |
744 | 744 | <form action="<?php print $globalURL; ?>/search" method="get"> |
745 | - <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
746 | - <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != ""){ print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
745 | + <!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>--> |
|
746 | + <input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != "") { print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
747 | 747 | </form> |
748 | 748 | </div> |
749 | 749 | <div class="social"> |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | print '</div>'; |
762 | 762 | } |
763 | 763 | |
764 | -if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
764 | +if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
765 | 765 | ?> |
766 | 766 | <div class="top-header clear" role="main"> |
767 | 767 | <?php |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | </div> |
775 | 775 | <?php |
776 | 776 | } |
777 | -if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
|
777 | +if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false)) |
|
778 | 778 | { |
779 | 779 | ?> |
780 | 780 | <div class="top-header clear" role="main"> |
@@ -787,15 +787,15 @@ discard block |
||
787 | 787 | var zoom = 13; |
788 | 788 | //create the map |
789 | 789 | <?php |
790 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
790 | + if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
791 | 791 | ?> |
792 | 792 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
793 | 793 | <?php |
794 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
794 | + } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) { |
|
795 | 795 | ?> |
796 | 796 | map = L.map('map', { zoomControl:true }); |
797 | 797 | <?php |
798 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
798 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
799 | 799 | ?> |
800 | 800 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
801 | 801 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
804 | 804 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
805 | 805 | <?php |
806 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
806 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
807 | 807 | ?> |
808 | 808 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
809 | 809 | <?php |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | // When button "Remove all filters" is clicked |
39 | 39 | if (isset($_POST['removefilters'])) { |
40 | 40 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
41 | - return strpos($key,'filter_') === 0; |
|
41 | + return strpos($key,'filter_') === 0; |
|
42 | 42 | }); |
43 | 43 | foreach ($allfilters as $filt) { |
44 | 44 | unset($_COOKIE[$filt]); |
@@ -188,17 +188,17 @@ discard block |
||
188 | 188 | } |
189 | 189 | ?> |
190 | 190 | <?php |
191 | - if (isset($_POST['archive'])) { |
|
191 | + if (isset($_POST['archive'])) { |
|
192 | 192 | ?> |
193 | 193 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
194 | 194 | <?php |
195 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
195 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
196 | 196 | ?> |
197 | 197 | |
198 | 198 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script> |
199 | 199 | <?php |
200 | - } |
|
201 | - } else { |
|
200 | + } |
|
201 | + } else { |
|
202 | 202 | ?> |
203 | 203 | <?php |
204 | 204 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | ?> |
212 | 212 | <?php |
213 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
213 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
214 | 214 | ?> |
215 | 215 | <?php |
216 | 216 | // if (isset($globalBeta) && $globalBeta) { |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | <script src="<?php print $globalURL; ?>/js/map-satellite.2d.js.php?<?php print time(); ?>"></script> |
242 | 242 | <?php |
243 | 243 | } |
244 | - } |
|
244 | + } |
|
245 | 245 | ?> |
246 | 246 | <?php |
247 | 247 | // } |
248 | 248 | ?> |
249 | 249 | <?php |
250 | - } |
|
250 | + } |
|
251 | 251 | } |
252 | 252 | ?> |
253 | 253 | <?php |
@@ -424,34 +424,34 @@ discard block |
||
424 | 424 | |
425 | 425 | <ul class="nav navbar-nav"> |
426 | 426 | <?php |
427 | - if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) { |
|
427 | + if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) { |
|
428 | 428 | ?> |
429 | 429 | <li><a href="<?php print $globalURL; ?>/news"><?php echo _("News"); ?></a></li> |
430 | 430 | <?php |
431 | - } |
|
431 | + } |
|
432 | 432 | ?> |
433 | 433 | |
434 | 434 | <?php |
435 | - $sub = false; |
|
436 | - if ( |
|
435 | + $sub = false; |
|
436 | + if ( |
|
437 | 437 | ( |
438 | - (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
438 | + (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
439 | 439 | ) || |
440 | 440 | ( |
441 | - isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
441 | + isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
442 | 442 | ) || |
443 | 443 | ( |
444 | - isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
444 | + isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
445 | 445 | ) || |
446 | 446 | ( |
447 | - isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
447 | + isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
448 | 448 | ) |
449 | - ) { |
|
449 | + ) { |
|
450 | 450 | $sub = true; |
451 | - } |
|
451 | + } |
|
452 | 452 | ?> |
453 | 453 | <?php |
454 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
454 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
455 | 455 | ?> |
456 | 456 | <li class="dropdown"> |
457 | 457 | <?php |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | <ul class="dropdown-menu multi-level"> |
463 | 463 | <li class="dropdown-submenu"> |
464 | 464 | <?php |
465 | - } |
|
465 | + } |
|
466 | 466 | ?> |
467 | 467 | <?php |
468 | 468 | if (isset($globalNewsFeeds['aircraft']) && !empty($globalNewsFeeds['aircraft'])) { |
@@ -477,25 +477,25 @@ discard block |
||
477 | 477 | <ul class="dropdown-menu"> |
478 | 478 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li> |
479 | 479 | <?php |
480 | - if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
480 | + if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
481 | 481 | ?> |
482 | 482 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
483 | 483 | <?php |
484 | - } |
|
484 | + } |
|
485 | 485 | ?> |
486 | 486 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
487 | 487 | <?php |
488 | - if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
488 | + if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
489 | 489 | ?> |
490 | 490 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
491 | 491 | <?php |
492 | - } |
|
493 | - if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
492 | + } |
|
493 | + if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
494 | 494 | |
495 | 495 | ?> |
496 | 496 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
497 | 497 | <?php |
498 | - } |
|
498 | + } |
|
499 | 499 | ?> |
500 | 500 | <li><hr /></li> |
501 | 501 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -503,43 +503,43 @@ discard block |
||
503 | 503 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
504 | 504 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
505 | 505 | <?php |
506 | - if ($globalACARS) { |
|
507 | - if (isset($globalDemo) && $globalDemo) { |
|
508 | - ?> |
|
506 | + if ($globalACARS) { |
|
507 | + if (isset($globalDemo) && $globalDemo) { |
|
508 | + ?> |
|
509 | 509 | <li><hr /></li> |
510 | 510 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
511 | 511 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
512 | 512 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
513 | 513 | <?php |
514 | - } else { |
|
515 | - ?> |
|
514 | + } else { |
|
515 | + ?> |
|
516 | 516 | <li><hr /></li> |
517 | 517 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
518 | 518 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
519 | 519 | <?php |
520 | - } |
|
521 | - } |
|
522 | - ?> |
|
520 | + } |
|
521 | + } |
|
522 | + ?> |
|
523 | 523 | <?php |
524 | - if (isset($globalAccidents) && $globalAccidents) { |
|
525 | - ?> |
|
524 | + if (isset($globalAccidents) && $globalAccidents) { |
|
525 | + ?> |
|
526 | 526 | <li><hr /></li> |
527 | 527 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
528 | 528 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
529 | 529 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
530 | 530 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
531 | 531 | <?php |
532 | - } |
|
533 | - ?> |
|
532 | + } |
|
533 | + ?> |
|
534 | 534 | <li><hr /></li> |
535 | 535 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
536 | 536 | <?php |
537 | 537 | if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) { |
538 | - ?> |
|
538 | + ?> |
|
539 | 539 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
540 | 540 | <?php |
541 | 541 | } |
542 | - ?> |
|
542 | + ?> |
|
543 | 543 | </ul> |
544 | 544 | </li> |
545 | 545 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
@@ -566,14 +566,14 @@ discard block |
||
566 | 566 | </ul> |
567 | 567 | <?php |
568 | 568 | } |
569 | - } |
|
569 | + } |
|
570 | 570 | ?> |
571 | 571 | <?php |
572 | - if (isset($globalMarine) && $globalMarine) { |
|
572 | + if (isset($globalMarine) && $globalMarine) { |
|
573 | 573 | ?> |
574 | 574 | <li class="dropdown"> |
575 | 575 | <?php |
576 | - if ($sub) { |
|
576 | + if ($sub) { |
|
577 | 577 | ?> |
578 | 578 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Marines"); ?> <b class="caret"></b></a> |
579 | 579 | <ul class="dropdown-menu multi-level"> |
@@ -607,14 +607,14 @@ discard block |
||
607 | 607 | } |
608 | 608 | ?> |
609 | 609 | <?php |
610 | - } |
|
610 | + } |
|
611 | 611 | ?> |
612 | 612 | <?php |
613 | - if (isset($globalTracker) && $globalTracker) { |
|
613 | + if (isset($globalTracker) && $globalTracker) { |
|
614 | 614 | ?> |
615 | 615 | <li class="dropdown"> |
616 | 616 | <?php |
617 | - if ($sub) { |
|
617 | + if ($sub) { |
|
618 | 618 | ?> |
619 | 619 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a> |
620 | 620 | <ul class="dropdown-menu multi-level"> |
@@ -648,14 +648,14 @@ discard block |
||
648 | 648 | } |
649 | 649 | ?> |
650 | 650 | <?php |
651 | - } |
|
651 | + } |
|
652 | 652 | ?> |
653 | 653 | <?php |
654 | - if (isset($globalSatellite) && $globalSatellite) { |
|
654 | + if (isset($globalSatellite) && $globalSatellite) { |
|
655 | 655 | ?> |
656 | 656 | <li class="dropdown"> |
657 | 657 | <?php |
658 | - if ($sub) { |
|
658 | + if ($sub) { |
|
659 | 659 | ?> |
660 | 660 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellites"); ?> <b class="caret"></b></a> |
661 | 661 | <ul class="dropdown-menu multi-level"> |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | } |
692 | 692 | ?> |
693 | 693 | <?php |
694 | - } |
|
694 | + } |
|
695 | 695 | ?> |
696 | 696 | |
697 | 697 | <li class="dropdown"> |
@@ -700,12 +700,12 @@ discard block |
||
700 | 700 | <li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li> |
701 | 701 | <li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li> |
702 | 702 | <?php |
703 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
703 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
704 | 704 | ?> |
705 | 705 | <li><hr /></li> |
706 | 706 | <li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li> |
707 | 707 | <?php |
708 | - } |
|
708 | + } |
|
709 | 709 | ?> |
710 | 710 | <?php if (isset($globalContribute) && $globalContribute) { ?> |
711 | 711 | <li><hr /></li> |
@@ -726,14 +726,14 @@ discard block |
||
726 | 726 | <form> |
727 | 727 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
728 | 728 | <?php |
729 | - $Language = new Language(); |
|
730 | - $alllang = $Language->getLanguages(); |
|
731 | - foreach ($alllang as $key => $lang) { |
|
732 | - print '<option value="'.$key.'"'; |
|
733 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
734 | - print '>'.$lang[0].'</option>'; |
|
735 | - } |
|
736 | - ?> |
|
729 | + $Language = new Language(); |
|
730 | + $alllang = $Language->getLanguages(); |
|
731 | + foreach ($alllang as $key => $lang) { |
|
732 | + print '<option value="'.$key.'"'; |
|
733 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
734 | + print '>'.$lang[0].'</option>'; |
|
735 | + } |
|
736 | + ?> |
|
737 | 737 | </select> |
738 | 738 | </form> |
739 | 739 | </div> |
@@ -765,18 +765,18 @@ discard block |
||
765 | 765 | ?> |
766 | 766 | <div class="top-header clear" role="main"> |
767 | 767 | <?php |
768 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
768 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
769 | 769 | ?> |
770 | 770 | <div id="archive-map"></div> |
771 | 771 | <?php |
772 | - } |
|
772 | + } |
|
773 | 773 | ?> |
774 | 774 | </div> |
775 | 775 | <?php |
776 | 776 | } |
777 | 777 | if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
778 | 778 | { |
779 | - ?> |
|
779 | + ?> |
|
780 | 780 | <div class="top-header clear" role="main"> |
781 | 781 | <div id="map"></div> |
782 | 782 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -787,15 +787,15 @@ discard block |
||
787 | 787 | var zoom = 13; |
788 | 788 | //create the map |
789 | 789 | <?php |
790 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
790 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
791 | 791 | ?> |
792 | 792 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
793 | 793 | <?php |
794 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
794 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
795 | 795 | ?> |
796 | 796 | map = L.map('map', { zoomControl:true }); |
797 | 797 | <?php |
798 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
798 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
799 | 799 | ?> |
800 | 800 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
801 | 801 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -803,22 +803,22 @@ discard block |
||
803 | 803 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
804 | 804 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
805 | 805 | <?php |
806 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
806 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
807 | 807 | ?> |
808 | 808 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
809 | 809 | <?php |
810 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
810 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
811 | 811 | ?> |
812 | 812 | map = L.map('map', { zoomControl:true }); |
813 | 813 | <?php |
814 | - } |
|
814 | + } |
|
815 | 815 | ?> |
816 | 816 | //initialize the layer group for the aircrft markers |
817 | 817 | var layer_data = L.layerGroup(); |
818 | 818 | |
819 | 819 | //a few title layers |
820 | 820 | <?php |
821 | - if ($globalMapProvider == 'Mapbox') { |
|
821 | + if ($globalMapProvider == 'Mapbox') { |
|
822 | 822 | ?> |
823 | 823 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
824 | 824 | maxZoom: 18, |
@@ -829,14 +829,14 @@ discard block |
||
829 | 829 | token : '<?php print $globalMapboxToken; ?>' |
830 | 830 | }).addTo(map); |
831 | 831 | <?php |
832 | - } elseif ($globalMapProvider == 'Mapbox-GL') { |
|
832 | + } elseif ($globalMapProvider == 'Mapbox-GL') { |
|
833 | 833 | ?> |
834 | 834 | L.mapboxGL({ |
835 | 835 | accessToken: '<?php print $globalMapboxToken; ?>', |
836 | 836 | style: 'mapbox://styles/mapbox/bright-v8' |
837 | 837 | }).addTo(map); |
838 | 838 | <?php |
839 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
839 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
840 | 840 | ?> |
841 | 841 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
842 | 842 | maxZoom: 18, |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
846 | 846 | }).addTo(map); |
847 | 847 | <?php |
848 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
848 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
849 | 849 | ?> |
850 | 850 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
851 | 851 | maxZoom: 18, |
@@ -854,27 +854,27 @@ discard block |
||
854 | 854 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"' |
855 | 855 | }).addTo(map); |
856 | 856 | <?php |
857 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
857 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
858 | 858 | ?> |
859 | 859 | var googleLayer = new L.Google('ROADMAP'); |
860 | 860 | map.addLayer(googleLayer); |
861 | 861 | <?php |
862 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
862 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
863 | 863 | ?> |
864 | 864 | var googleLayer = new L.Google('SATELLITE'); |
865 | 865 | map.addLayer(googleLayer); |
866 | 866 | <?php |
867 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
867 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
868 | 868 | ?> |
869 | 869 | var googleLayer = new L.Google('HYBRID'); |
870 | 870 | map.addLayer(googleLayer); |
871 | 871 | <?php |
872 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
872 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
873 | 873 | ?> |
874 | 874 | var googleLayer = new L.Google('Terrain'); |
875 | 875 | map.addLayer(googleLayer); |
876 | 876 | <?php |
877 | - } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
877 | + } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
878 | 878 | $customid = $globalMapProvider; |
879 | 879 | ?> |
880 | 880 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
885 | 885 | }).addTo(map); |
886 | 886 | <?php |
887 | - } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) { |
|
887 | + } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) { |
|
888 | 888 | ?> |
889 | 889 | var center = map.getCenter(); |
890 | 890 | map.options.crs = L.CRS.EPSG4326; |
@@ -899,8 +899,8 @@ discard block |
||
899 | 899 | attribution: 'Natural Earth' |
900 | 900 | }).addTo(map); |
901 | 901 | <?php |
902 | - //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
903 | - } else { |
|
902 | + //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
903 | + } else { |
|
904 | 904 | ?> |
905 | 905 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
906 | 906 | maxZoom: 18, |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | }).addTo(map); |
910 | 910 | |
911 | 911 | <?php |
912 | - } |
|
912 | + } |
|
913 | 913 | ?> |
914 | 914 | </script> |
915 | 915 | </div> |
@@ -6,12 +6,19 @@ discard block |
||
6 | 6 | //gets the page file and stores it in a variable |
7 | 7 | $file_path = pathinfo($_SERVER['SCRIPT_NAME']); |
8 | 8 | $current_page = $file_path['filename']; |
9 | -if ($globalTimezone == '') $globalTimezone = 'UTC'; |
|
9 | +if ($globalTimezone == '') { |
|
10 | + $globalTimezone = 'UTC'; |
|
11 | +} |
|
10 | 12 | date_default_timezone_set($globalTimezone); |
11 | -if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType']; |
|
12 | -else $MapType = $globalMapProvider; |
|
13 | +if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') { |
|
14 | + $MapType = $_COOKIE['MapType']; |
|
15 | +} else { |
|
16 | + $MapType = $globalMapProvider; |
|
17 | +} |
|
13 | 18 | |
14 | -if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline'; |
|
19 | +if (isset($globalMapOffline) && $globalMapOffline) { |
|
20 | + $MapType = 'offline'; |
|
21 | +} |
|
15 | 22 | |
16 | 23 | if (isset($_GET['3d'])) { |
17 | 24 | setcookie('MapFormat','3d'); |
@@ -219,7 +226,10 @@ discard block |
||
219 | 226 | <?php |
220 | 227 | // } |
221 | 228 | ?> |
222 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script> |
|
229 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) { |
|
230 | + print '&tsk='.$tsk; |
|
231 | +} |
|
232 | +?>"></script> |
|
223 | 233 | <?php |
224 | 234 | if (!isset($globalAircraft) || $globalAircraft) { |
225 | 235 | ?> |
@@ -264,7 +274,13 @@ discard block |
||
264 | 274 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
265 | 275 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
266 | 276 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
267 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
277 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) { |
|
278 | + print '&latitude='.$latitude; |
|
279 | +} |
|
280 | +?><?php if(isset($longitude)) { |
|
281 | + print '&longitude='.$longitude; |
|
282 | +} |
|
283 | +?>&<?php print time(); ?>"></script> |
|
268 | 284 | <?php |
269 | 285 | if (!isset($type) || $type == 'aircraft') { |
270 | 286 | ?> |
@@ -337,7 +353,13 @@ discard block |
||
337 | 353 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
338 | 354 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
339 | 355 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
340 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
356 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) { |
|
357 | + print '&latitude='.$latitude; |
|
358 | +} |
|
359 | +?><?php if(isset($longitude)) { |
|
360 | + print '&longitude='.$longitude; |
|
361 | +} |
|
362 | +?>&<?php print time(); ?>"></script> |
|
341 | 363 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
342 | 364 | <?php |
343 | 365 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -418,7 +440,12 @@ discard block |
||
418 | 440 | <span class="icon-bar"></span> |
419 | 441 | </button> |
420 | 442 | <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a> |
421 | - <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
443 | + <a class="navbar-brand" href="<?php if ($globalURL == '') { |
|
444 | + print '/'; |
|
445 | +} else { |
|
446 | + print $globalURL; |
|
447 | +} |
|
448 | +?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
422 | 449 | </div> |
423 | 450 | <div class="collapse navbar-collapse"> |
424 | 451 | |
@@ -473,7 +500,10 @@ discard block |
||
473 | 500 | } |
474 | 501 | ?> |
475 | 502 | |
476 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
503 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
504 | + echo 'right-'; |
|
505 | +} |
|
506 | +?>caret"></b></a> |
|
477 | 507 | <ul class="dropdown-menu"> |
478 | 508 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li> |
479 | 509 | <?php |
@@ -544,8 +574,14 @@ discard block |
||
544 | 574 | </li> |
545 | 575 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
546 | 576 | <li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li> |
547 | - <li class="dropdown<?php if ($sub) echo '-submenu'; ?>"> |
|
548 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
577 | + <li class="dropdown<?php if ($sub) { |
|
578 | + echo '-submenu'; |
|
579 | +} |
|
580 | +?>"> |
|
581 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) { |
|
582 | + echo 'right-'; |
|
583 | +} |
|
584 | +?>caret"></b></a> |
|
549 | 585 | <ul class="dropdown-menu"> |
550 | 586 | <li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li> |
551 | 587 | <li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li> |
@@ -589,7 +625,10 @@ discard block |
||
589 | 625 | <?php |
590 | 626 | } |
591 | 627 | ?> |
592 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
628 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
629 | + echo 'right-'; |
|
630 | +} |
|
631 | +?>caret"></b></a> |
|
593 | 632 | <ul class="dropdown-menu"> |
594 | 633 | <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li> |
595 | 634 | <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -630,7 +669,10 @@ discard block |
||
630 | 669 | <?php |
631 | 670 | } |
632 | 671 | ?> |
633 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
672 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
673 | + echo 'right-'; |
|
674 | +} |
|
675 | +?>caret"></b></a> |
|
634 | 676 | <ul class="dropdown-menu"> |
635 | 677 | <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li> |
636 | 678 | <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -673,7 +715,10 @@ discard block |
||
673 | 715 | ?> |
674 | 716 | |
675 | 717 | <!-- |
676 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
718 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
719 | + echo 'right-'; |
|
720 | +} |
|
721 | +?>caret"></b></a> |
|
677 | 722 | <ul class="dropdown-menu"> |
678 | 723 | <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li> |
679 | 724 | <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -730,7 +775,9 @@ discard block |
||
730 | 775 | $alllang = $Language->getLanguages(); |
731 | 776 | foreach ($alllang as $key => $lang) { |
732 | 777 | print '<option value="'.$key.'"'; |
733 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
778 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) { |
|
779 | + print ' selected '; |
|
780 | + } |
|
734 | 781 | print '>'.$lang[0].'</option>'; |
735 | 782 | } |
736 | 783 | ?> |
@@ -878,9 +925,24 @@ discard block |
||
878 | 925 | $customid = $globalMapProvider; |
879 | 926 | ?> |
880 | 927 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
881 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
882 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
883 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
928 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
929 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
930 | +} else { |
|
931 | + print '18'; |
|
932 | +} |
|
933 | +?>, |
|
934 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
935 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
936 | +} else { |
|
937 | + print '0'; |
|
938 | +} |
|
939 | +?>, |
|
940 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
941 | + print 'false'; |
|
942 | +} else { |
|
943 | + print 'true'; |
|
944 | +} |
|
945 | +?>, |
|
884 | 946 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
885 | 947 | }).addTo(map); |
886 | 948 | <?php |
@@ -895,7 +957,12 @@ discard block |
||
895 | 957 | maxZoom: 5, |
896 | 958 | tms : true, |
897 | 959 | zindex : 3, |
898 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
960 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
961 | + print 'false'; |
|
962 | +} else { |
|
963 | + print 'true'; |
|
964 | +} |
|
965 | +?>, |
|
899 | 966 | attribution: 'Natural Earth' |
900 | 967 | }).addTo(map); |
901 | 968 | <?php |
@@ -918,4 +985,7 @@ discard block |
||
918 | 985 | |
919 | 986 | ?> |
920 | 987 | |
921 | -<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear"> |
|
988 | +<section class="container main-content <?php if (strtolower($current_page) == 'index') { |
|
989 | + print 'index '; |
|
990 | +} |
|
991 | +?>clear"> |