From 0025ff8fccbcfd8d2e483fdcd465387cb1cb5e63 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 15 Nov 2023 08:58:42 +0100 Subject: [PATCH 1/5] Prevent fetching image from non-existent qrz.com entry --- application/controllers/Logbook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index f0ff8f12..4f56f4b7 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -168,7 +168,7 @@ class Logbook extends CI_Controller { $return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $type, $band, $mode); if ($this->session->userdata('user_show_profile_image')) { - if (isset($callbook)) { + if (isset($callbook) && isset($callbook['image'])) { if ($callbook['image'] == "") { $return['image'] = "n/a"; } else { From 582cbb803cacf89a35a82c5c8d790ab0caf03686 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 15 Nov 2023 10:01:36 +0100 Subject: [PATCH 2/5] Fix previous lookup for QSO logging window --- application/controllers/Logbook.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 4f56f4b7..5e2cb87e 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -851,13 +851,13 @@ function worked_grid_before($gridsquare, $type, $band, $mode) $qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password')); $this->session->set_userdata('qrz_session_key', $qrz_session_key); } - $data= $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); + $callsign['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); - if (empty($data['callsign'])) + if (empty($callsign['callsign']['callsign'])) { $qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password')); $this->session->set_userdata('qrz_session_key', $qrz_session_key); - $data = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); + $callsign['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); } } @@ -866,12 +866,12 @@ function worked_grid_before($gridsquare, $type, $band, $mode) // Lookup using hamli $this->load->library('hamli'); - $data['callsign'] = $this->hamli->callsign($id); + $callsign['callsign'] = $this->hamli->callsign($id); }*/ - $data['id'] = strtoupper($id); + $callsign['id'] = strtoupper($id); - return $this->load->view('search/result', $data, true); + return $this->load->view('search/result', $callsign, true); } } From 596a276020643e615ce57274a9dbf0474c750f1a Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 15 Nov 2023 10:03:38 +0100 Subject: [PATCH 3/5] Worked grid lookup also for QSO logging view --- application/controllers/Logbook.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 5e2cb87e..e2fa74f1 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -869,6 +869,11 @@ function worked_grid_before($gridsquare, $type, $band, $mode) $callsign['callsign'] = $this->hamli->callsign($id); }*/ + if (isset($callsign['callsign']['gridsquare'])) { + $CI = &get_instance(); + $CI->load->model('logbook_model'); + $callsign['grid_worked'] = $CI->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); + } $callsign['id'] = strtoupper($id); return $this->load->view('search/result', $callsign, true); From 99a88e96d5f0235d8010d203abc86b3f57b0bc8d Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 15 Nov 2023 10:09:03 +0100 Subject: [PATCH 4/5] Also show lookup error during QSO logging --- application/controllers/Logbook.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index e2fa74f1..5835dff2 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -874,6 +874,9 @@ function worked_grid_before($gridsquare, $type, $band, $mode) $CI->load->model('logbook_model'); $callsign['grid_worked'] = $CI->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); } + if (isset($callsign['callsign']['error'])) { + $callsign['error'] = $callsign['callsign']['error']; + } $callsign['id'] = strtoupper($id); return $this->load->view('search/result', $callsign, true); From 6b41927d8d2de9a7ab60d502205ab1dec8c363d0 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 15 Nov 2023 11:06:14 +0100 Subject: [PATCH 5/5] Cover not configured lookup --- application/controllers/Logbook.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 5835dff2..223f1c9c 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -859,6 +859,8 @@ function worked_grid_before($gridsquare, $type, $band, $mode) $this->session->set_userdata('qrz_session_key', $qrz_session_key); $callsign['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); } + } else { + $callsign['error'] = 'Lookup not configured or set to hamqth. Currently only qrz is supported.'; } // There's no hamli integration? Disabled for now. @@ -936,7 +938,7 @@ function worked_grid_before($gridsquare, $type, $band, $mode) $data['error'] = $data['callsign']['error']; } } else { - $data['error'] = 'No result (qrz not configured)'; + $data['error'] = 'Lookup not configured or set to hamqth. Currently only qrz is supported.'; } /*else { // Lookup using hamli $this->load->library('hamli');