From bb743cb87fa4dd3b29351ececd375699c25fc7f1 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Mon, 6 Sep 2021 14:08:24 +0200 Subject: [PATCH 1/2] Fixed forget metaconsole alerts --- pandora_console/include/functions_ui.php | 22 +++++++++---------- .../operation/agentes/alerts_status.php | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 7ae033dca7..9c575fb1eb 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -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']] = ''.html_print_image($img, true, ['title' => $policyInfo['name']]).''; } else { $data[$index['policy']] = ''.html_print_image($img, true, ['title' => $policyInfo['name']]).''; } } - 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, '[…]', ''); } 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, '[…]', ''); } 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']] .= ''; } else { $data[$index['template']] .= ''; @@ -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 = '
    '; foreach ($actions as $action) { $actionText .= '
  • '.$action['name']; diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index 345b1379e9..713ab22169 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -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); From e8eb77058b1dfe4977b8ae6dc510df1c14136608 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Mon, 6 Sep 2021 15:19:23 +0200 Subject: [PATCH 2/2] Fix --- pandora_console/godmode/agentes/configurar_agente.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 2cb686fc3c..8617f85b70 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -2095,7 +2095,7 @@ if ($delete_module) { exit; } - // Also call base function to delete modules madafakas de los cojones. + // Also call base function to delete modules. modules_delete_agent_module($id_borrar_modulo); // Check for errors.