Merge branch 'ent-12695-16818-eliminar-warnings-en-console-log' into 'develop'

Ent 12695 16818 eliminar warnings en console log

See merge request artica/pandorafms!6919
This commit is contained in:
Rafael Ameijeiras 2024-02-22 16:21:32 +00:00
commit 0cce999c95
111 changed files with 1005 additions and 365 deletions

View File

@ -496,6 +496,10 @@ function mainAgentsModules()
$agents = [];
}
if (isset($agents_id) === false) {
$agents_id = '';
}
$filter_agents = html_print_label_input_block(
__('Agents'),
html_print_select(

View File

@ -91,7 +91,7 @@ function mainModuleGroups()
$module_group_search = get_parameter('module_group_search', '');
// Check the user's group permissions.
$user_groups = users_get_groups($config['user'], 'AR');
$user_groups = users_get_groups($config['id_user'], 'AR');
$info = array_filter(
$info,
function ($v) use ($user_groups) {
@ -112,7 +112,7 @@ function mainModuleGroups()
);
if (empty($info) === false) {
$groups_view = ($is_not_paginated) ? $info : array_slice(
$groups_view = (isset($is_not_paginated) === true) ? $info : array_slice(
$info,
$offset,
$config['block_size']
@ -374,6 +374,10 @@ function mainModuleGroups()
'…'
);
$j = 1;
if (isset($background_color) === false) {
$background_color = 'none';
}
if (isset($array_data[$key])) {
foreach ($value['gm'] as $k => $v) {
if (isset($array_data[$key][$k])) {

View File

@ -273,6 +273,14 @@ function buildConnectionURL($method)
{
global $config;
if (isset($config['gotty_ssh_use_ssl']) === false) {
$config['gotty_ssh_use_ssl'] = '';
}
if (isset($config['gotty_telnet_use_ssl']) === false) {
$config['gotty_telnet_use_ssl'] = '';
}
$address = (empty($config['gotty_addr']) === true) ? $_SERVER['SERVER_ADDR'] : $config['gotty_addr'];
$use_ssl = ($method === 'ssh') ? $config['gotty_ssh_use_ssl'] : $config['gotty_telnet_use_ssl'];
$protocol = ((bool) $use_ssl === true) ? 'https://' : 'http://';
@ -353,6 +361,18 @@ function quickShellSettings()
config_update_value('gotty_telnet_enabled', $gotty_telnet_enabled);
}
if (isset($config['gotty_addr']) === false) {
$config['gotty_addr'] = '';
}
if (isset($config['gotty_ssh_use_ssl']) === false) {
$config['gotty_ssh_use_ssl'] = '';
}
if (isset($config['gotty_telnet_use_ssl']) === false) {
$config['gotty_telnet_use_ssl'] = '';
}
if ($config['gotty_addr'] != $gotty_addr) {
config_update_value('gotty_addr', $gotty_addr);
}
@ -389,6 +409,25 @@ function quickShellSettings()
$general_table->data = [];
$general_table->style = [];
$general_table->style[0] = 'width: 50%;';
if (isset($config['gotty_addr']) === false) {
$config['gotty_addr'] = '';
}
if (isset($config['gotty_ssh_enabled']) === false) {
$config['gotty_ssh_enabled'] = '';
}
if (isset($config['gotty_ssh_use_ssl']) === false) {
$config['gotty_ssh_use_ssl'] = '';
}
if (isset($disable_agentaccess) === false) {
$disable_agentaccess = '';
}
if (isset($config['gotty_telnet_use_ssl']) === false) {
$config['gotty_telnet_use_ssl'] = '';
}
$general_table->data[0][] = html_print_label_input_block(
__('Address'),

View File

@ -229,7 +229,7 @@ function users_extension_main_god($god=true)
$data = [];
$data[0] = '<a href="index.php?sec=gusuarios&amp;sec2=godmode/users/configure_user&amp;id='.$row['id_user'].'">'.$row['id_user'].'</a>';
$data[1] = $last_login_data['ip_origin'];
$data[1] = $last_login_data['ip_origen'];
$data[2] = date($config['date_format'], $last_login_data['utimestamp']);
$data[3] = date($config['date_format'], $row['last_connect']);
array_push($table->data, $data);

View File

@ -161,6 +161,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
'code' => false,
];
if (isset($_GET['sec']) === false) {
$_GET['sec'] = '';
}
if (!isset($_GET['sec2'])) {
$_GET['sec2'] = '';
}

View File

@ -152,9 +152,11 @@
echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.');
echo '<br/> <br/>';
echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name());
if ($config['logged'] == false) {
if (session_status() === PHP_SESSION_ACTIVE) {
session_destroy();
if (isset($config['logged']) === true) {
if ($config['logged'] == false) {
if (session_status() === PHP_SESSION_ACTIVE) {
session_destroy();
}
}
}
?>

View File

@ -246,6 +246,7 @@ if ($new_agent === true) {
// QR Code table.
$CodeQRContent = '';
if ($new_agent === false) {
$CodeQRContent .= html_print_div(['id' => 'qr_container_image'], true);
$CodeQRContent .= html_print_anchor(

View File

@ -55,7 +55,7 @@ if ($id_field) {
$display_on_front = $field['display_on_front'];
$is_password_type = $field['is_password_type'];
$combo_values = $field['combo_values'] ? $field['combo_values'] : '';
$is_combo_enable = $config['is_combo_enable'];
$is_combo_enable = (isset($config['is_combo_enable']) === true) ? $config['is_combo_enable'] : false;
$is_link_enabled = $field['is_link_enabled'];
$header_title = __('Update agent custom field');
} else {
@ -162,6 +162,10 @@ $table->data[2][0] = html_print_label_input_block(
)
);
if (isset($config['is_combo_enable']) === false) {
$config['is_combo_enable'] = false;
}
$table->data[2][1] = html_print_label_input_block(
__('Enabled combo'),
html_print_checkbox_switch_extended(

View File

@ -109,7 +109,7 @@ if (is_ajax()) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$field_description = $fields_descriptions[($i - 1)];
$field_value = $fields_values[($i - 1)];
$field_hidden = $fields_hidden_checked[($i - 1)];
$field_hidden = (isset($fields_hidden_checked[($i - 1)]) === true) ? $fields_hidden_checked[($i - 1)] : '';
if (!empty($field_description)) {

View File

@ -253,7 +253,7 @@ if (is_metaconsole() === true) {
echo '<br>';
}
if (!$id_cluster) {
if (isset($id_cluster) === false) {
ui_toggle(
$form_filter,
'<span class="subsection_header_title">'.__('Alert control filter').'</span>',
@ -1115,7 +1115,7 @@ if (isset($dont_display_alert_create_bttn)) {
}
}
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) {
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && isset($id_cluster) === false) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
$actionButtons = html_print_submit_button(
__('Create'),

View File

@ -242,6 +242,7 @@ if (empty($result) === false) {
html_print_table($table);
$tablePagination = ui_pagination($total_categories, $url, $offset, 0, true, 'offset', false);
} else {
$tablePagination = '';
// No categories available or selected.
ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]);
}

View File

@ -195,13 +195,13 @@ foreach ($extensions as $file => $extension) {
$data[] = '<i class="grey">'.$file.'</i>';
// Get version of this extensions
if ($config['extensions'][$file]['operation_menu']) {
if (isset($config['extensions'][$file]['operation_menu']) === true) {
$data[] = $config['extensions'][$file]['operation_menu']['version'];
} else if ($config['extensions'][$file]['godmode_menu']) {
} else if (isset($config['extensions'][$file]['godmode_menu']) === true) {
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
} else if ($config['extensions'][$file]['extension_ope_tab']) {
} else if (isset($config['extensions'][$file]['extension_ope_tab']) === true) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
} else if ($config['extensions'][$file]['extension_god_tab']) {
} else if (isset($config['extensions'][$file]['extension_god_tab']) === true) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
} else {
$data[] = __('N/A');
@ -216,7 +216,7 @@ foreach ($extensions as $file => $extension) {
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
} else if (isset($config['extensions'][$file]['extension_ope_tab'])) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
} else if ($config['extensions'][$file]['extension_god_tab']) {
} else if (isset($config['extensions'][$file]['extension_god_tab']) === true) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
} else {
$data[] = __('N/A');

View File

@ -1205,9 +1205,9 @@ $tab = 'group_edition';
<script type="text/javascript">
let show_full_hirearchy = "<?php echo $show_full_hirearchy; ?>";
let show_not_init_agents = "<?php echo $show_not_init_agents; ?>";
let show_not_init_modules = "<?php echo $show_not_init_modules; ?>";
let show_full_hirearchy = "<?php echo (isset($show_full_hirearchy) === true) ? $show_full_hirearchy : ''; ?>";
let show_not_init_agents = "<?php echo (isset($show_not_init_agents) === true) ? $show_not_init_agents : ''; ?>";
let show_not_init_modules = "<?php echo (isset($show_not_init_modules) === true) ? $show_not_init_modules : ''; ?>";
$('#checkbox-show_full_hirearchy').on("change", function() {
if (show_full_hirearchy == 1) {

View File

@ -134,7 +134,7 @@ $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_label_input_block(
__('Group recursion'),
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
html_print_checkbox('recursion', 1, ($recursion ?? false), true, false, '', true)
);
$arr_policies = policies_get_policies();

View File

@ -138,7 +138,7 @@ $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_label_input_block(
__('Group recursion'),
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
html_print_checkbox('recursion', 1, ($recursion ?? false), true, false, '', true)
);
$arr_policies = policies_get_policies();

View File

@ -631,8 +631,8 @@ if (is_metaconsole() === true) {
echo '<form method="post" autocomplete="off" id="form_agent" action="'.$url.'">';
echo html_print_avoid_autocomplete();
$params = [
'id_group' => $id_group,
'recursion' => $recursion,
'id_group' => ($id_group ?? ''),
'recursion' => ($recursion ?? ''),
];
echo get_table_inputs_masive_agents($params);
@ -712,9 +712,9 @@ if (is_metaconsole() === false) {
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Module').'&nbsp;';
$table->data[0][1] .= html_print_select(
$modules,
($modules ?? ''),
'cascade_protection_module',
$cascade_protection_module,
($cascade_protection_module ?? ''),
'',
'',
0,
@ -1162,7 +1162,7 @@ $table->data[7][0] = __('Safe operation mode').': '.ui_print_help_tip(
),
true
);
$table->data[7][1] .= html_print_select(
$table->data[7][1] = html_print_select(
[
1 => __('Enabled'),
0 => __('Disabled'),
@ -1229,7 +1229,7 @@ if ($fields === false) {
foreach ($fields as $field) {
$data[0] = '<b>'.$field['name'].'</b>';
$combo = [];
$combo = $field['combo_values'];
$combo = ($field['combo_values'] ?? '');
$combo = explode(',', $combo);
$combo_values = [];
foreach ($combo as $value) {
@ -1258,7 +1258,7 @@ foreach ($fields as $field) {
'',
30,
100,
$view_mode,
($view_mode ?? ''),
'',
'',
true,

View File

@ -421,7 +421,7 @@ $table->data[4][0] = html_print_label_input_block(
html_print_select(
$tags,
'tags[]',
$tags_name,
($tags_name ?? ''),
false,
__('Any'),
-1,
@ -537,7 +537,7 @@ $table->data[8][0] = html_print_label_input_block(
html_print_select(
$tags,
'tags[]',
$tags_name,
($tags_name ?? ''),
false,
__('Any'),
-1,
@ -1304,7 +1304,7 @@ $table->data[29][0] = html_print_label_input_block(
html_print_select_from_sql(
'SELECT id_tag, name FROM ttag ORDER BY name',
'id_tag[]',
$id_tag,
($id_tag ?? ''),
'',
__('None'),
'0',

View File

@ -476,12 +476,12 @@ if (is_metaconsole() === false) {
$timezone_name = 'Asia/Shanghai';
}
$area_data_timezone_polys .= '';
$area_data_timezone_polys = '';
foreach ($tz['polys'] as $coords) {
$area_data_timezone_polys .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="poly" coords="'.implode(',', $coords).'" />';
}
$area_data_timezone_rects .= '';
$area_data_timezone_rects = '';
foreach ($tz['rects'] as $coords) {
$area_data_timezone_rects .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="rect" coords="'.implode(',', $coords).'" />';
}
@ -543,7 +543,7 @@ echo sprintf(
'<div class="edit_user_options">%s %s %s %s %s %s %s %s %s %s</div>',
$language,
$size_pagination,
$skin,
($skin ?? ''),
$home_screen,
$event_filter,
$autorefresh_show,

View File

@ -348,6 +348,10 @@ if (check_acl($config['id_user'], 0, 'UM')) {
$onheader['user_agents'] = $userstab;
}
if (isset($servicestab) === false) {
$servicestab = '';
}
$onheader['massive_alerts'] = $alertstab;
$onheader['massive_policies_alerts'] = $policiesalertstab;
$onheader['massive_policies_alerts_external'] = $policiesalertsexternaltab;

View File

@ -524,10 +524,12 @@ if ($access_console_node === true) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$show_ipam = false;
$ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network');
foreach ($ipam as $row) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
$show_ipam = true;
break;
if ($ipam !== false) {
foreach ($ipam as $row) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
$show_ipam = true;
break;
}
}
}
}

View File

@ -686,6 +686,12 @@ $table->data[0][] = html_print_label_input_block(
)
);
if (isset($component) === false) {
$component = [];
$component['id'] = '';
$component['id_nc'] = '';
}
$filter_action_url = 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&search_string='.urlencode(io_safe_output($search_string)).'&search_id_group'.$search_id_group.'&pure='.$pure;
$toggleFilters = '<form class="filters_form" method="POST" action="'.$filter_action_url.'">';
$toggleFilters .= html_print_table($table, true);
@ -824,7 +830,7 @@ foreach ($components as $component) {
$data[0] = io_safe_output($component['name']);
}
$data[1] .= ui_print_servertype_icon((int) $component['id_modulo']);
$data[1] = ui_print_servertype_icon((int) $component['id_modulo']);
$data[2] = ui_print_moduletype_icon($component['type'], true);
$data[3] = "<span class='font_8px'>".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').'</span>';

View File

@ -221,6 +221,9 @@ $search = trim(get_parameter('search', ''));
$graphs = custom_graphs_get_user($config['id_user'], false, true, $access);
$offset = (int) get_parameter('offset');
$table_aux = new stdClass();
if (isset($strict_user) === false) {
$strict_user = false;
}
$table_aux->width = '100%';
if (is_metaconsole() === true) {
@ -273,7 +276,11 @@ if (is_metaconsole() === true) {
html_print_input_text('search', $search, '', 30, '', true)
);
$searchForm .= '<form action="index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group='.$id_group.'&pure='.$pure.'"method="post">';
if (isset($pure) === false) {
$pure = '';
}
$searchForm = '<form action="index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group='.$id_group.'&pure='.$pure.'"method="post">';
$searchForm .= html_print_table($table_aux, true);
$searchForm .= html_print_div(

View File

@ -130,6 +130,14 @@ if ($action === 'new') {
$backgroundPreviewImages[] = html_print_image('', true, ['id' => 'imagen', 'class' => 'invisible']);
if (isset($formAction) === false) {
$formAction = 'POST';
}
if (isset($formHidden) === false) {
$formHidden = '';
}
// Form.
echo '<form id="back" class="max_floating_element_size" method="POST" action="'.$formAction.'" enctype="multipart/form-data">';
echo $formHidden;

View File

@ -285,7 +285,11 @@ switch ($activeTab) {
}
// If the background is changed the size is reseted
$background_now = $visualConsole['background'];
if (isset($visualConsole['background']) === true) {
$background_now = $visualConsole['background'];
} else {
$background_now = '';
}
$values['width'] = $width;
$values['height'] = $height;

View File

@ -268,8 +268,8 @@ echo '</div>';
if (msg.status === true) {
title = "<?php echo __('Importation successfully completed'); ?>";
message = "<?php echo __('PRD import successfull:'); ?>";
const name = "<?php echo $name; ?>";
const type = "<?php echo $type; ?>";
const name = "<?php echo ($name ?? ''); ?>";
const type = "<?php echo ($type ?? ''); ?>";
message += ` ${type} - ${name}`;
} else {
title = "<?php echo __('Import failure'); ?>";

View File

@ -496,8 +496,8 @@ if (isset($_GET['server']) === true) {
<script language="javascript" type="text/javascript">
$(document).ready (function () {
var id_server = '<?php echo $id_server; ?>';
var server_type = '<?php echo $row['server_type']; ?>';
var id_server = '<?php echo ($id_server ?? ''); ?>';
var server_type = '<?php echo ($row['server_type'] ?? ''); ?>';
$("#check_exec_server img").on("click", function () {
$("#check_exec_server img").attr("src", "images/spinner.gif");

View File

@ -1172,6 +1172,10 @@ if (empty($create) === false || empty($view) === false) {
}
ui_require_javascript_file('pandora_modules');
if (isset($locked) === false) {
$locked = '';
}
?>
<script type="text/javascript">

View File

@ -523,27 +523,29 @@ if ($error === null) {
}
}
if (file_exists($uploaded_filename) === true) {
if (is_metaconsole() === true && is_management_allowed() === true) {
// Keep uploaded file to be transferred to nodes.
if (is_dir($config['attachment_store'].'/downloads/') === false) {
mkdir($config['attachment_store'].'/downloads/');
}
if (isset($uploaded_filename) === true) {
if (file_exists($uploaded_filename) === true) {
if (is_metaconsole() === true && is_management_allowed() === true) {
// Keep uploaded file to be transferred to nodes.
if (is_dir($config['attachment_store'].'/downloads/') === false) {
mkdir($config['attachment_store'].'/downloads/');
}
$keep = move_uploaded_file(
$uploaded_filename,
$config['attachment_store'].'/downloads/'.$filename
);
if ($keep === false) {
$error = __(
'Cannot move uploaded file to %s.',
$config['attachment_store'].'/downloads/'
$keep = move_uploaded_file(
$uploaded_filename,
$config['attachment_store'].'/downloads/'.$filename
);
if ($keep === false) {
$error = __(
'Cannot move uploaded file to %s.',
$config['attachment_store'].'/downloads/'
);
}
} else {
// Clean temporary files.
unlink($uploaded_filename);
}
} else {
// Clean temporary files.
unlink($uploaded_filename);
}
}

View File

@ -146,9 +146,9 @@ foreach ($servers as $server) {
// Type.
$data[2] = '<span class="nowrap">'.$server['img'].'&nbsp;&nbsp;&nbsp;&nbsp;'.$server['server_name'];
if ($server['master'] == $master) {
$data[3] .= __('Yes', true);
$data[3] = __('Yes', true);
} else {
$data[3] .= __('-');
$data[3] = __('-');
}
if ((int) $server['exec_proxy'] === 1) {

View File

@ -116,6 +116,10 @@ if ($display_loading === true || $running_create === true || $running_delete) {
$table_load->size = [];
$table_load->size[0] = '50%';
$table_load->size[1] = '50%';
$list_mkup = '';
if (isset($operation['id']) === false) {
$operation['id'] = 0;
}
$table_load->data['row0'][] = progress_bar(
0,

View File

@ -70,6 +70,10 @@ if (isset($config['filemanager']['message']) === true) {
// Add custom directories here.
$fallback_directory = 'images';
// Get directory.
if (isset($text) === false) {
$text = '';
}
$directory = (string) get_parameter('directory');
$directory = str_replace('&lt;', '', $text);
$directory = str_replace('&gt;', '', $text);
@ -90,7 +94,12 @@ $create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/');
// Remove double dot in filename path.
$file_name = $_FILES['file']['name'];
if (isset($_FILES['file']) === true) {
$file_name = $_FILES['file']['name'];
} else {
$file_name = '';
}
$path_parts = explode('/', $file_name);
$stripped_parts = array_filter(

View File

@ -399,7 +399,7 @@ $table->data[0][0] = html_print_label_input_block(
__('Total Agents'),
html_print_input_text(
'total_agents',
$total_agents,
($total_agents ?? ''),
'',
30,
255,
@ -412,7 +412,7 @@ $table->data[0][1] = html_print_label_input_block(
__('Network & other devices'),
html_print_input_text(
'type_network',
$network_others,
($network_others ?? ''),
'',
30,
255,
@ -425,7 +425,7 @@ $table->data[1][0] = html_print_label_input_block(
__('Workstations'),
html_print_input_text(
'type_workstation',
$workstations,
($workstations ?? ''),
'',
30,
255,
@ -438,7 +438,7 @@ $table->data[1][1] = html_print_label_input_block(
__('Servers'),
html_print_input_text(
'type_server',
$servers,
($servers ?? ''),
'',
30,
255,

View File

@ -389,6 +389,10 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
echo '<td>'.__('No').'</b></td>';
}
if (isset($tdcolor) === false) {
$tdcolor = '';
}
echo '<td class="'.$tdcolor.' table_action_buttons"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row['id_news'].'&borrar='.$row['id_news'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['border' => '0', 'class' => 'invert_filter main_menu_icon']).'</a></td></tr>';
}

View File

@ -164,9 +164,8 @@ if (is_metaconsole() === true) {
html_print_action_buttons(
$buttons,
[
'type' => 'data_table',
'class' => 'fixed_action_buttons',
'right_content' => $tablePagination,
'type' => 'data_table',
'class' => 'fixed_action_buttons',
]
);

View File

@ -437,15 +437,19 @@ if (isset($config['error_config_update_config'])) {
ui_print_success_message(__('Correct update the setup options'));
}
if (is_array($config['error_config_update_config']['errors']) === true) {
foreach ($config['error_config_update_config']['errors'] as $msg) {
ui_print_error_message($msg);
if (isset($config['error_config_update_config']['errors']) === true) {
if (is_array($config['error_config_update_config']['errors']) === true) {
foreach ($config['error_config_update_config']['errors'] as $msg) {
ui_print_error_message($msg);
}
}
}
if (is_array($config['error_config_update_config']['warnings']) === true) {
foreach ($config['error_config_update_config']['warnings'] as $msg) {
ui_print_warning_message($msg);
if (isset($config['error_config_update_config']['warnings']) === true) {
if (is_array($config['error_config_update_config']['warnings']) === true) {
foreach ($config['error_config_update_config']['warnings'] as $msg) {
ui_print_warning_message($msg);
}
}
}

View File

@ -137,6 +137,10 @@ $row['hostname'] = html_print_label_input_block(
['div_class' => 'ITSM-remote-setup-ITSM_hostname']
);
if (isset($config['ITSM_token']) === false) {
$config['ITSM_token'] = '';
}
// ITSM token.
$row['password'] = html_print_label_input_block(
__('Token'),

View File

@ -390,7 +390,7 @@ if (is_ajax() === true) {
set_unless_defined($config['double_auth_enabled'], false);
$row = [];
$row['name'] = __('Double authentication');
$row['control'] .= html_print_checkbox_switch(
$row['control'] = html_print_checkbox_switch(
'double_auth_enabled',
1,
$config['double_auth_enabled'],
@ -405,7 +405,7 @@ if (is_ajax() === true) {
set_unless_defined($config['2FA_all_users'], false);
$row = [];
$row['name'] = __('Force 2FA for all users is enabled');
$row['control'] .= html_print_checkbox_switch(
$row['control'] = html_print_checkbox_switch(
'2FA_all_users',
1,
$config['2FA_all_users'],

View File

@ -78,6 +78,18 @@ $table_remote->class = 'databox filters filter-table-adv';
$table_remote->size['ehorus_hostname'] = '50%';
$table_remote->size['ehorus_port'] = '50%';
if (isset($config['ehorus_user_level_conf']) === false) {
$config['ehorus_user_level_conf'] = '';
}
if (isset($config['ehorus_user']) === false) {
$config['ehorus_user'] = '';
}
if (isset($config['ehorus_pass']) === false) {
$config['ehorus_pass'] = '';
}
// Enable eHorus user configuration.
$row = [];
$row['ehorus_user_level_conf'] = html_print_label_input_block(

View File

@ -488,6 +488,10 @@ $table->data[$i][] = html_print_label_input_block(
)
);
if (isset($config['force_public_url']) === false) {
$config['force_public_url'] = '';
}
$table->data[$i++][] = html_print_label_input_block(
__('Force use Public URL'),
html_print_switch(
@ -498,6 +502,10 @@ $table->data[$i++][] = html_print_label_input_block(
)
);
if (isset($config['public_url_exclusions']) === false) {
$config['public_url_exclusions'] = '';
}
$table->data[$i++][] = html_print_label_input_block(
__('Public URL host exclusions'),
html_print_textarea(
@ -919,6 +927,10 @@ echo '<legend>'.__('Mail configuration').'</legend>';
$table_ncm_config->size[0] = '50%';
$table_ncm_config->data = [];
if (isset($config['tftp_server_ip']) === false) {
$config['tftp_server_ip'] = '';
}
$table_ncm_config->data[0][] = html_print_label_input_block(
__('FTP server IP').ui_print_help_tip(__('This value will be used by TFTP_SERVER_IP macro in NCM scripts.'), true),
html_print_input_text(

View File

@ -74,6 +74,8 @@ if ($view === 'create' || $view === 'edit') {
if (count($errors) === 0) {
if (count($files) > 0) {
$uploadImages = $tipsWindow->uploadImages($files);
} else {
$uploadImages = '';
}
$response = $tipsWindow->createTip($id_lang, $id_profile, $title, $text, $url, $enable, $uploadImages);

View File

@ -2087,7 +2087,7 @@ if ($create_alert || $update_alert) {
FROM talert_actions
ORDER BY name',
'alert_type',
$alert_type,
($alert_type ?? ''),
'',
'',
0,
@ -2100,26 +2100,26 @@ if ($create_alert || $update_alert) {
echo '</tr>';
$al = [
'al_field1' => $al_field1,
'al_field2' => $al_field2,
'al_field3' => $al_field3,
'al_field4' => $al_field4,
'al_field5' => $al_field5,
'al_field6' => $al_field6,
'al_field7' => $al_field7,
'al_field8' => $al_field8,
'al_field9' => $al_field9,
'al_field10' => $al_field10,
'al_field11' => $al_field11,
'al_field12' => $al_field12,
'al_field13' => $al_field13,
'al_field14' => $al_field14,
'al_field15' => $al_field15,
'al_field16' => $al_field16,
'al_field17' => $al_field17,
'al_field18' => $al_field18,
'al_field19' => $al_field19,
'al_field20' => $al_field20,
'al_field1' => ($al_field1 ?? ''),
'al_field2' => ($al_field2 ?? ''),
'al_field3' => ($al_field3 ?? ''),
'al_field4' => ($al_field4 ?? ''),
'al_field5' => ($al_field5 ?? ''),
'al_field6' => ($al_field6 ?? ''),
'al_field7' => ($al_field7 ?? ''),
'al_field8' => ($al_field8 ?? ''),
'al_field9' => ($al_field9 ?? ''),
'al_field10' => ($al_field10 ?? ''),
'al_field11' => ($al_field11 ?? ''),
'al_field12' => ($al_field12 ?? ''),
'al_field13' => ($al_field13 ?? ''),
'al_field14' => ($al_field14 ?? ''),
'al_field15' => ($al_field15 ?? ''),
'al_field16' => ($al_field16 ?? ''),
'al_field17' => ($al_field17 ?? ''),
'al_field18' => ($al_field18 ?? ''),
'al_field19' => ($al_field19 ?? ''),
'al_field20' => ($al_field20 ?? ''),
];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -2287,7 +2287,7 @@ $(document).ready (function () {
});
values.push({
name: "content_type",
value: "<?php echo $al_field4; ?>"
value: "<?php echo ($al_field4 ?? ''); ?>"
})
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,

View File

@ -377,11 +377,15 @@ if ($edit_filter > -2) {
echo '</form></div>';
}
if (isset($index) === false) {
$index = 0;
}
?>
<script type="text/javascript">
// +1 because there is already a defined 'filter' field.
var id = parseInt("<?php echo $index; ?>")+1;
var id = parseInt("<?php echo $index; ?>")+1;
var homeurl = "<?php echo $config['homeurl']; ?>";
$(document).ready (function () {

View File

@ -99,7 +99,7 @@ if (!$action_update_url_update_manager) {
);
$allow_offline_patches = get_parameter_switch(
'allow_offline_patches',
$config['allow_offline_patches']
($config['allow_offline_patches'] ?? '')
);
$lts_updates = get_parameter_switch(
'lts_updates',

View File

@ -1113,11 +1113,15 @@ if (!$new_user) {
$user_id .= $apiTokenContent;
$CodeQRContent .= html_print_div(['id' => 'qr_container_image', 'class' => 'scale-0-8'], true);
$CodeQRContent = html_print_div(['id' => 'qr_container_image', 'class' => 'scale-0-8'], true);
$CodeQRContent .= html_print_anchor(
['id' => 'qr_code_agent_view'],
true
);
if (isset($custom_id_div) === false) {
$custom_id_div = '';
}
$CodeQRContent .= '<br/>'.$custom_id_div;
// QR code div.

View File

@ -64,6 +64,16 @@ if ($dashboards === false) {
}
}
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
$layouts_aux = ['None' => 'None'];
} else {
foreach ($layouts as $layout) {
$layouts_aux[$layout] = $layout;
}
}
// Custom Home Screen controls.
$customHomeScreenAddition = [];
// Home screen. Dashboard.
@ -81,21 +91,12 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
false,
'width: 100%'
);
// Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
// Home screen. External link and Other.
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 400, true);
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
$layouts_aux = ['None' => 'None'];
} else {
foreach ($layouts as $layout) {
$layouts_aux[$layout] = $layout;
}
}
// Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select(
$layouts_aux,
@ -889,7 +890,7 @@ if (users_is_admin($config['id_user']) === true || (bool) check_acl($config['id_
true
);
$userManagementTable->data['fields_addSettings'][1] .= html_print_div(
$userManagementTable->data['fields_addSettings'][1] = html_print_div(
[
'class' => 'edit_user_allowed_ip '.(((int) $user_info['allowed_ip_active'] === 1) ? '' : 'invisible'),
'content' => html_print_textarea(
@ -914,6 +915,7 @@ if (users_is_admin($config['id_user']) === true || (bool) check_acl($config['id_
);
}
$ITSM_host = '';
if ($config['ITSM_enabled'] && $config['ITSM_user_level_conf']) {
// Pandora ITSM user remote login.
$table_ITSM = new StdClass();

View File

@ -66,7 +66,8 @@ class Applications extends Wizard
int $page=0,
string $msg='Default message. Not set.',
string $icon='images/wizard/applications.png',
string $label='Applications'
string $label='Applications',
string $class_style='',
) {
$this->setBreadcrum([]);

View File

@ -321,7 +321,7 @@ class Cloud extends Wizard
ui_print_error_message($this->msg);
}
if ($empty_account === true) {
if (isset($empty_account) === true) {
ui_print_error_message($this->msg);
}
@ -357,7 +357,7 @@ class Cloud extends Wizard
'name' => 'account_identifier',
'type' => 'select',
'fields' => CredentialStore::getKeys($this->keyStoreType),
'selected' => $this->keyIdentifier,
'selected' => (isset($this->keyIdentifier) === true) ? $this->keyIdentifier : '',
'return' => true,
],
],
@ -408,7 +408,7 @@ class Cloud extends Wizard
{
global $config;
$pandora = io_safe_output($config['cloud_util_path']);
$pandora = io_safe_output(($config['cloud_util_path'] ?? ''));
if (isset($pandora) === false) {
config_update_value('cloud_util_path', '/usr/bin/pandora-cm-api');
@ -419,7 +419,7 @@ class Cloud extends Wizard
return false;
}
if ($this->keyIdentifier === null) {
if (isset($this->keyIdentifier) === false) {
// Ask user for available credentials.
$this->msg = __('Select a set of credentials from the list');
$this->status = null;
@ -496,7 +496,7 @@ class Cloud extends Wizard
*/
public function getCredentials()
{
return CredentialStore::getKey($this->keyIdentifier);
return CredentialStore::getKey((isset($this->keyIdentifier) === true) ? $this->keyIdentifier : '');
}

View File

@ -66,7 +66,8 @@ class Custom extends Wizard
int $page=0,
string $msg='Default message. Not set.',
string $icon='/images/wizard/Custom_apps@svg.svg',
string $label='Custom'
string $label='Custom',
string $class_style='',
) {
$this->setBreadcrum([]);

View File

@ -629,7 +629,7 @@ class DiscoveryTaskList extends HTML
// Updated at.
$table->headstyle[8] .= 'min-width: 50px; width: 150px;';
// Operations.
$table->headstyle[9] .= 'min-width: 150px; width: 250px;';
$table->headstyle[9] = 'min-width: 150px; width: 250px;';
if (check_acl($config['id_user'], 0, 'AW')) {
$table->head[0] = __('Force');
@ -1135,6 +1135,10 @@ class DiscoveryTaskList extends HTML
array_push($table->data, $data);
}
if (isset($server_name) === false) {
$server_name = '';
}
if (empty($table->data)) {
$content = '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no discovery tasks assigned').'</div>';
$return = false;

View File

@ -813,8 +813,36 @@ class HostDevices extends Wizard
// Interval and schedules.
$interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
if (isset($this->task['interval_sweep']) === true) {
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
}
} else {
$this->task['interval_sweep'] = '';
}
if (isset($this->task['name']) === false) {
$this->task['name'] = '';
}
if (isset($this->task['id_recon_server']) === false) {
$this->task['id_recon_server'] = '';
}
if (isset($this->task['subnet_csv']) === false) {
$this->task['subnet_csv'] = '';
}
if (isset($this->task['subnet']) === false) {
$this->task['subnet'] = '';
}
if (isset($this->task['id_group']) === false) {
$this->task['id_group'] = 0;
}
if (isset($this->task['description']) === false) {
$this->task['description'] = '';
}
$form['rows'][0]['new_form_block'] = true;

View File

@ -214,7 +214,8 @@ class ManageExtensions extends HTML
break;
default:
continue;
// Nothing.
break;
}
}

View File

@ -104,6 +104,20 @@ class Wizard
*/
public $rootUrl;
/**
* Task.
*
* @var mixed
*/
public $task;
/**
* Max pages net scan.
*
* @var mixed
*/
public $maxPagesNetScan;
/**
* Setter for breadcrum
@ -221,6 +235,10 @@ class Wizard
$i = 0;
foreach ($urls as $url) {
if (isset($url['selected']) === false) {
$url['selected'] = 0;
}
if ($url['selected'] == 1) {
$class = 'selected';
} else {

View File

@ -431,6 +431,10 @@ if ($get_agent_alerts_datatable === true) {
if (empty($filter_alert['free_search']) === false) {
$free_search_alert = $filter_alert['free_search'];
} else {
if (isset($filter_alert['free_search_alert']) === false) {
$filter_alert['free_search_alert'] = '';
}
$free_search_alert = $filter_alert['free_search_alert'];
}
@ -635,6 +639,10 @@ if ($get_agent_alerts_datatable === true) {
}
$alerts = [];
if (isset($agent_view_page) === false) {
$agent_view_page = false;
}
if ($agent_view_page === true) {
$options_simple = ['order' => $order];
} else {

View File

@ -71,7 +71,7 @@ if ($get_all_datatables_formatted === true) {
// Datatables format: RecordsTotal && recordsfiltered.
echo json_encode(
[
'data' => $data,
'data' => ($data ?? ''),
'recordsTotal' => $count,
'recordsFiltered' => $count,
]

View File

@ -58,6 +58,10 @@ if (check_login()) {
if ($check_csv_button) {
if (check_acl($config['id_user'], 0, 'PM')) {
if (isset($permission) === false) {
$permission = '';
}
echo json_encode($permission);
return;
} else {

View File

@ -186,9 +186,9 @@ if ($action === 'create_demo_data') {
}
$modules_data = $ini_agent_data['modules'];
$inventory = $ini_agent_data['inventory'];
$inventory_values = $ini_agent_data['inventory_values'];
$traps = $ini_agent_data['traps'];
$inventory = (isset($ini_agent_data['inventory']) === true) ? $ini_agent_data['inventory'] : '';
$inventory_values = (isset($ini_agent_data['inventory_values']) === true) ? $ini_agent_data['inventory_values'] : '';
$traps = (isset($ini_agent_data['traps']) === true) ? $ini_agent_data['traps'] : '';
$address_network = $agent_data['address_network'];
@ -435,11 +435,15 @@ if ($action === 'create_demo_data') {
$module_description = '';
if (isset($modules_array['description']) === true && is_string($modules_array['description']) === true) {
if (isset($mac) === false) {
$mac = '';
}
$module_description = str_replace('_mac_', $mac, $modules_array['description']);
}
$values = [
'unit' => $modules_array['unit'],
'unit' => (isset($modules_array['unit']) === true) ? $modules_array['unit'] : '',
'descripcion' => $module_description,
'id_tipo_modulo' => $id_tipo,
'id_module_group' => ($modules_array['group'] ?? 0),
@ -597,8 +601,12 @@ if ($action === 'create_demo_data') {
while (1) {
// Insert in tmodule_inventory.
$modules_array = [];
foreach ($inventory as $key => $value) {
$modules_array[$key] = ($value[$module_access_idx] ?? null);
if (isset($inventory) === true) {
if ($inventory !== '') {
foreach ($inventory as $key => $value) {
$modules_array[$key] = ($value[$module_access_idx] ?? null);
}
}
}
$module_access_idx++;
@ -3307,6 +3315,26 @@ if ($action === 'create_demo_data') {
$module_values['module_interval'] = $interval;
$module_values['id_modulo'] = 4;
$module_values['id_plugin'] = $created_plugin_id;
if (isset($traps_target_ip) === false) {
$traps_target_ip = '';
}
if (isset($traps_community) === false) {
$traps_community = '';
}
if (isset($tentacle_target_ip) === false) {
$tentacle_target_ip = '';
}
if (isset($tentacle_port) === false) {
$tentacle_port = '';
}
if (isset($tentacle_extra_options) === false) {
$tentacle_extra_options = '';
}
$module_values['macros'] = '{"1":{"macro":"_field1_","desc":"Agents&#x20;files&#x20;folder&#x20;path","help":"","value":"/usr/share/pandora_server/util/plugin/demodata_agents","hide":""},"2":{"macro":"_field2_","desc":"Number&#x20;of&#x20;agents","help":"","value":"'.$total_agents_to_create.'","hide":""},"3":{"macro":"_field3_","desc":"Traps&#x20;target&#x20;IP","help":"","value":"'.$traps_target_ip.'","hide":""},"4":{"macro":"_field4_","desc":"Traps&#x20;community","help":"","value":"'.$traps_community.'","hide":""},"5":{"macro":"_field5_","desc":"Tentacle&#x20;target&#x20;IP","help":"","value":"'.$tentacle_target_ip.'","hide":""},"6":{"macro":"_field6_","desc":"Tentacle&#x20;port","help":"","value":"'.$tentacle_port.'","hide":""},"7":{"macro":"_field7_","desc":"Tentacle&#x20;extra&#x20;options","help":"","value":"'.$tentacle_extra_options.'","hide":""}}';
$id_plugin_module = modules_create_agent_module(

View File

@ -452,7 +452,7 @@ class CustomNetScan extends Wizard
'label' => __('Task name'),
'arguments' => [
'name' => 'taskname',
'value' => $this->task['name'],
'value' => (isset($this->task['name']) === true) ? $this->task['name'] : '',
'type' => 'text',
'size' => 50,
],
@ -474,7 +474,7 @@ class CustomNetScan extends Wizard
'label' => __('Comment'),
'arguments' => [
'name' => 'comment',
'value' => $this->task['description'],
'value' => (isset($this->task['description']) === true) ? $this->task['description'] : '',
'type' => 'text',
'size' => 50,
],
@ -496,7 +496,7 @@ class CustomNetScan extends Wizard
SERVER_TYPE_DISCOVERY
),
'name' => 'id_recon_server',
'selected' => $this->task['id_recon_server'],
'selected' => (isset($this->task['id_recon_server']) === true) ? $this->task['id_recon_server'] : '',
'return' => true,
],
];
@ -509,7 +509,7 @@ class CustomNetScan extends Wizard
'returnAllGroup' => false,
'privilege' => $this->access,
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'selected' => (isset($this->task['id_group']) === true) ? $this->task['id_group'] : '',
'return' => true,
'size' => '400px',
],
@ -517,8 +517,10 @@ class CustomNetScan extends Wizard
// Interval and schedules.
$interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
if (isset($this->task['interval_sweep']) === true) {
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
}
}
// Schedule.
@ -541,7 +543,7 @@ class CustomNetScan extends Wizard
],
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
'interval',
$this->task['interval_sweep'],
(isset($this->task['interval_sweep']) === true) ? $this->task['interval_sweep'] : '',
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'',
'0',

View File

@ -410,7 +410,7 @@ class Diagnostics extends Wizard
],
];
$return .= '<div class="title-self-monitoring">';
$return = '<div class="title-self-monitoring">';
$return .= __(
'Graphs modules that represent the self-monitoring system'
);
@ -423,7 +423,7 @@ class Diagnostics extends Wizard
$return .= '</div>';
}
return $return;
return ($return ?? '');
}
@ -694,7 +694,7 @@ class Diagnostics extends Wizard
WHERE tagente_estado.estado = 4';
$notInitAgents = db_get_sql($sqlNotInitAgents);
$dateDbMantenaince = $config['db_maintance'];
$dateDbMantenaince = ($config['db_maintance'] ?? '');
$currentTime = time();
@ -1059,6 +1059,10 @@ class Diagnostics extends Wizard
$tFragmentationStatus = 1;
}
if (isset($config['thousand_separator']) === false) {
$config['thousand_separator'] = '';
}
$result = [
'error' => false,
'data' => [
@ -1844,6 +1848,10 @@ class Diagnostics extends Wizard
$sizeServerLog = number_format($fileSize);
$sizeServerLog = (0 + str_replace(',', '', $sizeServerLog));
if (isset($config['thousand_separator']) === false) {
$config['thousand_separator'] = '';
}
$value = number_format(($fileSize / $mega), 3, $config['decimal_separator'], $config['thousand_separator']);
$message = __('You have more than 10 MB of logs');
$status = 0;

View File

@ -427,30 +427,32 @@ class EventSound extends HTML
);
$data = db_get_all_rows_sql($sql);
foreach ($data as $key => $row) {
if ($row['active'] === '1') {
$img = 'images/lightbulb.png';
$action = __('Disable sound');
$new_action = 0;
} else {
$img = 'images/lightbulb_off.png';
$action = __('Enable sound');
$new_action = 1;
if ($data !== false) {
foreach ($data as $key => $row) {
if ($row['active'] === '1') {
$img = 'images/lightbulb.png';
$action = __('Disable sound');
$new_action = 0;
} else {
$img = 'images/lightbulb_off.png';
$action = __('Enable sound');
$new_action = 1;
}
$options = '<a href="index.php?sec=eventos&sec2=godmode/events/configuration_sounds';
$options .= '&action=change_action&id='.$row['id'].'&set_action='.$new_action.'">';
$options .= html_print_image(
$img,
true,
[
'title' => $action,
'class' => 'main_menu_icon invert_filter',
]
);
$options .= '</a>';
$data[$key]['options'] = $options;
}
$options = '<a href="index.php?sec=eventos&sec2=godmode/events/configuration_sounds';
$options .= '&action=change_action&id='.$row['id'].'&set_action='.$new_action.'">';
$options .= html_print_image(
$img,
true,
[
'title' => $action,
'class' => 'main_menu_icon invert_filter',
]
);
$options .= '</a>';
$data[$key]['options'] = $options;
}
echo json_encode(

View File

@ -186,9 +186,11 @@ class ExtensionsDiscovery extends Wizard
private function loadConfig()
{
$row = db_get_row('tdiscovery_apps', 'short_name', $this->mode);
$this->id = $row['id_app'];
$this->name = $row['name'];
$this->description = $row['description'];
if ($row !== false) {
$this->id = $row['id_app'];
$this->name = $row['name'];
$this->description = $row['description'];
}
}
@ -415,7 +417,10 @@ class ExtensionsDiscovery extends Wizard
public function loadIni()
{
global $config;
$iniFile = parse_ini_file($config['homedir'].$this->path.'/'.$this->mode.'/discovery_definition.ini', true, INI_SCANNER_TYPED);
$iniFile = false;
if (file_exists($config['homedir'].$this->path.'/'.$this->mode.'/discovery_definition.ini') === true) {
$iniFile = parse_ini_file($config['homedir'].$this->path.'/'.$this->mode.'/discovery_definition.ini', true, INI_SCANNER_TYPED);
}
return $iniFile;
}
@ -2190,7 +2195,8 @@ class ExtensionsDiscovery extends Wizard
break;
default:
continue;
// Nothing.
break;
}
if ($value !== false) {

View File

@ -208,12 +208,20 @@ class HTML
$i = 0;
foreach ($urls as $url) {
if (isset($url['selected']) === false) {
$url['selected'] = 0;
}
if ($url['selected'] == 1) {
$class = 'selected';
} else {
$class = '';
}
if (isset($url['link']) === false) {
$url['link'] = '';
}
$bc[$i] = '';
$bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">';
$bc[$i] .= $url['label'];
@ -618,6 +626,10 @@ class HTML
public static function printBlockAsGrid(array $input, bool $return=false)
{
$output = '';
if (isset($input['hidden']) === false) {
$input['hidden'] = 0;
}
if ($input['hidden'] == 1) {
$class = ' hidden';
} else {
@ -628,6 +640,14 @@ class HTML
$class = $input['class'].$class;
}
if (isset($input['block_content']) === false) {
$input['block_content'] = '';
}
if (isset($input['block_class']) === false) {
$input['block_class'] = '';
}
if (is_array($input['block_content']) === true) {
if (empty($input['label']) === false) {
$output .= '<div class="label_select">';
@ -637,13 +657,29 @@ class HTML
// Print independent block of inputs.
$output .= '<ul class="wizard '.$input['block_class'].'">';
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
$output .= '<li id="'.($input['block_id'] ?? '').'" class="'.$class.'">';
foreach ($input['block_content'] as $input) {
$output .= self::printBlockAsGrid($input, $return);
}
$output .= '</ul></li>';
} else {
if (isset($input['arguments']['inline']) === false) {
$input['arguments']['inline'] = '';
}
if (isset($input['extra']) === false) {
$input['extra'] = '';
}
if (isset($input['arguments']) === false) {
$input['arguments'] = '';
}
if (isset($input['arguments']['type']) === false) {
$input['arguments']['type'] = '';
}
if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended'
) {
@ -729,6 +765,10 @@ class HTML
public static function printBlockAsList(array $input, bool $return=false)
{
$output = '';
if (isset($input['hidden']) === false) {
$input['hidden'] = 0;
}
if ($input['hidden'] == 1) {
$class = ' hidden';
} else {
@ -739,6 +779,10 @@ class HTML
$class = $input['class'].$class;
}
if (isset($input['block_content']) === false) {
$input['block_content'] = '';
}
if (is_array($input['block_content']) === true) {
// Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
@ -749,6 +793,14 @@ class HTML
$output .= '</ul></li>';
} else {
if (isset($input['id']) === false) {
$input['id'] = '';
}
if (isset($input['extra']) === false) {
$input['extra'] = '';
}
if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended'
) {
@ -949,6 +1001,46 @@ class HTML
{
$form = $data['form'];
if (isset($data['rows']) === false) {
$data['rows'] = '';
}
if (isset($data['rawInputs']) === false) {
$data['rawInputs'] = '';
}
if (isset($data['js']) === false) {
$data['js'] = '';
}
if (isset($data['js_block']) === false) {
$data['js_block'] = '';
}
if (isset($data['cb_function']) === false) {
$data['cb_function'] = null;
}
if (isset($data['cb_args']) === false) {
$data['cb_args'] = [];
}
if (isset($form['class']) === false) {
$form['class'] = '';
}
if (isset($form['onsubmit']) === false) {
$form['onsubmit'] = '';
}
if (isset($form['extra']) === false) {
$form['extra'] = '';
}
if (isset($form['enctype']) === false) {
$form['enctype'] = '';
}
$rows = $data['rows'];
$rawInputs = $data['rawInputs'];
$js = $data['js'];
@ -987,7 +1079,15 @@ class HTML
if (is_array($rows)) {
foreach ($rows as $row) {
if ($row['new_form_block'] == true) {
if (isset($row['class']) === false) {
$row['class'] = '';
}
if (isset($row['style']) === false) {
$row['style'] = '';
}
if (isset($row['new_form_block']) === true) {
if ($first_block_printed === true) {
// If first form block has been placed, then close it before starting a new one.
$output .= '</div>';
@ -1015,30 +1115,38 @@ class HTML
// Toggle option.
foreach ($column['inputs'] as $input) {
if (is_array($input)) {
if ($input['arguments']['type'] != 'submit') {
if ($input['toggle'] === true) {
$output .= ui_print_toggle(
[
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'title' => $input['toggle_title'],
'id' => $input['toggle_id'],
'hidden_default' => $input['toggle_hidden_default'],
'content' => self::printBlockAsGrid(
$input,
true
),
'return' => true,
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'toggle_class' => $input['toggle_toggle_class'],
'main_class' => $input['toggle_main_class'],
'container_class' => $input['toggle_container_class'],
'img_a' => $input['toggle_img_a'],
'img_b' => $input['toggle_img_b'],
'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true),
]
);
if (isset($input['arguments']) === true) {
if ($input['arguments']['type'] != 'submit') {
if (isset($input['toggle']) === true) {
if ($input['toggle'] === true) {
$output .= ui_print_toggle(
[
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'title' => $input['toggle_title'],
'id' => $input['toggle_id'],
'hidden_default' => $input['toggle_hidden_default'],
'content' => self::printBlockAsGrid(
$input,
true
),
'return' => true,
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'toggle_class' => $input['toggle_toggle_class'],
'main_class' => $input['toggle_main_class'],
'container_class' => $input['toggle_container_class'],
'img_a' => $input['toggle_img_a'],
'img_b' => $input['toggle_img_b'],
'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true),
]
);
} else {
$output .= self::printBlockAsGrid($input, true);
}
} else {
$output .= self::printBlockAsGrid($input, true);
}
} else {
$output .= self::printBlockAsGrid($input, true);
$output_submit .= self::printBlockAsGrid($input, true);
}
} else {
$output_submit .= self::printBlockAsGrid($input, true);
@ -1089,6 +1197,34 @@ class HTML
*/
public static function printFormAsList(array $data, bool $return=false)
{
if (isset($data['rows']) === false) {
$data['rows'] = '';
}
if (isset($data['rawInputs']) === false) {
$data['rawInputs'] = '';
}
if (isset($data['js']) === false) {
$data['js'] = '';
}
if (isset($data['js_block']) === false) {
$data['js_block'] = '';
}
if (isset($data['cb_function']) === false) {
$data['cb_function'] = null;
}
if (isset($data['cb_args']) === false) {
$data['cb_args'] = [];
}
if (isset($form['class']) === false) {
$form['class'] = '';
}
$form = $data['form'];
$inputs = $data['inputs'];
$rawInputs = $data['rawInputs'];
@ -1097,6 +1233,18 @@ class HTML
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
if (isset($form['onsubmit']) === false) {
$form['onsubmit'] = '';
}
if (isset($form['extra']) === false) {
$form['extra'] = '';
}
if (isset($form['enctype']) === false) {
$form['enctype'] = '';
}
$output_head = '<form class="discovery max_floating_element_size" id="'.$form['id'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
@ -1117,7 +1265,7 @@ class HTML
$output = '<div class="white_box pdd_15px">';
$output .= '<ul class="wizard">';
$output_submit = '';
foreach ($inputs as $input) {
if ($input['arguments']['type'] != 'submit') {
$output .= self::printBlockAsList($input, true);

View File

@ -780,8 +780,13 @@ class ModuleTemplates extends HTML
private function setNetworkProfile()
{
$profileInfo = db_get_row('tnetwork_profile', 'id_np', $this->id_np);
$this->name = $profileInfo['name'];
$this->description = $profileInfo['description'];
if ($profileInfo !== false) {
$this->name = $profileInfo['name'];
$this->description = $profileInfo['description'];
} else {
$this->name = '';
$this->description = '';
}
$penInfo = db_get_all_rows_filter('tnetwork_profile_pen', ['id_np' => $this->id_np]);
$penList = [];

View File

@ -199,6 +199,10 @@ class SnmpConsole extends HTML
).'</a>';
$list['active'] = true;
if (isset($screen) === false) {
$screen = '';
}
// Header.
ui_print_standard_header(
__('SNMP Console'),

View File

@ -646,7 +646,7 @@ class TipsWindow
['class' => 'main_menu_icon']
);
$data[$key]['edit'] .= '</a>';
$data[$key]['delete'] .= '<form name="grupo" method="post" class="rowPair table_action_buttons" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=welcome_tips&action=delete">';
$data[$key]['delete'] = '<form name="grupo" method="post" class="rowPair table_action_buttons" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=welcome_tips&action=delete">';
$data[$key]['delete'] .= html_print_input_image(
'button_delete_tip',
'images/delete.svg',
@ -1087,7 +1087,7 @@ class TipsWindow
return false;
}
if ($images !== null) {
if ($images !== '') {
foreach ($images as $key => $image) {
$res = db_process_sql_insert(
'twelcome_tip_file',

View File

@ -738,6 +738,22 @@ class Tree
if ($module['showGraphs']) {
$tresholds = true;
if (isset($module['min_warning']) === false) {
$module['min_warning'] = '';
}
if (isset($module['max_warning']) === false) {
$module['max_warning'] = '';
}
if (isset($module['min_critical']) === false) {
$module['min_critical'] = '';
}
if (isset($module['max_critical']) === false) {
$module['max_critical'] = '';
}
if (empty((float) $module['min_warning']) === true
&& empty((float) $module['max_warning']) === true
&& empty($module['warning_inverse']) === true

View File

@ -621,6 +621,10 @@ class TreeGroup extends Tree
protected function getDisplayHierarchy()
{
if (isset($this->filter['searchHirearchy']) === false) {
$this->filter['searchHirearchy'] = '';
}
return $this->filter['searchHirearchy'] ||
(empty($this->filter['searchAgent']) && empty($this->filter['searchModule']));
}

View File

@ -376,10 +376,6 @@ class WelcomeWindow extends Wizard
'class' => 'modal',
];
if (enterprise_installed() === true) {
$logo_url = ENTERPRISE_DIR.'/'.$logo_url;
}
if (check_acl($config['id_user'], 0, 'PM')) {
$flag_um = false;
$flag_cm = false;
@ -768,6 +764,10 @@ class WelcomeWindow extends Wizard
],
true
);
if (isset($agents_num) === false) {
$agents_num = '';
}
echo html_print_label_input_block(
__('Number of agents to be created'),
html_print_div(
@ -1214,6 +1214,10 @@ class WelcomeWindow extends Wizard
__('Agent'),
ui_print_agent_autocomplete_input($params)
);
if (isset($modules) === false) {
$modules = '';
}
echo html_print_label_input_block(
__('Module'),
html_print_select(

View File

@ -1279,7 +1279,7 @@ function agents_get_group_agents(
}
if (is_array($search) === true) {
if (!$search['all_agents']) {
if (isset($search['all_agents']) === false) {
$filter['disabled'] = 0;
if (isset($search['disabled']) === true) {
$filter['disabled'] = (int) $search['disabled'];

View File

@ -593,7 +593,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($report === false) {
continue;
break;
}
$email = ui_print_truncate_text($args[1], 120);
@ -656,7 +656,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($template === false) {
continue;
break;
}
if (empty($args[1]) === false && (string) $args[1] !== '0') {
@ -777,7 +777,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($report === false) {
continue;
break;
}
$path = $args[1];
@ -817,7 +817,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($report === false) {
continue;
break;
}
$path = $args[1];

View File

@ -289,6 +289,10 @@ function agent_counters_custom_fields($filters)
}
}
if (isset($groups_and) === false) {
$groups_and = '';
}
// Filter by status module.
$empty_agents_count = "UNION ALL
SELECT ta.id_agente,
@ -616,6 +620,10 @@ function agent_counters_custom_fields($filters)
$result_meta = [];
$data = [];
if (isset($and_module_search) === false) {
$and_module_search = '';
}
$query = sprintf(
"SELECT tcd.description AS name_data,
SUM(IF($agent_state_total, 1, 0)) AS a_agents,
@ -677,6 +685,11 @@ function agent_counters_custom_fields($filters)
$result_meta[] = db_get_all_rows_sql($query);
if (isset($server_data) === false) {
$server_data = [];
$server_data['id'] = '';
}
$query_data = sprintf(
"SELECT
tcd.description,

View File

@ -526,8 +526,10 @@ function filemanager_file_explorer(
$allowCreateText = (isset($options['all']) === true) || ((isset($options['allowCreateText']) === true) && ($options['allowCreateText'] === true));
$allowCreateFolder = (isset($options['allowCreateFolder'])) ? false : true;
if ($options['denyCreateText'] === true) {
$allowCreateText = false;
if (isset($options['denyCreateText']) === true) {
if ($options['denyCreateText'] === true) {
$allowCreateText = false;
}
}
if ($homedir_filemanager === false) {
@ -1065,8 +1067,10 @@ function filemanager_file_explorer(
$modal_real_path = "<div><b>Real path to plugin execution is:</b></div>
<div id='real_path'></div>";
if (isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '127.0.0.1') {
$modal_real_path .= "<div style='float:right;margin: 5em 0 0 auto';>".html_print_submit_button(__('Copy'), 'submit', false, ['icon' => 'wand', 'mode' => 'mini'], true).'</div>';
if (isset($_SERVER['HTTPS']) === true) {
if ($_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '127.0.0.1') {
$modal_real_path .= "<div style='float:right;margin: 5em 0 0 auto';>".html_print_submit_button(__('Copy'), 'submit', false, ['icon' => 'wand', 'mode' => 'mini'], true).'</div>';
}
}
html_print_div(

View File

@ -737,6 +737,10 @@ function grafico_modulo_sparse($params)
$params['backgroundColor'] = 'white';
}
if (isset($params['vconsole']) === false) {
$params['vconsole'] = false;
}
if (isset($params['only_image']) === true && $params['vconsole'] !== true) {
$params['backgroundColor'] = 'transparent';
}
@ -903,6 +907,10 @@ function grafico_modulo_sparse($params)
// Format of the graph.
if (empty($params['unit']) === true) {
if (isset($module_data['unit']) === false) {
$module_data['unit'] = '';
}
$params['unit'] = $module_data['unit'];
if (modules_is_unit_macro($params['unit'])) {
$params['unit'] = '';
@ -1008,6 +1016,10 @@ function grafico_modulo_sparse($params)
$data_module_graph = [];
}
if (isset($series_suffix) === false) {
$series_suffix = '';
}
$data_module_graph['series_suffix'] = $series_suffix;
// Check available data.
@ -4701,11 +4713,13 @@ function graph_nodata_image($options)
{
global $config;
if ($options['base64'] === true) {
$dataImg = file_get_contents(
$config['homedir'].'/images/image_problem_area_150.png'
);
return base64_encode($dataImg);
if (isset($options['base64']) === true) {
if ($options['base64'] === true) {
$dataImg = file_get_contents(
$config['homedir'].'/images/image_problem_area_150.png'
);
return base64_encode($dataImg);
}
}
$style = '';

View File

@ -196,7 +196,7 @@ function groupview_get_groups_list($id_user=false, $access='AR', $is_not_paginat
$list[$id_group]['_monitors_not_init_'] = (int) $modules_counters[$id_group]['total_module_not_init'];
$list[$id_group]['_monitors_ok_'] = (int) $modules_counters[$id_group]['total_module_normal'];
$list[$id_group]['_monitor_checks_'] = (int) $modules_counters[$id_group]['total_module'];
$list[$id_group]['_monitor_not_normal_'] = ($list[$group['id_grupo']]['_monitor_checks_'] - $list[$group['id_grupo']]['_monitors_ok_']);
$list[$id_group]['_monitor_not_normal_'] = ($modules_counters[$id_group]['total_module'] - $modules_counters[$id_group]['total_module_normal']);
$list[$id_group]['_monitors_alerts_fired_'] = (int) $modules_counters[$id_group]['total_module_alerts'];
}

View File

@ -2075,7 +2075,7 @@ function html_print_extended_select_for_post_process(
$found = false;
if ($selected) {
if (array_key_exists(number_format($selected, 14, $config['decimal_separator'], $config['thousand_separator']), $fields)) {
if (array_key_exists(number_format($selected, 14, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')), $fields)) {
$found = true;
}
}
@ -5579,7 +5579,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$output .= html_print_input_image(
((isset($data['name']) === true) ? $data['name'] : ''),
$data['src'],
$data['value'],
($data['value'] ?? ''),
((isset($data['style']) === true) ? $data['style'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
@ -5819,7 +5819,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'checkbox':
$output .= html_print_checkbox(
$data['name'],
((isset($data['name']) === true) ? $data['name'] : ''),
($data['value'] ?? null),
((isset($data['checked']) === true) ? $data['checked'] : false),
((isset($data['return']) === true) ? $data['return'] : false),
@ -5859,9 +5859,9 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'textarea':
$output .= html_print_textarea(
$data['name'],
$data['rows'],
$data['columns'],
(isset($data['name']) === true) ? $data['name'] : '',
(isset($data['rows']) === true) ? $data['rows'] : '',
(isset($data['columns']) === true) ? $data['columns'] : '',
((isset($data['value']) === true) ? $data['value'] : ''),
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
@ -7416,8 +7416,9 @@ function html_print_select_date_range(
$output .= '</div>';
$output .= '<div id="'.$name.'_range" class="inline_flex" '.$display_range.'>';
$table = new stdClass();
$table->data = [];
$table->class = 'table-adv-filter';
$table->data[0][0] .= '<div><div><div><span class="font-title-font">'.__('From').':</span></div>';
$table->data[0][0] = '<div><div><div><span class="font-title-font">'.__('From').':</span></div>';
$table->data[0][0] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' ';
$table->data[0][0] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' ';
$table->data[0][0] .= '</div>';

View File

@ -788,22 +788,24 @@ function inventory_get_datatable(
$rows = db_get_all_rows_sql($sql);
if ($order_by_agent === false) {
$modules = [];
foreach ($rows as $row) {
if ($row['utimestamp'] !== $row['last_update']) {
$row['timestamp'] = $row['last_update_timestamp'];
}
$data_rows = explode(PHP_EOL, $row['data_inventory']);
foreach ($data_rows as $data_key => $data_value) {
if (empty($inventory_search_string) !== true) {
$search_check = strpos(str_replace('&#x20;', ' ', $data_value), $inventory_search_string);
} else {
$search_check = true;
if ($rows !== false) {
foreach ($rows as $row) {
if ($row['utimestamp'] !== $row['last_update']) {
$row['timestamp'] = $row['last_update_timestamp'];
}
if (empty($data_value) === false && $search_check !== false) {
$row['data'] = $data_value;
$modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row;
$data_rows = explode(PHP_EOL, $row['data_inventory']);
foreach ($data_rows as $data_key => $data_value) {
if (empty($inventory_search_string) !== true) {
$search_check = strpos(str_replace('&#x20;', ' ', $data_value), $inventory_search_string);
} else {
$search_check = true;
}
if (empty($data_value) === false && $search_check !== false) {
$row['data'] = $data_value;
$modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row;
}
}
}
}

View File

@ -699,9 +699,9 @@ function menu_get_sec($with_categories=false)
}
$sec_array[$k]['optgroup'] = $category;
$sec_array[$k]['name'] = $v['text'];
$sec_array[$k]['name'] = (isset($v['text']) === true) ? $v['text'] : '';
} else {
$sec_array[$k] = $v['text'];
$sec_array[$k] = (isset($v['text']) === true) ? $v['text'] : '';
}
}

View File

@ -2700,6 +2700,14 @@ function modules_get_agentmodule_data_for_humans($module)
if ($data_macro !== false) {
$salida = $data_macro;
} else {
if (isset($module['current_interval']) === false) {
$module['current_interval'] = 0;
}
if (isset($module['module_name']) === false) {
$module['module_name'] = 0;
}
$salida = ui_print_module_string_value(
$module['datos'],
empty($module['id']) ? $module['id_agente_modulo'] : $module['id'],

View File

@ -144,7 +144,7 @@ function config_wiz_modal(
'UTC' => __('UTC'),
];
if ($zone_selected == '') {
if (isset($zone_selected) === false) {
if ($config['timezone'] != '') {
$zone_array = explode('/', $config['timezone']);
$zone_selected = $zone_array[0];

View File

@ -1435,7 +1435,7 @@ function custom_fields_macros_report($macro, $key_macro)
$macro['server_id']
);
if (metaconsole_connect($server) != NOERR) {
continue;
break;
}
}

View File

@ -741,7 +741,7 @@ function snmp_browser_print_container(
)
);
$table->data[0][1] .= html_print_label_input_block(
$table->data[0][1] = html_print_label_input_block(
__('Port'),
html_print_input(
[

View File

@ -4018,19 +4018,21 @@ function ui_print_datatable(array $parameters)
$parameters['order']['order'] = $order;
$parameters['order']['direction'] = $direction;
foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search(
$parameters['no_sortable_columns'][$key],
$columns_tmp
);
if (isset($parameters['no_sortable_columns']) === true) {
foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search(
$parameters['no_sortable_columns'][$key],
$columns_tmp
);
if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found);
}
if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found);
}
if (is_int($parameters['no_sortable_columns'][$key]) === false) {
unset($parameters['no_sortable_columns'][$key]);
if (is_int($parameters['no_sortable_columns'][$key]) === false) {
unset($parameters['no_sortable_columns'][$key]);
}
}
}
@ -4094,11 +4096,13 @@ function ui_print_datatable(array $parameters)
$filter .= '<ul class="datatable_filter content filter_table no_border">';
foreach ($parameters['form']['inputs'] as $input) {
if ($input['type'] === 'date_range') {
$filter .= '<li><label>'.$input['label'].'</label>'.html_print_select_date_range('date', true).'</li>';
} else {
$filter .= html_print_input(($input + ['return' => true]), 'li');
if (isset($parameters['form']['inputs']) === true) {
foreach ($parameters['form']['inputs'] as $input) {
if ($input['type'] === 'date_range') {
$filter .= '<li><label>'.$input['label'].'</label>'.html_print_select_date_range('date', true).'</li>';
} else {
$filter .= html_print_input(($input + ['return' => true]), 'li');
}
}
}
@ -4248,7 +4252,7 @@ function ui_print_datatable(array $parameters)
}
$parameters['phpDate'] = date('Y-m-d');
$parameters['dataElements'] = json_encode($parameters['data_element']);
$parameters['dataElements'] = (isset($parameters['data_element']) === true) ? json_encode($parameters['data_element']) : '';
// * START JAVASCRIPT.
$file_path = $config['homedir'].'/include/javascript/datatablesFunction.js';
@ -6789,6 +6793,10 @@ function ui_print_module_string_value(
$value = io_safe_input($value);
}
if (isset($module) === false) {
$module['datos'] = '';
}
$is_snapshot = is_snapshot_data($module['datos']);
$is_large_image = is_text_to_black_string($module['datos']);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {

View File

@ -1355,12 +1355,12 @@ function get_build_setup_charts($type, $options, $data)
$chart->labels()->exchangeArray($options['labels']);
foreach ($data as $key => $dataset) {
$dataSet = $chart->createDataSet();
$dataSet->setLabel($dataset['label']);
$dataSet->setLabel((isset($dataset['label']) === true) ? $dataset['label'] : '');
$dataSet->setBackgroundColor($dataset['backgroundColor']);
$dataSet->setBorderColor($dataset['borderColor']);
$dataSet->setPointBackgroundColor($dataset['pointBackgroundColor']);
$dataSet->setPointBorderColor($dataset['pointBorderColor']);
$dataSet->setPointHoverBackgroundColor($dataset['pointHoverBackgroundColor']);
$dataSet->setPointBorderColor((isset($dataset['pointBorderColor']) === true) ? $dataset['pointBorderColor'] : '');
$dataSet->setPointHoverBackgroundColor((isset($dataset['pointHoverBackgroundColor']) === true) ? $dataset['pointHoverBackgroundColor'] : '');
$dataSet->setPointHoverBorderColor($dataset['pointHoverBorderColor']);
$dataSet->data()->exchangeArray($dataset['data']);
$chart->addDataSet($dataSet);

View File

@ -205,6 +205,14 @@ function flot_area_graph(
$red_inverse = false;
}
} else if (isset($params['combined']) === false || !$params['combined']) {
if (isset($data_module_graph['w_min']) === false) {
$data_module_graph['w_min'] = '';
}
if (isset($data_module_graph['c_min']) === false) {
$data_module_graph['c_min'] = '';
}
$yellow_threshold = $data_module_graph['w_min'];
$red_threshold = $data_module_graph['c_min'];
// Get other required module datas to draw warning and critical.

View File

@ -43,7 +43,11 @@ function unserialize_in_temp($serial_id=null, $delete=true, $ttl=1)
}
}
$content = file_get_contents($file_path);
if (file_exists($file_path) === false) {
return false;
} else {
$content = file_get_contents($file_path);
}
if ($content === false) {
return false;

View File

@ -43,6 +43,9 @@ class ITSM
$this->userLevelConf = (bool) $config['ITSM_user_level_conf'];
$this->url = ($host ?? $config['ITSM_hostname']);
if (isset($config['ITSM_token']) === false) {
$config['ITSM_token'] = '';
}
$this->userBearer = ($token ?? $config['ITSM_token']);
if ($this->userLevelConf === true) {

View File

@ -144,9 +144,11 @@ class GeneralTacticalView
{
$js = '<script>';
foreach ($this->elements as $key => $element) {
if ($element->interval > 0) {
foreach ($element->refreshConfig as $key => $conf) {
$js .= 'autoRefresh('.$element->interval.',"'.$conf['id'].'", "'.$conf['method'].'", "'.$element->nameClass().'");';
if (isset($element->interval) === true) {
if ($element->interval > 0) {
foreach ($element->refreshConfig as $key => $conf) {
$js .= 'autoRefresh('.$element->interval.',"'.$conf['id'].'", "'.$conf['method'].'", "'.$element->nameClass().'");';
}
}
}
}

View File

@ -34,6 +34,7 @@ class Agents extends Element
*/
public function __construct()
{
global $config;
parent::__construct();
include_once $config['homedir'].'/include/graphs/fgraph.php';
include_once $config['homedir'].'/include/functions_graph.php';

View File

@ -197,6 +197,10 @@ class Database extends Element
$string_reads = [];
$total = 0;
foreach ($reads as $key => $read) {
if (isset($read['utimestamp']) === false) {
$read['utimestamp'] = 0;
}
$dates[] = date('d-m-Y H:i:s', $read['utimestamp']);
$string_reads[] = $read['datos'];
$total += $read['datos'];
@ -272,6 +276,10 @@ class Database extends Element
$string_writes = [];
$total = 0;
foreach ($writes as $key => $write) {
if (isset($write['utimestamp']) === false) {
$write['utimestamp'] = 0;
}
$dates[] = date('d-m-Y H:i:s', $write['utimestamp']);
$string_writes[] = $write['datos'];
$total += $write['datos'];

View File

@ -391,7 +391,8 @@ class Events extends Element
break;
default:
continue;
// Nothing.
break;
}
$labels[] = $this->controlSizeText($label);

View File

@ -73,6 +73,9 @@ class Groups extends Element
public function getStatusHeatMap():string
{
global $config;
if (isset($config['id_group']) === false) {
$config['id_group'] = false;
}
$groups = users_get_groups($config['id_group'], 'AR', false);
if (is_array($groups) === true && count($groups) >= 10) {
@ -98,8 +101,8 @@ class Groups extends Element
public function getStatusHeatMapModules():string
{
global $config;
$width = get_parameter('width', 350);
$height = get_parameter('height', 275);
$width = (int) get_parameter('width', 350);
$height = (int) get_parameter('height', 275);
$id_groups = array_keys(users_get_groups($config['id_user'], 'AR', false));

View File

@ -34,6 +34,7 @@ class MonitoringElements extends Element
*/
public function __construct()
{
global $config;
parent::__construct();
include_once $config['homedir'].'/include/graphs/fgraph.php';
include_once $config['homedir'].'/include/functions_graph.php';
@ -58,13 +59,15 @@ class MonitoringElements extends Element
$labels = [];
$data = [];
foreach ($rows as $key => $row) {
if (empty($row['name']) === true) {
continue;
}
if ($rows !== false) {
foreach ($rows as $key => $row) {
if (empty($row['name']) === true) {
continue;
}
$labels[] = $this->controlSizeText($row['name']);
$data[] = $row['total'];
$labels[] = $this->controlSizeText($row['name']);
$data[] = $row['total'];
}
}
$options = [

View File

@ -156,6 +156,10 @@ class ScheduledDowntime extends Element
'cron_interval_from',
'cron_interval_to',
];
if (isset($config['user']) === false) {
$config['user'] = '';
}
$groups = implode(',', array_keys(users_get_groups($config['user'])));
$columns_str = implode(',', $columns);
$sql = sprintf(
@ -170,49 +174,51 @@ class ScheduledDowntime extends Element
);
$sql_count = 'SELECT COUNT(id) AS num
FROM tplanned_downtime';
FROM tplanned_downtime';
$downtimes = db_get_all_rows_sql($sql);
foreach ($downtimes as $key => $downtime) {
if ((int) $downtime['executed'] === 0) {
$downtimes[$key]['running'] = html_print_div(
if ($downtimes !== false) {
foreach ($downtimes as $key => $downtime) {
if ((int) $downtime['executed'] === 0) {
$downtimes[$key]['running'] = html_print_div(
[
'content' => '',
'class' => 'square stop',
'title' => 'Not running',
],
true
);
} else {
$downtimes[$key]['running'] = html_print_div(
[
'content' => '',
'class' => 'square running',
'title' => 'Running',
],
true
);
}
$downtimes[$key]['configuration'] = reporting_format_planned_downtime_dates($downtime);
$settings = [
'url' => ui_get_full_url('ajax.php', false, false, false),
'loadingText' => __('Loading, this operation might take several minutes...'),
'title' => __('Elements affected'),
'id' => $downtime['id'],
];
$downtimes[$key]['affected'] = '<a style="margin-left: 22px;" href="javascript:" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>';
$downtimes[$key]['affected'] .= html_print_image(
'images/details.svg',
true,
[
'content' => '',
'class' => 'square stop',
'title' => 'Not running',
],
true
);
} else {
$downtimes[$key]['running'] = html_print_div(
[
'content' => '',
'class' => 'square running',
'title' => 'Running',
],
true
'title' => __('Agents and modules affected'),
'class' => 'main_menu_icon invert_filter',
]
);
$downtimes[$key]['affected'] .= '</a>';
}
$downtimes[$key]['configuration'] = reporting_format_planned_downtime_dates($downtime);
$settings = [
'url' => ui_get_full_url('ajax.php', false, false, false),
'loadingText' => __('Loading, this operation might take several minutes...'),
'title' => __('Elements affected'),
'id' => $downtime['id'],
];
$downtimes[$key]['affected'] = '<a style="margin-left: 22px;" href="javascript:" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>';
$downtimes[$key]['affected'] .= html_print_image(
'images/details.svg',
true,
[
'title' => __('Agents and modules affected'),
'class' => 'main_menu_icon invert_filter',
]
);
$downtimes[$key]['affected'] .= '</a>';
}
$downtimes_number_res = db_get_all_rows_sql($sql_count);

View File

@ -1462,6 +1462,10 @@ if ($searchPage) {
// Make file path absolute to prevent accessing remote files.
$file = __DIR__.'/'.$file;
// Translate some secs.
if (isset($_GET['sec']) === false) {
$_GET['sec'] = '';
}
$main_sec = get_sec($_GET['sec']);
$_GET['sec'] = ($main_sec == false) ? $_GET['sec'] : $main_sec;
@ -1566,6 +1570,10 @@ echo '</html>';
$run_time = format_numeric((microtime(true) - $config['start_time']), 3);
echo "\n<!-- Page generated in ".$run_time." seconds -->\n";
if (isset($_GET['logged']) === false) {
$_GET['logged'] = '';
}
// Values from PHP to be recovered from JAVASCRIPT.
require 'include/php_to_js_values.php';
?>

View File

@ -211,7 +211,7 @@ function printFormFilterAlert(
)
);
$data .= html_print_table($table, true);
$data = html_print_table($table, true);
if ($return) {
return $data;

View File

@ -358,6 +358,9 @@ if (is_metaconsole() === true) {
}
ob_start();
if (isset($agent_view_page) === false) {
$agent_view_page = false;
}
if ($agent_view_page === true) {
ui_print_datatable(
@ -551,6 +554,8 @@ if (isset($id_agente)) {
}
echo '<div id="system_higher" class="invisible_important agent_details_agent_data flex_important"><img src="images/alert-yellow@svg.svg" width="10%" class="mrgn_right_20px">'.__('Your system has a much higher rate of modules per agent than recommended (200 modules per agent). This implies performance problems in the system, please consider reducing the number of modules in this agent.').'</div>';
} else {
$system_higher = false;
}
?>

View File

@ -206,6 +206,10 @@ if ($load_filter_id > 0) {
$loaded_filter = db_get_row_sql($sql);
}
if (isset($loaded_filter) === false) {
$loaded_filter['id_filter'] = 0;
}
if ($loaded_filter['id_filter'] > 0) {
$query_filter['id_filter'] = $load_filter_id;
$filter = db_get_row_filter('tagent_filter', $query_filter, false);

View File

@ -70,7 +70,12 @@ $agents = agents_get_agents(
['nombre LIKE "'.$agentName.'"'],
['id_agente']
);
$agent = $agents[0]['id_agente'];
if ($agents !== false) {
$agent = $agents[0]['id_agente'];
} else {
$agent = '';
}
$module = (array) get_parameter_post('module_arr', []);
$start_date = get_parameter_post('start_date', 0);
@ -292,7 +297,8 @@ if (empty($export_btn) || $show_form) {
break;
default:
continue;
// Nothing.
break;
}
$i++;

View File

@ -80,8 +80,7 @@ if ($config['realtimestats'] == 0) {
$updated_time .= __('Last update').' : '.ui_print_timestamp(db_get_sql('SELECT min(utimestamp) FROM tgroup_stat'), true);
$updated_time .= '</a>';
} else {
// $updated_info = __("Updated at realtime");
$updated_info = '';
$updated_time = '';
}
// Header.
@ -211,6 +210,10 @@ if ($count == 1) {
}
}
if (isset($offset) === false) {
$offset = 0;
}
if (empty($result_groups) === false) {
$pagination = ui_pagination(
$count,

View File

@ -464,6 +464,7 @@ function print_table(
$url_if_bandwidth_usage_out .= $selected_agents_query_str.'&'.$selected_interfaces_query_str;
$last_data .= $selected_agents_query_str.'&'.$selected_interfaces_query_str;
$recursion = get_parameter_switch('recursion', '');
$url_if_agent_name .= '&recursion='.$recursion;
$url_if_name .= '&recursion='.$recursion;
$url_if_speed .= '&recursion='.$recursion;

View File

@ -58,6 +58,10 @@ $autosearch = false;
$sec = (string) get_parameter('sec', 'view');
$agent_id = (int) get_parameter('id_agente', 0);
if (isset($subpage) === false) {
$subpage = '';
}
if ($sec === 'view') {
ui_print_standard_header(
__('Interface view').$subpage,

Some files were not shown because too many files have changed in this diff Show More