Merge pull request #133 from int2001/Fix_space_in_adif

Fix space in adif
This commit is contained in:
Joerg (DJ7NT)
2024-02-14 10:00:40 +01:00
committed by GitHub
4 changed files with 10 additions and 7 deletions

View File

@@ -193,7 +193,7 @@ class adif extends CI_Controller {
$f_elements=explode(".",$fdata['upload_data']['file_name']);
if (strtolower($f_elements[count($f_elements)-1])=='zip') {
$f_adif = preg_replace('/\\.zip$/', '', $fdata['upload_data']['file_name']);
$p_adif = preg_replace('/^(.*)(_)(\S{2,4})$/', '$1.$3', $f_adif); // Bug in CodeIgniter. Destroys Filename if there is more than one dot.
$p_adif = hash('sha256', $this->session->userdata('user_callsign') ).'.adif';
if (preg_match("/.*\.adi.?$/",strtolower($p_adif))) { // Check if adi? inside zip
$zip = new ZipArchive;
if ($zip->open('./uploads/'.$fdata['upload_data']['file_name'])) {

View File

@@ -3215,13 +3215,15 @@ function lotw_last_qsl_date($user_id) {
$a_qsos=[];
foreach ($records as $record) {
$one_error = $this->logbook_model->import($record, $station_id, $skipDuplicate, $markClublog, $markLotw,$dxccAdif, $markQrz, $markHrd, $skipexport, $operatorName, $apicall, $skipStationCheck, true);
if ($one_error['error'] != '') {
if ($one_error['error'] ?? '' != '') {
$custom_errors.=$one_error['error']."<br/>";
} else {
array_push($a_qsos,$one_error['raw_qso']);
array_push($a_qsos,$one_error['raw_qso'] ?? '');
}
}
$this->db->insert_batch($this->config->item('table_name'), $a_qsos);
if (count($a_qsos)>0) {
$this->db->insert_batch($this->config->item('table_name'), $a_qsos);
}
return $custom_errors;
}
/*
@@ -3245,10 +3247,10 @@ function lotw_last_qsl_date($user_id) {
if (($station_id !=0 ) && (!(isset($record['station_callsign'])))) {
$record['station_callsign']=$station_profile_call;
}
if ((!$skipStationCheck) && ($station_id != 0) && (strtoupper($record['station_callsign']) != strtoupper($station_profile_call))) { // Check if station_call from import matches profile ONLY when submitting via GUI.
return "Wrong station callsign <b>\"".htmlentities($record['station_callsign'])."\"</b> while importing QSO with ".$record['call']." for <b>".$station_profile_call."</b> : SKIPPED" .
$returner['error']="Wrong station callsign <b>\"".htmlentities($record['station_callsign'] ?? '')."\"</b> while importing QSO with ".$record['call'] ?? ''." for <b>".$station_profile_call ?? ''."</b> : SKIPPED" .
"<br>See the <a target=\"_blank\" href=\"https://github.com/wavelog/Wavelog/wiki/ADIF-file-can't-be-imported\">Wavelog Wiki</a> for hints about errors in ADIF files.";
return($returner);
}
$this->load->library('frequency');

View File

@@ -56,6 +56,7 @@
<p><span class="badge text-bg-warning"><?php echo lang('general_word_warning') ?></span> <?php echo lang('gen_max_file_upload_size') ?><?php echo $max_upload; ?>B.</p>
<form class="form" id="upform" action="<?php echo site_url('adif/import'); ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="fhash" id="fhash" value="<?php echo hash('sha256', $this->session->userdata('user_callsign') );?>">
<select name="station_profile" class="form-select mb-2 me-sm-2" style="width: 20%;">
<option value="0"><?php echo lang('adif_select_stationlocation') ?></option>
<?php foreach ($station_profile->result() as $station) { ?>

View File

@@ -14,7 +14,7 @@ $(document).ready(function(){
arrayBuffer = this.result;
let chker = partof(arrayBuffer,4096);
if (chker.toUpperCase().includes('<QSO_DATE')) {
zip.file(file.name, arrayBuffer, { binary:true });
zip.file($("#fhash").val()+'.adif', arrayBuffer, { binary:true });
zip.generateAsync({type:"blob", compression:"DEFLATE"}).then(function(content){
//generated zip content to file type