You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: application/models/Eqsl_images.php
+37-19Lines changed: 37 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,23 @@ function get_image($qso_id) {
15
15
}
16
16
}
17
17
18
+
functiondel_image($qso_id, $user_id = null) {
19
+
// QSO belongs to station_profile. But since we have folders for Users (and therefore an extra indirect relation) we need to lookup user for station first...
20
+
$eqsl_img=$this->db->query('SELECT e.image_file,e.id, qso.station_id, s.user_id FROM `eQSL_images` e INNER JOIN '.$this->config->item('table_name').' qso ON (e.qso_id = qso.COL_PRIMARY_KEY) inner join station_profile s on (s.station_id=qso.station_id) where qso.COL_PRIMARY_KEY=?',$qso_id);
21
+
foreach ($eqsl_img->result() as$row) {
22
+
if (($user_id ?? '') == '') { // Calling as User? Check if User-id matches User-id from QSO
23
+
$user_id = $this->session->userdata('user_id');
24
+
if ($row->user_id != $user_id) {
25
+
return"No Image"; // Image doesn't belong to user, so return
0 commit comments