check if qso belongs to user when deleting/requesting/confirming QSOs/QSLs

pull/2350/head
int2001 2023-07-31 05:03:05 +00:00
rodzic 61b55a2e3d
commit ef65d6a7c4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DFB1C13CD2DB037B
2 zmienionych plików z 89 dodań i 57 usunięć

Wyświetl plik

@ -290,13 +290,13 @@ class QSO extends CI_Controller {
function delete($id) { function delete($id) {
$this->load->model('logbook_model'); $this->load->model('logbook_model');
if ($this->logbook_model->check_qso_is_accessible($id)) {
$this->logbook_model->delete($id); $this->logbook_model->delete($id);
$this->session->set_flashdata('notice', 'QSO Deleted Successfully'); $this->session->set_flashdata('notice', 'QSO Deleted Successfully');
$data['message_title'] = "Deleted"; $data['message_title'] = "Deleted";
$data['message_contents'] = "QSO Deleted Successfully"; $data['message_contents'] = "QSO Deleted Successfully";
$this->load->view('messages/message', $data); $this->load->view('messages/message', $data);
}
// If deletes from /logbook dropdown redirect // If deletes from /logbook dropdown redirect
if (strpos($_SERVER['HTTP_REFERER'], '/logbook') !== false) { if (strpos($_SERVER['HTTP_REFERER'], '/logbook') !== false) {
@ -309,10 +309,14 @@ class QSO extends CI_Controller {
$id = str_replace('"', "", $this->input->post("id")); $id = str_replace('"', "", $this->input->post("id"));
$this->load->model('logbook_model'); $this->load->model('logbook_model');
if ($this->logbook_model->check_qso_is_accessible($id)) {
$this->logbook_model->delete($id); $this->logbook_model->delete($id);
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode(array('message' => 'OK')); echo json_encode(array('message' => 'OK'));
} else {
header('Content-Type: application/json');
echo json_encode(array('message' => 'not allowed'));
}
return; return;
} }

Wyświetl plik

@ -1290,14 +1290,19 @@ class Logbook_model extends CI_Model {
} }
/* Return QSO Info */ /* Return QSO Info */
function qso_info($id) { function qso_info($id) {
if ($this->logbook_model->check_qso_is_accessible($id)) {
$this->db->where('COL_PRIMARY_KEY', $id); $this->db->where('COL_PRIMARY_KEY', $id);
return $this->db->get($this->config->item('table_name')); return $this->db->get($this->config->item('table_name'));
} else {
return;
}
} }
// Set Paper to received // Set Paper to received
function paperqsl_update($qso_id, $method) { function paperqsl_update($qso_id, $method) {
if ($this->logbook_model->check_qso_is_accessible($qso_id)) {
$data = array( $data = array(
'COL_QSLRDATE' => date('Y-m-d H:i:s'), 'COL_QSLRDATE' => date('Y-m-d H:i:s'),
@ -1308,11 +1313,15 @@ class Logbook_model extends CI_Model {
$this->db->where('COL_PRIMARY_KEY', $qso_id); $this->db->where('COL_PRIMARY_KEY', $qso_id);
$this->db->update($this->config->item('table_name'), $data); $this->db->update($this->config->item('table_name'), $data);
} else {
return;
}
} }
// Set Paper to sent // Set Paper to sent
function paperqsl_update_sent($qso_id, $method) { function paperqsl_update_sent($qso_id, $method) {
if ($this->logbook_model->check_qso_is_accessible($qso_id)) {
$data = array( $data = array(
'COL_QSLSDATE' => date('Y-m-d H:i:s'), 'COL_QSLSDATE' => date('Y-m-d H:i:s'),
@ -1323,11 +1332,15 @@ class Logbook_model extends CI_Model {
$this->db->where('COL_PRIMARY_KEY', $qso_id); $this->db->where('COL_PRIMARY_KEY', $qso_id);
$this->db->update($this->config->item('table_name'), $data); $this->db->update($this->config->item('table_name'), $data);
} else {
return;
}
} }
// Set Paper to requested // Set Paper to requested
function paperqsl_requested($qso_id, $method) { function paperqsl_requested($qso_id, $method) {
if ($this->logbook_model->check_qso_is_accessible($qso_id)) {
$data = array( $data = array(
'COL_QSLSDATE' => date('Y-m-d H:i:s'), 'COL_QSLSDATE' => date('Y-m-d H:i:s'),
@ -1338,10 +1351,14 @@ class Logbook_model extends CI_Model {
$this->db->where('COL_PRIMARY_KEY', $qso_id); $this->db->where('COL_PRIMARY_KEY', $qso_id);
$this->db->update($this->config->item('table_name'), $data); $this->db->update($this->config->item('table_name'), $data);
} else {
return;
}
} }
function paperqsl_ignore($qso_id, $method) { function paperqsl_ignore($qso_id, $method) {
if ($this->logbook_model->check_qso_is_accessible($qso_id)) {
$data = array( $data = array(
'COL_QSLSDATE' => date('Y-m-d H:i:s'), 'COL_QSLSDATE' => date('Y-m-d H:i:s'),
@ -1351,6 +1368,9 @@ class Logbook_model extends CI_Model {
$this->db->where('COL_PRIMARY_KEY', $qso_id); $this->db->where('COL_PRIMARY_KEY', $qso_id);
$this->db->update($this->config->item('table_name'), $data); $this->db->update($this->config->item('table_name'), $data);
} else {
return;
}
} }
function get_qsos_for_printing($station_id2 = null) { function get_qsos_for_printing($station_id2 = null) {
@ -1427,6 +1447,7 @@ class Logbook_model extends CI_Model {
} }
function get_qso($id) { function get_qso($id) {
if ($this->logbook_model->check_qso_is_accessible($id)) {
$this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, coalesce(dxcc_entities_2.name, "- NONE -") as station_country, dxcc_entities_2.end as station_end, eQSL_images.image_file as eqsl_image_file, lotw_users.callsign as lotwuser, lotw_users.lastupload'); $this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, coalesce(dxcc_entities_2.name, "- NONE -") as station_country, dxcc_entities_2.end as station_end, eQSL_images.image_file as eqsl_image_file, lotw_users.callsign as lotwuser, lotw_users.lastupload');
$this->db->from($this->config->item('table_name')); $this->db->from($this->config->item('table_name'));
$this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left'); $this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left');
@ -1437,6 +1458,9 @@ class Logbook_model extends CI_Model {
$this->db->where('COL_PRIMARY_KEY', $id); $this->db->where('COL_PRIMARY_KEY', $id);
return $this->db->get(); return $this->db->get();
} else {
return;
}
} }
/* /*
@ -2628,8 +2652,12 @@ class Logbook_model extends CI_Model {
/* Delete QSO based on the QSO ID */ /* Delete QSO based on the QSO ID */
function delete($id) { function delete($id) {
if ($this->check_qso_is_accessible($id)) {
$this->db->where('COL_PRIMARY_KEY', $id); $this->db->where('COL_PRIMARY_KEY', $id);
$this->db->delete($this->config->item('table_name')); $this->db->delete($this->config->item('table_name'));
} else {
return;
}
} }
/* Used to check if the qso is already in the database */ /* Used to check if the qso is already in the database */