From d45740f8fb0314944f70306bec1836e8bb0896f3 Mon Sep 17 00:00:00 2001
From: Alex <40072887+alexdcrane@users.noreply.github.com>
Date: Fri, 12 Sep 2025 10:37:45 -0700
Subject: [PATCH] Dashboard: Fix php warnings (#7492)
* Dashboard: Fix php warnings
* Update dashboard_widget_list.php
* Update dashboard_widget_edit.php
* Update dashboard.php
* Update parent.php
* Update footer.php
* Update active_calls.php
* Update active_calls.php
---
app/active_calls/active_calls.php | 4 ++--
.../resources/dashboard/active_calls.php | 2 +-
core/dashboard/dashboard.php | 4 ++--
core/dashboard/dashboard_widget_edit.php | 13 +++++++++----
core/dashboard/dashboard_widget_list.php | 6 +++---
core/dashboard/index.php | 10 +++++-----
core/dashboard/resources/dashboard/parent.php | 2 +-
resources/footer.php | 4 ++--
8 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/app/active_calls/active_calls.php b/app/active_calls/active_calls.php
index e458582729..63c85746ec 100644
--- a/app/active_calls/active_calls.php
+++ b/app/active_calls/active_calls.php
@@ -241,9 +241,9 @@ echo " \n";
-$version = md5(file_get_contents(__DIR__, '/resources/javascript/arrow.js'));
+$version = md5(file_get_contents(__DIR__ . '/resources/javascript/arrows.js'));
echo "\n";
?>
\n";
?>
diff --git a/core/dashboard/dashboard.php b/core/dashboard/dashboard.php
index 2b99b080a3..5e9b896c10 100644
--- a/core/dashboard/dashboard.php
+++ b/core/dashboard/dashboard.php
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane
- Portions created by the Initial Developer are Copyright (C) 2021-2024
+ Portions created by the Initial Developer are Copyright (C) 2021-2025
the Initial Developer. All Rights Reserved.
*/
@@ -228,7 +228,7 @@
$list_row_url = '';
if (permission_exists('dashboard_edit')) {
$list_row_url = "dashboard_edit.php?id=".urlencode($row['dashboard_uuid']);
- if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ if (!empty($row['domain_uuid']) && $row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
$list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
}
}
diff --git a/core/dashboard/dashboard_widget_edit.php b/core/dashboard/dashboard_widget_edit.php
index 56eb8948f2..ca2c5092ef 100644
--- a/core/dashboard/dashboard_widget_edit.php
+++ b/core/dashboard/dashboard_widget_edit.php
@@ -57,7 +57,9 @@
$widget_groups = [];
$widget_label_enabled = 'true';
$widget_label_text_color = '';
+ $widget_label_text_color_hover = '';
$widget_label_background_color = '';
+ $widget_label_background_color_hover = '';
$widget_number_text_color = '';
$widget_number_background_color = '';
$widget_column_span = '';
@@ -422,15 +424,18 @@
$widget_path_name = $widget_path_array[1];
$path_array = glob(dirname(__DIR__, 2).'/*/'.$application_name.'/resources/dashboard/config.php');
if (file_exists($path_array[0])) {
+ $x = 0;
include($path_array[0]);
}
//find the chart type options
$widget_chart_type_options = [];
- foreach ($array['dashboard_widgets'] as $index => $row) {
- if ($row['widget_path'] === "$application_name/$widget_path_name") {
- $widget_chart_type_options = $row['widget_chart_type_options'];
- break;
+ if (!empty($array['dashboard_widgets'])) {
+ foreach ($array['dashboard_widgets'] as $index => $row) {
+ if ($row['widget_path'] === "$application_name/$widget_path_name") {
+ $widget_chart_type_options = $row['widget_chart_type_options'];
+ break;
+ }
}
}
diff --git a/core/dashboard/dashboard_widget_list.php b/core/dashboard/dashboard_widget_list.php
index 1bff2d9e88..601f7cbc8b 100644
--- a/core/dashboard/dashboard_widget_list.php
+++ b/core/dashboard/dashboard_widget_list.php
@@ -151,7 +151,7 @@
//get the group list
$sql = "select group_uuid, group_name from v_groups ";
$database = new database;
- $groups = $database->select($sql, $parameters, 'all');
+ $groups = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token
@@ -186,7 +186,7 @@
}
echo button::create(['type'=>'button','id'=>'action_bar_sub_button_back','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'collapse'=>'hide-xs','style'=>'margin-right: 15px; display: none;','link'=>'dashboard.php']);
if (permission_exists('dashboard_widget_add')) {
- echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','name'=>'btn_add','link'=>'dashboard_widget_edit.php?id='.escape($dashboard_uuid).'&widget_uuid='.escape($widget_uuid)]);
+ echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','name'=>'btn_add','link'=>'dashboard_widget_edit.php?id='.escape($dashboard_uuid).'&widget_uuid='.escape($widget_uuid ?? null)]);
}
if (permission_exists('dashboard_widget_edit') && !empty($widgets)) {
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$settings->get('theme', 'button_icon_toggle'),'id'=>'btn_toggle','name'=>'btn_toggle','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
@@ -233,7 +233,7 @@
$list_row_url = '';
if (permission_exists('dashboard_widget_edit')) {
$list_row_url = "dashboard_widget_edit.php?id=".urlencode($dashboard_uuid)."&widget_uuid=".urlencode($row['dashboard_widget_uuid']);
- if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
+ if (!empty($row['domain_uuid']) && $row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
$list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
}
}
diff --git a/core/dashboard/index.php b/core/dashboard/index.php
index f7fb2b8f15..7c823b4aa2 100644
--- a/core/dashboard/index.php
+++ b/core/dashboard/index.php
@@ -213,7 +213,7 @@
require_once "resources/header.php";
//include websockets
- $version = md5(file_get_contents(__DIR__, '/resources/javascript/ws_client.js'));
+ $version = md5(file_get_contents(__DIR__ . '/resources/javascript/ws_client.js'));
echo "\n";
//include sortablejs
@@ -224,9 +224,9 @@
//chart variables
echo "