'; html_print_input_hidden('server', $id_server); $server_type = __('Standard'); if ($row['server_type'] == 13) { $server_type = __('Satellite'); } $exec_server_enable = __('No'); if ($row['exec_proxy'] == 1) { $exec_server_enable = __('Yes'); } $table = new stdClass(); $table->cellpadding = 4; $table->cellspacing = 4; $table->width = '100%'; $table->class = 'databox filters'; $table->data[] = [ __('Name'), $row['name'], ]; $table->data[] = [ __('IP Address'), html_print_input_text('address', $row['ip_address'], '', 50, 0, true), ]; $table->data[] = [ __('Description'), html_print_input_text('description', $row['description'], '', 50, 0, true), ]; if (enterprise_installed()) { $table->data[] = [ __('Type'), $server_type, ]; if ($row['server_type'] == 13 || $row['server_type'] == 1) { $table->data[] = [ __('Exec Server'), html_print_checkbox('exec_proxy', 1, $row['exec_proxy'], true), ]; $port_number = empty($row['port']) ? '' : $row['port']; $table->data[] = [ __('Port'), html_print_input_text('port', $port_number, '', 10, 0, true).ui_print_help_tip(__('Leave blank to use SSH default port (22)'), true), ]; if ($row['exec_proxy']) { $table->data[] = [ __('Check Exec Server'), ''.html_print_image('images/dot_red.disabled.png', true).''.'
', ]; } } } html_print_table($table); echo '
'; echo ''; echo '
'; echo ''; if ($row['server_type'] == 13) { echo '
'; ui_toggle($content, __('Credential boxes'), '', 'toggle_credential', false); echo '
'; } } else if (isset($_GET['server_remote'])) { // Headers. $id_server = get_parameter_get('server_remote'); $ext = get_parameter('ext', ''); $tab = get_parameter('tab', 'standard_editor'); $advanced_editor = true; $server_type = (int) db_get_value( 'server_type', 'tserver', 'id_server', $id_server ); $buttons = ''; // Buttons. $buttons = [ 'standard_editor' => [ 'active' => false, 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Standard editor')]).'', ], 'advanced_editor' => [ 'active' => false, 'text' => ''.html_print_image('images/pen.png', true, ['title' => __('Advanced editor')]).'', ], ]; if ($server_type === SERVER_TYPE_ENTERPRISE_SATELLITE) { $buttons['agent_editor'] = [ 'active' => false, 'text' => ''.html_print_image('images/agent.png', true, ['title' => __('Advanced editor')]).'', ]; } $buttons[$tab]['active'] = true; ui_print_page_header(__('Remote Configuration'), 'images/gm_servers.png', false, 'servers', true, $buttons); if ($tab === 'standard_editor') { $advanced_editor = false; if ($server_type === 13) { echo ""; echo ''; echo '
'; echo __('Dynamic search').'  '; html_print_input_text('search_config_token', $search, '', 12); echo '
'; } } else if ($tab === 'agent_editor' && $server_type === SERVER_TYPE_ENTERPRISE_SATELLITE) { $advanced_editor = 'agent_editor'; } enterprise_include('godmode/servers/server_disk_conf_editor.php'); } else { // Header. ui_print_page_header(__('%s servers', get_product_name()), 'images/gm_servers.png', false, '', true); // Move SNMP modules back to the enterprise server. if (isset($_GET['server_reset_snmp_enterprise'])) { $result = db_process_sql('UPDATE tagente_estado SET last_error=0'); if ($result === false) { ui_print_error_message(__('Unsuccessfull action')); } else { ui_print_success_message(__('Successfully action')); } } // Reset module count. if (isset($_GET['server_reset_counts'])) { $reslt = db_process_sql('UPDATE tagente SET update_module_count=1, update_alert_count=1'); if ($result === false) { ui_print_error_message(__('Unsuccessfull action')); } else { ui_print_success_message(__('Successfully action')); } } if (isset($_GET['delete'])) { $id_server = get_parameter_get('server_del'); $result = db_process_sql_delete('tserver', ['id_server' => $id_server]); if ($result !== false) { ui_print_success_message(__('Server deleted successfully')); } else { ui_print_error_message(__('There was a problem deleting the server')); } } else if (isset($_GET['update'])) { $address = trim(io_safe_output(get_parameter_post('address')), ' '); $description = trim(get_parameter_post('description'), ' '); $id_server = get_parameter_post('server'); $exec_proxy = get_parameter_post('exec_proxy'); $port = get_parameter_post('port'); $port_number = empty($port) ? 0 : $port; $values = [ 'ip_address' => $address, 'description' => $description, 'exec_proxy' => $exec_proxy, 'port' => $port_number, ]; $result = db_process_sql_update('tserver', $values, ['id_server' => $id_server]); if ($result !== false) { ui_print_success_message(__('Server updated successfully')); } else { ui_print_error_message(__('There was a problem updating the server')); } } else if (isset($_GET['delete_conf_file'])) { $correct = false; $id_server = get_parameter('id_server'); $ext = get_parameter('ext', ''); $server_md5 = md5(io_safe_output(servers_get_name($id_server, 'none').$ext), false); if (file_exists($config['remote_config'].'/md5/'.$server_md5.'.srv.md5')) { // Server remote configuration editor. $file_name = $config['remote_config'].'/conf/'.$server_md5.'.srv.conf'; $correct = @unlink($file_name); $file_name = $config['remote_config'].'/md5/'.$server_md5.'.srv.md5'; $correct = @unlink($file_name); } ui_print_result_message( $correct, __('Conf file deleted successfully'), __('Could not delete conf file') ); } $tiny = false; include $config['homedir'].'/godmode/servers/servers.build_table.php'; } ?>