diff --git a/require/class.ACARS.php b/require/class.ACARS.php index 3e490fab..4d367ea2 100644 --- a/require/class.ACARS.php +++ b/require/class.ACARS.php @@ -119,7 +119,7 @@ public function parse($data) { $ident = ''; $message = ''; $result = array(); - $n = sscanf($data,'(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); + $n = sscanf($data,'%*[0-9a-z.] %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); if ($n == 0) $n = sscanf($data,'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); diff --git a/scripts/daemon-spotter.php b/scripts/daemon-spotter.php index 5f22428a..cd16a57a 100755 --- a/scripts/daemon-spotter.php +++ b/scripts/daemon-spotter.php @@ -1780,6 +1780,7 @@ function connect_all($hosts) { if ($globalDebug) echo 'ACARS : '.$buffer."\n"; $line = json_decode(trim($buffer), true); if (!empty($line)) { + $line = array_merge(array('text' => '','tail' => '','label' => '','block_id' => '','flight' => '','msgno' => ''),$line); $ACARS->add(isset($line['text']) ? $line['text'] : '', array('registration' => str_replace('.', '', $line['tail']), 'ident' => $line['flight'], 'label' => $line['label'], 'block_id' => $line['block_id'], 'msg_no' => $line['msgno'], 'message' => (isset($line['text']) ? $line['text'] : ''))); $ACARS->deleteLiveAcarsData(); }