From 8fcbfafbc8d40df8007da825a43586b05d767e4d Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 30 Mar 2026 10:45:51 +0100 Subject: [PATCH] Allow overriding displayed callsign in widgets Add an optional $display_callsign parameter to on_air and on_air_image so embedders can show a different callsign than the one used to look up the user (e.g., /widgets/on_air/M0ABC/GB2XXX). Update embed examples and use the display_callsign when provided (sanitised with xss_clean and strtoupper) while preserving the original lookup behavior. --- application/controllers/Widgets.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/application/controllers/Widgets.php b/application/controllers/Widgets.php index 868defa4f..e9984816b 100644 --- a/application/controllers/Widgets.php +++ b/application/controllers/Widgets.php @@ -48,7 +48,8 @@ class Widgets extends CI_Controller { // Embeddable "on air" status widget - pass a callsign to get current radio/satellite status. // Embed via: - public function on_air($callsign = null) { + // Optionally override the displayed callsign: + public function on_air($callsign = null, $display_callsign = null) { if ($callsign == null) { show_error('Please provide a callsign. Usage: widgets/on_air/YOURCALL'); } @@ -64,14 +65,17 @@ class Widgets extends CI_Controller { $this->load->model('cat'); $data['radio_status'] = $this->cat->recent_status_by_user_id($user->user_id); - $data['callsign'] = strtoupper($this->security->xss_clean($callsign)); + $data['callsign'] = strtoupper($this->security->xss_clean( + $display_callsign !== null ? $display_callsign : $callsign + )); $this->load->view('widgets/on_air', $data); } // Embeddable "on air" status badge as an SVG image. // Embed via: M0ABC on air status - public function on_air_image($callsign = null) { + // Optionally override the displayed callsign: + public function on_air_image($callsign = null, $display_callsign = null) { if ($callsign == null) { show_error('Please provide a callsign. Usage: widgets/on_air_image/YOURCALL'); } @@ -84,7 +88,9 @@ class Widgets extends CI_Controller { } $user = $user_result->row(); - $callsign = strtoupper($this->security->xss_clean($callsign)); + $callsign = strtoupper($this->security->xss_clean( + $display_callsign !== null ? $display_callsign : $callsign + )); $this->load->model('cat'); $radio_status = $this->cat->recent_status_by_user_id($user->user_id);