diff --git a/pandora_console/extras/mr/68.sql b/pandora_console/extras/mr/68.sql index cbd84a03cb..c4f71a08ef 100644 --- a/pandora_console/extras/mr/68.sql +++ b/pandora_console/extras/mr/68.sql @@ -3,5 +3,6 @@ START TRANSACTION; -- Update version for plugin oracle UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle'; -COMMIT; +ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_data_section` TEXT NOT NULL DEFAULT '' ; +COMMIT; \ No newline at end of file diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 1af5e3d780..d0c255e25e 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -399,12 +399,12 @@ if ($new_agent === true) { // Ip adress. $tableAgent->data['caption_ip_address'] = __('IP Address'); -$tableAgent->rowclass['ip_address'] = 'w540px'; +$tableAgent->rowclass['ip_address'] = 'w400px'; $tableAgent->data['ip_address'][0] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true, false, false, '', 'w540px'); +$tableAgent->data['ip_address'][1] = html_print_button(__('Check unique IP'), 'check_unique_ip', false, '', ['class' => 'secondary w130px'], true); +$tableAgent->data['message_check_ip'][0] = html_print_div(['id' => 'message_check_ip'], true); $tableAgent->rowclass['additional_ip_address'] = 'subinput'; -$tableAgent->data['additional_ip_address'][0] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true); -$tableAgent->data['additional_ip_address'][1] = __('Unique IP'); $tableAgent->cellclass['additional_ip_address'][1] = 'w120px'; $tableAgent->data['additional_ip_address'][2] = html_print_input( [ @@ -1301,6 +1301,7 @@ ui_require_jquery_file('bgiframe'); ?> diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 3da403ef80..c2e3a2f4f6 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -102,7 +102,6 @@ $alias_as_name = 0; $direccion_agente = get_parameter('direccion', ''); $direccion_agente = trim(io_safe_output($direccion_agente)); $direccion_agente = io_safe_input($direccion_agente); -$unique_ip = 0; $intervalo = SECONDS_5MINUTES; $ff_interval = 0; $quiet_module = 0; @@ -186,7 +185,6 @@ if ($create_agent) { $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output))); $alias_as_name = (int) get_parameter_post('alias_as_name', 0); $direccion_agente = (string) get_parameter_post('direccion', ''); - $unique_ip = (int) get_parameter_post('unique_ip', 0); // Safe_output only validate ip. $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -269,12 +267,7 @@ if ($create_agent) { $nombre_agente = $alias; } - if ($unique_ip && $direccion_agente != '') { - $sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"'; - $exists_ip = db_get_row_sql($sql); - } - - if (!$exists_alias && !$exists_ip) { + if (!$exists_alias) { $id_agente = db_process_sql_insert( 'tagente', [ @@ -371,8 +364,6 @@ if ($create_agent) { $agent_creation_error = __('Could not be created'); if ($exists_alias) { $agent_creation_error = __('Could not be created, because name already exists'); - } else if ($exists_ip) { - $agent_creation_error = __('Could not be created, because IP already exists'); } } } @@ -962,7 +953,6 @@ if ($update_agent) { $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output))); $alias_as_name = (int) get_parameter_post('alias_as_name', 0); $direccion_agente = (string) get_parameter_post('direccion', ''); - $unique_ip = (int) get_parameter_post('unique_ip', 0); // Safe_output only validate ip. $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -1097,18 +1087,11 @@ if ($update_agent) { // If there is an agent with the same name, but a different ID. } - if ($direccion_agente !== $address_list && (bool) $unique_ip === true && $direccion_agente != '') { - $sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"'; - $exists_ip = db_get_row_sql($sql); - } - $old_group = agents_get_agent_group($id_agente); if ($grupo <= 0) { ui_print_error_message(__('The group id %d is incorrect.', $grupo)); } else if ($old_group !== $grupo && group_allow_more_agents($grupo, true, 'update') === false) { ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group')); - } else if ($exists_ip) { - ui_print_error_message(__('Duplicate main IP address')); } else { // If different IP is specified than previous, add the IP. if ($direccion_agente != '' diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index afb5a8b1f0..7a5abb8503 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -111,6 +111,15 @@ $customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select( false, 'width: 100%' ); +// Home screen. External link and Other. +$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text( + 'data_section', + $user_info['data_section'], + '', + 60, + 999, + true +); $customHomeScreenDataField = ''; foreach ($customHomeScreenAddition as $key => $customField) { $customHomeScreenDataField .= html_print_div( diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php index 65dcd96aef..b03a9e5b40 100644 --- a/pandora_console/include/ajax/agent.php +++ b/pandora_console/include/ajax/agent.php @@ -39,6 +39,7 @@ $get_agent_filters = get_parameter('get_agent_filters', 0); $save_agent_filter = get_parameter('save_agent_filter', 0); $update_agent_filter = get_parameter('update_agent_filter', 0); $delete_agent_filter = get_parameter('delete_agent_filter', 0); +$check_unique_ip = (bool) get_parameter('check_unique_ip', 0); if (https_is_running()) { header('Content-type: application/json'); @@ -1020,4 +1021,29 @@ $(document).ready(function() { return; } +if ($check_unique_ip === true) { + $direccion_agente = (string) get_parameter_post('direccion', ''); + $ip_all = get_parameter_post('ip_all', ''); + + if (empty($direccion_agente) === true) { + echo json_encode(['success' => false, 'message' => __('Please enter an IP address.')]); + return; + } + + $sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"'; + $exists_ip = db_get_row_sql($sql); + + if ($exists_ip !== false) { + if (is_array($ip_all) === true && in_array($direccion_agente, $ip_all) === true) { + echo json_encode(['success' => true, 'message' => __('Success! but this IP is already in the list.')]); + } else { + echo json_encode(['success' => false, 'message' => __('This IP is already being used'), 'exist_ip' => true]); + } + } else { + echo json_encode(['success' => true, 'message' => __('Success! this IP is available to be used.')]); + } + + return; +} + return; diff --git a/pandora_console/include/class/SatelliteAgent.class.php b/pandora_console/include/class/SatelliteAgent.class.php index 29fa2e3b77..a40b3ecc7a 100644 --- a/pandora_console/include/class/SatelliteAgent.class.php +++ b/pandora_console/include/class/SatelliteAgent.class.php @@ -388,26 +388,40 @@ class SatelliteAgent extends HTML $tmp->actions = ''; if ($delete === false) { - $tmp->actions .= html_print_image( - ($disable === true) ? 'images/lightbulb_off.png' : 'images/lightbulb.png', - true, + $tmp->actions .= html_print_anchor( [ - 'border' => '0', - 'class' => 'main_menu_icon mrgn_lft_05em invert_filter', - 'onclick' => 'disable_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $disable.'\',\''.$id_agente.'\')', - ] + 'href' => '#', + 'content' => html_print_image( + ($disable === true) ? 'images/lightbulb_off.png' : 'images/lightbulb.png', + true, + [ + 'title' => ($disable === true) ? __('Enable') : __('Disable'), + 'border' => '0', + 'class' => 'main_menu_icon mrgn_lft_05em invert_filter', + 'onclick' => 'disable_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $disable.'\',\''.$id_agente.'\')', + ] + ), + ], + true ); } if ($disable === false) { - $tmp->actions .= html_print_image( - ($delete === true) ? 'images/add.png' : 'images/delete.svg', - true, + $tmp->actions .= html_print_anchor( [ - 'border' => '0', - 'class' => 'main_menu_icon mrgn_lft_05em invert_filter', - 'onclick' => 'delete_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $delete.'\',\''.$id_agente.'\')', - ] + 'href' => '#', + 'content' => html_print_image( + ($delete === true) ? 'images/add.png' : 'images/delete.svg', + true, + [ + 'title' => ($delete === true) ? __('Add') : __('Delete'), + 'border' => '0', + 'class' => 'main_menu_icon mrgn_lft_05em invert_filter', + 'onclick' => 'delete_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $delete.'\',\''.$id_agente.'\')', + ] + ), + ], + true ); } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index fd5b51ea3e..94c8718b6a 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -481,6 +481,11 @@ select:-internal-list-box { max-width: 120px; } +.w130px { + width: 130px; + max-width: 130px; +} + .w200px { width: 200px; max-width: 200px; @@ -598,6 +603,10 @@ select:-internal-list-box { min-width: 120px; } +.mw130px { + min-width: 130px; +} + .mw180px { min-width: 180px; } diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 697dd2a3d9..792ca2770c 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1294,7 +1294,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` ( `section` TEXT, `data_section` TEXT, `metaconsole_section` VARCHAR(255) NOT NULL DEFAULT 'Default', - `metaconsole_data_section` VARCHAR(255) NOT NULL DEFAULT '', + `metaconsole_data_section` TEXT, `force_change_pass` TINYINT UNSIGNED NOT NULL DEFAULT 0, `last_pass_change` DATETIME, `last_failed_login` DATETIME,