From 83a66774318a37dbdaf157235802dca06890490e Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Tue, 3 Feb 2026 21:13:56 +0100 Subject: [PATCH] fix dxwaterfall since I broke it due to the 404 in the return. It's now working again --- application/controllers/Dxcluster.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/application/controllers/Dxcluster.php b/application/controllers/Dxcluster.php index 17df1a565..8d42eb6b2 100644 --- a/application/controllers/Dxcluster.php +++ b/application/controllers/Dxcluster.php @@ -44,25 +44,26 @@ class Dxcluster extends CI_Controller { $calls_found = $this->dxcluster_model->dxc_spotlist($band, $age, $de, $mode); header('Content-Type: application/json'); + http_response_code(200); if ($calls_found && !empty($calls_found)) { - http_response_code(200); echo json_encode($calls_found, JSON_PRETTY_PRINT); } else { - $this->_return_not_found(); + echo json_encode([], JSON_PRETTY_PRINT); // "error: not found" would be misleading here. No spots are not an error. Therefore we return an empty array } } public function qrg_lookup($qrg) { $call_found = $this->dxcluster_model->dxc_qrg_lookup($this->security->xss_clean($qrg)); header('Content-Type: application/json'); + http_response_code(200); if ($call_found) { - http_response_code(200); echo json_encode($call_found, JSON_PRETTY_PRINT); } else { - $this->_return_not_found(); + echo json_encode([], JSON_PRETTY_PRINT); // "error: not found" would be misleading here. No call is not an error, the call is just not in the spotlist. Therefore we return an empty array } } + // TODO: Is this used anywhere? If not, remove it! public function call($call) { $date = date('Y-m-d', time()); $dxccobj = new Dxcc($date); @@ -70,17 +71,11 @@ class Dxcluster extends CI_Controller { $dxcc = $dxccobj->dxcc_lookup($call, $date); header('Content-Type: application/json'); + http_response_code(200); if ($dxcc) { - http_response_code(200); echo json_encode($dxcc, JSON_PRETTY_PRINT); } else { - $this->_return_not_found(); + echo json_encode(['error' => 'not found'], JSON_PRETTY_PRINT); } } - - private function _return_not_found() { - header('Content-Type: application/json'); - http_response_code(404); - echo json_encode(['error' => 'not found'], JSON_PRETTY_PRINT); - } }