Merge pull request #2312 from int2001/import_check

Strong check for station_id when importing
这个提交包含在:
Peter Goodhall 2023-07-20 15:44:40 +01:00 提交者 GitHub
当前提交 49dcc9c3d0
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 2 个文件被更改,包括 25 次插入26 次删除

查看文件

@ -171,8 +171,7 @@ class adif extends CI_Controller {
$this->load->library('upload', $config); $this->load->library('upload', $config);
if ( ! $this->upload->do_upload()) if ( ! $this->upload->do_upload()) {
{
$data['error'] = $this->upload->display_errors(); $data['error'] = $this->upload->display_errors();
$data['max_upload'] = ini_get('upload_max_filesize'); $data['max_upload'] = ini_get('upload_max_filesize');
@ -180,10 +179,8 @@ class adif extends CI_Controller {
$this->load->view('interface_assets/header', $data); $this->load->view('interface_assets/header', $data);
$this->load->view('adif/import'); $this->load->view('adif/import');
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
} } else {
else if ($this->stations->check_station_is_accessible($this->input->post('station_profile'))) {
{
$data = array('upload_data' => $this->upload->data()); $data = array('upload_data' => $this->upload->data());
ini_set('memory_limit', '-1'); ini_set('memory_limit', '-1');
@ -199,20 +196,22 @@ class adif extends CI_Controller {
$custom_errors = ""; $custom_errors = "";
while($record = $this->adif_parser->get_record()) while($record = $this->adif_parser->get_record())
{ {
if(count($record) == 0) if(count($record) == 0) {
{
break; break;
}; };
$one_error = $this->logbook_model->import($record, $this->input->post('station_profile'), $this->input->post('skipDuplicate'), $this->input->post('markLotw'), $this->input->post('dxccAdif'), $this->input->post('markQrz'), $this->input->post('markHrd'), true, $this->input->post('operatorName'));
$custom_errors .= $this->logbook_model->import($record, $this->input->post('station_profile'), if ($one_error != '') {
$this->input->post('skipDuplicate'), $this->input->post('markLotw'), $this->input->post('dxccAdif'), $this->input->post('markQrz'), $this->input->post('markHrd'), true, $this->input->post('operatorName'))."<br/>"; $custom_errors.=$one_error."<br/>";
}
}; };
unlink('./uploads/'.$data['upload_data']['file_name']);
} else {
$custom_errors='Station Profile not valid for User';
}
$data['adif_errors'] = $custom_errors; $data['adif_errors'] = $custom_errors;
unlink('./uploads/'.$data['upload_data']['file_name']);
$data['page_title'] = "ADIF Imported"; $data['page_title'] = "ADIF Imported";
$this->load->view('interface_assets/header', $data); $this->load->view('interface_assets/header', $data);

查看文件

@ -44,7 +44,7 @@
<div class="col-md-10"> <div class="col-md-10">
<div class="form-check-inline"> <div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="skipDuplicate" value="1" id="skipDuplicate"> <input class="form-check-input" type="checkbox" name="skipDuplicate" value="1" id="skipDuplicate">
<label class="form-check-label" for="skipDuplicate">Skip duplicate QSO check</label> <label class="form-check-label" for="skipDuplicate">Import duplicate QSOs</label>
</div> </div>
</div> </div>
</div> </div>