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
This commit is contained in:
Alex
2025-09-12 10:37:45 -07:00
committed by GitHub
parent e0c67dbbfb
commit d45740f8fb
8 changed files with 25 additions and 20 deletions

View File

@@ -241,9 +241,9 @@ echo " <input id='token' type='hidden' name='" . $token['name'] . "' value='" .
subscriber::save_token($token, ['active.calls']);
//break the caching
$version = md5(file_get_contents(__DIR__, '/resources/javascript/websocket_client.js'));
$version = md5(file_get_contents(__DIR__ . '/resources/javascript/websocket_client.js'));
echo "<script src='resources/javascript/websocket_client.js?v=$version'></script>\n";
$version = md5(file_get_contents(__DIR__, '/resources/javascript/arrow.js'));
$version = md5(file_get_contents(__DIR__ . '/resources/javascript/arrows.js'));
echo "<script src='resources/javascript/arrows.js?v=$version'></script>\n";
?>
<script>

View File

@@ -95,7 +95,7 @@ if ($widget_details_state != 'disabled') {
echo "</div>\n";
//include arrows when not changed
$version = md5(file_get_contents($project_root, '/app/active_calls/resources/javascript/arrow.js'));
$version = md5(file_get_contents($project_root . '/app/active_calls/resources/javascript/arrows.js'));
echo "<script src='/app/active_calls/resources/javascript/arrows.js?v=$version'></script>\n";
?>

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
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';
}
}

View File

@@ -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;
}
}
}

View File

@@ -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';
}
}

View File

@@ -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 "<script src='/core/dashboard/resources/javascript/ws_client.js?v=$version'></script>\n";
//include sortablejs
@@ -224,9 +224,9 @@
//chart variables
echo "<script>\n";
echo " var chart_text_font = '".($settings->get('theme', 'dashboard_number_text_font') ?? 'arial')."';\n";
echo " var chart_text_size = '".($settings->get('theme', 'dashboard_chart_text_size') ?? '30px')."';\n";
echo " Chart.overrides.doughnut.cutout = '".($settings->get('theme', 'dashboard_chart_cutout') ?? '75%')."';\n";
echo " var chart_text_font = '".$settings->get('theme', 'dashboard_number_text_font', 'arial')."';\n";
echo " var chart_text_size = '".$settings->get('theme', 'dashboard_chart_text_size', '30px')."';\n";
echo " Chart.overrides.doughnut.cutout = '".$settings->get('theme', 'dashboard_chart_cutout', '75%')."';\n";
echo " Chart.defaults.responsive = true;\n";
echo " Chart.defaults.maintainAspectRatio = false;\n";
echo " Chart.defaults.plugins.legend.display = false;\n";
@@ -245,7 +245,7 @@
echo " <div class='heading'><b>".$text['title-dashboard']."</b></div>\n";
echo " <div class='actions'>\n";
echo " <form id='dashboard' method='post' _onsubmit='setFormSubmitting()'>\n";
if ($_SESSION['theme']['menu_style']['text'] != 'side') {
if ($settings->get('theme', 'menu_style', '') != 'side') {
echo " ".$text['label-welcome']." <a href='".PROJECT_PATH."/core/users/user_edit.php?id=user'>".$_SESSION["username"]."</a>&nbsp; &nbsp;";
}
if (permission_exists('dashboard_edit')) {

View File

@@ -12,7 +12,7 @@
$text = $language->get($_SESSION['domain']['language']['code'], dirname($widget_url));
//get the dashboard label
$widget_label = $text['title-'.$widget_key];
$widget_label = $text['title-'.$widget_key] ?? '';
if (empty($widget_label)) {
$widget_label = $widget_name;
}

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -214,7 +214,7 @@
unset($menu);
}
//build menu by style
switch ($_SESSION['theme']['menu_style']['text']) {
switch ($settings->get('theme', 'menu_style')) {
case 'side':
$view->assign('menu_side_state', (isset($_SESSION['theme']['menu_side_state']['text']) && $_SESSION['theme']['menu_side_state']['text'] != '' ? $_SESSION['theme']['menu_side_state']['text'] : 'expanded'));
if ($_SESSION['theme']['menu_side_state']['text'] != 'hidden') {