diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php index 5ef077ae..32282650 100644 --- a/application/controllers/Adif.php +++ b/application/controllers/Adif.php @@ -81,14 +81,16 @@ class adif extends CI_Controller { $this->load->model('adif_data'); + $station_id = $this->security->xss_clean($this->input->post('station_profile')); + // Used for exporting QSOs not previously exported to LoTW if ($this->input->post('exportLotw') == 1) { $exportLotw = true; } else { $exportLotw = false; } - - $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $exportLotw); + + $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $station_id, $exportLotw); $this->load->view('adif/data/exportall', $data); @@ -106,9 +108,10 @@ class adif extends CI_Controller { // Set memory limit to unlimited to allow heavy usage ini_set('memory_limit', '-1'); + $station_id = $this->security->xss_clean($this->input->post('station_profile')); $this->load->model('adif_data'); - $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to')); + $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $station_id); foreach ($data['qsos']->result() as $qso) { @@ -122,9 +125,11 @@ class adif extends CI_Controller { // Set memory limit to unlimited to allow heavy usage ini_set('memory_limit', '-1'); + $station_id = $this->security->xss_clean($this->input->post('station_profile')); + $this->load->model('adif_data'); - $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to')); + $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $station_id); $this->load->model('logbook_model'); @@ -225,7 +230,7 @@ class adif extends CI_Controller { }; - $data['adif_errors'] = $custom_errors; + $data['adif_errors'] = $custom_errors; unlink('./uploads/'.$data['upload_data']['file_name']); diff --git a/application/models/Adif_data.php b/application/models/Adif_data.php index cdc2f49c..da774e72 100644 --- a/application/models/Adif_data.php +++ b/application/models/Adif_data.php @@ -67,14 +67,11 @@ class adif_data extends CI_Model { return $this->db->get(); } - - function export_custom($from, $to, $exportLotw = false) { - $this->load->model('stations'); - $active_station_id = $this->stations->find_active(); + function export_custom($from, $to, $station_id, $exportLotw = false) { $this->db->select(''.$this->config->item('table_name').'.*, station_profile.*'); $this->db->from($this->config->item('table_name')); - $this->db->where($this->config->item('table_name').'.station_id', $active_station_id); + $this->db->where($this->config->item('table_name').'.station_id', $station_id); // If date is set, we format the date and add it to the where-statement if ($from != 0) { @@ -97,12 +94,12 @@ class adif_data extends CI_Model { return $this->db->get(); } - + function export_lotw() { $this->load->model('stations'); $active_station_id = $this->stations->find_active(); - + $this->db->select(''.$this->config->item('table_name').'.*, station_profile.*'); $this->db->from($this->config->item('table_name')); $this->db->where($this->config->item('table_name').'.station_id', $active_station_id); @@ -114,15 +111,15 @@ class adif_data extends CI_Model { return $this->db->get(); } - + function mark_lotw_sent($id) { $data = array( 'COL_LOTW_QSL_SENT' => 'Y' ); - + $this->db->set('COL_LOTW_QSLSDATE', 'now()', FALSE); $this->db->where('COL_PRIMARY_KEY', $id); - $this->db->update($this->config->item('table_name'), $data); + $this->db->update($this->config->item('table_name'), $data); } } diff --git a/application/views/adif/import.php b/application/views/adif/import.php index e2e610bc..5a7cd82a 100644 --- a/application/views/adif/import.php +++ b/application/views/adif/import.php @@ -82,20 +82,21 @@ - +
Warning If a date range is not selected then all QSOs will be marked!
Warning If a date range is not selected then all QSOs will be marked!
+