Event widget and some notices fixed

This commit is contained in:
fbsanchez 2021-02-10 15:00:23 +01:00
parent 40852de906
commit 0be3e0ab90
10 changed files with 435 additions and 126 deletions

View File

@ -877,7 +877,9 @@ if ($config['menu_type'] == 'classic') {
blinkpubli();
<?php
if ($_GET['refr'] || $do_refresh === true) {
if ($_GET['refr']
|| (isset($do_refresh) === true && $do_refresh === true)
) {
if ($_GET['sec2'] == 'operation/events/events') {
$autorefresh_draw = true;
}
@ -941,7 +943,7 @@ if ($config['menu_type'] == 'classic') {
var newValue = btoa(JSON.stringify(values));
<?php
// Check if the url has the parameter fb64.
if ($_GET['fb64']) {
if (isset($_GET['fb64']) === true) {
$fb64 = $_GET['fb64'];
?>
var fb64 = '<?php echo $fb64; ?>';

View File

@ -188,7 +188,12 @@ try {
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']);
if (!$double_auth_enabled && $config['2FA_all_users'] != ''
if (isset($config['2FA_all_users']) === false) {
$config['2FA_all_users'] = null;
}
if (!$double_auth_enabled
&& $config['2FA_all_users'] != ''
&& $config['2Fa_auth'] != '1'
&& $config['double_auth_enabled']
) {

View File

@ -118,8 +118,14 @@ class ConsoleSupervisor
// Assign targets.
$targets = get_notification_source_targets($this->sourceId);
$this->targetGroups = $targets['groups'];
$this->targetUsers = $targets['users'];
if (isset($targets['groups']) === true) {
$this->targetGroups = $targets['groups'];
}
if (isset($targets['users']) === true) {
$this->targetUsers = $targets['users'];
}
$this->targetUpdated = true;
}
@ -622,8 +628,14 @@ class ConsoleSupervisor
if ($this->targetUpdated === false) {
$targets = get_notification_source_targets($this->sourceId);
$this->targetGroups = $targets['groups'];
$this->targetUsers = $targets['users'];
if (isset($targets['groups']) === true) {
$this->targetGroups = $targets['groups'];
}
if (isset($targets['users']) === true) {
$this->targetUsers = $targets['users'];
}
$this->targetUpdated = false;
}
@ -631,8 +643,14 @@ class ConsoleSupervisor
$source_id = $this->sourceId;
// Assign targets.
$targets = get_notification_source_targets($source_id);
$this->targetGroups = $targets['groups'];
$this->targetUsers = $targets['users'];
if (isset($targets['groups']) === true) {
$this->targetGroups = $targets['groups'];
}
if (isset($targets['users']) === true) {
$this->targetUsers = $targets['users'];
}
$this->targetUpdated = false;
}

View File

@ -782,8 +782,40 @@ class HTML
}
if (isset($data['form']) === true) {
$output_head .= '<form name="'.$form['name'].'" id="'.$form['id'].'" class="discovery '.$form['class'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
$output_head .= '<form ';
if (isset($form['name']) === true) {
$output_head .= 'name="'.$form['name'].'" ';
}
if (isset($form['id']) === true) {
$output_head .= 'id="'.$form['id'].'" ';
}
if (isset($form['class']) === true) {
$output_head .= 'class="discovery '.$form['class'].'" ';
}
if (isset($form['onsubmit']) === true) {
$output_head .= 'onsubmit="'.$form['onsubmit'].'" ';
}
if (isset($form['enctype']) === true) {
$output_head .= 'enctype="'.$form['enctype'].'" ';
}
if (isset($form['action']) === true) {
$output_head .= 'action="'.$form['action'].'" ';
}
if (isset($form['method']) === true) {
$output_head .= 'method="'.$form['method'].'" ';
}
if (isset($form['extra']) === true) {
$output_head .= $form['extra'];
}
$output_head .= '>';
}
if ($return === false) {

View File

@ -3219,7 +3219,7 @@ function get_um_url()
*/
function config_return_in_bytes($val)
{
$val = trim($val);
$val = (int) trim($val);
$last = strtolower($val[(strlen($val) - 1)]);
switch ($last) {
// The 'G' modifier is available since PHP 5.1.0.

View File

@ -675,6 +675,33 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
*
* @param array $fields Fields to retrieve.
* @param array $filter Filters to be applied.
* Available filters:
* [
* 'date_from'
* 'time_from'
* 'date_to'
* 'time_to'
* 'event_view_hr'
* 'id_agent'
* 'event_type'
* 'severity'
* 'id_group_filter'
* 'status'
* 'agent_alias'
* 'search'
* 'id_extra'
* 'id_source_event'
* 'user_comment'
* 'source'
* 'id_user_ack'
* 'tag_with'
* 'tag_without'
* 'filter_only_alert'
* 'module_search'
* 'group_rep'
* 'server_id'
* ].
*
* @param integer $offset Offset (pagination).
* @param integer $limit Limit (pagination).
* @param string $order Sort order.
@ -683,6 +710,8 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
* @param boolean $return_sql Return SQL (true) or execute it (false).
* @param string $having Having filter.
* @param boolean $validatedEvents If true, evaluate validated events.
* @param boolean $recursiveGroups If true, filtered groups and their children
* will be search.
*
* @return array Events.
* @throws Exception On error.
@ -697,7 +726,8 @@ function events_get_all(
$history=false,
$return_sql=false,
$having='',
$validatedEvents=false
$validatedEvents=false,
$recursiveGroups=true
) {
global $config;
@ -873,17 +903,56 @@ function events_get_all(
}
$groups = $filter['id_group_filter'];
if (isset($groups) === true && $groups > 0) {
$children = groups_get_children($groups);
if ((bool) $user_is_admin === false
&& isset($groups) === false
) {
// Not being filtered by group but not an admin, limit results.
$groups = array_keys(users_get_groups(false, 'AR'));
}
$_groups = [ $groups ];
if (empty($children) === false) {
foreach ($children as $child) {
$_groups[] = (int) $child['id_grupo'];
if (isset($groups) === true
&& (is_array($groups) === true || ($groups > 0))
) {
if ($recursiveGroups === true) {
// Add children groups.
$children = [];
if (is_array($groups) === true) {
foreach ($groups as $g) {
$children = array_merge(
groups_get_children($g),
$children
);
}
} else {
$children = groups_get_children($groups);
}
if (is_array($groups) === true) {
$_groups = $groups;
} else {
$_groups = [ $groups ];
}
if (empty($children) === false) {
foreach ($children as $child) {
$_groups[] = (int) $child['id_grupo'];
}
}
if ((bool) $user_is_admin === false) {
$user_groups = users_get_groups(false, 'AR');
$_groups = array_intersect(
$_groups,
array_keys($user_groups)
);
}
$groups = $_groups;
}
$groups = $_groups;
if (is_array($groups) === false) {
$groups = [ $groups ];
}
$sql_filters[] = sprintf(
' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))',
@ -1466,6 +1535,8 @@ function events_get_all(
/**
* @deprecated Use events_get_all instead.
*
* Get all rows of events from the database, that
* pass the filter, and can get only some fields.
*
@ -1502,7 +1573,9 @@ function events_get_all(
*/
function events_get_events($filter=false, $fields=false)
{
if ($filter['criticity'] == EVENT_CRIT_WARNING_OR_CRITICAL) {
if (isset($filter['criticity']) === true
&& (int) $filter['criticity'] === EVENT_CRIT_WARNING_OR_CRITICAL
) {
$filter['criticity'] = [
EVENT_CRIT_WARNING,
EVENT_CRIT_CRITICAL,
@ -7363,3 +7436,40 @@ function events_get_instructions($event)
return $output;
}
/**
* Return class name matching criticity received.
*
* @param integer $criticity Event's criticity.
*
* @return string
*/
function events_get_criticity_class($criticity)
{
switch ($criticity) {
case EVENT_CRIT_CRITICAL:
return 'datos_red';
case EVENT_CRIT_MAINTENANCE:
return 'datos_grey';
case EVENT_CRIT_INFORMATIONAL:
return 'datos_blue';
case EVENT_CRIT_MAJOR:
return 'datos_pink';
case EVENT_CRIT_MINOR:
return 'datos_pink';
case EVENT_CRIT_NORMAL:
return 'datos_green';
case EVENT_CRIT_WARNING:
return 'datos_yellow';
default:
return 'datos_blue';
}
}

View File

@ -257,6 +257,23 @@ class Manager
$extradata = \get_parameter('extradata', '');
if (empty($extradata) === false) {
$extradata = json_decode(\io_safe_output($extradata), true);
if (isset($extradata['dashboardId']) === false) {
$extradata['dashboardId'] = null;
}
if (isset($extradata['cellId']) === false) {
$extradata['cellId'] = null;
}
if (isset($extradata['offset']) === false) {
$extradata['offset'] = null;
}
if (isset($extradata['widgetId']) === false) {
$extradata['widgetId'] = null;
}
$this->dashboardId = (int) $extradata['dashboardId'];
$this->cellId = (int) $extradata['cellId'];
$this->offset = (int) $extradata['offset'];
@ -1031,6 +1048,10 @@ class Manager
);
}
if (isset($config['public_dashboard']) === false) {
$config['public_dashboard'] = false;
}
// View.
if ($this->slides === 0 || $this->cellModeSlides === 0) {
View::render(
@ -1450,4 +1471,21 @@ class Manager
}
/**
* Prints error.
*
* @param string $msg Message.
*
* @return void
*/
public function error(string $msg)
{
if ((bool) \is_ajax() === true) {
echo json_encode(['error' => $msg]);
} else {
\ui_print_error_message($msg);
}
}
}

View File

@ -21,7 +21,7 @@ class Widget
*
* @var integer
*/
private $cellId;
protected $cellId;
/**
* Widget Id.
@ -99,8 +99,6 @@ class Widget
*/
public function getOptionsWidget():array
{
global $config;
$result = [];
if (empty($this->dataCell['options']) === false) {
$result = \json_decode($this->dataCell['options'], true);
@ -591,4 +589,37 @@ class Widget
}
/**
* Get description should be implemented for each child.
*
* @return string
*/
public static function getDescription()
{
return '**NOT DEFINED**';
}
/**
* Load should be implemented for each child.
*
* @return string
*/
public function load()
{
return '**NOT DEFINED**';
}
/**
* Get name should be implemented for each child.
*
* @return string
*/
public static function getName()
{
return '**NOT DEFINED**';
}
}

View File

@ -172,7 +172,7 @@ class EventsListWidget extends Widget
$this->className = $class->getShortName();
// Title.
$this->title = __('List of latest events');
$this->title = \__('List of latest events');
// Name.
if (empty($this->name) === true) {
@ -242,6 +242,10 @@ class EventsListWidget extends Widget
$values['groupId'] = $decoder['id_groups'];
}
if (isset($decoder['groupRecursion']) === true) {
$values['groupRecursion'] = $decoder['groupRecursion'];
}
if (isset($decoder['groupId']) === true) {
$values['groupId'] = $decoder['groupId'];
}
@ -271,7 +275,7 @@ class EventsListWidget extends Widget
$inputs = parent::getFormInputs();
$fields = \get_event_types();
$fields['not_normal'] = __('Not normal');
$fields['not_normal'] = \__('Not normal');
// Default values.
if (isset($values['maxHours']) === false) {
@ -284,21 +288,21 @@ class EventsListWidget extends Widget
// Event Type.
$inputs[] = [
'label' => __('Event type'),
'label' => \__('Event type'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'eventType',
'selected' => $values['eventType'],
'return' => true,
'nothing' => __('Any'),
'nothing' => \__('Any'),
'nothing_value' => 0,
],
];
// Max. hours old. Default 8.
$inputs[] = [
'label' => __('Max. hours old'),
'label' => \__('Max. hours old'),
'arguments' => [
'name' => 'maxHours',
'type' => 'number',
@ -320,7 +324,7 @@ class EventsListWidget extends Widget
];
$inputs[] = [
'label' => __('Limit'),
'label' => \__('Limit'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
@ -332,13 +336,13 @@ class EventsListWidget extends Widget
// Event status.
$fields = [
-1 => __('All event'),
1 => __('Only validated'),
0 => __('Only pending'),
-1 => \__('All event'),
1 => \__('Only validated'),
0 => \__('Only pending'),
];
$inputs[] = [
'label' => __('Event status'),
'label' => \__('Event status'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
@ -352,14 +356,14 @@ class EventsListWidget extends Widget
$fields = \get_priorities();
$inputs[] = [
'label' => __('Severity'),
'label' => \__('Severity'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'severity',
'selected' => $values['severity'],
'return' => true,
'nothing' => __('All'),
'nothing' => \__('All'),
'nothing_value' => -1,
],
];
@ -367,14 +371,18 @@ class EventsListWidget extends Widget
$return_all_group = false;
$selected_groups_array = explode(',', $values['groupId'][0]);
if (users_can_manage_group_all('RM') || ($selected_groups_array[0] !== '' && in_array(0, $selected_groups_array) === true)) {
// Return all group if user has permissions or it is a currently selected group.
if ((bool) \users_can_manage_group_all('RM') === true
|| ($selected_groups_array[0] !== ''
&& in_array(0, $selected_groups_array) === true)
) {
// Return all group if user has permissions or it is a currently
// selected group.
$return_all_group = true;
}
// Groups.
$inputs[] = [
'label' => __('Groups'),
'label' => \__('Groups'),
'arguments' => [
'type' => 'select_groups',
'name' => 'groupId[]',
@ -387,18 +395,31 @@ class EventsListWidget extends Widget
],
];
// Group recursion.
$inputs[] = [
'label' => \__('Group recursion'),
'arguments' => [
'type' => 'switch',
'name' => 'groupRecursion',
'value' => $values['groupRecursion'],
'return' => true,
],
];
// Tags.
$fields = tags_get_user_tags($config['id_user'], 'AR');
$fields = \tags_get_user_tags($config['id_user'], 'AR');
$inputs[] = [
'label' => __('Tags'),
'label' => \__('Tags'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'tagsId[]',
'selected' => explode(',', $values['tagsId'][0]),
'return' => true,
'multiple' => true,
'type' => 'select',
'fields' => $fields,
'name' => 'tagsId[]',
'selected' => explode(',', $values['tagsId'][0]),
'return' => true,
'multiple' => true,
'nothing' => __('None'),
'nothing_value' => 0,
],
];
@ -423,6 +444,7 @@ class EventsListWidget extends Widget
$values['severity'] = \get_parameter_switch('severity', -1);
$values['groupId'] = \get_parameter_switch('groupId', []);
$values['tagsId'] = \get_parameter_switch('tagsId', []);
$values['groupRecursion'] = \get_parameter_switch('groupRecursion', 0);
return $values;
}
@ -441,97 +463,138 @@ class EventsListWidget extends Widget
$return_all_group = false;
if (users_can_manage_group_all('RM')) {
if ((bool) \users_can_manage_group_all('RM') === true) {
$return_all_group = true;
}
$user_groups = \users_get_groups(false, 'AR', $return_all_group);
ui_require_css_file('events', 'include/styles/', true);
ui_require_css_file('tables', 'include/styles/', true);
\ui_require_css_file('events', 'include/styles/', true);
\ui_require_css_file('tables', 'include/styles/', true);
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
$this->values['tagsId'] = explode(',', $this->values['tagsId'][0]);
if (empty($this->values['groupId']) === true) {
$output .= __('You must select some group');
$output .= \__('You must select some group');
return $output;
}
$useTags = \tags_has_user_acl_tags($config['id_user']);
if ($useTags) {
$useTags = (bool) \tags_has_user_acl_tags($config['id_user']);
if ($useTags === true) {
if (empty($this->values['tagsId']) === true) {
$output .= __('You don\'t have access');
$output .= \__('You don\'t have access');
return;
}
}
$hours = ($this->values['maxHours'] * SECONDS_1HOUR);
$unixtime = (get_system_time() - $hours);
// Put hours in seconds.
$filter = [];
// Group all.
if (in_array(0, $this->values['groupId'])) {
$filter['id_grupo'] = array_keys($user_groups);
} else {
$filter['id_grupo'] = array_intersect($this->values['groupId'], array_keys($user_groups));
$order = [];
// Filtering.
$filter['event_view_hr'] = $hours;
// Group.
$filter['id_group_filter'] = $this->values['groupId'];
if (empty($filter['id_group_filter']) === true
|| $filter['id_group_filter'][0] === ''
|| $filter['id_group_filter'][0] === '0'
) {
// No filter specified. Don't filter at all...
$filter['id_group_filter'] = null;
}
if (empty($filter['id_grupo'])) {
$output .= '<div class="container-center">';
$output .= \ui_print_error_message(
__('You have no access'),
'',
true
// Tags.
if (empty($this->values['tagsId']) === false) {
$filter['tag_with'] = base64_encode(
json_encode($this->values['tagsId'])
);
$output .= '</div>';
return $output;
}
$filter['utimestamp'] = '>'.$unixtime;
// Severity.
if (isset($this->values['severity']) === true) {
$filter['severity'] = $this->values['severity'];
}
// Event types.
if (empty($this->values['eventType']) === false) {
$filter['event_type'] = $this->values['eventType'];
if ($filter['event_type'] === 'warning'
|| $filter['event_type'] === 'critical'
|| $filter['event_type'] === 'normal'
) {
$filter['event_type'] = '%'.$filter['event_type'].'%';
} else if ($filter['event_type'] === 'not_normal') {
unset($filter['event_type']);
$filter[] = '(event_type REGEXP "warning|critical|unknown")';
}
}
// Event status.
if ((int) $this->values['eventStatus'] !== -1) {
$filter['estado'] = $this->values['eventStatus'];
$filter['status'] = $this->values['eventStatus'];
}
$filter['limit'] = $this->values['limit'];
$filter['order'] = '`utimestamp` DESC';
// Order.
$order['field'] = 'timestamp';
$order['direction'] = 'DESC';
if (isset($this->values['severity']) === true) {
if ((int) $this->values['severity'] === 20) {
$filter['criticity'] = [
EVENT_CRIT_WARNING,
EVENT_CRIT_CRITICAL,
];
} else if ((int) $this->values['severity'] !== -1) {
$filter['criticity'] = $this->values['severity'];
}
$fields = [
'te.id_evento',
'te.id_agente',
'te.id_usuario',
'te.id_grupo',
'te.estado',
'te.timestamp',
'te.evento',
'te.utimestamp',
'te.event_type',
'te.id_alert_am',
'te.criticity',
'te.user_comment',
'te.tags',
'te.source',
'te.id_extra',
'te.critical_instructions',
'te.warning_instructions',
'te.unknown_instructions',
'te.owner_user',
'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp',
'te.custom_data',
'te.data',
'te.module_status',
'ta.alias as agent_name',
'tg.nombre as group_name',
];
if ((bool) \is_metaconsole() === false) {
$fields[] = 'am.nombre as module_name';
$fields[] = 'am.id_agente_modulo as id_agentmodule';
$fields[] = 'am.custom_id as module_custom_id';
$fields[] = 'ta.server_name as server_name';
} else {
$fields[] = 'ts.server_name as server_name';
$fields[] = 'te.id_agentmodule';
$fields[] = 'te.server_id';
}
if (empty($this->values['tagsId']) === false) {
foreach ($this->values['tagsId'] as $tag) {
$tag_name[$tag] = \tags_get_name($tag);
}
$filter['tags'] = $tag_name;
}
$events = \events_get_events($filter);
$events = \events_get_all(
// Fields.
$fields,
// Filter.
$filter,
// Offset.
null,
// Limit.
$this->values['limit'],
// Order.
$order['direction'],
// Sort field.
$order['field'],
// History.
false,
// SQL.
false,
// Having.
'',
// ValidatedEvents.
false,
// Recursive Groups.
(bool) $this->values['groupRecursion']
);
if ($events === false) {
$events = [];
@ -542,9 +605,9 @@ class EventsListWidget extends Widget
&& is_array($events) === true
&& empty($events) === false
) {
$output .= html_print_input_hidden(
$output .= \html_print_input_hidden(
'ajax_file',
ui_get_full_url('ajax.php', false, false, false),
\ui_get_full_url('ajax.php', false, false, false),
true
);
@ -558,15 +621,10 @@ class EventsListWidget extends Widget
foreach ($events as $event) {
$data = [];
$event['evento'] = io_safe_output($event['evento']);
if ($event['estado'] === 0) {
$img = 'images/pixel_red.png';
} else {
$img = 'images/pixel_green.png';
}
$event['evento'] = \io_safe_output($event['evento']);
$data[0] = events_print_type_img($event['event_type'], true);
$agent_alias = agents_get_alias($event['id_agente']);
$data[0] = \events_print_type_img($event['event_type'], true);
$agent_alias = \agents_get_alias($event['id_agente']);
if ($agent_alias !== '') {
$data[1] = '<a href="'.$config['homeurl'];
@ -577,15 +635,21 @@ class EventsListWidget extends Widget
$data[1] .= $agent_alias;
$data[1] .= '</a>';
} else {
$data[1] = '<em>'.__('Unknown').'</em>';
$data[1] = '&nbsp;';
}
// Group.
$data[2] = $event['group_name'];
// Tags.
$data[3] = $event['tags'];
$settings = json_encode(
[
'event' => $event,
'page' => 'include/ajax/events',
'cellId' => $id_cell,
'ajaxUrl' => ui_get_full_url(
'cellId' => $this->cellId,
'ajaxUrl' => \ui_get_full_url(
'ajax.php',
false,
false,
@ -596,35 +660,40 @@ class EventsListWidget extends Widget
);
if ($this->publicLink === false) {
$data[2] = '<a href="javascript:"onclick="dashboardShowEventDialog(\''.base64_encode($settings).'\');">';
$data[4] = '<a href="javascript:"onclick="';
$data[4] .= 'dashboardShowEventDialog(\'';
$data[4] .= base64_encode($settings).'\');">';
}
$data[2] .= substr(io_safe_output($event['evento']), 0, 150);
$data[4] .= substr(\io_safe_output($event['evento']), 0, 150);
if (strlen($event['evento']) > 150) {
$data[2] .= '...';
$data[4] .= '...';
}
if ($this->publicLink === false) {
$data[2] .= '<a>';
$data[4] .= '<a>';
}
$data[3] = ui_print_timestamp($event['timestamp'], true);
$data[5] = \ui_print_timestamp($event['timestamp'], true);
$table->data[$i] = $data;
$table->cellstyle[$i][0] = 'background: #E8E8E8;';
$rowclass = get_priority_class($event['criticity']);
$rowclass = \events_get_criticity_class($event['criticity']);
$table->cellclass[$i][1] = $rowclass;
$table->cellclass[$i][2] = $rowclass;
$table->cellclass[$i][3] = $rowclass;
$table->cellclass[$i][4] = $rowclass;
$table->cellclass[$i][5] = $rowclass;
$i++;
}
$output .= html_print_table($table, true);
$output .= \html_print_table($table, true);
$output .= "<div id='event_details_window'></div>";
$output .= "<div id='event_response_window'></div>";
$output .= "<div id='event_response_command_window' title='".__('Parameters')."'></div>";
$output .= ui_require_javascript_file(
$output .= "<div id='event_response_command_window' title='";
$output .= \__('Parameters')."'></div>";
$output .= \ui_require_javascript_file(
'pandora_events',
'include/javascript/',
true
@ -632,7 +701,7 @@ class EventsListWidget extends Widget
} else {
$output .= '<div class="container-center">';
$output .= \ui_print_info_message(
__('There are no events matching selected search filters'),
\__('There are no events matching selected search filters'),
'',
true
);
@ -650,7 +719,7 @@ class EventsListWidget extends Widget
*/
public static function getDescription()
{
return __('List of latest events');
return \__('List of latest events');
}

View File

@ -120,7 +120,9 @@ $publiclink['text'] .= html_print_image(
$publiclink['text'] .= '</a>';
// Refresh selector time dashboards.
if ($config['public_dashboard'] === true) {
if (isset($config['public_dashboard']) === true
&& (bool) $config['public_dashboard'] === true
) {
$urlRefresh = $publicUrl;
} else {
$queryRefresh = [
@ -188,7 +190,9 @@ $newWidget['text'] .= html_print_image(
);
$newWidget['text'] .= '</a>';
if ($config['public_dashboard'] === true) {
if (isset($config['public_dashboard']) === true
&& (bool) $config['public_dashboard'] === true
) {
$buttons = [
'combo_refresh_one_dashboard' => $comboRefresh,
'combo_refresh_countdown' => $comboRefreshCountdown,