'.__('metaconsole').''; } else { $url = __('any node'); } ui_print_warning_message( __( 'This node is configured with centralized mode. All alert actions information is read only. Go to %s to manage it.', $url ) ); } $search_string = (string) get_parameter('search_string', ''); $group = (int) get_parameter('group', 0); $group_search = (int) get_parameter('group_search', 0); $id_command_search = (int) get_parameter('id_command_search', 0); $url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&search_string='.$search_string.'&group_search='.$group_search.'&id_command_search='.$id_command_search; // Filter table. $table_filter = new stdClass(); $table_filter->width = '100%'; $table_filter->class = 'databox filters'; $table_filter->style = []; $table_filter->style[0] = 'font-weight: bold'; $table_filter->style[2] = 'font-weight: bold'; $table_filter->style[4] = 'font-weight: bold'; $table_filter->data = []; $table_filter->data[0][0] = __('Search'); $table_filter->data[0][1] = html_print_input_text( 'search_string', $search_string, '', 25, 255, true ); $return_all_group = false; if (users_can_manage_group_all('LM') === true) { $return_all_group = true; } $table_filter->data[0][2] = __('Group'); $table_filter->data[0][3] = html_print_select_groups( $config['id_user'], 'LM', $return_all_group, 'group_search', $group_search, '', '', 0, true ); $table_filter->data[0][4] = __('Command'); $commands_sql = db_get_all_rows_filter( 'talert_commands', ['id_group' => array_keys(users_get_groups(false, 'LW'))], [ 'id', 'name', ], 'AND', false, true ); $commands = db_get_all_rows_sql($commands_sql); $table_filter->data[0][5] = html_print_select( index_array($commands, 'id', 'name'), 'id_command_search', $id_command_search, '', __('None'), 0, true, false, true, '', false, 'width:150px' ); $table_filter->data[0][6] = '
'; $show_table_filter = ''; if (is_metaconsole()) { ui_toggle($show_table_filter, __('Show Options')); } else { echo $show_table_filter; } $table = new stdClass(); $table->width = '100%'; $table->class = 'info_table'; $table->data = []; $table->head = []; $table->head[0] = __('Name'); $table->head[1] = __('Command'); $table->head[2] = __('Group'); if (is_management_allowed() === true) { $table->head[3] = __('Copy'); $table->head[4] = __('Delete'); } $table->style = []; $table->style[0] = 'font-weight: bold'; $table->size = []; $table->size[3] = '40px'; $table->size[4] = '40px'; $table->align = []; $table->align[1] = 'left'; $table->align[2] = 'left'; $table->align[3] = 'left'; $table->align[4] = 'left'; $filter = []; if (!is_user_admin($config['id_user'])) { $filter['talert_actions.id_group'] = array_keys( users_get_groups(false, 'LM') ); } if ($group_search !== 0) { $filter['talert_actions.id_group'] = $group_search; } if ($search_string !== '') { $filter['talert_actions.name'] = '%'.$search_string.'%'; } if ($id_command_search !== 0) { $filter['talert_commands.id'] = $id_command_search; } $actions = db_get_all_rows_filter( 'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id', $filter, 'talert_actions.* , talert_commands.id_group AS command_group, talert_commands.name AS command_name' ); if ($actions === false) { $actions = []; } // Pagination. $total_actions = count($actions); $offset = (int) get_parameter('offset'); $limit = (int) $config['block_size']; $actions = array_slice($actions, $offset, $limit); $rowPair = true; $iterator = 0; foreach ($actions as $action) { if ($rowPair) { $table->rowclass[$iterator] = 'rowPair'; } else { $table->rowclass[$iterator] = 'rowOdd'; } $rowPair = !$rowPair; $iterator++; $data = []; $data[0] = ''.$action['name'].''; if ($action['id_group'] == 0 && $can_edit_all == false) { $data[0] .= ui_print_help_tip(__('You cannot edit this action, You don\'t have the permission to edit All group.'), true); } $data[1] = $action['command_name']; $data[2] = ui_print_group_icon($action['id_group'], true).' '; if (!alerts_validate_command_to_action($action['id_group'], $action['command_group'])) { $data[2] .= html_print_image( 'images/error.png', true, // FIXME: Translation. [ 'title' => __('The action and the command associated with it do not have the same group. Please contact an administrator to fix it.'), ] ); } $data[3] = ''; $data[4] = ''; if (is_management_allowed() === true && check_acl($config['id_user'], $action['id_group'], 'LM') ) { $table->cellclass[] = [ 3 => 'action_buttons', 4 => 'action_buttons', ]; $id_action = $action['id']; $text_confirm = __('Are you sure?'); $data[3] = ' '; if ($action['id_group'] != 0 || $can_edit_all == true) { $data[4] = ' '; } else { $data[4] = ''; } } array_push($table->data, $data); } ui_pagination($total_actions, $url); if (isset($data)) { html_print_table($table); ui_pagination($total_actions, $url, 0, 0, false, 'offset', true, 'pagination-bottom'); } else { ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]); } if (is_management_allowed() === true) { echo ' '; } enterprise_hook('close_meta_frame');