Only calculate Lat/Lon if QRA loc has even number of chars

这个提交包含在:
phl0 2020-12-04 11:30:40 +01:00
父节点 c1b0d49ae7
当前提交 f77d60436d
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A

查看文件

@ -119,20 +119,24 @@ $var_dist = "";
function qra2latlong($strQRA) function qra2latlong($strQRA)
{ {
$strQRA = strtoupper($strQRA); if (strlen($strQRA) %2 == 0) {
if (strlen($strQRA) == 4) $strQRA .= "MM"; $strQRA = strtoupper($strQRA);
if (!preg_match('/^[A-Z]{2}[0-9]{2}[A-Z]{2}$/',$strQRA)) return false; if (strlen($strQRA) == 4) $strQRA .= "MM";
list($a,$b,$c,$d,$e,$f) = str_split($strQRA,1); if (!preg_match('/^[A-Z]{2}[0-9]{2}[A-Z]{2}$/',$strQRA)) return false;
$a = ord($a) - ord('A'); list($a,$b,$c,$d,$e,$f) = str_split($strQRA,1);
$b = ord($b) - ord('A'); $a = ord($a) - ord('A');
$c = ord($c) - ord('0'); $b = ord($b) - ord('A');
$d = ord($d) - ord('0'); $c = ord($c) - ord('0');
$e = ord($e) - ord('A'); $d = ord($d) - ord('0');
$f = ord($f) - ord('A'); $e = ord($e) - ord('A');
$nLong = ($a*20) + ($c*2) + (($e+0.5)/12) - 180; $f = ord($f) - ord('A');
$nLat = ($b*10) + $d + (($f+0.5)/24) - 90; $nLong = ($a*20) + ($c*2) + (($e+0.5)/12) - 180;
$arLatLong = array($nLat,$nLong); $nLat = ($b*10) + $d + (($f+0.5)/24) - 90;
return($arLatLong); $arLatLong = array($nLat,$nLong);
return($arLatLong);
} else {
return array(0, 0);
}
} }
/* End of file Qra.php */ /* End of file Qra.php */