Merge branch 'ent-12605-vista-de-agentes-error-500-en-develop' into 'develop'

fix error 500 and warnings pandora_enterprise#12605

See merge request artica/pandorafms!6738
This commit is contained in:
Rafael Ameijeiras 2023-12-11 14:27:39 +00:00
commit d072187a2c
7 changed files with 63 additions and 23 deletions

View File

@ -34,11 +34,11 @@ if ((bool) $config['metaconsole']) {
include_once $config['homedir'].'/include/functions_modules.php';
include_once $config['homedir'].'/include/functions_users.php';
} else {
include_once '../include/config.php';
include_once '../include/functions_agents.php';
include_once '../include/functions_reporting.php';
include_once '../include/functions_modules.php';
include_once '../include/functions_users.php';
include_once __DIR__.'/../include/config.php';
include_once __DIR__.'/../include/functions_agents.php';
include_once __DIR__.'/../include/functions_reporting.php';
include_once __DIR__.'/../include/functions_modules.php';
include_once __DIR__.'/../include/functions_users.php';
}

View File

@ -35,7 +35,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$notifications_numbers['last_id']
).'</div>';
$header_welcome = '';
if (check_acl($config['id_user'], $group, 'AW')) {
if (check_acl($config['id_user'], 0, 'AW')) {
$header_welcome .= '<div id="welcome-icon-header">';
$header_welcome .= html_print_image(
'images/wizard@svg.svg',

View File

@ -575,12 +575,13 @@ if ($access_console_node === true) {
continue;
}
$extmenu = [];
if ($extension['godmode_menu']['name'] !== __('DB Schema check') && $extension['godmode_menu']['name'] !== __('DB interface')) {
$extmenu = $extension['godmode_menu'];
}
// Check the ACL for this user.
if ((bool) check_acl($config['id_user'], 0, $extmenu['acl']) === false) {
if ((bool) check_acl($config['id_user'], 0, ($extmenu['acl'] ?? '')) === false) {
continue;
}
@ -732,7 +733,7 @@ if ((bool) $config['pure'] === false) {
echo '<div id="about-div"></div>';
// Need to be here because the translate string.
if (check_acl($config['id_user'], $group, 'AW')) {
if (check_acl($config['id_user'], 0, 'AW')) {
?>
<script type="text/javascript">
$("#conf_wizard").click(function() {

View File

@ -652,30 +652,30 @@ if ($get_agent_alerts_datatable === true) {
if (is_metaconsole() === true) {
include_once $config['homedir'].'/enterprise/meta/include/functions_alerts_meta.php';
if ($idAgent !== 0) {
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter);
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter);
} else {
$id_groups = array_keys(
users_get_groups($config['id_user'], 'AR', false)
);
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, $search_sg);
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter, $search_sg);
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, $search_sg);
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter, $search_sg);
}
} else {
if ($idAgent !== 0) {
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter);
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter);
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter);
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter);
} else {
$id_groups = array_keys(
users_get_groups($config['id_user'], $access, false)
);
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false, $search_sg);
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter, false, $search_sg);
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false, $search_sg);
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter, false, $search_sg);
}
}

View File

@ -756,6 +756,7 @@ if (check_login()) {
$access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');
$id_agent = (int) get_parameter('id_agente');
$id_agente = $id_agent;
$id_grupo = agents_get_agent_group($id_agent);
$show_notinit = (bool) get_parameter('show_notinit');
$cluster_list = (int) get_parameter('cluster_list');
$sortField = (string) get_parameter('sort_field');

View File

@ -2624,12 +2624,26 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']);
}
} else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$salida = remove_right_zeros(
number_format(
$module['datos'],
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
}
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$salida = remove_right_zeros(
number_format(
$module['datos'],
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
break;
}
break;
@ -2648,12 +2662,26 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']);
}
} else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$salida = remove_right_zeros(
number_format(
$module['datos'],
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
}
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$salida = remove_right_zeros(
number_format(
$module['datos'],
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
break;
}
}
@ -2935,7 +2963,14 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
}
if (is_numeric($data)) {
$title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$title .= ': '.remove_right_zeros(
number_format(
$data,
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
} else {
$text = io_safe_output($data);

View File

@ -121,8 +121,11 @@ if (empty($agent['os_version']) !== true) {
$os_agent_text = $os_version.' ('.$os_version_name[1].')';
} else {
$os_name = preg_split('/[0-9]/', $agent['os_version'])[0];
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
$os_agent_text = $os_version;
$os_agent_text = $agent['os_version'];
if (empty($os_name) === false) {
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
$os_agent_text = $os_version;
}
}
}