[LoTW][Sync] You can now select the DXCC for the p12 certificate on upload

这个提交包含在:
Peter Goodhall 2020-12-28 13:42:26 +00:00
父节点 0b84d4c005
当前提交 7abb6013fd
共有 3 个文件被更改,包括 31 次插入7 次删除

查看文件

@ -68,8 +68,12 @@ class Lotw extends CI_Controller {
*/
public function cert_upload() {
$this->load->model('user_model');
$this->load->model('dxcc');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
// Load DXCC Countrys List
$data['dxcc_list'] = $this->dxcc->list();
// Set Page Title
$data['page_title'] = "Logbook of the World";
@ -91,6 +95,7 @@ class Lotw extends CI_Controller {
public function do_cert_upload()
{
$this->load->model('user_model');
$this->load->model('dxcc');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
// Fire OpenSSL missing error if not found
@ -131,13 +136,18 @@ class Lotw extends CI_Controller {
$info = $this->decrypt_key($data['upload_data']['full_path']);
// Check to see if certificate is already in the system
$new_certficiate = $this->LotwCert->find_cert($info['issued_callsign'], $this->session->userdata('user_id'));
// Check DXCC & Store Country Name
$this->load->model('Logbook_model');
$dxcc_check = $this->Logbook_model->check_dxcc_table($info['issued_callsign'], $info['validFrom']);
$dxcc = $dxcc_check[1];
$this->load->model('Logbook_model');
if($this->input->post('dxcc') != "") {
$dxcc = $this->input->post('dxcc');
} else{
$dxcc_check = $this->Logbook_model->check_dxcc_table($info['issued_callsign'], $info['validFrom']);
$dxcc = $dxcc_check[1];
}
// Check to see if certificate is already in the system
$new_certficiate = $this->LotwCert->find_cert($info['issued_callsign'], $dxcc, $this->session->userdata('user_id'));
if($new_certficiate == 0) {
// New Certificate Store in Database

查看文件

@ -33,8 +33,9 @@ class LotwCert extends CI_Model {
return $query->row();
}
function find_cert($callsign, $user_id) {
function find_cert($callsign, $dxcc, $user_id) {
$this->db->where('user_id', $user_id);
$this->db->where('cert_dxcc', $dxcc);
$this->db->where('callsign', $callsign);
$query = $this->db->get('lotw_certs');

查看文件

@ -32,6 +32,19 @@
<input type="file" name="userfile" class="form-control-file" id="exampleFormControlFile1">
</div>
<div class="form-group">
<label for="stationDXCCInput">Certificate DXCC</label>
<?php if ($dxcc_list->num_rows() > 0) { ?>
<select class="form-control" id="dxcc_select" name="dxcc" aria-describedby="stationCallsignInputHelp">
<option value=""></option>
<?php foreach ($dxcc_list->result() as $dxcc) { ?>
<option value="<?php echo $dxcc->name; ?>"><?php echo $dxcc->name; ?></option>
<?php } ?>
</select>
<?php } ?>
<small id="stationDXCCInputHelp" class="form-text text-muted">Certificate DXCC entity. For example: Scotland</small>
</div>
<button type="submit" value="upload" class="btn btn-primary">Upload File</button>
</form>