From dc22e87fc2e0d9003c511b821f4bd91785e2b769 Mon Sep 17 00:00:00 2001 From: frytimo Date: Fri, 17 Jan 2025 15:48:11 -0400 Subject: [PATCH] fix dashboard php warnings (#7218) --- .../resources/dashboard/registrations.php | 10 +++------- core/dashboard/index.php | 6 +++--- core/dashboard/resources/dashboard/icon.php | 5 +---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/app/registrations/resources/dashboard/registrations.php b/app/registrations/resources/dashboard/registrations.php index 6883af3d3d..44ea55ed3f 100644 --- a/app/registrations/resources/dashboard/registrations.php +++ b/app/registrations/resources/dashboard/registrations.php @@ -12,10 +12,7 @@ $text = $language->get($_SESSION['domain']['language']['code'], dirname($dashboard_url)); //get the dashboard label - $dashboard_label = $text['title-'.$dashboard_key]; - if (empty($dashboard_label)) { - $dashboard_label = $dashboard_name; - } + $dashboard_label = $text['title-'.$dashboard_key] ?? $dashboard_name; //prepare variables $dashboard_target = ($dashboard_target == 'new') ? '_blank' : '_self'; @@ -25,9 +22,7 @@ } //channel count - if ($esl == null) { - $esl = event_socket::create(); - } + $esl = event_socket::create(); //registration count if ($esl->is_connected() && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) { @@ -41,6 +36,7 @@ //get the total enabled extensions $sql = "select count(*) as count from v_extensions "; $sql .= "where enabled = 'true' "; + $parameters = null; if (!permission_exists("registration_all")) { $sql .= "and domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; diff --git a/core/dashboard/index.php b/core/dashboard/index.php index c9b92880dc..9e28e1f689 100644 --- a/core/dashboard/index.php +++ b/core/dashboard/index.php @@ -187,7 +187,7 @@ //determine initial state all button to display $expanded_all = true; - if (is_array($dashboard) && @sizeof($dashboard) != 0) { + if (!empty($dashboard)) { foreach ($dashboard as $row) { if ($row['dashboard_details_state'] == 'contracted' || $row['dashboard_details_state'] == 'hidden' || $row['dashboard_details_state'] == 'disabled') { $expanded_all = false; } } @@ -531,8 +531,8 @@ function toggle_grid_row_end_all() { $dashboard_content_text_align = $row['dashboard_content_text_align'] ?? ''; $dashboard_content_details = $row['dashboard_content_details'] ?? ''; $dashboard_chart_type = $row['dashboard_chart_type'] ?? "doughnut"; - $dashboard_label_text_color = $row['dashboard_label_text_color'] ?? $settings->get('theme', 'dashboard_label_text_color'); - $dashboard_number_text_color = $row['dashboard_number_text_color'] ?? $settings->get('theme', 'dashboard_number_text_color'); + $dashboard_label_text_color = $row['dashboard_label_text_color'] ?? $settings->get('theme', 'dashboard_label_text_color', ''); + $dashboard_number_text_color = $row['dashboard_number_text_color'] ?? $settings->get('theme', 'dashboard_number_text_color', ''); $dashboard_details_state = $row['dashboard_details_state'] ?? "expanded"; $dashboard_row_span = $row['dashboard_row_span'] ?? 2; diff --git a/core/dashboard/resources/dashboard/icon.php b/core/dashboard/resources/dashboard/icon.php index 6cbba3f718..5ad649d4c4 100644 --- a/core/dashboard/resources/dashboard/icon.php +++ b/core/dashboard/resources/dashboard/icon.php @@ -12,10 +12,7 @@ $text = $language->get($_SESSION['domain']['language']['code'], dirname($dashboard_url)); //get the dashboard label - $dashboard_label = $text['title-'.$dashboard_key]; - if (empty($dashboard_label)) { - $dashboard_label = $dashboard_name; - } + $dashboard_label = $text['title-'.$dashboard_key] ?? $dashboard_name; //prepare variables $dashboard_target = ($dashboard_target == 'new') ? '_blank' : '_self';