From 1a6390fb4be7de1df0606002133fb35897b8e476 Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 24 Feb 2025 11:52:25 +0000 Subject: [PATCH 1/2] Check themes for exitance b4 using them --- application/controllers/Widgets.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/application/controllers/Widgets.php b/application/controllers/Widgets.php index 53c6e16d5..ad0ae482b 100644 --- a/application/controllers/Widgets.php +++ b/application/controllers/Widgets.php @@ -62,9 +62,15 @@ class Widgets extends CI_Controller { $data['logo_url'] = 'https://github.com/wavelog/wavelog'; } + $this->load->model('themes_model'); $theme = $this->input->get('theme', TRUE); + log_message("Error",$this->themes_model->get_theme_mode($theme)); if ($theme != null) { - $data['theme'] = $theme; + if (($this->themes_model->get_theme_mode($theme) ?? '') != '') { + $data['theme'] = $theme; + } else { + $data['theme'] = $this->config->item('option_theme'); + } } else { $data['theme'] = $this->config->item('option_theme'); } @@ -81,13 +87,23 @@ class Widgets extends CI_Controller { */ public function on_air($user_slug = "") { // determine theme - $theme = $this->input->get('theme', true) ?? $this->config->item('option_theme'); + $this->load->model('themes_model'); + $theme = $this->input->get('theme', TRUE); + log_message("Error",$this->themes_model->get_theme_mode($theme)); + if ($theme != null) { + if (($this->themes_model->get_theme_mode($theme) ?? '') != '') { + $data['theme'] = $theme; + } else { + $data['theme'] = $this->config->item('option_theme'); + } + } else { + $data['theme'] = $this->config->item('option_theme'); + } // determine text size $text_size = $this->input->get('text_size', true) ?? 1; if (empty($user_slug)) { - $data['theme'] = $theme; $data['text_size_class'] = $this->prepare_text_size_css_class($text_size); $data['error'] = __("User slug not specified"); $this->load->view('widgets/on_air', $data); @@ -97,7 +113,6 @@ class Widgets extends CI_Controller { try { $user = $this->get_user_by_slug($user_slug); } catch (\Exception $e) { - $data['theme'] = $theme; $data['text_size_class'] = $this->prepare_text_size_css_class($text_size); $data['error'] = __("User slug not specified"); $data['error'] = $e->getMessage(); @@ -109,7 +124,6 @@ class Widgets extends CI_Controller { $widget_options = $this->get_on_air_widget_options($user_id); if ($widget_options->is_enabled === false) { - $data['theme'] = $theme; $data['text_size_class'] = $this->prepare_text_size_css_class($text_size); $data['error'] = __("User has on-air widget disabled"); $this->load->view('widgets/on_air', $data); @@ -157,7 +171,6 @@ class Widgets extends CI_Controller { // last seen text $last_seen_text = $widget_options->display_last_seen ? $this->prepare_last_seen_text($last_seen_days_ago) : null; - $data['theme'] = $theme; $data['text_size_class'] = $this->prepare_text_size_css_class($text_size); // prepare rest of the data for UI @@ -169,8 +182,6 @@ class Widgets extends CI_Controller { $this->load->view('widgets/on_air', $data); } else { - $theme = $this->input->get('theme', true) ?? $this->config->item('option_theme'); - $data['theme'] = $theme; $data['text_size_class'] = $this->prepare_text_size_css_class($text_size); $data['user_callsign'] = strtoupper($user->user_callsign); $data['error'] = __("No CAT interfaced radios found. You need to have at least one radio interface configured."); From 0415bd61835e60865b4ac5d3e6116e9f4add02be Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 24 Feb 2025 11:59:49 +0000 Subject: [PATCH 2/2] Rmv debug --- application/controllers/Widgets.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/application/controllers/Widgets.php b/application/controllers/Widgets.php index ad0ae482b..017a6a609 100644 --- a/application/controllers/Widgets.php +++ b/application/controllers/Widgets.php @@ -64,7 +64,6 @@ class Widgets extends CI_Controller { $this->load->model('themes_model'); $theme = $this->input->get('theme', TRUE); - log_message("Error",$this->themes_model->get_theme_mode($theme)); if ($theme != null) { if (($this->themes_model->get_theme_mode($theme) ?? '') != '') { $data['theme'] = $theme; @@ -89,7 +88,6 @@ class Widgets extends CI_Controller { // determine theme $this->load->model('themes_model'); $theme = $this->input->get('theme', TRUE); - log_message("Error",$this->themes_model->get_theme_mode($theme)); if ($theme != null) { if (($this->themes_model->get_theme_mode($theme) ?? '') != '') { $data['theme'] = $theme;