@@ -8,8 +8,12 @@ discard block |
||
8 | 8 | } |
9 | 9 | $tracker = false; |
10 | 10 | $marine = false; |
11 | -if (isset($_GET['tracker'])) $tracker = true; |
|
12 | -if (isset($_GET['marine'])) $marine = true; |
|
11 | +if (isset($_GET['tracker'])) { |
|
12 | + $tracker = true; |
|
13 | +} |
|
14 | +if (isset($_GET['marine'])) { |
|
15 | + $marine = true; |
|
16 | +} |
|
13 | 17 | if ($tracker) { |
14 | 18 | require_once('require/class.Tracker.php'); |
15 | 19 | require_once('require/class.TrackerLive.php'); |
@@ -66,23 +70,46 @@ discard block |
||
66 | 70 | } |
67 | 71 | header('Content-Type: text/javascript'); |
68 | 72 | |
69 | -if (!isset($globalJsonCompress)) $compress = true; |
|
70 | -else $compress = $globalJsonCompress; |
|
73 | +if (!isset($globalJsonCompress)) { |
|
74 | + $compress = true; |
|
75 | +} else { |
|
76 | + $compress = $globalJsonCompress; |
|
77 | +} |
|
71 | 78 | |
72 | 79 | $from_archive = false; |
73 | 80 | $min = false; |
74 | 81 | $allhistory = false; |
75 | 82 | $filter['source'] = array(); |
76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
85 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
83 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
84 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
85 | +} |
|
86 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
87 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
88 | +} |
|
89 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
90 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
91 | +} |
|
92 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
93 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
94 | +} |
|
95 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
96 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
97 | +} |
|
98 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
99 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
100 | +} |
|
101 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
102 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
103 | +} |
|
104 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
105 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
106 | +} |
|
107 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
108 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
109 | +} |
|
110 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
111 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
112 | +} |
|
86 | 113 | /* |
87 | 114 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
88 | 115 | $min = true; |
@@ -167,8 +194,12 @@ discard block |
||
167 | 194 | } else { |
168 | 195 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
169 | 196 | } |
170 | - if ($flightcnt == '') $flightcnt = 0; |
|
171 | -} else $flightcnt = 0; |
|
197 | + if ($flightcnt == '') { |
|
198 | + $flightcnt = 0; |
|
199 | + } |
|
200 | + } else { |
|
201 | + $flightcnt = 0; |
|
202 | +} |
|
172 | 203 | |
173 | 204 | $sqltime = round(microtime(true)-$begintime,2); |
174 | 205 | $minitime = time(); |
@@ -192,7 +223,9 @@ discard block |
||
192 | 223 | $j = 0; |
193 | 224 | $prev_flightaware_id = ''; |
194 | 225 | $speed = 1; |
195 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
226 | +if (isset($archivespeed)) { |
|
227 | + $speed = $archivespeed; |
|
228 | +} |
|
196 | 229 | $output = '['; |
197 | 230 | if ($tracker) { |
198 | 231 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
@@ -218,7 +251,9 @@ discard block |
||
218 | 251 | foreach($spotter_array as $spotter_item) |
219 | 252 | { |
220 | 253 | $j++; |
221 | - if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
|
254 | + if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') { |
|
255 | + $heightrelative = 'RELATIVE_TO_GROUND'; |
|
256 | + } |
|
222 | 257 | date_default_timezone_set('UTC'); |
223 | 258 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
224 | 259 | { |
@@ -227,9 +262,13 @@ discard block |
||
227 | 262 | $image = "images/placeholder_thumb.png"; |
228 | 263 | } |
229 | 264 | |
230 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
231 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
232 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
265 | + if (isset($spotter_item['flightaware_id'])) { |
|
266 | + $id = $spotter_item['flightaware_id']; |
|
267 | + } elseif (isset($spotter_item['famtrackid'])) { |
|
268 | + $id = $spotter_item['famtrackid']; |
|
269 | + } elseif (isset($spotter_item['fammarine_id'])) { |
|
270 | + $id = $spotter_item['fammarine_id']; |
|
271 | + } |
|
233 | 272 | if ($prev_flightaware_id != $id) { |
234 | 273 | if ($prev_flightaware_id != '') { |
235 | 274 | $output .= ']'; |
@@ -271,7 +310,9 @@ discard block |
||
271 | 310 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
272 | 311 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
273 | 312 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
274 | - } else $aircraft_shadow = ''; |
|
313 | + } else { |
|
314 | + $aircraft_shadow = ''; |
|
315 | + } |
|
275 | 316 | $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
276 | 317 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] && isset($_COOKIE['IconColor'])) { |
277 | 318 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
@@ -279,7 +320,9 @@ discard block |
||
279 | 320 | } |
280 | 321 | $output .= '},'; |
281 | 322 | } |
282 | - } else $output .= ' "billboard" : {"image" : "data:image/png;base64,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","scale" : 0.5},'; |
|
323 | + } else { |
|
324 | + $output .= ' "billboard" : {"image" : "data:image/png;base64,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","scale" : 0.5},'; |
|
325 | + } |
|
283 | 326 | } elseif ($one3dmodel) { |
284 | 327 | if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { |
285 | 328 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -310,7 +353,9 @@ discard block |
||
310 | 353 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
311 | 354 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
312 | 355 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
313 | - } else $aircraft_shadow = ''; |
|
356 | + } else { |
|
357 | + $aircraft_shadow = ''; |
|
358 | + } |
|
314 | 359 | if ($aircraft_shadow != '') { |
315 | 360 | if (isset($modelsdb[$aircraft_shadow])) { |
316 | 361 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -447,7 +492,9 @@ discard block |
||
447 | 492 | } |
448 | 493 | $output .= '},'; |
449 | 494 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
450 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
495 | + if ($spotter_item['aircraft_icao'] != '') { |
|
496 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
497 | + } |
|
451 | 498 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
452 | 499 | } |
453 | 500 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -469,7 +516,9 @@ discard block |
||
469 | 516 | } |
470 | 517 | $output .= '},'; |
471 | 518 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
472 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
519 | + if ($spotter_item['aircraft_icao'] != '') { |
|
520 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
521 | + } |
|
473 | 522 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
474 | 523 | } |
475 | 524 | } else { |
@@ -482,7 +531,9 @@ discard block |
||
482 | 531 | } |
483 | 532 | $output .= '},'; |
484 | 533 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
485 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
534 | + if ($spotter_item['aircraft_icao'] != '') { |
|
535 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
536 | + } |
|
486 | 537 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
487 | 538 | } |
488 | 539 | } elseif ($tracker && isset($spotter_item['type'])) { |
@@ -538,8 +589,12 @@ discard block |
||
538 | 589 | // $output .= '"interpolationDegree" : 5,'; |
539 | 590 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
540 | 591 | $output .= '"cartographicDegrees": ['; |
541 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
542 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
592 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
593 | + $minitime = strtotime($spotter_item['date']); |
|
594 | + } |
|
595 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
596 | + $maxitime = strtotime($spotter_item['date']); |
|
597 | + } |
|
543 | 598 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
544 | 599 | $output .= $spotter_item['longitude'].', '; |
545 | 600 | $output .= $spotter_item['latitude']; |
@@ -553,19 +608,26 @@ discard block |
||
553 | 608 | $output .= ', '.round($spotter_item['altitude']*30.48); |
554 | 609 | $prevalt = round($spotter_item['altitude']*30.48); |
555 | 610 | } |
556 | - } else $output .= ', 0'; |
|
611 | + } else { |
|
612 | + $output .= ', 0'; |
|
613 | + } |
|
557 | 614 | //$orientation = '"orientation" : { '; |
558 | 615 | //$orientation .= '"unitQuaternion": ['; |
559 | 616 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
560 | 617 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
561 | 618 | } else { |
562 | 619 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
563 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
620 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
621 | + $maxitime = strtotime($spotter_item['date']); |
|
622 | + } |
|
564 | 623 | if ($spotter_item['ground_speed'] == 0) { |
565 | 624 | $output .= $prevlong.', '; |
566 | 625 | $output .= $prevlat; |
567 | - if (!$tracker && !$marine) $output .= ', '.$prevalt; |
|
568 | - else $output .= ', 0'; |
|
626 | + if (!$tracker && !$marine) { |
|
627 | + $output .= ', '.$prevalt; |
|
628 | + } else { |
|
629 | + $output .= ', 0'; |
|
630 | + } |
|
569 | 631 | } else { |
570 | 632 | $output .= $spotter_item['longitude'].', '; |
571 | 633 | $output .= $spotter_item['latitude']; |
@@ -577,10 +639,15 @@ discard block |
||
577 | 639 | $output .= ', 0'; |
578 | 640 | } |
579 | 641 | } else { |
580 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
581 | - else $output .= ', '.round($spotter_item['altitude']*30.48); |
|
642 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
643 | + $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
644 | + } else { |
|
645 | + $output .= ', '.round($spotter_item['altitude']*30.48); |
|
646 | + } |
|
582 | 647 | } |
583 | - } else $output .= ', 0'; |
|
648 | + } else { |
|
649 | + $output .= ', 0'; |
|
650 | + } |
|
584 | 651 | } |
585 | 652 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
586 | 653 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
@@ -593,9 +660,14 @@ discard block |
||
593 | 660 | } |
594 | 661 | $output .= ']'; |
595 | 662 | if (isset($globalArchive) && $globalArchive === TRUE) { |
596 | - if ((time()-$globalLiveInterval) > $minitime) $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
597 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
598 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
663 | + if ((time()-$globalLiveInterval) > $minitime) { |
|
664 | + $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
665 | + } else { |
|
666 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
667 | + } |
|
668 | + } else { |
|
669 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
670 | +} |
|
599 | 671 | $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
600 | 672 | print $output; |
601 | 673 | ?> |
@@ -14,13 +14,17 @@ discard block |
||
14 | 14 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
15 | 15 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
17 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
17 | +if (isset($globalTracker) && $globalTracker) { |
|
18 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
19 | +} |
|
18 | 20 | if (isset($globalMarine) && $globalMarine) { |
19 | 21 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
20 | 22 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
21 | 23 | } |
22 | 24 | |
23 | -if (!isset($globalDebug)) $globalDebug = FALSE; |
|
25 | +if (!isset($globalDebug)) { |
|
26 | + $globalDebug = FALSE; |
|
27 | +} |
|
24 | 28 | |
25 | 29 | // Check if schema is at latest version |
26 | 30 | $Connection = new Connection(); |
@@ -55,35 +59,62 @@ discard block |
||
55 | 59 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
56 | 60 | if (isset($options['s'])) { |
57 | 61 | $globalSources = array(); |
58 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
59 | - else $globalSources[] = array('host' => $options['s']); |
|
60 | -} elseif (isset($options['source'])) { |
|
62 | + if (isset($options['format'])) { |
|
63 | + $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
64 | + } else { |
|
65 | + $globalSources[] = array('host' => $options['s']); |
|
66 | + } |
|
67 | + } elseif (isset($options['source'])) { |
|
61 | 68 | $globalSources = array(); |
62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
63 | - else $globalSources[] = array('host' => $options['source']); |
|
64 | -} |
|
69 | + if (isset($options['format'])) { |
|
70 | + $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
71 | + } else { |
|
72 | + $globalSources[] = array('host' => $options['source']); |
|
73 | + } |
|
74 | + } |
|
65 | 75 | if (isset($options['aprsserverhost'])) { |
66 | 76 | $globalServerAPRS = TRUE; |
67 | 77 | $globalServerAPRShost = $options['aprsserverhost']; |
68 | 78 | } |
69 | -if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport']; |
|
70 | -if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid']; |
|
71 | -if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass']; |
|
72 | -if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; |
|
73 | -if (isset($options['nodaemon'])) $globalDaemon = FALSE; |
|
74 | -if (isset($options['server'])) $globalServer = TRUE; |
|
75 | -if (isset($options['idsource'])) $id_source = $options['idsource']; |
|
76 | -else $id_source = 1; |
|
79 | +if (isset($options['aprsserverport'])) { |
|
80 | + $globalServerAPRSport = $options['aprsserverport']; |
|
81 | +} |
|
82 | +if (isset($options['aprsserverssid'])) { |
|
83 | + $globalServerAPRSssid = $options['aprsserverssid']; |
|
84 | +} |
|
85 | +if (isset($options['aprsserverpass'])) { |
|
86 | + $globalServerAPRSpass = $options['aprsserverpass']; |
|
87 | +} |
|
88 | +if (isset($options['noaprsserver'])) { |
|
89 | + $globalServerAPRS = FALSE; |
|
90 | +} |
|
91 | +if (isset($options['nodaemon'])) { |
|
92 | + $globalDaemon = FALSE; |
|
93 | +} |
|
94 | +if (isset($options['server'])) { |
|
95 | + $globalServer = TRUE; |
|
96 | +} |
|
97 | +if (isset($options['idsource'])) { |
|
98 | + $id_source = $options['idsource']; |
|
99 | +} else { |
|
100 | + $id_source = 1; |
|
101 | +} |
|
77 | 102 | if (isset($globalServer) && $globalServer) { |
78 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
103 | + if ($globalDebug) { |
|
104 | + echo "Using Server Mode\n"; |
|
105 | + } |
|
79 | 106 | $SI=new SpotterServer(); |
80 | 107 | /* |
81 | 108 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
82 | 109 | $SI = new adsb2aprs(); |
83 | 110 | $SI->connect(); |
84 | 111 | */ |
85 | -} else $SI=new SpotterImport($Connection->db); |
|
86 | -if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
|
112 | +} else { |
|
113 | + $SI=new SpotterImport($Connection->db); |
|
114 | +} |
|
115 | +if (isset($globalTracker) && $globalTracker) { |
|
116 | + $TI = new TrackerImport($Connection->db); |
|
117 | +} |
|
87 | 118 | if (isset($globalMarine) && $globalMarine) { |
88 | 119 | $AIS = new AIS(); |
89 | 120 | $MI = new MarineImport($Connection->db); |
@@ -106,7 +137,9 @@ discard block |
||
106 | 137 | } |
107 | 138 | |
108 | 139 | // let's try and connect |
109 | -if ($globalDebug) echo "Connecting...\n"; |
|
140 | +if ($globalDebug) { |
|
141 | + echo "Connecting...\n"; |
|
142 | +} |
|
110 | 143 | $use_aprs = false; |
111 | 144 | $aprs_full = false; |
112 | 145 | $reset = 0; |
@@ -115,7 +148,9 @@ discard block |
||
115 | 148 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
116 | 149 | global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
117 | 150 | $reset++; |
118 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
151 | + if ($globalDebug) { |
|
152 | + echo 'Connect to all...'."\n"; |
|
153 | + } |
|
119 | 154 | foreach ($hosts as $id => $value) { |
120 | 155 | $host = $value['host']; |
121 | 156 | $globalSources[$id]['last_exec'] = 0; |
@@ -125,22 +160,30 @@ discard block |
||
125 | 160 | //$formats[$id] = 'deltadbtxt'; |
126 | 161 | $globalSources[$id]['format'] = 'deltadbtxt'; |
127 | 162 | //$last_exec['deltadbtxt'] = 0; |
128 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
163 | + if ($globalDebug) { |
|
164 | + echo "Connect to deltadb source (".$host.")...\n"; |
|
165 | + } |
|
129 | 166 | } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
130 | 167 | //$formats[$id] = 'vatsimtxt'; |
131 | 168 | $globalSources[$id]['format'] = 'vatsimtxt'; |
132 | 169 | //$last_exec['vatsimtxt'] = 0; |
133 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
170 | + if ($globalDebug) { |
|
171 | + echo "Connect to vatsim source (".$host.")...\n"; |
|
172 | + } |
|
134 | 173 | } else if (preg_match('/aircraftlist.json$/i',$host)) { |
135 | 174 | //$formats[$id] = 'aircraftlistjson'; |
136 | 175 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
137 | 176 | //$last_exec['aircraftlistjson'] = 0; |
138 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
177 | + if ($globalDebug) { |
|
178 | + echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
179 | + } |
|
139 | 180 | } else if (preg_match('/opensky/i',$host)) { |
140 | 181 | //$formats[$id] = 'aircraftlistjson'; |
141 | 182 | $globalSources[$id]['format'] = 'opensky'; |
142 | 183 | //$last_exec['aircraftlistjson'] = 0; |
143 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
184 | + if ($globalDebug) { |
|
185 | + echo "Connect to opensky source (".$host.")...\n"; |
|
186 | + } |
|
144 | 187 | /* |
145 | 188 | // Disabled for now, site change source format |
146 | 189 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
@@ -157,7 +200,9 @@ discard block |
||
157 | 200 | //$formats[$id] = 'planeupdatefaa'; |
158 | 201 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
159 | 202 | //$last_exec['planeupdatefaa'] = 0; |
160 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
203 | + if ($globalDebug) { |
|
204 | + echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
205 | + } |
|
161 | 206 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
162 | 207 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
163 | 208 | exit(0); |
@@ -166,29 +211,41 @@ discard block |
||
166 | 211 | //$formats[$id] = 'phpvmacars'; |
167 | 212 | $globalSources[$id]['format'] = 'phpvmacars'; |
168 | 213 | //$last_exec['phpvmacars'] = 0; |
169 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
214 | + if ($globalDebug) { |
|
215 | + echo "Connect to phpvmacars source (".$host.")...\n"; |
|
216 | + } |
|
170 | 217 | } else if (preg_match('/VAM-json.php$/i',$host)) { |
171 | 218 | //$formats[$id] = 'phpvmacars'; |
172 | 219 | $globalSources[$id]['format'] = 'vam'; |
173 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
220 | + if ($globalDebug) { |
|
221 | + echo "Connect to Vam source (".$host.")...\n"; |
|
222 | + } |
|
174 | 223 | } else if (preg_match('/whazzup/i',$host)) { |
175 | 224 | //$formats[$id] = 'whazzup'; |
176 | 225 | $globalSources[$id]['format'] = 'whazzup'; |
177 | 226 | //$last_exec['whazzup'] = 0; |
178 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
227 | + if ($globalDebug) { |
|
228 | + echo "Connect to whazzup source (".$host.")...\n"; |
|
229 | + } |
|
179 | 230 | } else if (preg_match('/airwhere/i',$host)) { |
180 | 231 | $globalSources[$id]['format'] = 'airwhere'; |
181 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
232 | + if ($globalDebug) { |
|
233 | + echo "Connect to airwhere source (".$host.")...\n"; |
|
234 | + } |
|
182 | 235 | } else if (preg_match('/recentpireps/i',$host)) { |
183 | 236 | //$formats[$id] = 'pirepsjson'; |
184 | 237 | $globalSources[$id]['format'] = 'pirepsjson'; |
185 | 238 | //$last_exec['pirepsjson'] = 0; |
186 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
239 | + if ($globalDebug) { |
|
240 | + echo "Connect to pirepsjson source (".$host.")...\n"; |
|
241 | + } |
|
187 | 242 | } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
188 | 243 | //$formats[$id] = 'fr24json'; |
189 | 244 | $globalSources[$id]['format'] = 'fr24json'; |
190 | 245 | //$last_exec['fr24json'] = 0; |
191 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
246 | + if ($globalDebug) { |
|
247 | + echo "Connect to fr24 source (".$host.")...\n"; |
|
248 | + } |
|
192 | 249 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
193 | 250 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
194 | 251 | exit(0); |
@@ -197,7 +254,9 @@ discard block |
||
197 | 254 | //$formats[$id] = 'fr24json'; |
198 | 255 | $globalSources[$id]['format'] = 'myshiptracking'; |
199 | 256 | //$last_exec['fr24json'] = 0; |
200 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
257 | + if ($globalDebug) { |
|
258 | + echo "Connect to myshiptracking source (".$host.")...\n"; |
|
259 | + } |
|
201 | 260 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
202 | 261 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
203 | 262 | exit(0); |
@@ -206,17 +265,24 @@ discard block |
||
206 | 265 | } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
207 | 266 | //$formats[$id] = 'tsv'; |
208 | 267 | $globalSources[$id]['format'] = 'tsv'; |
209 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
268 | + if ($globalDebug) { |
|
269 | + echo "Connect to tsv source (".$host.")...\n"; |
|
270 | + } |
|
210 | 271 | } |
211 | 272 | } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
212 | 273 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
213 | 274 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
214 | 275 | if ($idf !== false) { |
215 | 276 | $httpfeeds[$id] = $idf; |
216 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
277 | + if ($globalDebug) { |
|
278 | + echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
279 | + } |
|
280 | + } elseif ($globalDebug) { |
|
281 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
217 | 282 | } |
218 | - elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
219 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
283 | + } elseif ($globalDebug) { |
|
284 | + echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
285 | + } |
|
220 | 286 | } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
221 | 287 | $hostport = explode(':',$host); |
222 | 288 | if (isset($hostport[1])) { |
@@ -256,17 +322,25 @@ discard block |
||
256 | 322 | //$formats[$id] = 'beast'; |
257 | 323 | $globalSources[$id]['format'] = 'beast'; |
258 | 324 | //} else $formats[$id] = 'sbs'; |
259 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
325 | + } else { |
|
326 | + $globalSources[$id]['format'] = 'sbs'; |
|
327 | + } |
|
260 | 328 | //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
261 | 329 | } |
262 | - if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
330 | + if ($globalDebug) { |
|
331 | + echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
332 | + } |
|
263 | 333 | } else { |
264 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
334 | + if ($globalDebug) { |
|
335 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
336 | + } |
|
265 | 337 | } |
266 | 338 | } |
267 | 339 | } |
268 | 340 | } |
269 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; |
|
341 | +if (!isset($globalMinFetch)) { |
|
342 | + $globalMinFetch = 15; |
|
343 | +} |
|
270 | 344 | |
271 | 345 | // Initialize all |
272 | 346 | $status = array(); |
@@ -275,13 +349,19 @@ discard block |
||
275 | 349 | $formats = array(); |
276 | 350 | $last_exec = array(); |
277 | 351 | $time = time(); |
278 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; |
|
279 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
|
280 | -else $timeout = 20; |
|
352 | +if (isset($globalSourcesTimeout)) { |
|
353 | + $timeout = $globalSourcesTimeOut; |
|
354 | +} else if (isset($globalSBS1TimeOut)) { |
|
355 | + $timeout = $globalSBS1TimeOut; |
|
356 | +} else { |
|
357 | + $timeout = 20; |
|
358 | +} |
|
281 | 359 | $errno = ''; |
282 | 360 | $errstr=''; |
283 | 361 | |
284 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
362 | +if (!isset($globalDaemon)) { |
|
363 | + $globalDaemon = TRUE; |
|
364 | +} |
|
285 | 365 | /* Initiate connections to all the hosts simultaneously */ |
286 | 366 | //connect_all($hosts); |
287 | 367 | //connect_all($globalSources); |
@@ -307,7 +387,9 @@ discard block |
||
307 | 387 | if (isset($source['format']) && $source['format'] == 'aprs') { |
308 | 388 | $aprs_connect = 0; |
309 | 389 | $use_aprs = true; |
310 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
|
390 | + if (isset($source['port']) && $source['port'] == '10152') { |
|
391 | + $aprs_full = true; |
|
392 | + } |
|
311 | 393 | break; |
312 | 394 | } |
313 | 395 | } |
@@ -318,25 +400,48 @@ discard block |
||
318 | 400 | $aprs_connect = 0; |
319 | 401 | $aprs_keep = 120; |
320 | 402 | $aprs_last_tx = time(); |
321 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
322 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
323 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
|
324 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
325 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
|
326 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
327 | - if ($aprs_full) $aprs_filter = ''; |
|
328 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
|
329 | - else $aprs_pass = '-1'; |
|
403 | + if (isset($globalAPRSversion)) { |
|
404 | + $aprs_version = $globalAPRSversion; |
|
405 | + } else { |
|
406 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
407 | + } |
|
408 | + if (isset($globalAPRSssid)) { |
|
409 | + $aprs_ssid = $globalAPRSssid; |
|
410 | + } else { |
|
411 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
412 | + } |
|
413 | + if (isset($globalAPRSfilter)) { |
|
414 | + $aprs_filter = $globalAPRSfilter; |
|
415 | + } else { |
|
416 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
417 | + } |
|
418 | + if ($aprs_full) { |
|
419 | + $aprs_filter = ''; |
|
420 | + } |
|
421 | + if (isset($globalAPRSpass)) { |
|
422 | + $aprs_pass = $globalAPRSpass; |
|
423 | + } else { |
|
424 | + $aprs_pass = '-1'; |
|
425 | + } |
|
330 | 426 | |
331 | - if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
332 | - else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
333 | -} |
|
427 | + if ($aprs_filter != '') { |
|
428 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
429 | + } else { |
|
430 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
431 | + } |
|
432 | + } |
|
334 | 433 | |
335 | 434 | // connected - lets do some work |
336 | -if ($globalDebug) echo "Connected!\n"; |
|
435 | +if ($globalDebug) { |
|
436 | + echo "Connected!\n"; |
|
437 | +} |
|
337 | 438 | sleep(1); |
338 | -if ($globalDebug) echo "SCAN MODE \n\n"; |
|
339 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; |
|
439 | +if ($globalDebug) { |
|
440 | + echo "SCAN MODE \n\n"; |
|
441 | +} |
|
442 | +if (!isset($globalCronEnd)) { |
|
443 | + $globalCronEnd = 60; |
|
444 | +} |
|
340 | 445 | $endtime = time()+$globalCronEnd; |
341 | 446 | $i = 1; |
342 | 447 | $tt = array(); |
@@ -350,20 +455,28 @@ discard block |
||
350 | 455 | |
351 | 456 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
352 | 457 | while ($i > 0) { |
353 | - if (!$globalDaemon) $i = $endtime-time(); |
|
458 | + if (!$globalDaemon) { |
|
459 | + $i = $endtime-time(); |
|
460 | + } |
|
354 | 461 | // Delete old ATC |
355 | 462 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
356 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; |
|
463 | + if ($globalDebug) { |
|
464 | + echo 'Delete old ATC...'."\n"; |
|
465 | + } |
|
357 | 466 | $ATC->deleteOldATC(); |
358 | 467 | } |
359 | 468 | |
360 | 469 | if (count($last_exec) == count($globalSources)) { |
361 | 470 | $max = $globalMinFetch; |
362 | 471 | foreach ($last_exec as $last) { |
363 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
472 | + if ((time() - $last['last']) < $max) { |
|
473 | + $max = time() - $last['last']; |
|
474 | + } |
|
364 | 475 | } |
365 | 476 | if ($max != $globalMinFetch) { |
366 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
477 | + if ($globalDebug) { |
|
478 | + echo 'Sleeping...'."\n"; |
|
479 | + } |
|
367 | 480 | sleep($globalMinFetch-$max+2); |
368 | 481 | } |
369 | 482 | } |
@@ -372,11 +485,15 @@ discard block |
||
372 | 485 | //foreach ($formats as $id => $value) { |
373 | 486 | foreach ($globalSources as $id => $value) { |
374 | 487 | date_default_timezone_set('UTC'); |
375 | - if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
|
488 | + if (!isset($last_exec[$id]['last'])) { |
|
489 | + $last_exec[$id]['last'] = 0; |
|
490 | + } |
|
376 | 491 | if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
377 | 492 | //$buffer = $Common->getData($hosts[$id]); |
378 | 493 | $buffer = $Common->getData($value['host']); |
379 | - if ($buffer != '') $reset = 0; |
|
494 | + if ($buffer != '') { |
|
495 | + $reset = 0; |
|
496 | + } |
|
380 | 497 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
381 | 498 | $buffer = explode('\n',$buffer); |
382 | 499 | foreach ($buffer as $line) { |
@@ -385,20 +502,41 @@ discard block |
||
385 | 502 | $data = array(); |
386 | 503 | $data['hex'] = $line[1]; // hex |
387 | 504 | $data['ident'] = $line[2]; // ident |
388 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
389 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
390 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
391 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
392 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
505 | + if (isset($line[3])) { |
|
506 | + $data['altitude'] = $line[3]; |
|
507 | + } |
|
508 | + // altitude |
|
509 | + if (isset($line[4])) { |
|
510 | + $data['speed'] = $line[4]; |
|
511 | + } |
|
512 | + // speed |
|
513 | + if (isset($line[5])) { |
|
514 | + $data['heading'] = $line[5]; |
|
515 | + } |
|
516 | + // heading |
|
517 | + if (isset($line[6])) { |
|
518 | + $data['latitude'] = $line[6]; |
|
519 | + } |
|
520 | + // lat |
|
521 | + if (isset($line[7])) { |
|
522 | + $data['longitude'] = $line[7]; |
|
523 | + } |
|
524 | + // long |
|
393 | 525 | $data['verticalrate'] = ''; // vertical rate |
394 | 526 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
395 | 527 | $data['emergency'] = ''; // emergency |
396 | 528 | $data['datetime'] = date('Y-m-d H:i:s'); |
397 | 529 | $data['format_source'] = 'deltadbtxt'; |
398 | 530 | $data['id_source'] = $id_source; |
399 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
400 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
401 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
531 | + if (isset($value['name']) && $value['name'] != '') { |
|
532 | + $data['source_name'] = $value['name']; |
|
533 | + } |
|
534 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
535 | + $data['noarchive'] = true; |
|
536 | + } |
|
537 | + if (isset($value['sourcestats'])) { |
|
538 | + $data['sourcestats'] = $value['sourcestats']; |
|
539 | + } |
|
402 | 540 | $SI->add($data); |
403 | 541 | unset($data); |
404 | 542 | } |
@@ -408,7 +546,9 @@ discard block |
||
408 | 546 | date_default_timezone_set('CET'); |
409 | 547 | $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
410 | 548 | date_default_timezone_set('UTC'); |
411 | - if ($buffer != '') $reset = 0; |
|
549 | + if ($buffer != '') { |
|
550 | + $reset = 0; |
|
551 | + } |
|
412 | 552 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
413 | 553 | $buffer = explode('\n',$buffer); |
414 | 554 | foreach ($buffer as $line) { |
@@ -417,16 +557,36 @@ discard block |
||
417 | 557 | $add = false; |
418 | 558 | $ais_data = $AIS->parse_line(trim($line)); |
419 | 559 | $data = array(); |
420 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
421 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
422 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
423 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
424 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
425 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
426 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
427 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
428 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
429 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
560 | + if (isset($ais_data['ident'])) { |
|
561 | + $data['ident'] = $ais_data['ident']; |
|
562 | + } |
|
563 | + if (isset($ais_data['mmsi'])) { |
|
564 | + $data['mmsi'] = $ais_data['mmsi']; |
|
565 | + } |
|
566 | + if (isset($ais_data['speed'])) { |
|
567 | + $data['speed'] = $ais_data['speed']; |
|
568 | + } |
|
569 | + if (isset($ais_data['heading'])) { |
|
570 | + $data['heading'] = $ais_data['heading']; |
|
571 | + } |
|
572 | + if (isset($ais_data['latitude'])) { |
|
573 | + $data['latitude'] = $ais_data['latitude']; |
|
574 | + } |
|
575 | + if (isset($ais_data['longitude'])) { |
|
576 | + $data['longitude'] = $ais_data['longitude']; |
|
577 | + } |
|
578 | + if (isset($ais_data['status'])) { |
|
579 | + $data['status'] = $ais_data['status']; |
|
580 | + } |
|
581 | + if (isset($ais_data['type'])) { |
|
582 | + $data['type'] = $ais_data['type']; |
|
583 | + } |
|
584 | + if (isset($ais_data['imo'])) { |
|
585 | + $data['imo'] = $ais_data['imo']; |
|
586 | + } |
|
587 | + if (isset($ais_data['callsign'])) { |
|
588 | + $data['callsign'] = $ais_data['callsign']; |
|
589 | + } |
|
430 | 590 | if (isset($ais_data['timestamp'])) { |
431 | 591 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
432 | 592 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
@@ -440,8 +600,12 @@ discard block |
||
440 | 600 | $data['format_source'] = 'aisnmeatxt'; |
441 | 601 | $data['id_source'] = $id_source; |
442 | 602 | //print_r($data); |
443 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
444 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
603 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
604 | + $data['noarchive'] = true; |
|
605 | + } |
|
606 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
607 | + $MI->add($data); |
|
608 | + } |
|
445 | 609 | unset($data); |
446 | 610 | } |
447 | 611 | } |
@@ -461,20 +625,48 @@ discard block |
||
461 | 625 | if ($line != '') { |
462 | 626 | $ais_data = $AIS->parse_line(trim($line)); |
463 | 627 | $data = array(); |
464 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
465 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
466 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
467 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
468 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
469 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
470 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
471 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
472 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
473 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
474 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
475 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
476 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
477 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
628 | + if (isset($ais_data['ident'])) { |
|
629 | + $data['ident'] = $ais_data['ident']; |
|
630 | + } |
|
631 | + if (isset($ais_data['mmsi'])) { |
|
632 | + $data['mmsi'] = $ais_data['mmsi']; |
|
633 | + } |
|
634 | + if (isset($ais_data['speed'])) { |
|
635 | + $data['speed'] = $ais_data['speed']; |
|
636 | + } |
|
637 | + if (isset($ais_data['heading'])) { |
|
638 | + $data['heading'] = $ais_data['heading']; |
|
639 | + } |
|
640 | + if (isset($ais_data['latitude'])) { |
|
641 | + $data['latitude'] = $ais_data['latitude']; |
|
642 | + } |
|
643 | + if (isset($ais_data['longitude'])) { |
|
644 | + $data['longitude'] = $ais_data['longitude']; |
|
645 | + } |
|
646 | + if (isset($ais_data['status'])) { |
|
647 | + $data['status'] = $ais_data['status']; |
|
648 | + } |
|
649 | + if (isset($ais_data['statusid'])) { |
|
650 | + $data['status_id'] = $ais_data['statusid']; |
|
651 | + } |
|
652 | + if (isset($ais_data['type'])) { |
|
653 | + $data['type'] = $ais_data['type']; |
|
654 | + } |
|
655 | + if (isset($ais_data['typeid'])) { |
|
656 | + $data['type_id'] = $ais_data['typeid']; |
|
657 | + } |
|
658 | + if (isset($ais_data['imo'])) { |
|
659 | + $data['imo'] = $ais_data['imo']; |
|
660 | + } |
|
661 | + if (isset($ais_data['callsign'])) { |
|
662 | + $data['callsign'] = $ais_data['callsign']; |
|
663 | + } |
|
664 | + if (isset($ais_data['destination'])) { |
|
665 | + $data['arrival_code'] = $ais_data['destination']; |
|
666 | + } |
|
667 | + if (isset($ais_data['eta_ts'])) { |
|
668 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
669 | + } |
|
478 | 670 | if (isset($ais_data['timestamp'])) { |
479 | 671 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
480 | 672 | } else { |
@@ -482,18 +674,27 @@ discard block |
||
482 | 674 | } |
483 | 675 | $data['format_source'] = 'aisnmeahttp'; |
484 | 676 | $data['id_source'] = $id_source; |
485 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
486 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
677 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
678 | + $data['noarchive'] = true; |
|
679 | + } |
|
680 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
681 | + $MI->add($data); |
|
682 | + } |
|
487 | 683 | unset($data); |
488 | 684 | } |
489 | 685 | } |
490 | 686 | } |
491 | 687 | } else { |
492 | 688 | $format = $value['format']; |
493 | - if (isset($tt[$format])) $tt[$format]++; |
|
494 | - else $tt[$format] = 0; |
|
689 | + if (isset($tt[$format])) { |
|
690 | + $tt[$format]++; |
|
691 | + } else { |
|
692 | + $tt[$format] = 0; |
|
693 | + } |
|
495 | 694 | if ($tt[$format] > 30) { |
496 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
695 | + if ($globalDebug) { |
|
696 | + echo 'Reconnect...'."\n"; |
|
697 | + } |
|
497 | 698 | sleep(2); |
498 | 699 | $sourceeen[] = $value; |
499 | 700 | connect_all($sourceeen); |
@@ -523,7 +724,9 @@ discard block |
||
523 | 724 | $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
524 | 725 | $data['format_source'] = 'myshiptracking'; |
525 | 726 | $data['id_source'] = $id_source; |
526 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
727 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
728 | + $data['noarchive'] = true; |
|
729 | + } |
|
527 | 730 | $MI->add($data); |
528 | 731 | unset($data); |
529 | 732 | } |
@@ -543,7 +746,9 @@ discard block |
||
543 | 746 | $data['callsign'] = $line['callsign']; |
544 | 747 | $data['mmsi'] = $line['mmsi']; |
545 | 748 | $data['speed'] = $line['sog']; |
546 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
749 | + if ($line['heading'] != '511') { |
|
750 | + $data['heading'] = $line['heading']; |
|
751 | + } |
|
547 | 752 | $data['latitude'] = $line['latitude']; |
548 | 753 | $data['longitude'] = $line['longitude']; |
549 | 754 | $data['type_id'] = $line['shiptype']; |
@@ -551,7 +756,9 @@ discard block |
||
551 | 756 | $data['datetime'] = $line['time']; |
552 | 757 | $data['format_source'] = 'boatbeaconapp'; |
553 | 758 | $data['id_source'] = $id_source; |
554 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
759 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
760 | + $data['noarchive'] = true; |
|
761 | + } |
|
555 | 762 | $MI->add($data); |
556 | 763 | unset($data); |
557 | 764 | } |
@@ -567,22 +774,44 @@ discard block |
||
567 | 774 | if (isset($all_data['features'][0]['id'])) { |
568 | 775 | foreach ($all_data['features'] as $line) { |
569 | 776 | $data = array(); |
570 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
|
571 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
|
572 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = $line['properties']['mmsi']; |
|
573 | - if (isset($line['properties']['imo'])) $data['mmsi'] = $line['properties']['imo']; |
|
574 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
|
575 | - if (isset($line['properties']['heading'])) $data['heading'] = $line['properties']['heading']; |
|
777 | + if (isset($line['properties']['name'])) { |
|
778 | + $data['ident'] = $line['properties']['name']; |
|
779 | + } |
|
780 | + if (isset($line['properties']['callsign'])) { |
|
781 | + $data['callsign'] = $line['properties']['callsign']; |
|
782 | + } |
|
783 | + if (isset($line['properties']['mmsi'])) { |
|
784 | + $data['mmsi'] = $line['properties']['mmsi']; |
|
785 | + } |
|
786 | + if (isset($line['properties']['imo'])) { |
|
787 | + $data['mmsi'] = $line['properties']['imo']; |
|
788 | + } |
|
789 | + if (isset($line['properties']['speed'])) { |
|
790 | + $data['speed'] = $line['properties']['speed']; |
|
791 | + } |
|
792 | + if (isset($line['properties']['heading'])) { |
|
793 | + $data['heading'] = $line['properties']['heading']; |
|
794 | + } |
|
576 | 795 | $data['latitude'] = $line['geometry']['coordinates'][1]; |
577 | 796 | $data['longitude'] = $line['geometry']['coordinates'][0]; |
578 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; |
|
579 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; |
|
580 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; |
|
797 | + if (isset($line['properties']['vesselType'])) { |
|
798 | + $data['type'] = $line['properties']['vesselType']; |
|
799 | + } |
|
800 | + if (isset($line['properties']['destination'])) { |
|
801 | + $data['arrival_code'] = $line['properties']['destination']; |
|
802 | + } |
|
803 | + if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { |
|
804 | + $data['arrival_date'] = $line['properties']['eta']; |
|
805 | + } |
|
581 | 806 | $data['format_source'] = 'boatnerd'; |
582 | 807 | $data['id_source'] = $id_source; |
583 | 808 | $data['datetime'] = date('Y-m-d H:i:s'); |
584 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
585 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
|
809 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
810 | + $data['noarchive'] = true; |
|
811 | + } |
|
812 | + if ($line['properties']['vesselType'] != 'Navigation Aid') { |
|
813 | + $MI->add($data); |
|
814 | + } |
|
586 | 815 | unset($data); |
587 | 816 | } |
588 | 817 | } |
@@ -593,7 +822,9 @@ discard block |
||
593 | 822 | echo 'download...'; |
594 | 823 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
595 | 824 | echo 'done !'."\n"; |
596 | - if ($buffer != '') $reset = 0; |
|
825 | + if ($buffer != '') { |
|
826 | + $reset = 0; |
|
827 | + } |
|
597 | 828 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
598 | 829 | $buffer = explode('\n',$buffer); |
599 | 830 | foreach ($buffer as $line) { |
@@ -618,7 +849,9 @@ discard block |
||
618 | 849 | //$data['etaTime'] = substr($line,135,5); |
619 | 850 | $data['format_source'] = 'shipplotter'; |
620 | 851 | $data['id_source'] = $id_source; |
621 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
852 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
853 | + $data['noarchive'] = true; |
|
854 | + } |
|
622 | 855 | //print_r($data); |
623 | 856 | echo 'Add...'."\n"; |
624 | 857 | $MI->add($data); |
@@ -638,16 +871,28 @@ discard block |
||
638 | 871 | $line = explode(':', $line); |
639 | 872 | if (count($line) > 30 && $line[0] != 'callsign') { |
640 | 873 | $data = array(); |
641 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
642 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
874 | + if (isset($line[37]) && $line[37] != '') { |
|
875 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
876 | + } else { |
|
877 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
878 | + } |
|
643 | 879 | $data['pilot_id'] = $line[1]; |
644 | 880 | $data['pilot_name'] = $line[2]; |
645 | 881 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
646 | 882 | $data['ident'] = $line[0]; // ident |
647 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
|
883 | + if ($line[7] != '' && $line[7] != 0) { |
|
884 | + $data['altitude'] = $line[7]; |
|
885 | + } |
|
886 | + // altitude |
|
648 | 887 | $data['speed'] = $line[8]; // speed |
649 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading |
|
650 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
|
888 | + if (isset($line[45])) { |
|
889 | + $data['heading'] = $line[45]; |
|
890 | + } |
|
891 | + // heading |
|
892 | + elseif (isset($line[38])) { |
|
893 | + $data['heading'] = $line[38]; |
|
894 | + } |
|
895 | + // heading |
|
651 | 896 | $data['latitude'] = $line[5]; // lat |
652 | 897 | $data['longitude'] = $line[6]; // long |
653 | 898 | $data['verticalrate'] = ''; // vertical rate |
@@ -663,7 +908,9 @@ discard block |
||
663 | 908 | $data['frequency'] = $line[4]; |
664 | 909 | $data['type'] = $line[18]; |
665 | 910 | $data['range'] = $line[19]; |
666 | - if (isset($line[35])) $data['info'] = $line[35]; |
|
911 | + if (isset($line[35])) { |
|
912 | + $data['info'] = $line[35]; |
|
913 | + } |
|
667 | 914 | $data['id_source'] = $id_source; |
668 | 915 | //$data['arrival_airport_time'] = ; |
669 | 916 | if ($line[9] != '') { |
@@ -677,27 +924,47 @@ discard block |
||
677 | 924 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
678 | 925 | */ |
679 | 926 | $data['format_source'] = $value['format']; |
680 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
681 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
682 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
683 | - elseif ($line[3] == 'ATC') { |
|
927 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
928 | + $data['noarchive'] = true; |
|
929 | + } |
|
930 | + if (isset($value['name']) && $value['name'] != '') { |
|
931 | + $data['source_name'] = $value['name']; |
|
932 | + } |
|
933 | + if ($line[3] == 'PILOT') { |
|
934 | + $SI->add($data); |
|
935 | + } elseif ($line[3] == 'ATC') { |
|
684 | 936 | //print_r($data); |
685 | 937 | $data['info'] = str_replace('^§','<br />',$data['info']); |
686 | 938 | $data['info'] = str_replace('&sect;','',$data['info']); |
687 | 939 | $typec = substr($data['ident'],-3); |
688 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
689 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
690 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
691 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
692 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
693 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
694 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
695 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
696 | - elseif ($data['type'] == '') $data['type'] = 'Observer'; |
|
697 | - if (!isset($data['source_name'])) $data['source_name'] = ''; |
|
940 | + if ($typec == 'APP') { |
|
941 | + $data['type'] = 'Approach'; |
|
942 | + } elseif ($typec == 'TWR') { |
|
943 | + $data['type'] = 'Tower'; |
|
944 | + } elseif ($typec == 'OBS') { |
|
945 | + $data['type'] = 'Observer'; |
|
946 | + } elseif ($typec == 'GND') { |
|
947 | + $data['type'] = 'Ground'; |
|
948 | + } elseif ($typec == 'DEL') { |
|
949 | + $data['type'] = 'Delivery'; |
|
950 | + } elseif ($typec == 'DEP') { |
|
951 | + $data['type'] = 'Departure'; |
|
952 | + } elseif ($typec == 'FSS') { |
|
953 | + $data['type'] = 'Flight Service Station'; |
|
954 | + } elseif ($typec == 'CTR') { |
|
955 | + $data['type'] = 'Control Radar or Centre'; |
|
956 | + } elseif ($data['type'] == '') { |
|
957 | + $data['type'] = 'Observer'; |
|
958 | + } |
|
959 | + if (!isset($data['source_name'])) { |
|
960 | + $data['source_name'] = ''; |
|
961 | + } |
|
698 | 962 | if (isset($ATC)) { |
699 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
700 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
963 | + if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { |
|
964 | + echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
965 | + } else { |
|
966 | + echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
967 | + } |
|
701 | 968 | } |
702 | 969 | } |
703 | 970 | unset($data); |
@@ -719,13 +986,19 @@ discard block |
||
719 | 986 | $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
720 | 987 | $data['latitude'] = (float)$line['pktLatitude']; |
721 | 988 | $data['longitude'] = (float)$line['pktLongitude']; |
722 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
723 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
989 | + if ((float)$line['pktTrack'] != 0) { |
|
990 | + $data['heading'] = (float)$line['pktTrack']; |
|
991 | + } |
|
992 | + if ((int)$line['pktSpeed'] != 0) { |
|
993 | + $data['speed'] = (int)$line['pktSpeed']; |
|
994 | + } |
|
724 | 995 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
725 | 996 | $data['pilot_id'] = (int)$line['pktPilotID']; |
726 | 997 | $data['aircraft_icao'] = 'PARAGLIDER'; |
727 | 998 | $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
728 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
|
999 | + if (isset($pilot_data[4])) { |
|
1000 | + $data['pilot_name'] = $pilot_data[4]; |
|
1001 | + } |
|
729 | 1002 | $data['format_source'] = $value['format']; |
730 | 1003 | $SI->add($data); |
731 | 1004 | unset($data); |
@@ -761,27 +1034,61 @@ discard block |
||
761 | 1034 | foreach ($all_data['acList'] as $line) { |
762 | 1035 | $data = array(); |
763 | 1036 | $data['hex'] = $line['Icao']; // hex |
764 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
765 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
766 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
767 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
768 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
769 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
1037 | + if (isset($line['Call'])) { |
|
1038 | + $data['ident'] = $line['Call']; |
|
1039 | + } |
|
1040 | + // ident |
|
1041 | + if (isset($line['Alt'])) { |
|
1042 | + $data['altitude'] = $line['Alt']; |
|
1043 | + } |
|
1044 | + // altitude |
|
1045 | + if (isset($line['Spd'])) { |
|
1046 | + $data['speed'] = $line['Spd']; |
|
1047 | + } |
|
1048 | + // speed |
|
1049 | + if (isset($line['Trak'])) { |
|
1050 | + $data['heading'] = $line['Trak']; |
|
1051 | + } |
|
1052 | + // heading |
|
1053 | + if (isset($line['Lat'])) { |
|
1054 | + $data['latitude'] = $line['Lat']; |
|
1055 | + } |
|
1056 | + // lat |
|
1057 | + if (isset($line['Long'])) { |
|
1058 | + $data['longitude'] = $line['Long']; |
|
1059 | + } |
|
1060 | + // long |
|
770 | 1061 | //$data['verticalrate'] = $line['']; // verticale rate |
771 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
1062 | + if (isset($line['Sqk'])) { |
|
1063 | + $data['squawk'] = $line['Sqk']; |
|
1064 | + } |
|
1065 | + // squawk |
|
772 | 1066 | $data['emergency'] = ''; // emergency |
773 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
1067 | + if (isset($line['Reg'])) { |
|
1068 | + $data['registration'] = $line['Reg']; |
|
1069 | + } |
|
774 | 1070 | |
775 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
776 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1071 | + if (isset($line['PosTime'])) { |
|
1072 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
1073 | + } else { |
|
1074 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1075 | + } |
|
777 | 1076 | |
778 | 1077 | //$data['datetime'] = date('Y-m-d H:i:s'); |
779 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
1078 | + if (isset($line['Type'])) { |
|
1079 | + $data['aircraft_icao'] = $line['Type']; |
|
1080 | + } |
|
780 | 1081 | $data['format_source'] = 'aircraftlistjson'; |
781 | 1082 | $data['id_source'] = $id_source; |
782 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
783 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
784 | - if (isset($data['latitude'])) $SI->add($data); |
|
1083 | + if (isset($value['name']) && $value['name'] != '') { |
|
1084 | + $data['source_name'] = $value['name']; |
|
1085 | + } |
|
1086 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1087 | + $data['noarchive'] = true; |
|
1088 | + } |
|
1089 | + if (isset($data['latitude'])) { |
|
1090 | + $SI->add($data); |
|
1091 | + } |
|
785 | 1092 | unset($data); |
786 | 1093 | } |
787 | 1094 | } elseif (is_array($all_data)) { |
@@ -798,12 +1105,19 @@ discard block |
||
798 | 1105 | $data['verticalrate'] = $line['vrt']; // verticale rate |
799 | 1106 | $data['squawk'] = $line['squawk']; // squawk |
800 | 1107 | $data['emergency'] = ''; // emergency |
801 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
802 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1108 | + if (isset($line['PosTime'])) { |
|
1109 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
1110 | + } else { |
|
1111 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1112 | + } |
|
803 | 1113 | $data['format_source'] = 'aircraftlistjson'; |
804 | 1114 | $data['id_source'] = $id_source; |
805 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
806 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1115 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1116 | + $data['noarchive'] = true; |
|
1117 | + } |
|
1118 | + if (isset($value['name']) && $value['name'] != '') { |
|
1119 | + $data['source_name'] = $value['name']; |
|
1120 | + } |
|
807 | 1121 | $SI->add($data); |
808 | 1122 | unset($data); |
809 | 1123 | } |
@@ -839,8 +1153,12 @@ discard block |
||
839 | 1153 | $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
840 | 1154 | $data['format_source'] = 'planeupdatefaa'; |
841 | 1155 | $data['id_source'] = $id_source; |
842 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
843 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1156 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1157 | + $data['noarchive'] = true; |
|
1158 | + } |
|
1159 | + if (isset($value['name']) && $value['name'] != '') { |
|
1160 | + $data['source_name'] = $value['name']; |
|
1161 | + } |
|
844 | 1162 | $SI->add($data); |
845 | 1163 | unset($data); |
846 | 1164 | } |
@@ -869,7 +1187,9 @@ discard block |
||
869 | 1187 | $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
870 | 1188 | $data['format_source'] = 'opensky'; |
871 | 1189 | $data['id_source'] = $id_source; |
872 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1190 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1191 | + $data['noarchive'] = true; |
|
1192 | + } |
|
873 | 1193 | $SI->add($data); |
874 | 1194 | unset($data); |
875 | 1195 | } |
@@ -881,7 +1201,9 @@ discard block |
||
881 | 1201 | //$buffer = $Common->getData($hosts[$id]); |
882 | 1202 | $buffer = $Common->getData($value['host']); |
883 | 1203 | $all_data = json_decode($buffer,true); |
884 | - if (!empty($all_data)) $reset = 0; |
|
1204 | + if (!empty($all_data)) { |
|
1205 | + $reset = 0; |
|
1206 | + } |
|
885 | 1207 | foreach ($all_data as $key => $line) { |
886 | 1208 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
887 | 1209 | $data = array(); |
@@ -902,8 +1224,12 @@ discard block |
||
902 | 1224 | $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
903 | 1225 | $data['format_source'] = 'fr24json'; |
904 | 1226 | $data['id_source'] = $id_source; |
905 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
906 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1227 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1228 | + $data['noarchive'] = true; |
|
1229 | + } |
|
1230 | + if (isset($value['name']) && $value['name'] != '') { |
|
1231 | + $data['source_name'] = $value['name']; |
|
1232 | + } |
|
907 | 1233 | $SI->add($data); |
908 | 1234 | unset($data); |
909 | 1235 | } |
@@ -927,24 +1253,42 @@ discard block |
||
927 | 1253 | if (isset($line['inf'])) { |
928 | 1254 | $data = array(); |
929 | 1255 | $data['hex'] = $line['inf']['ia']; |
930 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
|
1256 | + if (isset($line['inf']['cs'])) { |
|
1257 | + $data['ident'] = $line['inf']['cs']; |
|
1258 | + } |
|
1259 | + //$line[13] |
|
931 | 1260 | $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
932 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
933 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
1261 | + if (isset($line['inf']['gs'])) { |
|
1262 | + $data['speed'] = round($line['inf']['gs']*0.539957); |
|
1263 | + } |
|
1264 | + // speed |
|
1265 | + if (isset($line['inf']['tr'])) { |
|
1266 | + $data['heading'] = $line['inf']['tr']; |
|
1267 | + } |
|
1268 | + // heading |
|
934 | 1269 | $data['latitude'] = $line['pt'][0]; // lat |
935 | 1270 | $data['longitude'] = $line['pt'][1]; // long |
936 | 1271 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
937 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
1272 | + if (isset($line['inf']['sq'])) { |
|
1273 | + $data['squawk'] = $line['inf']['sq']; |
|
1274 | + } |
|
1275 | + // squawk |
|
938 | 1276 | //$data['aircraft_icao'] = $line[8]; |
939 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
1277 | + if (isset($line['inf']['rc'])) { |
|
1278 | + $data['registration'] = $line['inf']['rc']; |
|
1279 | + } |
|
940 | 1280 | //$data['departure_airport_iata'] = $line[11]; |
941 | 1281 | //$data['arrival_airport_iata'] = $line[12]; |
942 | 1282 | //$data['emergency'] = ''; // emergency |
943 | 1283 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
944 | 1284 | $data['format_source'] = 'radarvirtueljson'; |
945 | 1285 | $data['id_source'] = $id_source; |
946 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
947 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1286 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1287 | + $data['noarchive'] = true; |
|
1288 | + } |
|
1289 | + if (isset($value['name']) && $value['name'] != '') { |
|
1290 | + $data['source_name'] = $value['name']; |
|
1291 | + } |
|
948 | 1292 | $SI->add($data); |
949 | 1293 | unset($data); |
950 | 1294 | } |
@@ -965,30 +1309,65 @@ discard block |
||
965 | 1309 | $data['id'] = $line['id']; |
966 | 1310 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
967 | 1311 | $data['ident'] = $line['callsign']; // ident |
968 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
969 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
970 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
971 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
972 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
973 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1312 | + if (isset($line['pilotid'])) { |
|
1313 | + $data['pilot_id'] = $line['pilotid']; |
|
1314 | + } |
|
1315 | + // pilot id |
|
1316 | + if (isset($line['name'])) { |
|
1317 | + $data['pilot_name'] = $line['name']; |
|
1318 | + } |
|
1319 | + // pilot name |
|
1320 | + if (isset($line['alt'])) { |
|
1321 | + $data['altitude'] = $line['alt']; |
|
1322 | + } |
|
1323 | + // altitude |
|
1324 | + if (isset($line['gs'])) { |
|
1325 | + $data['speed'] = $line['gs']; |
|
1326 | + } |
|
1327 | + // speed |
|
1328 | + if (isset($line['heading'])) { |
|
1329 | + $data['heading'] = $line['heading']; |
|
1330 | + } |
|
1331 | + // heading |
|
1332 | + if (isset($line['route'])) { |
|
1333 | + $data['waypoints'] = $line['route']; |
|
1334 | + } |
|
1335 | + // route |
|
974 | 1336 | $data['latitude'] = $line['lat']; // lat |
975 | 1337 | $data['longitude'] = $line['lon']; // long |
976 | 1338 | //$data['verticalrate'] = $line['vrt']; // verticale rate |
977 | 1339 | //$data['squawk'] = $line['squawk']; // squawk |
978 | 1340 | //$data['emergency'] = ''; // emergency |
979 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
980 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
981 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
1341 | + if (isset($line['depicao'])) { |
|
1342 | + $data['departure_airport_icao'] = $line['depicao']; |
|
1343 | + } |
|
1344 | + if (isset($line['deptime'])) { |
|
1345 | + $data['departure_airport_time'] = $line['deptime']; |
|
1346 | + } |
|
1347 | + if (isset($line['arricao'])) { |
|
1348 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
1349 | + } |
|
982 | 1350 | //$data['arrival_airport_time'] = $line['arrtime']; |
983 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
984 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
985 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
986 | - else $data['info'] = ''; |
|
1351 | + if (isset($line['aircraft'])) { |
|
1352 | + $data['aircraft_icao'] = $line['aircraft']; |
|
1353 | + } |
|
1354 | + if (isset($line['transponder'])) { |
|
1355 | + $data['squawk'] = $line['transponder']; |
|
1356 | + } |
|
1357 | + if (isset($line['atis'])) { |
|
1358 | + $data['info'] = $line['atis']; |
|
1359 | + } else { |
|
1360 | + $data['info'] = ''; |
|
1361 | + } |
|
987 | 1362 | $data['format_source'] = 'pireps'; |
988 | 1363 | $data['id_source'] = $id_source; |
989 | 1364 | $data['datetime'] = date('Y-m-d H:i:s'); |
990 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
991 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1365 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1366 | + $data['noarchive'] = true; |
|
1367 | + } |
|
1368 | + if (isset($value['name']) && $value['name'] != '') { |
|
1369 | + $data['source_name'] = $value['name']; |
|
1370 | + } |
|
992 | 1371 | if ($line['icon'] == 'plane') { |
993 | 1372 | $SI->add($data); |
994 | 1373 | // print_r($data); |
@@ -997,16 +1376,28 @@ discard block |
||
997 | 1376 | $data['info'] = str_replace('&sect;','',$data['info']); |
998 | 1377 | $typec = substr($data['ident'],-3); |
999 | 1378 | $data['type'] = ''; |
1000 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
1001 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
1002 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
1003 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
1004 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
1005 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
1006 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
1007 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
1008 | - else $data['type'] = 'Observer'; |
|
1009 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
1379 | + if ($typec == 'APP') { |
|
1380 | + $data['type'] = 'Approach'; |
|
1381 | + } elseif ($typec == 'TWR') { |
|
1382 | + $data['type'] = 'Tower'; |
|
1383 | + } elseif ($typec == 'OBS') { |
|
1384 | + $data['type'] = 'Observer'; |
|
1385 | + } elseif ($typec == 'GND') { |
|
1386 | + $data['type'] = 'Ground'; |
|
1387 | + } elseif ($typec == 'DEL') { |
|
1388 | + $data['type'] = 'Delivery'; |
|
1389 | + } elseif ($typec == 'DEP') { |
|
1390 | + $data['type'] = 'Departure'; |
|
1391 | + } elseif ($typec == 'FSS') { |
|
1392 | + $data['type'] = 'Flight Service Station'; |
|
1393 | + } elseif ($typec == 'CTR') { |
|
1394 | + $data['type'] = 'Control Radar or Centre'; |
|
1395 | + } else { |
|
1396 | + $data['type'] = 'Observer'; |
|
1397 | + } |
|
1398 | + if (isset($ATC)) { |
|
1399 | + echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
1400 | + } |
|
1010 | 1401 | } |
1011 | 1402 | unset($data); |
1012 | 1403 | } |
@@ -1016,7 +1407,9 @@ discard block |
||
1016 | 1407 | //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
1017 | 1408 | } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
1018 | 1409 | //$buffer = $Common->getData($hosts[$id]); |
1019 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
1410 | + if ($globalDebug) { |
|
1411 | + echo 'Get Data...'."\n"; |
|
1412 | + } |
|
1020 | 1413 | $buffer = $Common->getData($value['host']); |
1021 | 1414 | $all_data = json_decode($buffer,true); |
1022 | 1415 | if ($buffer != '' && is_array($all_data)) { |
@@ -1024,10 +1417,16 @@ discard block |
||
1024 | 1417 | foreach ($all_data as $line) { |
1025 | 1418 | $data = array(); |
1026 | 1419 | //$data['id'] = $line['id']; // id not usable |
1027 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
1420 | + if (isset($line['pilotid'])) { |
|
1421 | + $data['id'] = $line['pilotid'].$line['flightnum']; |
|
1422 | + } |
|
1028 | 1423 | $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
1029 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
1030 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
1424 | + if (isset($line['pilotname'])) { |
|
1425 | + $data['pilot_name'] = $line['pilotname']; |
|
1426 | + } |
|
1427 | + if (isset($line['pilotid'])) { |
|
1428 | + $data['pilot_id'] = $line['pilotid']; |
|
1429 | + } |
|
1031 | 1430 | $data['ident'] = $line['flightnum']; // ident |
1032 | 1431 | $data['altitude'] = $line['alt']; // altitude |
1033 | 1432 | $data['speed'] = $line['gs']; // speed |
@@ -1045,28 +1444,44 @@ discard block |
||
1045 | 1444 | $data['arrival_airport_icao'] = $line['arricao']; |
1046 | 1445 | $data['arrival_airport_time'] = $line['arrtime']; |
1047 | 1446 | $data['registration'] = $line['aircraft']; |
1048 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1049 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1447 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1448 | + $data['noarchive'] = true; |
|
1449 | + } |
|
1450 | + if (isset($line['route'])) { |
|
1451 | + $data['waypoints'] = $line['route']; |
|
1452 | + } |
|
1453 | + // route |
|
1050 | 1454 | if (isset($line['aircraftname'])) { |
1051 | 1455 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1052 | 1456 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
1053 | 1457 | $aircraft_data = explode('-',$line['aircraftname']); |
1054 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
1055 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
1056 | - else { |
|
1458 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { |
|
1459 | + $data['aircraft_icao'] = $aircraft_data[0]; |
|
1460 | + } elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { |
|
1461 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
1462 | + } else { |
|
1057 | 1463 | $aircraft_data = explode(' ',$line['aircraftname']); |
1058 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1059 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1464 | + if (isset($aircraft_data[1])) { |
|
1465 | + $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1466 | + } else { |
|
1467 | + $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1468 | + } |
|
1060 | 1469 | } |
1061 | 1470 | } |
1062 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
1471 | + if (isset($line['route'])) { |
|
1472 | + $data['waypoints'] = $line['route']; |
|
1473 | + } |
|
1063 | 1474 | $data['id_source'] = $id_source; |
1064 | 1475 | $data['format_source'] = 'phpvmacars'; |
1065 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1476 | + if (isset($value['name']) && $value['name'] != '') { |
|
1477 | + $data['source_name'] = $value['name']; |
|
1478 | + } |
|
1066 | 1479 | $SI->add($data); |
1067 | 1480 | unset($data); |
1068 | 1481 | } |
1069 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
1482 | + if ($globalDebug) { |
|
1483 | + echo 'No more data...'."\n"; |
|
1484 | + } |
|
1070 | 1485 | unset($buffer); |
1071 | 1486 | unset($all_data); |
1072 | 1487 | } |
@@ -1074,7 +1489,9 @@ discard block |
||
1074 | 1489 | $last_exec[$id]['last'] = time(); |
1075 | 1490 | } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
1076 | 1491 | //$buffer = $Common->getData($hosts[$id]); |
1077 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
1492 | + if ($globalDebug) { |
|
1493 | + echo 'Get Data...'."\n"; |
|
1494 | + } |
|
1078 | 1495 | $buffer = $Common->getData($value['host']); |
1079 | 1496 | $all_data = json_decode($buffer,true); |
1080 | 1497 | if ($buffer != '' && is_array($all_data)) { |
@@ -1103,16 +1520,25 @@ discard block |
||
1103 | 1520 | $data['arrival_airport_icao'] = $line['arrival']; |
1104 | 1521 | //$data['arrival_airport_time'] = $line['arrival_time']; |
1105 | 1522 | //$data['registration'] = $line['aircraft']; |
1106 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
1523 | + if (isset($line['route'])) { |
|
1524 | + $data['waypoints'] = $line['route']; |
|
1525 | + } |
|
1526 | + // route |
|
1107 | 1527 | $data['aircraft_icao'] = $line['plane_type']; |
1108 | 1528 | $data['id_source'] = $id_source; |
1109 | 1529 | $data['format_source'] = 'vam'; |
1110 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1111 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1530 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
1531 | + $data['noarchive'] = true; |
|
1532 | + } |
|
1533 | + if (isset($value['name']) && $value['name'] != '') { |
|
1534 | + $data['source_name'] = $value['name']; |
|
1535 | + } |
|
1112 | 1536 | $SI->add($data); |
1113 | 1537 | unset($data); |
1114 | 1538 | } |
1115 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
1539 | + if ($globalDebug) { |
|
1540 | + echo 'No more data...'."\n"; |
|
1541 | + } |
|
1116 | 1542 | unset($buffer); |
1117 | 1543 | unset($all_data); |
1118 | 1544 | } |
@@ -1120,7 +1546,9 @@ discard block |
||
1120 | 1546 | $last_exec[$id]['last'] = time(); |
1121 | 1547 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
1122 | 1548 | } elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'famaprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais' || $value['format'] == 'vrstcp') { |
1123 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
1549 | + if (function_exists('pcntl_fork')) { |
|
1550 | + pcntl_signal_dispatch(); |
|
1551 | + } |
|
1124 | 1552 | //$last_exec[$id]['last'] = time(); |
1125 | 1553 | |
1126 | 1554 | //$read = array( $sockets[$id] ); |
@@ -1128,7 +1556,9 @@ discard block |
||
1128 | 1556 | $write = NULL; |
1129 | 1557 | $e = NULL; |
1130 | 1558 | $n = socket_select($read, $write, $e, $timeout); |
1131 | - if ($e != NULL) var_dump($e); |
|
1559 | + if ($e != NULL) { |
|
1560 | + var_dump($e); |
|
1561 | + } |
|
1132 | 1562 | if ($n > 0) { |
1133 | 1563 | $reset = 0; |
1134 | 1564 | foreach ($read as $nb => $r) { |
@@ -1149,12 +1579,16 @@ discard block |
||
1149 | 1579 | //$SI::del(); |
1150 | 1580 | if ($format == 'vrstcp') { |
1151 | 1581 | $buffer = explode('},{',$buffer); |
1152 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1582 | + } else { |
|
1583 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1584 | + } |
|
1153 | 1585 | // SBS format is CSV format |
1154 | 1586 | if ($buffer !== FALSE && $buffer != '') { |
1155 | 1587 | $tt[$format] = 0; |
1156 | 1588 | if ($format == 'acarssbs3') { |
1157 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
1589 | + if ($globalDebug) { |
|
1590 | + echo 'ACARS : '.$buffer."\n"; |
|
1591 | + } |
|
1158 | 1592 | $ACARS->add(trim($buffer)); |
1159 | 1593 | $ACARS->deleteLiveAcarsData(); |
1160 | 1594 | } elseif ($format == 'raw') { |
@@ -1163,30 +1597,70 @@ discard block |
||
1163 | 1597 | if (is_array($data)) { |
1164 | 1598 | $data['datetime'] = date('Y-m-d H:i:s'); |
1165 | 1599 | $data['format_source'] = 'raw'; |
1166 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1167 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1168 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1169 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1600 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
1601 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
1602 | + } |
|
1603 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
1604 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1605 | + } |
|
1606 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1607 | + $data['noarchive'] = true; |
|
1608 | + } |
|
1609 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
1610 | + $SI->add($data); |
|
1611 | + } |
|
1170 | 1612 | } |
1171 | 1613 | } elseif ($format == 'ais') { |
1172 | 1614 | $ais_data = $AIS->parse_line(trim($buffer)); |
1173 | 1615 | $data = array(); |
1174 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
1175 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
1176 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
1177 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
1178 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
1179 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
1180 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
1181 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
1182 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
1183 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
1184 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
1185 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
1186 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1187 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1188 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1189 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1616 | + if (isset($ais_data['ident'])) { |
|
1617 | + $data['ident'] = $ais_data['ident']; |
|
1618 | + } |
|
1619 | + if (isset($ais_data['mmsi'])) { |
|
1620 | + $data['mmsi'] = $ais_data['mmsi']; |
|
1621 | + } |
|
1622 | + if (isset($ais_data['speed'])) { |
|
1623 | + $data['speed'] = $ais_data['speed']; |
|
1624 | + } |
|
1625 | + if (isset($ais_data['heading'])) { |
|
1626 | + $data['heading'] = $ais_data['heading']; |
|
1627 | + } |
|
1628 | + if (isset($ais_data['latitude'])) { |
|
1629 | + $data['latitude'] = $ais_data['latitude']; |
|
1630 | + } |
|
1631 | + if (isset($ais_data['longitude'])) { |
|
1632 | + $data['longitude'] = $ais_data['longitude']; |
|
1633 | + } |
|
1634 | + if (isset($ais_data['status'])) { |
|
1635 | + $data['status'] = $ais_data['status']; |
|
1636 | + } |
|
1637 | + if (isset($ais_data['statusid'])) { |
|
1638 | + $data['status_id'] = $ais_data['statusid']; |
|
1639 | + } |
|
1640 | + if (isset($ais_data['type'])) { |
|
1641 | + $data['type'] = $ais_data['type']; |
|
1642 | + } |
|
1643 | + if (isset($ais_data['imo'])) { |
|
1644 | + $data['imo'] = $ais_data['imo']; |
|
1645 | + } |
|
1646 | + if (isset($ais_data['callsign'])) { |
|
1647 | + $data['callsign'] = $ais_data['callsign']; |
|
1648 | + } |
|
1649 | + if (isset($ais_data['destination'])) { |
|
1650 | + $data['arrival_code'] = $ais_data['destination']; |
|
1651 | + } |
|
1652 | + if (isset($ais_data['eta_ts'])) { |
|
1653 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1654 | + } |
|
1655 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1656 | + $data['noarchive'] = true; |
|
1657 | + } |
|
1658 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
1659 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
1660 | + } |
|
1661 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
1662 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1663 | + } |
|
1190 | 1664 | |
1191 | 1665 | if (isset($ais_data['timestamp'])) { |
1192 | 1666 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
@@ -1195,7 +1669,9 @@ discard block |
||
1195 | 1669 | } |
1196 | 1670 | $data['format_source'] = 'aisnmea'; |
1197 | 1671 | $data['id_source'] = $id_source; |
1198 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
1672 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
1673 | + $MI->add($data); |
|
1674 | + } |
|
1199 | 1675 | unset($data); |
1200 | 1676 | } elseif ($format == 'flightgearsp') { |
1201 | 1677 | //echo $buffer."\n"; |
@@ -1213,12 +1689,18 @@ discard block |
||
1213 | 1689 | $data['speed'] = round($line[5]*1.94384); |
1214 | 1690 | $data['datetime'] = date('Y-m-d H:i:s'); |
1215 | 1691 | $data['format_source'] = 'flightgearsp'; |
1216 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1217 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1692 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1693 | + $data['noarchive'] = true; |
|
1694 | + } |
|
1695 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
1696 | + $SI->add($data); |
|
1697 | + } |
|
1218 | 1698 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
1219 | 1699 | } |
1220 | 1700 | } elseif ($format == 'acars') { |
1221 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
1701 | + if ($globalDebug) { |
|
1702 | + echo 'ACARS : '.$buffer."\n"; |
|
1703 | + } |
|
1222 | 1704 | $ACARS->add(trim($buffer)); |
1223 | 1705 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
1224 | 1706 | $ACARS->deleteLiveAcarsData(); |
@@ -1239,8 +1721,12 @@ discard block |
||
1239 | 1721 | $aircraft_type = $line[10]; |
1240 | 1722 | $aircraft_type = preg_split(':/:',$aircraft_type); |
1241 | 1723 | $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
1242 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1243 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1724 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1725 | + $data['noarchive'] = true; |
|
1726 | + } |
|
1727 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
1728 | + $SI->add($data); |
|
1729 | + } |
|
1244 | 1730 | } |
1245 | 1731 | } |
1246 | 1732 | } elseif ($format == 'beast') { |
@@ -1250,28 +1736,62 @@ discard block |
||
1250 | 1736 | foreach($buffer as $all_data) { |
1251 | 1737 | $line = json_decode('{'.$all_data.'}',true); |
1252 | 1738 | $data = array(); |
1253 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
|
1254 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
1255 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
1256 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
1257 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
1258 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
1259 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
1739 | + if (isset($line['Icao'])) { |
|
1740 | + $data['hex'] = $line['Icao']; |
|
1741 | + } |
|
1742 | + // hex |
|
1743 | + if (isset($line['Call'])) { |
|
1744 | + $data['ident'] = $line['Call']; |
|
1745 | + } |
|
1746 | + // ident |
|
1747 | + if (isset($line['Alt'])) { |
|
1748 | + $data['altitude'] = $line['Alt']; |
|
1749 | + } |
|
1750 | + // altitude |
|
1751 | + if (isset($line['Spd'])) { |
|
1752 | + $data['speed'] = $line['Spd']; |
|
1753 | + } |
|
1754 | + // speed |
|
1755 | + if (isset($line['Trak'])) { |
|
1756 | + $data['heading'] = $line['Trak']; |
|
1757 | + } |
|
1758 | + // heading |
|
1759 | + if (isset($line['Lat'])) { |
|
1760 | + $data['latitude'] = $line['Lat']; |
|
1761 | + } |
|
1762 | + // lat |
|
1763 | + if (isset($line['Long'])) { |
|
1764 | + $data['longitude'] = $line['Long']; |
|
1765 | + } |
|
1766 | + // long |
|
1260 | 1767 | //$data['verticalrate'] = $line['']; // verticale rate |
1261 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
1768 | + if (isset($line['Sqk'])) { |
|
1769 | + $data['squawk'] = $line['Sqk']; |
|
1770 | + } |
|
1771 | + // squawk |
|
1262 | 1772 | $data['emergency'] = ''; // emergency |
1263 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
1773 | + if (isset($line['Reg'])) { |
|
1774 | + $data['registration'] = $line['Reg']; |
|
1775 | + } |
|
1264 | 1776 | /* |
1265 | 1777 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
1266 | 1778 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1267 | 1779 | */ |
1268 | 1780 | $data['datetime'] = date('Y-m-d H:i:s'); |
1269 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
1781 | + if (isset($line['Type'])) { |
|
1782 | + $data['aircraft_icao'] = $line['Type']; |
|
1783 | + } |
|
1270 | 1784 | $data['format_source'] = 'vrstcp'; |
1271 | 1785 | $data['id_source'] = $id_source; |
1272 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1273 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
1274 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
|
1786 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1787 | + $data['noarchive'] = true; |
|
1788 | + } |
|
1789 | + if (isset($value['name']) && $value['name'] != '') { |
|
1790 | + $data['source_name'] = $value['name']; |
|
1791 | + } |
|
1792 | + if (isset($data['latitude']) && isset($data['hex'])) { |
|
1793 | + $SI->add($data); |
|
1794 | + } |
|
1275 | 1795 | unset($data); |
1276 | 1796 | } |
1277 | 1797 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
@@ -1284,22 +1804,46 @@ discard block |
||
1284 | 1804 | $data['hex'] = $lined['hexid']; |
1285 | 1805 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1286 | 1806 | $data['datetime'] = date('Y-m-d H:i:s');; |
1287 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
1288 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
1289 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
1290 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
1291 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
1292 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
1293 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
1807 | + if (isset($lined['ident'])) { |
|
1808 | + $data['ident'] = $lined['ident']; |
|
1809 | + } |
|
1810 | + if (isset($lined['lat'])) { |
|
1811 | + $data['latitude'] = $lined['lat']; |
|
1812 | + } |
|
1813 | + if (isset($lined['lon'])) { |
|
1814 | + $data['longitude'] = $lined['lon']; |
|
1815 | + } |
|
1816 | + if (isset($lined['speed'])) { |
|
1817 | + $data['speed'] = $lined['speed']; |
|
1818 | + } |
|
1819 | + if (isset($lined['squawk'])) { |
|
1820 | + $data['squawk'] = $lined['squawk']; |
|
1821 | + } |
|
1822 | + if (isset($lined['alt'])) { |
|
1823 | + $data['altitude'] = $lined['alt']; |
|
1824 | + } |
|
1825 | + if (isset($lined['heading'])) { |
|
1826 | + $data['heading'] = $lined['heading']; |
|
1827 | + } |
|
1294 | 1828 | $data['id_source'] = $id_source; |
1295 | 1829 | $data['format_source'] = 'tsv'; |
1296 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1297 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1298 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1299 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
1830 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
1831 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
1832 | + } |
|
1833 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
1834 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1835 | + } |
|
1836 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1837 | + $data['noarchive'] = true; |
|
1838 | + } |
|
1839 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
1840 | + $SI->add($data); |
|
1841 | + } |
|
1300 | 1842 | unset($lined); |
1301 | 1843 | unset($data); |
1302 | - } else $error = true; |
|
1844 | + } else { |
|
1845 | + $error = true; |
|
1846 | + } |
|
1303 | 1847 | } elseif ($format == 'aprs' && $use_aprs) { |
1304 | 1848 | if ($aprs_connect == 0) { |
1305 | 1849 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
@@ -1324,41 +1868,89 @@ discard block |
||
1324 | 1868 | $aprs_last_tx = time(); |
1325 | 1869 | $data = array(); |
1326 | 1870 | //print_r($line); |
1327 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
1328 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
1329 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
1330 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
1331 | - if (isset($line['arrival_code'])) $data['arrical_code'] = $line['arrival_code']; |
|
1332 | - if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
|
1333 | - if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
|
1334 | - if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
|
1335 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1336 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
1871 | + if (isset($line['address'])) { |
|
1872 | + $data['hex'] = $line['address']; |
|
1873 | + } |
|
1874 | + if (isset($line['mmsi'])) { |
|
1875 | + $data['mmsi'] = $line['mmsi']; |
|
1876 | + } |
|
1877 | + if (isset($line['imo'])) { |
|
1878 | + $data['imo'] = $line['imo']; |
|
1879 | + } |
|
1880 | + if (isset($line['squawk'])) { |
|
1881 | + $data['squawk'] = $line['squawk']; |
|
1882 | + } |
|
1883 | + if (isset($line['arrival_code'])) { |
|
1884 | + $data['arrical_code'] = $line['arrival_code']; |
|
1885 | + } |
|
1886 | + if (isset($line['arrival_date'])) { |
|
1887 | + $data['arrical_date'] = $line['arrival_date']; |
|
1888 | + } |
|
1889 | + if (isset($line['type_id'])) { |
|
1890 | + $data['type_id'] = $line['typeid']; |
|
1891 | + } |
|
1892 | + if (isset($line['status_id'])) { |
|
1893 | + $data['status_id'] = $line['statusid']; |
|
1894 | + } |
|
1895 | + if (isset($line['timestamp'])) { |
|
1896 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1897 | + } else { |
|
1898 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
1899 | + } |
|
1337 | 1900 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1338 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
1901 | + if (isset($line['ident'])) { |
|
1902 | + $data['ident'] = $line['ident']; |
|
1903 | + } |
|
1339 | 1904 | $data['latitude'] = $line['latitude']; |
1340 | 1905 | $data['longitude'] = $line['longitude']; |
1341 | 1906 | //$data['verticalrate'] = $line[16]; |
1342 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
1343 | - else $data['speed'] = 0; |
|
1344 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
1345 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
1346 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
1347 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; |
|
1907 | + if (isset($line['speed'])) { |
|
1908 | + $data['speed'] = $line['speed']; |
|
1909 | + } else { |
|
1910 | + $data['speed'] = 0; |
|
1911 | + } |
|
1912 | + if (isset($line['altitude'])) { |
|
1913 | + $data['altitude'] = $line['altitude']; |
|
1914 | + } |
|
1915 | + if (isset($line['comment'])) { |
|
1916 | + $data['comment'] = $line['comment']; |
|
1917 | + } |
|
1918 | + if (isset($line['symbol'])) { |
|
1919 | + $data['type'] = $line['symbol']; |
|
1920 | + } |
|
1921 | + if (isset($line['heading'])) { |
|
1922 | + $data['heading'] = $line['heading']; |
|
1923 | + } |
|
1348 | 1924 | //else $data['heading'] = 0; |
1349 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
1925 | + if (isset($line['stealth'])) { |
|
1926 | + $data['aircraft_type'] = $line['stealth']; |
|
1927 | + } |
|
1350 | 1928 | //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
1351 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
1352 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
1353 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
1354 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
1929 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { |
|
1930 | + $data['noarchive'] = true; |
|
1931 | + } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { |
|
1932 | + $data['noarchive'] = false; |
|
1933 | + } |
|
1934 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
1935 | + $data['noarchive'] = true; |
|
1936 | + } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { |
|
1937 | + $data['noarchive'] = false; |
|
1938 | + } |
|
1355 | 1939 | $data['id_source'] = $id_source; |
1356 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
1357 | - else $data['format_source'] = 'aprs'; |
|
1940 | + if (isset($line['format_source'])) { |
|
1941 | + $data['format_source'] = $line['format_source']; |
|
1942 | + } else { |
|
1943 | + $data['format_source'] = 'aprs'; |
|
1944 | + } |
|
1358 | 1945 | $data['source_name'] = $line['source']; |
1359 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
1360 | - else $data['source_type'] = 'flarm'; |
|
1361 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1946 | + if (isset($line['source_type'])) { |
|
1947 | + $data['source_type'] = $line['source_type']; |
|
1948 | + } else { |
|
1949 | + $data['source_type'] = 'flarm'; |
|
1950 | + } |
|
1951 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
1952 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1953 | + } |
|
1362 | 1954 | $currentdate = date('Y-m-d H:i:s'); |
1363 | 1955 | $aprsdate = strtotime($data['datetime']); |
1364 | 1956 | // Accept data if time <= system time + 20s |
@@ -1366,14 +1958,21 @@ discard block |
||
1366 | 1958 | if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
1367 | 1959 | $send = $SI->add($data); |
1368 | 1960 | } elseif ($data['source_type'] == 'ais') { |
1369 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
|
1961 | + if (isset($globalMarine) && $globalMarine) { |
|
1962 | + $send = $MI->add($data); |
|
1963 | + } |
|
1370 | 1964 | } elseif (isset($line['stealth'])) { |
1371 | - if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
1372 | - else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
1965 | + if ($line['stealth'] != 0) { |
|
1966 | + echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
1967 | + } else { |
|
1968 | + echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
1969 | + } |
|
1373 | 1970 | //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] == 'Car' || $line['symbol'] == 'Ambulance' || $line['symbol'] == 'Van' || $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || $line['symbol'] == 'Motorcycle' || $line['symbol'] == 'Police' || $line['symbol'] == 'Bike' || $line['symbol'] == 'Jogger' || $line['symbol'] == 'Bus' || $line['symbol'] == 'Jeep' || $line['symbol'] == 'Recreational Vehicle' || $line['symbol'] == 'Yacht (Sail)' || $line['symbol'] == 'Ship (Power Boat)' || $line['symbol'] == 'Firetruck' || $line['symbol'] == 'Balloon' || $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) { |
1374 | 1971 | } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
1375 | 1972 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
1376 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
|
1973 | + if (isset($globalTracker) && $globalTracker) { |
|
1974 | + $send = $TI->add($data); |
|
1975 | + } |
|
1377 | 1976 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident'])) { |
1378 | 1977 | $Source->deleteOldLocationByType('gs'); |
1379 | 1978 | if (count($Source->getLocationInfoByName($data['ident'])) > 0) { |
@@ -1386,12 +1985,9 @@ discard block |
||
1386 | 1985 | print_r($data); |
1387 | 1986 | } |
1388 | 1987 | unset($data); |
1389 | - } |
|
1390 | - elseif (is_array($line) && $globalDebug && isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
|
1988 | + } elseif (is_array($line) && $globalDebug && isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
|
1391 | 1989 | echo '!! Weather Station not yet supported'."\n"; |
1392 | - } |
|
1393 | - |
|
1394 | - elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
1990 | + } elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
1395 | 1991 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
1396 | 1992 | } |
1397 | 1993 | /* |
@@ -1400,7 +1996,9 @@ discard block |
||
1400 | 1996 | } |
1401 | 1997 | */ |
1402 | 1998 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
1403 | - elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
|
1999 | + elseif ($line == true && $globalDebug) { |
|
2000 | + echo '!! Failed : '.$buffer."!!\n"; |
|
2001 | + } |
|
1404 | 2002 | } |
1405 | 2003 | } else { |
1406 | 2004 | $line = explode(',', $buffer); |
@@ -1429,26 +2027,45 @@ discard block |
||
1429 | 2027 | $data['ground'] = $line[21]; |
1430 | 2028 | $data['emergency'] = $line[19]; |
1431 | 2029 | $data['format_source'] = 'sbs'; |
1432 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
1433 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
1434 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
2030 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
2031 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
2032 | + } |
|
2033 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
2034 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
2035 | + } |
|
2036 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
2037 | + $data['noarchive'] = true; |
|
2038 | + } |
|
1435 | 2039 | $data['id_source'] = $id_source; |
1436 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
1437 | - else $error = true; |
|
2040 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
2041 | + $send = $SI->add($data); |
|
2042 | + } else { |
|
2043 | + $error = true; |
|
2044 | + } |
|
1438 | 2045 | unset($data); |
1439 | - } else $error = true; |
|
2046 | + } else { |
|
2047 | + $error = true; |
|
2048 | + } |
|
1440 | 2049 | if ($error) { |
1441 | 2050 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
1442 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; |
|
2051 | + if ($globalDebug) { |
|
2052 | + echo "Not a message. Ignoring... \n"; |
|
2053 | + } |
|
1443 | 2054 | } else { |
1444 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; |
|
2055 | + if ($globalDebug) { |
|
2056 | + echo "Wrong line format. Ignoring... \n"; |
|
2057 | + } |
|
1445 | 2058 | if ($globalDebug) { |
1446 | 2059 | echo $buffer; |
1447 | 2060 | //print_r($line); |
1448 | 2061 | } |
1449 | 2062 | //socket_close($r); |
1450 | - if ($globalDebug) echo "Reconnect after an error...\n"; |
|
1451 | - if ($format == 'aprs') $aprs_connect = 0; |
|
2063 | + if ($globalDebug) { |
|
2064 | + echo "Reconnect after an error...\n"; |
|
2065 | + } |
|
2066 | + if ($format == 'aprs') { |
|
2067 | + $aprs_connect = 0; |
|
2068 | + } |
|
1452 | 2069 | $sourceer[$nb] = $globalSources[$nb]; |
1453 | 2070 | connect_all($sourceer); |
1454 | 2071 | $sourceer = array(); |
@@ -1456,10 +2073,14 @@ discard block |
||
1456 | 2073 | } |
1457 | 2074 | } |
1458 | 2075 | // Sleep for xxx microseconds |
1459 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
|
2076 | + if (isset($globalSBSSleep)) { |
|
2077 | + usleep($globalSBSSleep); |
|
2078 | + } |
|
1460 | 2079 | } else { |
1461 | 2080 | if ($format == 'flightgearmp') { |
1462 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
2081 | + if ($globalDebug) { |
|
2082 | + echo "Reconnect FlightGear MP..."; |
|
2083 | + } |
|
1463 | 2084 | //@socket_close($r); |
1464 | 2085 | sleep($globalMinFetch); |
1465 | 2086 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1468,10 +2089,15 @@ discard block |
||
1468 | 2089 | break; |
1469 | 2090 | |
1470 | 2091 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
1471 | - if (isset($tt[$format])) $tt[$format]++; |
|
1472 | - else $tt[$format] = 0; |
|
2092 | + if (isset($tt[$format])) { |
|
2093 | + $tt[$format]++; |
|
2094 | + } else { |
|
2095 | + $tt[$format] = 0; |
|
2096 | + } |
|
1473 | 2097 | if ($tt[$format] > 30) { |
1474 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
|
2098 | + if ($globalDebug) { |
|
2099 | + echo "ERROR : Reconnect ".$format."..."; |
|
2100 | + } |
|
1475 | 2101 | //@socket_close($r); |
1476 | 2102 | sleep(2); |
1477 | 2103 | $aprs_connect = 0; |
@@ -1488,11 +2114,17 @@ discard block |
||
1488 | 2114 | } else { |
1489 | 2115 | $error = socket_strerror(socket_last_error()); |
1490 | 2116 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
1491 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1492 | - if (isset($globalDebug)) echo "Restarting...\n"; |
|
2117 | + if ($globalDebug) { |
|
2118 | + echo "ERROR : socket_select give this error ".$error . "\n"; |
|
2119 | + } |
|
2120 | + if (isset($globalDebug)) { |
|
2121 | + echo "Restarting...\n"; |
|
2122 | + } |
|
1493 | 2123 | // Restart the script if possible |
1494 | 2124 | if (is_array($sockets)) { |
1495 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
2125 | + if ($globalDebug) { |
|
2126 | + echo "Shutdown all sockets..."; |
|
2127 | + } |
|
1496 | 2128 | |
1497 | 2129 | foreach ($sockets as $sock) { |
1498 | 2130 | @socket_shutdown($sock,2); |
@@ -1500,22 +2132,36 @@ discard block |
||
1500 | 2132 | } |
1501 | 2133 | |
1502 | 2134 | } |
1503 | - if ($globalDebug) echo "Waiting..."; |
|
2135 | + if ($globalDebug) { |
|
2136 | + echo "Waiting..."; |
|
2137 | + } |
|
1504 | 2138 | sleep(2); |
1505 | 2139 | $time = time(); |
1506 | 2140 | //connect_all($hosts); |
1507 | 2141 | $aprs_connect = 0; |
1508 | - if ($reset%5 == 0) sleep(20); |
|
1509 | - if ($reset%10 == 0) sleep(100); |
|
1510 | - if ($reset%20 == 0) sleep(200); |
|
1511 | - if ($reset > 100) exit('Too many attempts...'); |
|
1512 | - if ($globalDebug) echo "Restart all connections..."; |
|
2142 | + if ($reset%5 == 0) { |
|
2143 | + sleep(20); |
|
2144 | + } |
|
2145 | + if ($reset%10 == 0) { |
|
2146 | + sleep(100); |
|
2147 | + } |
|
2148 | + if ($reset%20 == 0) { |
|
2149 | + sleep(200); |
|
2150 | + } |
|
2151 | + if ($reset > 100) { |
|
2152 | + exit('Too many attempts...'); |
|
2153 | + } |
|
2154 | + if ($globalDebug) { |
|
2155 | + echo "Restart all connections..."; |
|
2156 | + } |
|
1513 | 2157 | connect_all($globalSources); |
1514 | 2158 | } |
1515 | 2159 | } |
1516 | 2160 | } |
1517 | 2161 | if ($globalDaemon === false) { |
1518 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
2162 | + if ($globalDebug) { |
|
2163 | + echo 'Check all...'."\n"; |
|
2164 | + } |
|
1519 | 2165 | $SI->checkAll(); |
1520 | 2166 | } |
1521 | 2167 | } |
@@ -55,7 +55,9 @@ discard block |
||
55 | 55 | { |
56 | 56 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
57 | 57 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
58 | - } else $image = $spotter_item['image_thumbnail']; |
|
58 | + } else { |
|
59 | + $image = $spotter_item['image_thumbnail']; |
|
60 | + } |
|
59 | 61 | |
60 | 62 | } |
61 | 63 | /* else { |
@@ -68,8 +70,12 @@ discard block |
||
68 | 70 | } |
69 | 71 | print '<div class="right">'; |
70 | 72 | print '<div class="callsign-details">'; |
71 | -if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
72 | -if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
73 | +if ($spotter_item['ident'] != 'Not Available') { |
|
74 | + print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
|
75 | +} |
|
76 | +if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') { |
|
77 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
78 | +} |
|
73 | 79 | print '</div>'; |
74 | 80 | if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') { |
75 | 81 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
@@ -101,21 +107,35 @@ discard block |
||
101 | 107 | print '</div>'; |
102 | 108 | print '<div id="aircraft">'; |
103 | 109 | print '<span>'._("Aircraft").'</span>'; |
104 | -if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
105 | -if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
106 | -elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
107 | -else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
110 | +if (isset($spotter_item['aircraft_wiki'])) { |
|
111 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
112 | +} |
|
113 | +if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
|
114 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
115 | +} elseif (isset($spotter_item['aircraft_type'])) { |
|
116 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
117 | +} else { |
|
118 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
119 | +} |
|
108 | 120 | print '</div>'; |
109 | 121 | print '<div id ="altitude"><span>'._("Altitude").'</span>'; |
110 | 122 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
111 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
112 | - else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
113 | -} else { |
|
114 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
115 | - else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
116 | -} |
|
123 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
124 | + print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
125 | + } else { |
|
126 | + print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
127 | + } |
|
128 | + } else { |
|
129 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
130 | + print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
131 | + } else { |
|
132 | + print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
133 | + } |
|
134 | + } |
|
117 | 135 | print '</div>'; |
118 | -if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
136 | +if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
137 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
138 | +} |
|
119 | 139 | print '<div id="speed"><span>'._("Speed").'</span>'; |
120 | 140 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
121 | 141 | print round($spotter_item['ground_speed']*1.15078).' mph'; |
@@ -129,8 +149,11 @@ discard block |
||
129 | 149 | print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>'; |
130 | 150 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
131 | 151 | print '<div id="pilot"><span>'._("Pilot").'</span>'; |
132 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
133 | - else print $spotter_item['pilot_name']; |
|
152 | + if (isset($spotter_item['pilot_id'])) { |
|
153 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
154 | + } else { |
|
155 | + print $spotter_item['pilot_name']; |
|
156 | + } |
|
134 | 157 | print '</div>'; |
135 | 158 | } |
136 | 159 | |
@@ -158,10 +181,18 @@ discard block |
||
158 | 181 | print '</div>'; |
159 | 182 | print '</div>'; |
160 | 183 | |
161 | -if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
162 | -if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
163 | -if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
164 | -if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
184 | +if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
185 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
186 | +} |
|
187 | +if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
188 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
189 | +} |
|
190 | +if (isset($spotter_item['acars']['message'])) { |
|
191 | + print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
192 | +} |
|
193 | +if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
194 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
195 | +} |
|
165 | 196 | print '</div>'; |
166 | 197 | ?> |
167 | 198 | </div> |
168 | 199 | \ No newline at end of file |
@@ -131,45 +131,72 @@ discard block |
||
131 | 131 | </div> |
132 | 132 | <p> |
133 | 133 | <label for="dbhost">Database hostname</label> |
134 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
134 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
135 | + print $globalDBhost; |
|
136 | +} |
|
137 | +?>" /> |
|
135 | 138 | </p> |
136 | 139 | <p> |
137 | 140 | <label for="dbport">Database port</label> |
138 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
141 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
142 | + print $globalDBport; |
|
143 | +} |
|
144 | +?>" /> |
|
139 | 145 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
140 | 146 | </p> |
141 | 147 | <p> |
142 | 148 | <label for="dbname">Database name</label> |
143 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
149 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
150 | + print $globalDBname; |
|
151 | +} |
|
152 | +?>" /> |
|
144 | 153 | </p> |
145 | 154 | <p> |
146 | 155 | <label for="dbuser">Database user</label> |
147 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
156 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
157 | + print $globalDBuser; |
|
158 | +} |
|
159 | +?>" /> |
|
148 | 160 | </p> |
149 | 161 | <p> |
150 | 162 | <label for="dbuserpass">Database user password</label> |
151 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
163 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
164 | + print $globalDBpass; |
|
165 | +} |
|
166 | +?>" /> |
|
152 | 167 | </p> |
153 | 168 | </fieldset> |
154 | 169 | <fieldset id="site"> |
155 | 170 | <legend>Site configuration</legend> |
156 | 171 | <p> |
157 | 172 | <label for="sitename">Site name</label> |
158 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
173 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
174 | + print $globalName; |
|
175 | +} |
|
176 | +?>" /> |
|
159 | 177 | </p> |
160 | 178 | <p> |
161 | 179 | <label for="siteurl">Site directory</label> |
162 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
180 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
181 | + print $globalURL; |
|
182 | +} |
|
183 | +?>" /> |
|
163 | 184 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
164 | 185 | </p> |
165 | 186 | <p> |
166 | 187 | <label for="timezone">Timezone</label> |
167 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
188 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
189 | + print $globalTimezone; |
|
190 | +} |
|
191 | +?>" /> |
|
168 | 192 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
169 | 193 | </p> |
170 | 194 | <p> |
171 | 195 | <label for="language">Language</label> |
172 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
196 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
197 | + print $globalLanguage; |
|
198 | +} |
|
199 | +?>" /> |
|
173 | 200 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
174 | 201 | </p> |
175 | 202 | </fieldset> |
@@ -190,11 +217,17 @@ discard block |
||
190 | 217 | <div id="mapbox_data"> |
191 | 218 | <p> |
192 | 219 | <label for="mapboxid">Mapbox id</label> |
193 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
220 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
221 | + print $globalMapboxId; |
|
222 | +} |
|
223 | +?>" /> |
|
194 | 224 | </p> |
195 | 225 | <p> |
196 | 226 | <label for="mapboxtoken">Mapbox token</label> |
197 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
227 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
228 | + print $globalMapboxToken; |
|
229 | +} |
|
230 | +?>" /> |
|
198 | 231 | </p> |
199 | 232 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
200 | 233 | </div> |
@@ -202,7 +235,10 @@ discard block |
||
202 | 235 | <div id="google_data"> |
203 | 236 | <p> |
204 | 237 | <label for="googlekey">Google API key</label> |
205 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
238 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
239 | + print $globalGoogleAPIKey; |
|
240 | +} |
|
241 | +?>" /> |
|
206 | 242 | <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> |
207 | 243 | </p> |
208 | 244 | </div> |
@@ -210,7 +246,10 @@ discard block |
||
210 | 246 | <div id="bing_data"> |
211 | 247 | <p> |
212 | 248 | <label for="bingkey">Bing Map key</label> |
213 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
249 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
250 | + print $globalBingMapKey; |
|
251 | +} |
|
252 | +?>" /> |
|
214 | 253 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
215 | 254 | </p> |
216 | 255 | </div> |
@@ -218,7 +257,10 @@ discard block |
||
218 | 257 | <div id="mapquest_data"> |
219 | 258 | <p> |
220 | 259 | <label for="mapquestkey">MapQuest key</label> |
221 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
260 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
261 | + print $globalMapQuestKey; |
|
262 | +} |
|
263 | +?>" /> |
|
222 | 264 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
223 | 265 | </p> |
224 | 266 | </div> |
@@ -226,11 +268,17 @@ discard block |
||
226 | 268 | <div id="here_data"> |
227 | 269 | <p> |
228 | 270 | <label for="hereappid">Here App_Id</label> |
229 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
271 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
272 | + print $globalHereappId; |
|
273 | +} |
|
274 | +?>" /> |
|
230 | 275 | </p> |
231 | 276 | <p> |
232 | 277 | <label for="hereappcode">Here App_Code</label> |
233 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
278 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
279 | + print $globalHereappCode; |
|
280 | +} |
|
281 | +?>" /> |
|
234 | 282 | </p> |
235 | 283 | <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> |
236 | 284 | </div> |
@@ -238,7 +286,10 @@ discard block |
||
238 | 286 | <div id="openweathermap_data"> |
239 | 287 | <p> |
240 | 288 | <label for="openweathermapkey">OpenWeatherMap key</label> |
241 | - <input type="text" name="oepnweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
289 | + <input type="text" name="oepnweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
290 | + print $globalOpenWeatherMapKey; |
|
291 | +} |
|
292 | +?>" /> |
|
242 | 293 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
243 | 294 | </p> |
244 | 295 | </div> |
@@ -248,42 +299,86 @@ discard block |
||
248 | 299 | <legend>Coverage area</legend> |
249 | 300 | <p> |
250 | 301 | <label for="latitudemax">The maximum latitude (north)</label> |
251 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
302 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
303 | + print $globalLatitudeMax; |
|
304 | +} |
|
305 | +?>" /> |
|
252 | 306 | </p> |
253 | 307 | <p> |
254 | 308 | <label for="latitudemin">The minimum latitude (south)</label> |
255 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
309 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
310 | + print $globalLatitudeMin; |
|
311 | +} |
|
312 | +?>" /> |
|
256 | 313 | </p> |
257 | 314 | <p> |
258 | 315 | <label for="longitudemax">The maximum longitude (west)</label> |
259 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
316 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
317 | + print $globalLongitudeMax; |
|
318 | +} |
|
319 | +?>" /> |
|
260 | 320 | </p> |
261 | 321 | <p> |
262 | 322 | <label for="longitudemin">The minimum longitude (east)</label> |
263 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
323 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
324 | + print $globalLongitudeMin; |
|
325 | +} |
|
326 | +?>" /> |
|
264 | 327 | </p> |
265 | 328 | <p> |
266 | 329 | <label for="latitudecenter">The latitude center</label> |
267 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
330 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
331 | + print $globalCenterLatitude; |
|
332 | +} |
|
333 | +?>" /> |
|
268 | 334 | </p> |
269 | 335 | <p> |
270 | 336 | <label for="longitudecenter">The longitude center</label> |
271 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
337 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
338 | + print $globalCenterLongitude; |
|
339 | +} |
|
340 | +?>" /> |
|
272 | 341 | </p> |
273 | 342 | <p> |
274 | 343 | <label for="livezoom">Default Zoom on live map</label> |
275 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
344 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
345 | + print $globalLiveZoom; |
|
346 | +} else { |
|
347 | + print '9'; |
|
348 | +} |
|
349 | +?>" /> |
|
276 | 350 | </p> |
277 | 351 | <p> |
278 | 352 | <label for="squawk_country">Country for squawk usage</label> |
279 | 353 | <select name="squawk_country" id="squawk_country"> |
280 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
281 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
282 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
283 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
284 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
285 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
286 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
354 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
355 | + print ' selected '; |
|
356 | +} |
|
357 | +?>>UK</option> |
|
358 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
359 | + print ' selected '; |
|
360 | +} |
|
361 | +?>>NZ</option> |
|
362 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
363 | + print ' selected '; |
|
364 | +} |
|
365 | +?>>US</option> |
|
366 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
367 | + print ' selected '; |
|
368 | +} |
|
369 | +?>>AU</option> |
|
370 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
371 | + print ' selected '; |
|
372 | +} |
|
373 | +?>>NL</option> |
|
374 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
375 | + print ' selected '; |
|
376 | +} |
|
377 | +?>>FR</option> |
|
378 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
379 | + print ' selected '; |
|
380 | +} |
|
381 | +?>>TR</option> |
|
287 | 382 | </select> |
288 | 383 | </p> |
289 | 384 | </fieldset> |
@@ -292,15 +387,24 @@ discard block |
||
292 | 387 | <p><i>Only put in DB flights that are inside a circle</i></p> |
293 | 388 | <p> |
294 | 389 | <label for="latitude">Center latitude</label> |
295 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
390 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
391 | + echo $globalDistanceIgnore['latitude']; |
|
392 | +} |
|
393 | +?>" /> |
|
296 | 394 | </p> |
297 | 395 | <p> |
298 | 396 | <label for="longitude">Center longitude</label> |
299 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
397 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
398 | + echo $globalDistanceIgnore['longitude']; |
|
399 | +} |
|
400 | +?>" /> |
|
300 | 401 | </p> |
301 | 402 | <p> |
302 | 403 | <label for="Distance">Distance (in km)</label> |
303 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
404 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
405 | + echo $globalDistanceIgnore['distance']; |
|
406 | +} |
|
407 | +?>" /> |
|
304 | 408 | </p> |
305 | 409 | </fieldset> |
306 | 410 | <fieldset id="sourceloc"> |
@@ -409,11 +513,17 @@ discard block |
||
409 | 513 | <div id="flightaware_data"> |
410 | 514 | <p> |
411 | 515 | <label for="flightawareusername">FlightAware username</label> |
412 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
516 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
517 | + print $globalFlightAwareUsername; |
|
518 | +} |
|
519 | +?>" /> |
|
413 | 520 | </p> |
414 | 521 | <p> |
415 | 522 | <label for="flightawarepassword">FlightAware password/API key</label> |
416 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
523 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
524 | + print $globalFlightAwarePassword; |
|
525 | +} |
|
526 | +?>" /> |
|
417 | 527 | </p> |
418 | 528 | </div> |
419 | 529 | --> |
@@ -473,29 +583,92 @@ discard block |
||
473 | 583 | ?> |
474 | 584 | <td> |
475 | 585 | <select name="format[]" id="format"> |
476 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
477 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
478 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
479 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
480 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
481 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
482 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
483 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
484 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
485 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
486 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
487 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
488 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
489 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
490 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
491 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
492 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
493 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
586 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
587 | + print 'selected'; |
|
588 | +} |
|
589 | +?>>Auto</option> |
|
590 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
591 | + print 'selected'; |
|
592 | +} |
|
593 | +?>>SBS</option> |
|
594 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
595 | + print 'selected'; |
|
596 | +} |
|
597 | +?>>TSV</option> |
|
598 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
599 | + print 'selected'; |
|
600 | +} |
|
601 | +?>>Raw</option> |
|
602 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
603 | + print 'selected'; |
|
604 | +} |
|
605 | +?>>APRS</option> |
|
606 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
607 | + print 'selected'; |
|
608 | +} |
|
609 | +?>>Radarcape deltadb.txt</option> |
|
610 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
611 | + print 'selected'; |
|
612 | +} |
|
613 | +?>>Vatsim</option> |
|
614 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
615 | + print 'selected'; |
|
616 | +} |
|
617 | +?>>Virtual Radar Server AircraftList.json</option> |
|
618 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
619 | + print 'selected'; |
|
620 | +} |
|
621 | +?>>Virtual Radar Server TCP</option> |
|
622 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
623 | + print 'selected'; |
|
624 | +} |
|
625 | +?>>phpVMS</option> |
|
626 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
627 | + print 'selected'; |
|
628 | +} |
|
629 | +?>>Virtual Airlines Manager</option> |
|
630 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
631 | + print 'selected'; |
|
632 | +} |
|
633 | +?>>IVAO</option> |
|
634 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
635 | + print 'selected'; |
|
636 | +} |
|
637 | +?>>FlightGear Multiplayer</option> |
|
638 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
639 | + print 'selected'; |
|
640 | +} |
|
641 | +?>>FlightGear Singleplayer</option> |
|
642 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
643 | + print 'selected'; |
|
644 | +} |
|
645 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
646 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
647 | + print 'selected'; |
|
648 | +} |
|
649 | +?>>ACARS SBS-3 over TCP</option> |
|
650 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
651 | + print 'selected'; |
|
652 | +} |
|
653 | +?>>NMEA AIS over TCP</option> |
|
654 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
655 | + print 'selected'; |
|
656 | +} |
|
657 | +?>>AirWhere website</option> |
|
494 | 658 | </select> |
495 | 659 | </td> |
496 | - <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /></td> |
|
497 | - <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> |
|
498 | - <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> |
|
660 | + <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
661 | + print $source['name']; |
|
662 | +} |
|
663 | +?>" /></td> |
|
664 | + <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']) { |
|
665 | + print 'checked'; |
|
666 | +} |
|
667 | +?> /></td> |
|
668 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
669 | + print 'checked'; |
|
670 | +} |
|
671 | +?> /></td> |
|
499 | 672 | <td><input type="button" id="delhost" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhost" value="Add" onclick="insRow()" /></td> |
500 | 673 | </tr> |
501 | 674 | <?php |
@@ -545,11 +718,17 @@ discard block |
||
545 | 718 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
546 | 719 | <p> |
547 | 720 | <label for="acarshost">ACARS UDP host</label> |
548 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
721 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
722 | + print $globalACARSHost; |
|
723 | +} |
|
724 | +?>" /> |
|
549 | 725 | </p> |
550 | 726 | <p> |
551 | 727 | <label for="acarsport">ACARS UDP port</label> |
552 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
728 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
729 | + print $globalACARSPort; |
|
730 | +} |
|
731 | +?>" /> |
|
553 | 732 | </p> |
554 | 733 | </fieldset> |
555 | 734 | </div> |
@@ -629,13 +808,19 @@ discard block |
||
629 | 808 | <div id="schedules_options"> |
630 | 809 | <p> |
631 | 810 | <label for="britishairways">British Airways API Key</label> |
632 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
811 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
812 | + print $globalBritishAirwaysKey; |
|
813 | +} |
|
814 | +?>" /> |
|
633 | 815 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
634 | 816 | </p> |
635 | 817 | <!-- |
636 | 818 | <p> |
637 | 819 | <label for="transavia">Transavia Test API Consumer Key</label> |
638 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
820 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
821 | + print $globalTransaviaKey; |
|
822 | +} |
|
823 | +?>" /> |
|
639 | 824 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
640 | 825 | </p> |
641 | 826 | --> |
@@ -644,10 +829,16 @@ discard block |
||
644 | 829 | <b>Lufthansa API Key</b> |
645 | 830 | <p> |
646 | 831 | <label for="lufthansakey">Key</label> |
647 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
832 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
833 | + print $globalLufthansaKey['key']; |
|
834 | +} |
|
835 | +?>" /> |
|
648 | 836 | </p><p> |
649 | 837 | <label for="lufthansasecret">Secret</label> |
650 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
838 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
839 | + print $globalLufthansaKey['secret']; |
|
840 | +} |
|
841 | +?>" /> |
|
651 | 842 | </p> |
652 | 843 | </div> |
653 | 844 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -667,7 +858,10 @@ discard block |
||
667 | 858 | </p> |
668 | 859 | <p> |
669 | 860 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
670 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
861 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
862 | + print $globalNOTAMSource; |
|
863 | +} |
|
864 | +?>" /> |
|
671 | 865 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
672 | 866 | </p> |
673 | 867 | <br /> |
@@ -683,14 +877,20 @@ discard block |
||
683 | 877 | <div id="metarsrc"> |
684 | 878 | <p> |
685 | 879 | <label for="metarsource">URL of your METAR source</label> |
686 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
880 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
881 | + print $globalMETARurl; |
|
882 | +} |
|
883 | +?>" /> |
|
687 | 884 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
688 | 885 | </p> |
689 | 886 | </div> |
690 | 887 | <br /> |
691 | 888 | <p> |
692 | 889 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
693 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
890 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
891 | + print $globalBitlyAccessToken; |
|
892 | +} |
|
893 | +?>" /> |
|
694 | 894 | </p> |
695 | 895 | <br /> |
696 | 896 | <p> |
@@ -710,7 +910,12 @@ discard block |
||
710 | 910 | </p> |
711 | 911 | <p> |
712 | 912 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
713 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" /> |
|
913 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
914 | + print $globalArchiveMonths; |
|
915 | +} else { |
|
916 | + echo '0'; |
|
917 | +} |
|
918 | +?>" /> |
|
714 | 919 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
715 | 920 | </p> |
716 | 921 | <p> |
@@ -720,12 +925,22 @@ discard block |
||
720 | 925 | </p> |
721 | 926 | <p> |
722 | 927 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
723 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" /> |
|
928 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
929 | + print $globalArchiveKeepMonths; |
|
930 | +} else { |
|
931 | + echo '0'; |
|
932 | +} |
|
933 | +?>" /> |
|
724 | 934 | <p class="help-block">0 to disable</p> |
725 | 935 | </p> |
726 | 936 | <p> |
727 | 937 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
728 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" /> |
|
938 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
939 | + print $globalArchiveKeepTrackMonths; |
|
940 | +} else { |
|
941 | + echo '0'; |
|
942 | +} |
|
943 | +?>" /> |
|
729 | 944 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
730 | 945 | </p> |
731 | 946 | <br /> |
@@ -735,7 +950,12 @@ discard block |
||
735 | 950 | <p class="help-block">Uncheck if the script is running as cron job</p> |
736 | 951 | <div id="cronends"> |
737 | 952 | <label for="cronend">Run script for xx seconds</label> |
738 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
953 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
954 | + print $globalCronEnd; |
|
955 | +} else { |
|
956 | + print '0'; |
|
957 | +} |
|
958 | +?>" /> |
|
739 | 959 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
740 | 960 | </div> |
741 | 961 | </p> |
@@ -788,15 +1008,30 @@ discard block |
||
788 | 1008 | <br /> |
789 | 1009 | <p> |
790 | 1010 | <label for="refresh">Show flights detected since xxx seconds</label> |
791 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
1011 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
1012 | + echo $globalLiveInterval; |
|
1013 | +} else { |
|
1014 | + echo '200'; |
|
1015 | +} |
|
1016 | +?>" /> |
|
792 | 1017 | </p> |
793 | 1018 | <p> |
794 | 1019 | <label for="maprefresh">Live map refresh (in seconds)</label> |
795 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
1020 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
1021 | + echo $globalMapRefresh; |
|
1022 | +} else { |
|
1023 | + echo '30'; |
|
1024 | +} |
|
1025 | +?>" /> |
|
796 | 1026 | </p> |
797 | 1027 | <p> |
798 | 1028 | <label for="mapidle">Map idle timeout (in minutes)</label> |
799 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
1029 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
1030 | + echo $globalMapIdleTimeout; |
|
1031 | +} else { |
|
1032 | + echo '30'; |
|
1033 | +} |
|
1034 | +?>" /> |
|
800 | 1035 | <p class="help-block">0 to disable</p> |
801 | 1036 | </p> |
802 | 1037 | <p> |
@@ -806,12 +1041,20 @@ discard block |
||
806 | 1041 | <br /> |
807 | 1042 | <p> |
808 | 1043 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
809 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
1044 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
1045 | + echo $globalClosestMinDist; |
|
1046 | +} else { |
|
1047 | + echo '50'; |
|
1048 | +} |
|
1049 | +?>" /> |
|
810 | 1050 | </p> |
811 | 1051 | <br /> |
812 | 1052 | <p> |
813 | 1053 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
814 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1054 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
1055 | + echo $globalAircraftSize; |
|
1056 | +} |
|
1057 | +?>" /> |
|
815 | 1058 | </p> |
816 | 1059 | <br /> |
817 | 1060 | <p> |
@@ -824,7 +1067,12 @@ discard block |
||
824 | 1067 | if (extension_loaded('gd') && function_exists('gd_info')) { |
825 | 1068 | ?> |
826 | 1069 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
827 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
1070 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
1071 | + echo $globalAircraftIconColor; |
|
1072 | +} else { |
|
1073 | + echo '1a3151'; |
|
1074 | +} |
|
1075 | +?>" /> |
|
828 | 1076 | <?php |
829 | 1077 | if (!is_writable('../cache')) { |
830 | 1078 | ?> |
@@ -842,14 +1090,27 @@ discard block |
||
842 | 1090 | <p> |
843 | 1091 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
844 | 1092 | <div class="range"> |
845 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
846 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
1093 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
1094 | + echo $globalAirportZoom; |
|
1095 | +} else { |
|
1096 | + echo '7'; |
|
1097 | +} |
|
1098 | +?>" /> |
|
1099 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
1100 | + echo $globalAirportZoom; |
|
1101 | +} else { |
|
1102 | + echo '7'; |
|
1103 | +} |
|
1104 | +?></output> |
|
847 | 1105 | </div> |
848 | 1106 | </p> |
849 | 1107 | <br /> |
850 | 1108 | <p> |
851 | 1109 | <label for="customcss">Custom CSS web path</label> |
852 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
1110 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
1111 | + echo $globalCustomCSS; |
|
1112 | +} |
|
1113 | +?>" /> |
|
853 | 1114 | </p> |
854 | 1115 | </fieldset> |
855 | 1116 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -876,8 +1137,12 @@ discard block |
||
876 | 1137 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
877 | 1138 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
878 | 1139 | |
879 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
880 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1140 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
1141 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
1142 | + } |
|
1143 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
1144 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1145 | + } |
|
881 | 1146 | |
882 | 1147 | $_SESSION['database_root'] = $dbroot; |
883 | 1148 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -945,15 +1210,23 @@ discard block |
||
945 | 1210 | $source_city = $_POST['source_city']; |
946 | 1211 | $source_country = $_POST['source_country']; |
947 | 1212 | $source_ref = $_POST['source_ref']; |
948 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
949 | - else $source_id = array(); |
|
1213 | + if (isset($source_id)) { |
|
1214 | + $source_id = $_POST['source_id']; |
|
1215 | + } else { |
|
1216 | + $source_id = array(); |
|
1217 | + } |
|
950 | 1218 | |
951 | 1219 | $sources = array(); |
952 | 1220 | foreach ($source_name as $keys => $name) { |
953 | - 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]); |
|
954 | - 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]); |
|
1221 | + if (isset($source_id[$keys])) { |
|
1222 | + $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]); |
|
1223 | + } else { |
|
1224 | + $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]); |
|
1225 | + } |
|
1226 | + } |
|
1227 | + if (count($sources) > 0) { |
|
1228 | + $_SESSION['sources'] = $sources; |
|
955 | 1229 | } |
956 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
957 | 1230 | |
958 | 1231 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
959 | 1232 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -974,14 +1247,23 @@ discard block |
||
974 | 1247 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
975 | 1248 | |
976 | 1249 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
977 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
978 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1250 | + if ($globalaircraft == 'aircraft') { |
|
1251 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1252 | + } else { |
|
1253 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1254 | + } |
|
979 | 1255 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
980 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
981 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1256 | + if ($globaltracker == 'tracker') { |
|
1257 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1258 | + } else { |
|
1259 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1260 | + } |
|
982 | 1261 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
983 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
984 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1262 | + if ($globalmarine == 'marine') { |
|
1263 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1264 | + } else { |
|
1265 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1266 | + } |
|
985 | 1267 | |
986 | 1268 | /* |
987 | 1269 | $globalSBS1Hosts = array(); |
@@ -1002,19 +1284,35 @@ discard block |
||
1002 | 1284 | $port = $_POST['port']; |
1003 | 1285 | $name = $_POST['name']; |
1004 | 1286 | $format = $_POST['format']; |
1005 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
1006 | - else $sourcestats = array(); |
|
1007 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
1008 | - else $noarchive = array(); |
|
1287 | + if (isset($_POST['sourcestats'])) { |
|
1288 | + $sourcestats = $_POST['sourcestats']; |
|
1289 | + } else { |
|
1290 | + $sourcestats = array(); |
|
1291 | + } |
|
1292 | + if (isset($_POST['noarchive'])) { |
|
1293 | + $noarchive = $_POST['noarchive']; |
|
1294 | + } else { |
|
1295 | + $noarchive = array(); |
|
1296 | + } |
|
1009 | 1297 | $gSources = array(); |
1010 | 1298 | $forcepilots = false; |
1011 | 1299 | foreach ($host as $key => $h) { |
1012 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
1013 | - else $cov = 'FALSE'; |
|
1014 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
1015 | - else $arch = 'FALSE'; |
|
1016 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch); |
|
1017 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
1300 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
1301 | + $cov = 'TRUE'; |
|
1302 | + } else { |
|
1303 | + $cov = 'FALSE'; |
|
1304 | + } |
|
1305 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
1306 | + $arch = 'TRUE'; |
|
1307 | + } else { |
|
1308 | + $arch = 'FALSE'; |
|
1309 | + } |
|
1310 | + if ($h != '') { |
|
1311 | + $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch); |
|
1312 | + } |
|
1313 | + if ($format[$key] == 'airwhere') { |
|
1314 | + $forcepilots = true; |
|
1315 | + } |
|
1018 | 1316 | } |
1019 | 1317 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
1020 | 1318 | |
@@ -1042,7 +1340,9 @@ discard block |
||
1042 | 1340 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
1043 | 1341 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1044 | 1342 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
1045 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1343 | + } else { |
|
1344 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1345 | + } |
|
1046 | 1346 | |
1047 | 1347 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
1048 | 1348 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1081,7 +1381,9 @@ discard block |
||
1081 | 1381 | |
1082 | 1382 | // Create in settings.php keys not yet configurable if not already here |
1083 | 1383 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1084 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1384 | + if (!isset($globalDebug)) { |
|
1385 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1386 | + } |
|
1085 | 1387 | |
1086 | 1388 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
1087 | 1389 | if ($resetyearstats == 'resetyearstats') { |
@@ -1118,37 +1420,56 @@ discard block |
||
1118 | 1420 | } |
1119 | 1421 | */ |
1120 | 1422 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
1121 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1122 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1123 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1124 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1423 | + if ($globalsbs == 'sbs') { |
|
1424 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1425 | + } else { |
|
1426 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1427 | + } |
|
1428 | + if ($globalaprs == 'aprs') { |
|
1429 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1430 | + } else { |
|
1431 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1432 | + } |
|
1125 | 1433 | $va = false; |
1126 | 1434 | if ($globalivao == 'ivao') { |
1127 | 1435 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
1128 | 1436 | $va = true; |
1129 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1437 | + } else { |
|
1438 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1439 | + } |
|
1130 | 1440 | if ($globalvatsim == 'vatsim') { |
1131 | 1441 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
1132 | 1442 | $va = true; |
1133 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1443 | + } else { |
|
1444 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1445 | + } |
|
1134 | 1446 | if ($globalphpvms == 'phpvms') { |
1135 | 1447 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
1136 | 1448 | $va = true; |
1137 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1449 | + } else { |
|
1450 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1451 | + } |
|
1138 | 1452 | if ($globalvam == 'vam') { |
1139 | 1453 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
1140 | 1454 | $va = true; |
1141 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1455 | + } else { |
|
1456 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1457 | + } |
|
1142 | 1458 | if ($va) { |
1143 | 1459 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
1144 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1460 | + } else { |
|
1461 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1462 | + } |
|
1145 | 1463 | if ($globalva == 'va' || $va) { |
1146 | 1464 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
1147 | 1465 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
1148 | 1466 | } else { |
1149 | 1467 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
1150 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1151 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1468 | + if ($forcepilots) { |
|
1469 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1470 | + } else { |
|
1471 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1472 | + } |
|
1152 | 1473 | } |
1153 | 1474 | |
1154 | 1475 | |
@@ -1309,7 +1630,9 @@ discard block |
||
1309 | 1630 | $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
1310 | 1631 | } |
1311 | 1632 | |
1312 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1633 | + if (!isset($globalTransaction)) { |
|
1634 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1635 | + } |
|
1313 | 1636 | |
1314 | 1637 | // Set some defaults values... |
1315 | 1638 | if (!isset($globalAircraftImageSources)) { |
@@ -1324,15 +1647,23 @@ discard block |
||
1324 | 1647 | |
1325 | 1648 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1326 | 1649 | |
1327 | - if ($error == '') settings::modify_settings($settings); |
|
1328 | - if ($error == '') settings::comment_settings($settings_comment); |
|
1650 | + if ($error == '') { |
|
1651 | + settings::modify_settings($settings); |
|
1652 | + } |
|
1653 | + if ($error == '') { |
|
1654 | + settings::comment_settings($settings_comment); |
|
1655 | + } |
|
1329 | 1656 | if ($error != '') { |
1330 | 1657 | print '<div class="info column">'.$error.'</div>'; |
1331 | 1658 | require('../footer.php'); |
1332 | 1659 | exit; |
1333 | 1660 | } else { |
1334 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
1335 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
1661 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
1662 | + $_SESSION['waypoints'] = 1; |
|
1663 | + } |
|
1664 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
1665 | + $_SESSION['owner'] = 1; |
|
1666 | + } |
|
1336 | 1667 | if (isset($_POST['createdb'])) { |
1337 | 1668 | $_SESSION['install'] = 'database_create'; |
1338 | 1669 | } else { |
@@ -1373,10 +1704,18 @@ discard block |
||
1373 | 1704 | $popw = false; |
1374 | 1705 | foreach ($_SESSION['done'] as $done) { |
1375 | 1706 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
1376 | - if ($done == 'Create database') $pop = true; |
|
1377 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1378 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1379 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1707 | + if ($done == 'Create database') { |
|
1708 | + $pop = true; |
|
1709 | + } |
|
1710 | + if ($_SESSION['install'] == 'database_create') { |
|
1711 | + $pop = true; |
|
1712 | + } |
|
1713 | + if ($_SESSION['install'] == 'database_import') { |
|
1714 | + $popi = true; |
|
1715 | + } |
|
1716 | + if ($_SESSION['install'] == 'waypoints') { |
|
1717 | + $popw = true; |
|
1718 | + } |
|
1380 | 1719 | } |
1381 | 1720 | if ($pop) { |
1382 | 1721 | sleep(5); |
@@ -1387,7 +1726,9 @@ discard block |
||
1387 | 1726 | } else if ($popw) { |
1388 | 1727 | sleep(5); |
1389 | 1728 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
1390 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
1729 | + } else { |
|
1730 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
1731 | + } |
|
1391 | 1732 | print '</div></ul>'; |
1392 | 1733 | print '<div id="error"></div>'; |
1393 | 1734 | /* foreach ($_SESSION['done'] as $done) { |
@@ -4,10 +4,15 @@ discard block |
||
4 | 4 | |
5 | 5 | setcookie("MapFormat",'2d'); |
6 | 6 | |
7 | -if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = ''; |
|
7 | +if (!isset($globalOpenWeatherMapKey)) { |
|
8 | + $globalOpenWeatherMapKey = ''; |
|
9 | +} |
|
8 | 10 | // Compressed GeoJson is used if true |
9 | -if (!isset($globalJsonCompress)) $compress = true; |
|
10 | -else $compress = $globalJsonCompress; |
|
11 | +if (!isset($globalJsonCompress)) { |
|
12 | + $compress = true; |
|
13 | +} else { |
|
14 | + $compress = $globalJsonCompress; |
|
15 | +} |
|
11 | 16 | if (isset($_GET['archive'])) { |
12 | 17 | $archive = true; |
13 | 18 | //$archiveupdatetime = 50; |
@@ -18,8 +23,11 @@ discard block |
||
18 | 23 | //$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10)); |
19 | 24 | //$lastupd = 20; |
20 | 25 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
21 | - if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
|
22 | - else $enddate = time(); |
|
26 | + if (isset($_GET['enddate']) && $_GET['enddate'] != '') { |
|
27 | + $enddate = $_GET['enddate']; |
|
28 | + } else { |
|
29 | + $enddate = time(); |
|
30 | + } |
|
23 | 31 | setcookie("archive_begin",$begindate); |
24 | 32 | setcookie("archive_end",$enddate); |
25 | 33 | setcookie("archive_update",$lastupd); |
@@ -106,7 +114,17 @@ discard block |
||
106 | 114 | } |
107 | 115 | |
108 | 116 | //create the map |
109 | - map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom); |
|
117 | + map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) { |
|
118 | + print $latitude; |
|
119 | +} else { |
|
120 | + print $globalCenterLatitude; |
|
121 | +} |
|
122 | +?>,<?php if (isset($longitude)) { |
|
123 | + print $longitude; |
|
124 | +} else { |
|
125 | + print $globalCenterLongitude; |
|
126 | +} |
|
127 | +?>], zoom); |
|
110 | 128 | <?php |
111 | 129 | } else { |
112 | 130 | ?> |
@@ -119,9 +137,19 @@ discard block |
||
119 | 137 | || navigator.userAgent.match(/BlackBerry/i) |
120 | 138 | || navigator.userAgent.match(/Windows Phone/i)) |
121 | 139 | { |
122 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>; |
|
140 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
141 | + print $globalLiveZoom-1; |
|
142 | +} else { |
|
143 | + print '8'; |
|
144 | +} |
|
145 | +?>; |
|
123 | 146 | } else { |
124 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>; |
|
147 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
148 | + print $globalLiveZoom; |
|
149 | +} else { |
|
150 | + print '9'; |
|
151 | +} |
|
152 | +?>; |
|
125 | 153 | } |
126 | 154 | |
127 | 155 | //create the map |
@@ -146,16 +174,27 @@ discard block |
||
146 | 174 | bounds = L.latLngBounds(southWest,northEast); |
147 | 175 | //a few title layers |
148 | 176 | <?php |
149 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
150 | - else $MapType = $globalMapProvider; |
|
177 | + if (isset($_COOKIE['MapType'])) { |
|
178 | + $MapType = $_COOKIE['MapType']; |
|
179 | + } else { |
|
180 | + $MapType = $globalMapProvider; |
|
181 | + } |
|
151 | 182 | |
152 | 183 | if ($MapType == 'Mapbox') { |
153 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
154 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
155 | -?> |
|
184 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
185 | + $MapBoxId = $globalMapboxId; |
|
186 | + } else { |
|
187 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
188 | + } |
|
189 | + ?> |
|
156 | 190 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
157 | 191 | maxZoom: 18, |
158 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
192 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
193 | + print 'false'; |
|
194 | +} else { |
|
195 | + print 'true'; |
|
196 | +} |
|
197 | +?>, |
|
159 | 198 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
160 | 199 | '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + |
161 | 200 | 'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
@@ -167,7 +206,12 @@ discard block |
||
167 | 206 | ?> |
168 | 207 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
169 | 208 | maxZoom: 18, |
170 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
209 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
210 | + print 'false'; |
|
211 | +} else { |
|
212 | + print 'true'; |
|
213 | +} |
|
214 | +?>, |
|
171 | 215 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
172 | 216 | '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>' |
173 | 217 | }).addTo(map); |
@@ -213,20 +257,26 @@ discard block |
||
213 | 257 | map.addLayer(yandexLayer); |
214 | 258 | <?php |
215 | 259 | } elseif ($MapType == 'Bing-Aerial') { |
216 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
217 | -?> |
|
260 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
261 | + setcookie('MapType','OpenStreetMap'); |
|
262 | + } |
|
263 | + ?> |
|
218 | 264 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
219 | 265 | map.addLayer(bingLayer); |
220 | 266 | <?php |
221 | 267 | } elseif ($MapType == 'Bing-Hybrid') { |
222 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
223 | -?> |
|
268 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
269 | + setcookie('MapType','OpenStreetMap'); |
|
270 | + } |
|
271 | + ?> |
|
224 | 272 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
225 | 273 | map.addLayer(bingLayer); |
226 | 274 | <?php |
227 | 275 | } elseif ($MapType == 'Bing-Road') { |
228 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
229 | -?> |
|
276 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
277 | + setcookie('MapType','OpenStreetMap'); |
|
278 | + } |
|
279 | + ?> |
|
230 | 280 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
231 | 281 | map.addLayer(bingLayer); |
232 | 282 | <?php |
@@ -249,9 +299,24 @@ discard block |
||
249 | 299 | $customid = $MapType; |
250 | 300 | ?> |
251 | 301 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
252 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
253 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
254 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
302 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
303 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
304 | +} else { |
|
305 | + print '18'; |
|
306 | +} |
|
307 | +?>, |
|
308 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
309 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
310 | +} else { |
|
311 | + print '0'; |
|
312 | +} |
|
313 | +?>, |
|
314 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
315 | + print 'false'; |
|
316 | +} else { |
|
317 | + print 'true'; |
|
318 | +} |
|
319 | +?>, |
|
255 | 320 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
256 | 321 | }).addTo(map); |
257 | 322 | |
@@ -285,7 +350,12 @@ discard block |
||
285 | 350 | } |
286 | 351 | } elseif ($globalBounding == 'circle') { |
287 | 352 | ?> |
288 | - var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{ |
|
353 | + var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) { |
|
354 | + print $globalBoundingCircleSize; |
|
355 | +} else { |
|
356 | + print '70000'; |
|
357 | +} |
|
358 | +?>,{ |
|
289 | 359 | color: '#92C7D1', |
290 | 360 | fillColor: '#92C7D1', |
291 | 361 | fillOpacity: 0.3, |
@@ -9,7 +9,9 @@ discard block |
||
9 | 9 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
10 | 10 | exec("ps ux", $output, $result); |
11 | 11 | $j = 0; |
12 | - foreach ($output as $line) if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++; |
|
12 | + foreach ($output as $line) { |
|
13 | + if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++; |
|
14 | + } |
|
13 | 15 | if ($j > 1) { |
14 | 16 | echo "Script is already runnning..."; |
15 | 17 | die(); |
@@ -29,14 +31,18 @@ discard block |
||
29 | 31 | $update_db->update_notam(); |
30 | 32 | } |
31 | 33 | $update_db->insert_last_notam_update(); |
32 | - } elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n"; |
|
34 | + } elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) { |
|
35 | + echo "NOTAM are only updated once a day.\n"; |
|
36 | + } |
|
33 | 37 | if ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
34 | 38 | $update_db->update_all(); |
35 | 39 | // require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
36 | 40 | // $Spotter = new Spotter(); |
37 | 41 | // $Spotter->updateFieldsFromOtherTables(); |
38 | 42 | $update_db->insert_last_update(); |
39 | - } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n"; |
|
43 | + } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) { |
|
44 | + echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n"; |
|
45 | + } |
|
40 | 46 | if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) { |
41 | 47 | echo "Check if new airspace version exist..."; |
42 | 48 | echo $update_db->update_airspace_fam(); |
@@ -56,7 +62,9 @@ discard block |
||
56 | 62 | $update_db->delete_duplicateowner(); |
57 | 63 | } |
58 | 64 | $update_db->insert_last_owner_update(); |
59 | - } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n"; |
|
65 | + } elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
|
66 | + echo "Owner are only updated every 15 days.\n"; |
|
67 | + } |
|
60 | 68 | |
61 | 69 | if (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
62 | 70 | require_once(dirname(__FILE__).'/../require/class.Accident.php'); |
@@ -65,7 +73,9 @@ discard block |
||
65 | 73 | if ($Accident->check_last_accidents_update()) { |
66 | 74 | $Accident->download_update(); |
67 | 75 | $Accident->insert_last_accidents_update(); |
68 | - } else echo "Accidents are updated once a day.\n"; |
|
76 | + } else { |
|
77 | + echo "Accidents are updated once a day.\n"; |
|
78 | + } |
|
69 | 79 | } |
70 | 80 | |
71 | 81 | } |
@@ -78,15 +88,19 @@ discard block |
||
78 | 88 | if ($METAR->check_last_update()) { |
79 | 89 | $METAR->addMETARCycle(); |
80 | 90 | $METAR->insert_last_update(); |
81 | - } else echo "METAR are only updated every 30 minutes.\n"; |
|
82 | -} |
|
91 | + } else { |
|
92 | + echo "METAR are only updated every 30 minutes.\n"; |
|
93 | + } |
|
94 | + } |
|
83 | 95 | |
84 | 96 | if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
85 | 97 | echo "Updating schedules..."; |
86 | 98 | //$update_db->update_oneworld(); |
87 | 99 | $update_db->update_skyteam(); |
88 | 100 | $update_db->insert_last_schedules_update(); |
89 | -} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n"; |
|
101 | +} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) { |
|
102 | + echo "Schedules are only updated every 15 days.\n"; |
|
103 | +} |
|
90 | 104 | |
91 | 105 | if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) { |
92 | 106 | echo "Updating statistics and archive old data..."; |