diff --git a/require/class.ACARS.php b/require/class.ACARS.php index 4d367ea2..7fdbe369 100644 --- a/require/class.ACARS.php +++ b/require/class.ACARS.php @@ -6,6 +6,7 @@ * Licensed under AGPL license. * For more information see: https://www.flightairmap.com/ */ + require_once(dirname(__FILE__).'/class.Connection.php'); require_once(dirname(__FILE__).'/class.Spotter.php'); require_once(dirname(__FILE__).'/class.SpotterImport.php'); @@ -120,9 +121,11 @@ public function parse($data) { $message = ''; $result = array(); $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); + if ($n == 0 || $message == '') $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 || $message == '') $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 || $message == '') $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],,%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 || $message == '') $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); + if ($n == 0 || $message == '') $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 && ($registration != '' || $ident != '' || $label != '' || $block_id != '' || $msg_no != '')) { $registration = str_replace('.','',$registration); $result = array('registration' => $registration, 'ident' => $ident,'label' => $label, 'block_id' => $block_id,'msg_no' => $msg_no,'message' => $message); diff --git a/require/class.SpotterImport.php b/require/class.SpotterImport.php index c137a07d..b1850ad9 100644 --- a/require/class.SpotterImport.php +++ b/require/class.SpotterImport.php @@ -722,7 +722,7 @@ public function add($line) { //$dataFound = true; } - if (isset($line['altitude']) && $line['altitude'] != '') { + if (isset($line['altitude']) && $line['altitude'] != '' && is_numeric($line['altitude'])) { if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) { if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') { $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2);