Fixed forget metaconsole alerts

This commit is contained in:
Jose Gonzalez 2021-09-06 14:08:24 +02:00
parent a2ef804cec
commit bb743cb87f
2 changed files with 12 additions and 12 deletions

View File

@ -1041,7 +1041,7 @@ function ui_format_alert_row(
$styleDisabled = '';
}
if (empty($alert)) {
if (empty($alert) === true) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
return [
'',
@ -1066,7 +1066,7 @@ function ui_format_alert_row(
}
}
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$server = db_get_row('tmetaconsole_setup', 'id', $alert['server_data']['id']);
if (metaconsole_connect($server) == NOERR) {
@ -1087,7 +1087,7 @@ function ui_format_alert_row(
$data = [];
// Validate checkbox.
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
if (check_acl($config['id_user'], $id_group, 'LW')
|| check_acl($config['id_user'], $id_group, 'LM')
) {
@ -1106,7 +1106,7 @@ function ui_format_alert_row(
}
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if (is_metaconsole()) {
if (is_metaconsole() === true && (int) $alert['server_data']['id'] !== 0) {
$node = metaconsole_get_connection_by_id($alert['server_data']['id']);
if (metaconsole_load_external_db($node) !== NOERR) {
// Restore the default connection.
@ -1121,14 +1121,14 @@ function ui_format_alert_row(
$data[$index['policy']] = '';
} else {
$img = 'images/policies_mc.png';
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
} else {
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=advanced/policymanager&amp;id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
}
}
if (is_metaconsole()) {
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
}
@ -1139,7 +1139,7 @@ function ui_format_alert_row(
$data[$index['standby']] = html_print_image('images/bell_pause.png', true, ['title' => __('Standby on')]);
}
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
// Force alert execution.
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
if ($alert['force_execution'] == 0) {
@ -1154,7 +1154,7 @@ function ui_format_alert_row(
if ($agent == 0) {
$data[$index['module_name']] .= ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[&hellip;]', '');
} else {
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$agent_name = $alert['agent_name'];
$id_agent = $alert['id_agent'];
} else {
@ -1162,7 +1162,7 @@ function ui_format_alert_row(
$id_agent = modules_get_agentmodule_agent($alert['id_agent_module']);
}
if (defined('METACONSOLE') || !can_user_access_node()) {
if (is_metaconsole() === true || !can_user_access_node()) {
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]', '');
} else {
if ($agent_style !== false) {
@ -1179,7 +1179,7 @@ function ui_format_alert_row(
$data[$index['description']] = '';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$data[$index['template']] .= '<a class="template_details" href="'.ui_get_full_url('/', false, false, false).'/ajax.php?page=enterprise/meta/include/ajax/tree_view.ajax&action=get_template_tooltip&id_template='.$template['id'].'&server_name='.$alert['server_data']['server_name'].'">';
} else {
$data[$index['template']] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
@ -1196,7 +1196,7 @@ function ui_format_alert_row(
$actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']);
if (!empty($actions)) {
if (empty($actions) === false) {
$actionText = '<div><ul class="action_list">';
foreach ($actions as $action) {
$actionText .= '<div class="mrgn_btn_5px" ><span class="action_name"><li>'.$action['name'];

View File

@ -416,7 +416,7 @@ if ($filter_standby == 'standby_on') {
$filter_alert['disabled'] = $filter;
}
if (is_metaconsole()) {
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, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user);