Merge pull request #1653 from phl0/skipOptionalAdifHeaders

这个提交包含在:
Peter Goodhall 2022-10-11 14:10:38 +01:00 提交者 GitHub
当前提交 80c53255d8
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23

查看文件

@ -27,12 +27,13 @@ class ADIF_Parser
public function initialize() //this function locates the <EOH> public function initialize() //this function locates the <EOH>
{ {
$pos = mb_stripos(mb_strtoupper($this->data, "UTF-8"), "<EOH>", 0, "UTF-8"); $pos = mb_stripos(mb_strtoupper($this->data, "UTF-8"), "<EOH>", 0, "UTF-8");
if($pos == false) //did we find the end of headers? if($pos == false) //did we find the end of headers?
{ {
echo "Error: Adif_Parser Already Initialized or No <EOH> in ADIF File"; // Just skip if we did not find (optional) headers
return 0; $pos = 0;
goto noheaders;
}; };
//get headers //get headers
@ -102,8 +103,12 @@ class ADIF_Parser
$this->i++; $this->i++;
}; };
$this->i = $pos+5; //iterate past the <eoh> $this->i = $pos+5; //iterate past the <eoh>
// Skip to here in case we did not find headers
noheaders:
if($this->i >= mb_strlen($this->data, "UTF-8")) //is this the end of the file? if($this->i >= mb_strlen($this->data, "UTF-8")) //is this the end of the file?
{ {
echo "Error: ADIF File Does Not Contain Any QSOs"; echo "Error: ADIF File Does Not Contain Any QSOs";
@ -208,4 +213,4 @@ class ADIF_Parser
} }
} }
?> ?>