From 2ce9ecbebbb838f6da227b0365b83bbb402ee885 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 18 Feb 2024 09:41:54 +0100 Subject: [PATCH] [LBA] Added user_id check on update --- application/models/Logbookadvanced_model.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index ceaa0f2e1..96a863373 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -476,14 +476,12 @@ class Logbookadvanced_model extends CI_Model { case "propagation": $column = 'COL_PROP_MODE'; break; default: return; } - $this->load->model('user_model'); - $data = array( - $column => $value - ); + $this->db->trans_start(); + $sql = "UPDATE ".$this->config->item('table_name')." JOIN station_profile ON ".$this->config->item('table_name').".station_id = station_profile.station_id SET " . $column . " = ? WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?"; - $this->db->where_in('COL_PRIMARY_KEY', $ids); - $this->db->update($this->config->item('table_name'), $data); + $query = $this->db->query($sql, array($value, $ids, $this->session->userdata('user_id'))); + $this->db->trans_complete(); return array('message' => 'OK'); }