Check VUCC_GRIDs and gridsquare for structual integrity at import

这个提交包含在:
int2001 2023-12-30 06:15:20 +00:00
父节点 7abfbf671f
当前提交 c49b8e2163
找不到此签名对应的密钥
GPG 密钥 ID: DFB1C13CD2DB037B

查看文件

@ -3275,6 +3275,32 @@ function lotw_last_qsl_date($user_id) {
$cq_zone = NULL;
}
// Sanitise gridsquare input to make sure its a gridsquare
if (isset($record['gridsquare'])){
$a_grids=explode(',',$record['gridsquare']); // Split at , if there are junctions
foreach ($a_grids as $singlegrid) {
if (strlen($singlegrid)%2 != 0) { // Check if grid is structually valid
$record['gridsquare']=''; // If not: Set to ''
}
}
$input_gridsquare = $record['gridsquare'];
}else{
$input_gridsquare = NULL;
}
// Sanitise vucc-gridsquare input to make sure its a gridsquare
if (isset($record['vucc_grids'])){
$a_grids=explode(',',$record['vucc_grids']); // Split at , if there are junctions
foreach ($a_grids as $singlegrid) {
if (strlen($singlegrid)%2 != 0) { // Check if grid is structually valid
$record['vucc_grids']=''; // If not: Set to ''
}
}
$input_vucc_grids = $record['vucc_grids'];
}else{
$input_vucc_grids = NULL;
}
// Sanitise lat input to make sure its 11 chars
if (isset($record['lat'])){
$input_lat = mb_strimwidth($record['lat'], 0, 11);
@ -3540,7 +3566,7 @@ function lotw_last_qsl_date($user_id) {
'COL_FORCE_INIT' => (!empty($record['force_init'])) ? $record['force_init'] : null,
'COL_FREQ' => $freq,
'COL_FREQ_RX' => (!empty($record['freq_rx'])) ? $freqRX : null,
'COL_GRIDSQUARE' => (!empty($record['gridsquare'])) ? $record['gridsquare'] : '',
'COL_GRIDSQUARE' => $input_gridsquare,
'COL_HEADING' => (!empty($record['heading'])) ? $record['heading'] : null,
'COL_HRDLOG_QSO_UPLOAD_DATE' => (!empty($record['hrdlog_qso_upload_date'])) ? $record['hrdlog_qso_upload_date'] : null,
'COL_HRDLOG_QSO_UPLOAD_STATUS' => (!empty($record['hrdlog_qso_upload_status'])) ? $record['hrdlog_qso_upload_status'] : '',
@ -3654,7 +3680,7 @@ function lotw_last_qsl_date($user_id) {
'COL_TX_PWR' => (!empty($tx_pwr)) ? $tx_pwr : null,
'COL_UKSMG' => (!empty($record['uksmg'])) ? $record['uksmg'] : '',
'COL_USACA_COUNTIES' => (!empty($record['usaca_counties'])) ? $record['usaca_counties'] : '',
'COL_VUCC_GRIDS' =>((!empty($record['vucc_grids']))) ? $record['vucc_grids'] : '',
'COL_VUCC_GRIDS' => $input_vucc_grids,
'COL_WEB' => (!empty($record['web'])) ? $record['web'] : ''
);