From 260b2dbdf70bfd200b426d01b7f215a64c8a27f9 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Mon, 18 Jan 2021 14:57:20 +0100 Subject: [PATCH] Community API functions file --- pandora_console/include/functions_api.php | 713 +++++++++++----------- 1 file changed, 354 insertions(+), 359 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 1afd3f8431..ec4770757b 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -94,7 +94,7 @@ function returnError($typeError, $returnType='string') $returnType, [ 'type' => 'string', - 'data' => __('No set or get or help operation.'), + 'data' => __('Not `set`, `get` or `help` operation selected.'), ] ); break; @@ -114,7 +114,7 @@ function returnError($typeError, $returnType='string') $returnType, [ 'type' => 'string', - 'data' => __('Id does not exist in database.'), + 'data' => __('The Id does not exist in database.'), ] ); break; @@ -134,7 +134,7 @@ function returnError($typeError, $returnType='string') $returnType, [ 'type' => 'string', - 'data' => __('The user has not enough permission to make this action.'), + 'data' => __('The user has not enough permissions for perform this action.'), ] ); break; @@ -154,7 +154,7 @@ function returnError($typeError, $returnType='string') $returnType, [ 'type' => 'string', - 'data' => __('This console is not manager of this environment, please manage this feature from centralized manager console (Metaconsole).'), + 'data' => __('This console is not the environment administrator. Please, manage this feature from centralized manager console (Metaconsole).'), ] ); break; @@ -1363,7 +1363,7 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3) if ($idParent != 0) { $parentCheck = agents_check_access_agent($idParent); if ($parentCheck === null) { - returnError('parent_agent_not_exist', __('The agent parent don`t exist.')); + returnError('parent_agent_not_exist', __('The parent agent does not exist.')); return; } @@ -1507,7 +1507,7 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) global $config; if (!check_acl($config['id_user'], 0, 'AW')) { - returnError('forbidden', 'you havent got permissions to do this'); + returnError('forbidden', 'string'); return; } @@ -1516,8 +1516,7 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) } if ((int) $other['data'][3] == 0) { - $agent_creation_error = __('The agent could not be created, for security reasons use a group another than 0'); - returnError('generic error', $agent_creation_error); + returnError('generic error', __('For security reasons, the agent was not created. Use a group other than 0.')); return; } @@ -1658,9 +1657,9 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) $id_agente = 0; if ($exists_alias) { - $agent_creation_error = __('Could not be created, because name already exists'); + $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'); + $agent_creation_error = __('Could not be created because IP already exists'); } else { $agent_creation_error = __('Could not be created for unknown reason'); } @@ -1705,7 +1704,7 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) if ($resultOrId) { echo __('Success creating OS'); } else { - echo __('Error creating OS'); + echo __('Could not create OS'); } } @@ -1736,7 +1735,7 @@ function api_set_update_os($id_os, $thrash2, $other, $thrash3) if (db_process_sql_update('tconfig_os', $values, ['id_os' => $id_os])) { echo __('Success updating OS'); } else { - echo __('Error updating OS'); + echo __('Could not update OS'); } } @@ -1763,7 +1762,7 @@ function api_set_create_custom_field($t1, $t2, $other, $returnType) } if ($other['type'] == 'string') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else if ($other['type'] == 'array') { $name = ''; @@ -1923,9 +1922,9 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3) } if (!$result) { - returnError('error_delete', 'Error in delete operation.'); + returnError('error_delete', __('The agent could not be deleted')); } else { - returnData('string', ['type' => 'string', 'data' => __('Correct Delete')]); + returnData('string', ['type' => 'string', 'data' => __('The agent was successfully deleted')]); } } @@ -3263,6 +3262,7 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3) if ($agent_by_alias) { $agents_affected = 0; + $idModule = false; foreach ($idsAgents as $id) { if (!util_api_check_agent_and_print_error($id['id_agente'], 'string', 'AW')) { @@ -3318,7 +3318,7 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) if ($id_module == '') { returnError( 'error_update_network_module', - __('Error updating network module. Module name cannot be left blank.') + __('Could not update network module. Module name cannot be left blank.') ); return; } @@ -3337,7 +3337,7 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) if (!$check_id_module) { returnError( 'error_update_network_module', - __('Error updating network module. Id_module doesn\'t exist.') + __('Could not update network module. Id_module does not exist.') ); return; } @@ -3363,7 +3363,7 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) if ($id_module_exists) { returnError( 'error_update_network_module', - __('Error updating network module. Id_module exists in the new agent.') + __('Could not update network module. Id_module exists in the new agent.') ); return; } @@ -3419,7 +3419,7 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) $result_update = modules_update_agent_module($id_module, $values); if ($result_update < 0) { - returnError('error_update_network_module', 'Error updating network module.'); + returnError('error_update_network_module', __('Could not update network module.')); } else { returnData('string', ['type' => 'string', 'data' => __('Network module updated.')]); } @@ -3552,7 +3552,7 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3) if (is_error($idModule)) { // TODO: Improve the error returning more info. - returnError('error_create_plugin_module', __('Error in creation plugin module.')); + returnError('error_create_plugin_module', __('Could not create Plugin module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); } @@ -3584,7 +3584,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) } if ($id_module == '') { - returnError('error_update_plugin_module', __('Error updating plugin module. Id_module cannot be left blank.')); + returnError('error_update_plugin_module', __('Could not update plugin module. Id_module cannot be left blank.')); return; } @@ -3609,7 +3609,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) $id_module_exists = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['nombre' => $module_name, 'id_agente' => $other['data'][0]]); if ($id_module_exists) { - returnError('error_update_plugin_module', __('Error updating plugin module. Id_module exists in the new agent.')); + returnError('error_update_plugin_module', __('Could not update plugin module. Id_module exists in the new agent.')); return; } } @@ -3617,7 +3617,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) // Check if agent exists $check_id_agent = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][0]); if (!$check_id_agent) { - returnError('error_update_data_module', __('Error updating plugin module. Id_agent doesn\'t exist.')); + returnError('error_update_data_module', __('Could not update plugin module. Id_agent does not exist.')); return; } } @@ -3679,7 +3679,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) $result_update = modules_update_agent_module($id_module, $values); if ($result_update < 0) { - returnError('error_update_plugin_module', 'Error updating plugin module.'); + returnError('error_update_plugin_module', __('Could not update plugin module.')); } else { returnData('string', ['type' => 'string', 'data' => __('Plugin module updated.')]); } @@ -3711,7 +3711,7 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3) } if ($other['data'][0] == '') { - returnError('error_create_data_module', __('Error in creation data module. Module_name cannot be left blank.')); + returnError('error_create_data_module', __('Could not create data module. Module_name cannot be left blank.')); return; } @@ -3803,7 +3803,7 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3) if (is_error($idModule)) { // TODO: Improve the error returning more info. - returnError('error_create_data_module', __('Error in creation data module.')); + returnError('error_create_data_module', __('Could not create data module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); } @@ -3835,7 +3835,7 @@ function api_set_create_synthetic_module($id, $agent_by_alias, $other, $thrash3) io_safe_input_array($other); if ($other['data'][0] == '') { - returnError('error_create_data_module', __('Error in creation synthetic module. Module_name cannot be left blank.')); + returnError('error_create_data_module', __('Could not create synthetic module. Module_name cannot be left blank.')); return; } @@ -3858,13 +3858,13 @@ function api_set_create_synthetic_module($id, $agent_by_alias, $other, $thrash3) if ($agent_by_alias) { foreach ($ids_agents as $id) { if (!$id['id_agente']) { - returnError('error_create_data_module', __('Error in creation synthetic module. Agent name doesn\'t exist.')); + returnError('error_create_data_module', __('Could not create synthetic module. Agent name does not exist.')); return; } } } else { if (!$idAgent) { - returnError('error_create_data_module', __('Error in creation synthetic module. Agent name doesn\'t exist.')); + returnError('error_create_data_module', __('Could not create synthetic module. Agent name does not exist.')); return; } } @@ -3894,7 +3894,7 @@ function api_set_create_synthetic_module($id, $agent_by_alias, $other, $thrash3) if (is_error($idModule)) { // TODO: Improve the error returning more info. - returnError('error_create_data_module', __('Error in creation data module.')); + returnError('error_create_data_module', __('Could not create data module.')); } else { $synthetic_type = $other['data'][1]; unset($other['data'][0]); @@ -4037,7 +4037,7 @@ function api_set_create_synthetic_module($id, $agent_by_alias, $other, $thrash3) returnError('error_synthetic_modules', 'Error Synthetic modules.'); } else { db_process_sql('UPDATE tagente SET total_count=total_count+1, notinit_count=notinit_count+1 WHERE id_agente='.(int) $idAgent); - returnData('string', ['type' => 'string', 'data' => __('Synthetic module created ID: '.$idModule)]); + returnData('string', ['type' => 'string', 'data' => __('Synthetic module created ID: %s', $idModule)]); } } } @@ -4047,7 +4047,7 @@ function api_set_create_synthetic_module($id, $agent_by_alias, $other, $thrash3) if (is_error($idModule)) { // TODO: Improve the error returning more info - returnError('error_create_data_module', __('Error in creation data module.')); + returnError('error_create_data_module', __('Could not create data module.')); } else { $synthetic_type = $other['data'][1]; unset($other['data'][0]); @@ -4223,7 +4223,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) } if ($id_module == '') { - returnError('error_update_data_module', __('Error updating data module. Id_module cannot be left blank.')); + returnError('error_update_data_module', __('Could not update data module. Id_module cannot be left blank.')); return; } @@ -4248,7 +4248,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) $id_module_exists = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['nombre' => $module_name, 'id_agente' => $other['data'][0]]); if ($id_module_exists) { - returnError('error_update_data_module', __('Error updating data module. Id_module exists in the new agent.')); + returnError('error_update_data_module', __('Could not update data module. Id_module exists in the new agent.')); return; } } @@ -4256,7 +4256,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) // Check if agent exists $check_id_agent = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][0]); if (!$check_id_agent) { - returnError('error_update_data_module', __('Error updating data module. Id_agent doesn\'t exist.')); + returnError('error_update_data_module', __('Could not update data module. Id_agent does not exist.')); return; } } @@ -4305,7 +4305,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) $result_update = modules_update_agent_module($id_module, $values); if ($result_update < 0) { - returnError('error_update_data_module', 'Error updating data module.'); + returnError('error_update_data_module', 'Could not update data module.'); } else { returnData('string', ['type' => 'string', 'data' => __('Data module updated.')]); } @@ -4343,12 +4343,12 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) } if ($other['data'][0] == '') { - returnError('error_create_snmp_module', __('Error in creation SNMP module. Module_name cannot be left blank.')); + returnError('error_create_snmp_module', __('Could not create SNMP module. Module_name cannot be left blank.')); return; } if ($other['data'][2] < 15 or $other['data'][2] > 18) { - returnError('error_create_snmp_module', __('Error in creation SNMP module. Invalid id_module_type for a SNMP module.')); + returnError('error_create_snmp_module', __('Could not create SNMP module. Invalid id_module_type for a SNMP module.')); return; } @@ -4379,17 +4379,17 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) // SNMP version 3. if ($other['data'][14] == '3') { if ($other['data'][23] != 'AES' and $other['data'][23] != 'DES') { - returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. ')); + returnError('error_create_snmp_module', __('Could not create SNMP module. snmp3_priv_method does not exist. Set it to \'AES\' or \'DES\'. ')); return; } if ($other['data'][25] != 'authNoPriv' and $other['data'][25] != 'authPriv' and $other['data'][25] != 'noAuthNoPriv') { - returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_sec_level doesn\'t exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ')); + returnError('error_create_snmp_module', __('Could not create SNMP module. snmp3_sec_level does not exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ')); return; } if ($other['data'][26] != 'MD5' and $other['data'][26] != 'SHA') { - returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_auth_method doesn\'t exist. Set it to \'MD5\' or \'SHA\'. ')); + returnError('error_create_snmp_module', __('Could not create SNMP module. snmp3_auth_method does not exist. Set it to \'MD5\' or \'SHA\'. ')); return; } @@ -4493,7 +4493,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) if (is_error($idModule)) { // TODO: Improve the error returning more info - returnError('error_create_snmp_module', __('Error in creation SNMP module.')); + returnError('error_create_snmp_module', __('Could not create SNMP module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); } @@ -4527,7 +4527,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) } if ($id_module == '') { - returnError('error_update_snmp_module', __('Error updating SNMP module. Id_module cannot be left blank.')); + returnError('error_update_snmp_module', __('Could not update SNMP module. Id_module cannot be left blank.')); return; } @@ -4552,7 +4552,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) $id_module_exists = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['nombre' => $module_name, 'id_agente' => $other['data'][0]]); if ($id_module_exists) { - returnError('error_update_snmp_module', __('Error updating SNMP module. Id_module exists in the new agent.')); + returnError('error_update_snmp_module', __('Could not update SNMP module. Id_module exists in the new agent.')); return; } } @@ -4560,7 +4560,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) // Check if agent exists $check_id_agent = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][0]); if (!$check_id_agent) { - returnError('error_update_data_module', __('Error updating snmp module. Id_agent doesn\'t exist.')); + returnError('error_update_data_module', __('Could not update snmp module. Id_agent does not exist.')); return; } } @@ -4570,7 +4570,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) if ($other['data'][22] != 'AES' and $other['data'][22] != 'DES') { returnError( 'error_create_snmp_module', - __('Error in creation SNMP module. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. ') + __('Error in creation SNMP module. snmp3_priv_method does not exist. Set it to \'AES\' or \'DES\'. ') ); return; } @@ -4581,7 +4581,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) ) { returnError( 'error_create_snmp_module', - __('Error in creation SNMP module. snmp3_sec_level doesn\'t exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ') + __('Error in creation SNMP module. snmp3_sec_level does not exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ') ); return; } @@ -4589,7 +4589,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) if ($other['data'][25] != 'MD5' and $other['data'][25] != 'SHA') { returnError( 'error_create_snmp_module', - __('Error in creation SNMP module. snmp3_auth_method doesn\'t exist. Set it to \'MD5\' or \'SHA\'. ') + __('Error in creation SNMP module. snmp3_auth_method does not exist. Set it to \'MD5\' or \'SHA\'. ') ); return; } @@ -4679,7 +4679,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) $result_update = modules_update_agent_module($id_module, $values); if ($result_update < 0) { - returnError('error_update_snmp_module', 'Error updating SNMP module.'); + returnError('error_update_snmp_module', 'Could not update SNMP module.'); } else { returnData('string', ['type' => 'string', 'data' => __('SNMP module updated.')]); } @@ -4717,17 +4717,17 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2) } if ($id == '') { - returnError('error_set_new_network_component', __('Error creating network component. Network component name cannot be left blank.')); + returnError('error_set_new_network_component', __('Could not create network component. Network component name cannot be left blank.')); return; } if ($other['data'][0] < 6 or $other['data'][0] > 18) { - returnError('error_set_new_network_component', __('Error creating network component. Incorrect value for Network component type field.')); + returnError('error_set_new_network_component', __('Could not create network component. Incorrect value for Network component type field.')); return; } if ($other['data'][17] == '') { - returnError('error_set_new_network_component', __('Error creating network component. Network component group cannot be left blank.')); + returnError('error_set_new_network_component', __('Could not create network component. Network component group cannot be left blank.')); return; } @@ -4765,14 +4765,14 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2) $name_check = db_get_value('name', 'tnetwork_component', 'name', $id); if ($name_check !== false) { - returnError('error_set_new_network_component', __('Error creating network component. This network component already exists.')); + returnError('error_set_new_network_component', __('Could not create network component. This network component already exist.')); return; } $id = network_components_create_network_component($id, $other['data'][0], $other['data'][17], $values); if (!$id) { - returnError('error_set_new_network_component', 'Error creating network component.'); + returnError('error_set_new_network_component', 'Could not create network component.'); } else { returnData('string', ['type' => 'string', 'data' => $id]); } @@ -4813,18 +4813,18 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2) if ($id == '') { returnError( 'error_set_new_plugin_component', - __('Error creating plugin component. Plugin component name cannot be left blank.') + __('Could not create plugin component. Plugin component name cannot be left blank.') ); return; } if ($other['data'][7] == '') { - returnError('error_set_new_plugin_component', __('Error creating plugin component. Incorrect value for Id plugin.')); + returnError('error_set_new_plugin_component', __('Could not create plugin component. Incorrect value for Id plugin.')); return; } if ($other['data'][21] == '') { - returnError('error_set_new_plugin_component', __('Error creating plugin component. Plugin component group cannot be left blank.')); + returnError('error_set_new_plugin_component', __('Could not create plugin component. Plugin component group cannot be left blank.')); return; } @@ -4866,14 +4866,14 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2) $name_check = db_get_value('name', 'tnetwork_component', 'name', $id); if ($name_check !== false) { - returnError('error_set_new_plugin_component', __('Error creating plugin component. This plugin component already exists.')); + returnError('error_set_new_plugin_component', __('Could not create plugin component. This plugin component already exist.')); return; } $id = network_components_create_network_component($id, $other['data'][0], $other['data'][21], $values); if (!$id) { - returnError('error_set_new_plugin_component', 'Error creating plugin component.'); + returnError('error_set_new_plugin_component', 'Could not create plugin component.'); } else { returnData('string', ['type' => 'string', 'data' => $id]); } @@ -4908,7 +4908,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) } if ($id == '') { - returnError('error_set_new_snmp_component', __('Error creating SNMP component. SNMP component name cannot be left blank.')); + returnError('error_set_new_snmp_component', __('Could not create SNMP component. SNMP component name cannot be left blank.')); return; } @@ -4918,12 +4918,12 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) } if ($other['data'][0] < 15 or $other['data'][0] > 17) { - returnError('error_set_new_snmp_component', __('Error creating SNMP component. Incorrect value for Snmp component type field.')); + returnError('error_set_new_snmp_component', __('Could not create SNMP component. Incorrect value for Snmp component type field.')); return; } if ($other['data'][25] == '') { - returnError('error_set_new_snmp_component', __('Error creating SNMP component. Snmp component group cannot be left blank.')); + returnError('error_set_new_snmp_component', __('Could not create SNMP component. Snmp component group cannot be left blank.')); return; } @@ -4934,7 +4934,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) // SNMP version 3 if ($other['data'][16] == '3') { if ($other['data'][22] != 'AES' and $other['data'][22] != 'DES') { - returnError('error_set_new_snmp_component', __('Error creating SNMP component. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. ')); + returnError('error_set_new_snmp_component', __('Could not create SNMP component. snmp3_priv_method does not exist. Set it to \'AES\' or \'DES\'. ')); return; } @@ -4944,7 +4944,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) ) { returnError( 'error_set_new_snmp_component', - __('Error creating SNMP component. snmp3_sec_level doesn\'t exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ') + __('Could not create SNMP component. snmp3_sec_level does not exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ') ); return; } @@ -4952,7 +4952,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) if ($other['data'][24] != 'MD5' and $other['data'][24] != 'SHA') { returnError( 'error_set_new_snmp_component', - __('Error creating SNMP component. snmp3_auth_method doesn\'t exist. Set it to \'MD5\' or \'SHA\'. ') + __('Could not create SNMP component. snmp3_auth_method does not exist. Set it to \'MD5\' or \'SHA\'. ') ); return; } @@ -5035,14 +5035,14 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) $name_check = db_get_value('name', 'tnetwork_component', 'name', $id); if ($name_check !== false) { - returnError('error_set_new_snmp_component', __('Error creating SNMP component. This SNMP component already exists.')); + returnError('error_set_new_snmp_component', __('Could not create SNMP component. This SNMP component already exist.')); return; } $id = network_components_create_network_component($id, $other['data'][0], $other['data'][26], $values); if (!$id) { - returnError('error_set_new_snmp_component', 'Error creating SNMP component.'); + returnError('error_set_new_snmp_component', 'Could not create SNMP component.'); } else { returnData('string', ['type' => 'string', 'data' => $id]); } @@ -5077,7 +5077,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2) if ($id == '') { returnError( 'error_set_new_local_component', - __('Error creating local component. Local component name cannot be left blank.') + __('Could not create local component. Local component name cannot be left blank.') ); return; } @@ -5090,7 +5090,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2) if ($other['data'][1] == '') { returnError( 'error_set_new_local_component', - __('Error creating local component. Local component group cannot be left blank.') + __('Could not create local component. Local component group cannot be left blank.') ); return; } @@ -5123,7 +5123,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2) if ($name_check === ENTERPRISE_NOT_HOOK) { returnError( 'error_set_new_local_component', - __('Error creating local component.') + __('Could not create local component.') ); return; } @@ -5131,7 +5131,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2) if ($name_check !== false) { returnError( 'error_set_new_local_component', - __('Error creating local component. This local component already exists.') + __('Could not create local component. This local component already exist.') ); return; } @@ -5147,7 +5147,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2) ); if (!$id) { - returnError('error_set_new_local_component', 'Error creating local component.'); + returnError('error_set_new_local_component', 'Could not create local component.'); } else { returnData('string', ['type' => 'string', 'data' => $id]); } @@ -5176,7 +5176,7 @@ function api_get_module_value_all_agents($id, $thrash1, $other, $thrash2) if ($id == '') { returnError( 'error_get_module_value_all_agents', - __('Error getting module value from all agents. Module name cannot be left blank.') + __('Failed to get module value from all agents. Module name cannot be left blank.') ); return; } @@ -5186,7 +5186,7 @@ function api_get_module_value_all_agents($id, $thrash1, $other, $thrash2) if ($id_module === false) { returnError( 'error_get_module_value_all_agents', - __('Error getting module value from all agents. Module name doesn\'t exist.') + __('Failed to get module value from all agents. Module name does not exist.') ); return; } @@ -5209,7 +5209,7 @@ function api_get_module_value_all_agents($id, $thrash1, $other, $thrash2) $module_values = db_get_all_rows_sql($sql); if (!$module_values) { - returnError('error_get_module_value_all_agents', 'Error getting module values from all agents.'); + returnError('error_get_module_value_all_agents', 'Could not get module values from all agents.'); } else { $data = [ 'type' => 'array', @@ -5249,7 +5249,7 @@ function api_set_create_alert_template($name, $thrash1, $other, $thrash3) if ($name == '') { returnError( 'error_create_alert_template', - __('Error creating alert template. Template name cannot be left blank.') + __('Could not create alert template. Template name cannot be left blank.') ); return; } @@ -5321,7 +5321,7 @@ function api_set_create_alert_template($name, $thrash1, $other, $thrash3) if (is_error($id_template)) { // TODO: Improve the error returning more info - returnError('error_create_alert_template', __('Error creating alert template.')); + returnError('error_create_alert_template', __('Could not create alert template.')); } else { returnData('string', ['type' => 'string', 'data' => $id_template]); } @@ -5361,7 +5361,7 @@ function api_set_update_alert_template($id_template, $thrash1, $other, $thrash3) if ($id_template == '') { returnError( 'error_update_alert_template', - __('Error updating alert template. Id_template cannot be left blank.') + __('Could not update alert template. Id_template cannot be left blank.') ); return; } @@ -5371,7 +5371,7 @@ function api_set_update_alert_template($id_template, $thrash1, $other, $thrash3) if (!$result_template) { returnError( 'error_update_alert_template', - __('Error updating alert template. Id_template doesn\'t exist.') + __('Could not update alert template. Id_template does not exist.') ); return; } @@ -5422,14 +5422,14 @@ function api_set_update_alert_template($id_template, $thrash1, $other, $thrash3) // TODO: Improve the error returning more info returnError( 'error_create_alert_template', - __('Error updating alert template.') + __('Could not update alert template.') ); } else { returnData( 'string', [ 'type' => 'string', - 'data' => __('Correct updating of alert template'), + 'data' => __('Successful update of the alert template'), ] ); } @@ -5458,7 +5458,7 @@ function api_set_delete_alert_template($id_template, $thrash1, $other, $thrash3) if ($id_template == '') { returnError( 'error_delete_alert_template', - __('Error deleting alert template. Id_template cannot be left blank.') + __('Could not delete alert template. Id_template cannot be left blank.') ); return; } @@ -5469,14 +5469,14 @@ function api_set_delete_alert_template($id_template, $thrash1, $other, $thrash3) // TODO: Improve the error returning more info returnError( 'error_create_alert_template', - __('Error deleting alert template.') + __('Could not delete alert template.') ); } else { returnData( 'string', [ 'type' => 'string', - 'data' => __('Correct deleting of alert template.'), + 'data' => __('Successful delete of alert template.'), ] ); } @@ -5527,7 +5527,7 @@ function api_get_all_alert_templates($thrash1, $thrash2, $other, $thrash3) if (!$template) { returnError( 'error_get_all_alert_templates', - __('Error getting all alert templates.') + __('Could not get all alert templates.') ); } else { returnData('csv', $data, $separator); @@ -5572,7 +5572,7 @@ function api_get_all_alert_commands($thrash1, $thrash2, $other, $thrash3) if (!$commands) { returnError( 'error_get_all_alert_commands', - __('Error getting all alert commands.') + __('Could not get all alert commands.') ); } else { returnData('csv', $data, $separator); @@ -5607,7 +5607,7 @@ function api_get_alert_template($id_template, $thrash1, $other, $thrash3) if (!$result_template) { returnError( 'error_get_alert_template', - __('Error getting alert template. Id_template doesn\'t exist.') + __('Could not get alert template. Id_template does not exist.') ); return; } @@ -5635,7 +5635,7 @@ function api_get_alert_template($id_template, $thrash1, $other, $thrash3) if (!$template) { returnError( 'error_get_alert_template', - __('Error getting alert template.') + __('Could not get alert template.') ); } else { returnData('csv', $data, ';'); @@ -5699,7 +5699,7 @@ function api_get_alert_actions($thrash1, $thrash2, $other, $returnType) if (!$actions) { returnError( 'error_get_alert_actions', - __('Error getting alert actions.') + __('Could not get alert actions.') ); } else { returnData($returnType, $data, $separator); @@ -5749,7 +5749,7 @@ function api_get_module_groups($thrash1, $thrash2, $other, $thrash3) } if (!$module_groups) { - returnError('error_get_module_groups', __('Error getting module groups.')); + returnError('error_get_module_groups', __('Could not get module groups.')); } else { returnData('csv', $data, $separator); } @@ -5813,7 +5813,7 @@ function api_get_plugins($thrash1, $thrash2, $other, $thrash3) } if (!$plugins) { - returnError('error_get_plugins', __('Error getting plugins.')); + returnError('error_get_plugins', __('Could not get plugins.')); } else { returnData('csv', $data, $separator); } @@ -5861,13 +5861,13 @@ function api_set_create_network_module_from_component($agent_name, $component_na if ($agent_by_alias) { foreach ($ids_agents as $id) { if (!$id['id_agente']) { - returnError('error_network_module_from_component', __('Error creating module from network component. Agent doesn\'t exist.')); + returnError('error_network_module_from_component', __('Could not create module from network component. Agent does not exist.')); return; } } } else { if (!$agent_id) { - returnError('error_network_module_from_component', __('Error creating module from network component. Agent doesn\'t exist.')); + returnError('error_network_module_from_component', __('Could not create module from network component. Agent does not exist.')); return; } } @@ -5875,7 +5875,7 @@ function api_set_create_network_module_from_component($agent_name, $component_na $component = db_get_row('tnetwork_component', 'name', $component_name); if (!$component) { - returnError('error_network_module_from_component', __('Error creating module from network component. Network component doesn\'t exist.')); + returnError('error_network_module_from_component', __('Could not create module from network component. Network component does not exist.')); return; } @@ -5907,7 +5907,7 @@ function api_set_create_network_module_from_component($agent_name, $component_na $module_id = modules_create_agent_module($agent_id, $component_name, $component, true); if (!$module_id) { - returnError('error_network_module_from_component', __('Error creating module from network component. Error creating module.')); + returnError('error_network_module_from_component', __('Could not create module from network component.')); return; } @@ -5938,7 +5938,7 @@ function api_set_create_module_template($id, $thrash1, $other, $thrash3) if ($id == '') { returnError( 'error_module_to_template', - __('Error assigning module to template. Id_template cannot be left blank.') + __('Could not assign module to template. Id_template cannot be left blank.') ); return; } @@ -5946,7 +5946,7 @@ function api_set_create_module_template($id, $thrash1, $other, $thrash3) if ($other['data'][0] == '') { returnError( 'error_module_to_template', - __('Error assigning module to template. Id_module cannot be left blank.') + __('Could not assign module to template. Id_module cannot be left blank.') ); return; } @@ -5954,7 +5954,7 @@ function api_set_create_module_template($id, $thrash1, $other, $thrash3) if ($other['data'][1] == '') { returnError( 'error_module_to_template', - __('Error assigning module to template. Id_agent cannot be left blank.') + __('Could not assign module to template. Id_agent cannot be left blank.') ); return; } @@ -5971,7 +5971,7 @@ function api_set_create_module_template($id, $thrash1, $other, $thrash3) if (!$result_template) { returnError( 'error_module_to_template', - __('Error assigning module to template. Id_template doensn\'t exists.') + __('Could not assign module to template. Id_template does not exist.') ); return; } @@ -5979,14 +5979,14 @@ function api_set_create_module_template($id, $thrash1, $other, $thrash3) $result_agent = agents_get_name($id_agent); if (!$result_agent) { - returnError('error_module_to_template', __('Error assigning module to template. Id_agent doesn\'t exist.')); + returnError('error_module_to_template', __('Could not assign module to template. Id_agent does not exist.')); return; } $result_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', (int) $id_module); if (!$result_module) { - returnError('error_module_to_template', __('Error assigning module to template. Id_module doesn\'t exist.')); + returnError('error_module_to_template', __('Could not assign module to template. Id_module does not exist.')); return; } @@ -5994,7 +5994,7 @@ function api_set_create_module_template($id, $thrash1, $other, $thrash3) if (is_error($id_template_module)) { // TODO: Improve the error returning more info - returnError('error_module_to_template', __('Error assigning module to template.')); + returnError('error_module_to_template', __('Could not assign module to template.')); } else { returnData('string', ['type' => 'string', 'data' => $id_template_module]); } @@ -6028,14 +6028,14 @@ function api_set_delete_module_template($id, $thrash1, $other, $thrash3) } if ($id == '') { - returnError('error_delete_module_template', __('Error deleting module template. Id_module_template cannot be left blank.')); + returnError('error_delete_module_template', __('Could not delete module template. Id_module_template cannot be left blank.')); return; } $result_module_template = alerts_get_alert_agent_module($id); if (!$result_module_template) { - returnError('error_delete_module_template', __('Error deleting module template. Id_module_template doesn\'t exist.')); + returnError('error_delete_module_template', __('Could not delete module template. Id_module_template does not exist.')); return; } @@ -6043,7 +6043,7 @@ function api_set_delete_module_template($id, $thrash1, $other, $thrash3) if ($result == 0) { // TODO: Improve the error returning more info - returnError('error_delete_module_template', __('Error deleting module template.')); + returnError('error_delete_module_template', __('Could not delete module template.')); } else { returnData('string', ['type' => 'string', 'data' => __('Correct deleting of module template.')]); } @@ -6104,7 +6104,7 @@ function api_set_delete_module_template_by_names($id, $id2, $other, $trash1) $row = db_get_row_filter('talert_templates', ['name' => $id2]); if ($row === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -6138,7 +6138,7 @@ function api_set_delete_module_template_by_names($id, $id2, $other, $trash1) $idAgentModule = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['id_agente' => $idAgent, 'nombre' => $other['data'][0]]); if ($idAgentModule === false) { - returnError('error_parameter', 'Error in the parameters1.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -6151,9 +6151,9 @@ function api_set_delete_module_template_by_names($id, $id2, $other, $trash1) if ($result == 0) { // TODO: Improve the error returning more info - returnError('error_delete_module_template_by_name', __('Error deleting module template.')); + returnError('error_delete_module_template_by_name', __('Could not delete module template.')); } else { - returnData('string', ['type' => 'string', 'data' => __('Correct deleting of module template.')]); + returnData('string', ['type' => 'string', 'data' => __('Successful delete of module template.')]); } } } @@ -6226,9 +6226,9 @@ function api_set_validate_all_alerts($id, $thrash1, $other, $thrash3) if ($total_alerts > $count_results) { $errors = ($total_alerts - $count_results); - returnError('error_validate_all_alerts', __('Error validate all alerts. Failed '.$errors.'.')); + returnError('error_validate_all_alerts', __('Failed to validate all alerts. Failed '.$errors.'.')); } else { - returnData('string', ['type' => 'string', 'data' => __('Correct validating of all alerts (total %d).', $count_results)]); + returnData('string', ['type' => 'string', 'data' => __('Correct validation of all alerts (total %d).', $count_results)]); } } @@ -6263,7 +6263,7 @@ function api_set_validate_all_policy_alerts($id, $thrash1, $other, $thrash3) $policies = enterprise_hook('policies_get_policies', [false, false, false]); if ($duplicated === ENTERPRISE_NOT_HOOK) { - returnError('error_validate_all_policy_alerts', __('Error validating all alert policies.')); + returnError('error_validate_all_policy_alerts', __('Failed to validate all alert policies.')); return; } @@ -6320,9 +6320,9 @@ function api_set_validate_all_policy_alerts($id, $thrash1, $other, $thrash3) // Check results if ($total_alerts > $count_results) { $errors = ($total_alerts - $count_results); - returnError('error_validate_all_alerts', __('Error validate all policy alerts. Failed '.$errors.'.')); + returnError('error_validate_all_alerts', __('Failed to validate all policy alerts. Failed '.$errors.'.')); } else { - returnData('string', ['type' => 'string', 'data' => __('Correct validating of all policy alerts.')]); + returnData('string', ['type' => 'string', 'data' => __('Correct validation of all policy alerts.')]); } } @@ -6354,7 +6354,7 @@ function api_set_stop_downtime($id, $thrash1, $other, $thrash3) } if ($id == '') { - returnError('error_stop_downtime', __('Error stopping downtime. Id_downtime cannot be left blank.')); + returnError('error_stop_downtime', __('Failed to stop downtime. Id_downtime cannot be left blank.')); return; } @@ -6367,7 +6367,7 @@ function api_set_stop_downtime($id, $thrash1, $other, $thrash3) if ($result_update == 0) { returnError('error_stop_downtime', __('No action has been taken.')); } else if ($result_update < 0) { - returnError('error_stop_downtime', __('Error stopping downtime.')); + returnError('error_stop_downtime', __('Could not stop downtime.')); } else { returnData('string', ['type' => 'string', 'data' => __('Downtime stopped.')]); } @@ -6414,7 +6414,7 @@ function api_set_add_tag_module($id, $id2, $thrash1, $thrash2) } if (empty($exists)) { - returnError('error_set_tag_module', 'Error set tag module.'); + returnError('error_set_tag_module', 'Failed to set tag module.'); } else { returnData( 'string', @@ -6496,7 +6496,7 @@ function api_set_tag($id, $thrash1, $other, $thrash3) $id_tag = tags_create_tag($values); if (empty($id_tag)) { - returnError('error_set_tag', __('Error set tag.')); + returnError('error_set_tag', __('Failed to set tag.')); } else { returnData( 'string', @@ -6558,7 +6558,7 @@ function api_get_all_planned_downtimes($thrash1, $thrash2, $other, $returnType=' $returned = all_planned_downtimes($values); if ($returned === false) { - returnError('error_get_all_planned_downtimes', __('No planned downtime retrieved')); + returnError('error_get_all_planned_downtimes', __('Planned downtime was not retrieved')); return; } @@ -6893,7 +6893,7 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3) } if ($id == '') { - returnError('error_add_data_module_policy', __('Error adding data module to policy. Id_policy cannot be left blank.')); + returnError('error_add_data_module_policy', __('Could not add data module to policy. Id_policy cannot be left blank.')); return; } @@ -6903,7 +6903,7 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3) } if ($other['data'][0] == '') { - returnError('error_add_data_module_policy', __('Error adding data module to policy. Module_name cannot be left blank.')); + returnError('error_add_data_module_policy', __('Could not add data module to policy. Module_name cannot be left blank.')); return; } @@ -6911,7 +6911,7 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3) $name_module_policy = enterprise_hook('policies_get_modules', [$id, ['name' => $other['data'][0]], 'name']); if ($name_module_policy === ENTERPRISE_NOT_HOOK) { - returnError('error_add_data_module_policy', __('Error adding data module to policy.')); + returnError('error_add_data_module_policy', __('Could not add data module to policy.')); return; } @@ -6949,7 +6949,7 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3) if ($name_module_policy[0]['name'] == $other['data'][0]) { returnError( 'error_add_data_module_policy', - __('Error adding data module to policy. The module is already in the policy.') + __('Could not add data module to policy. The module is already in the policy.') ); return; } @@ -6970,7 +6970,7 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3) // returnData('string', array('type' => 'string', 'data' => __('Data module added to policy. Is necessary to apply the policy in order to changes take effect.'))); returnData('string', ['type' => 'string', 'data' => $success]); } else { - returnError('error_add_data_module_policy', 'Error adding data module to policy.'); + returnError('error_add_data_module_policy', 'Could not add data module to policy.'); } } @@ -7001,7 +7001,7 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3) } if ($id == '') { - returnError('error_update_data_module_policy', __('Error updating data module in policy. Id_policy cannot be left blank.')); + returnError('error_update_data_module_policy', __('Could not update data module in policy. Id_policy cannot be left blank.')); return; } @@ -7010,7 +7010,7 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3) } if ($other['data'][0] == '') { - returnError('error_update_data_module_policy', __('Error updating data module in policy. Id_policy_module cannot be left blank.')); + returnError('error_update_data_module_policy', __('Could not update data module in policy. Id_policy_module cannot be left blank.')); return; } @@ -7018,14 +7018,14 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3) $module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']); if ($module_policy === false) { - returnError('error_update_data_module_policy', __('Error updating data module in policy. Module doesn\'t exist.')); + returnError('error_update_data_module_policy', __('Could not update data module in policy. Module does not exist.')); return; } if ($module_policy[0]['id_module'] != 1) { returnError( 'error_update_data_module_policy', - __('Error updating data module in policy. Module type is not network type.') + __('Could not update data module in policy. Module type is not network type.') ); return; } @@ -7069,7 +7069,7 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3) ); if ($result_update < 0) { - returnError('error_update_data_module_policy', 'Error updating policy module.'); + returnError('error_update_data_module_policy', 'Could not update policy module.'); } else { returnData( 'string', @@ -7110,7 +7110,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) if ($id == '') { returnError( 'error_network_data_module_policy', - __('Error adding network module to policy. Id_policy cannot be left blank.') + __('Could not add network module to policy. Id_policy cannot be left blank.') ); return; } @@ -7123,7 +7123,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) if ($other['data'][0] == '') { returnError( 'error_network_data_module_policy', - __('Error adding network module to policy. Module_name cannot be left blank.') + __('Could not add network module to policy. Module_name cannot be left blank.') ); return; } @@ -7131,7 +7131,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) if ($other['data'][1] < 6 or $other['data'][1] > 18) { returnError( 'error_network_data_module_policy', - __('Error adding network module to policy. Id_module_type is not correct for network modules.') + __('Could not add network module to policy. Id_module_type is not correct for network modules.') ); return; } @@ -7149,7 +7149,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) if ($name_module_policy === ENTERPRISE_NOT_HOOK) { returnError( 'error_network_data_module_policy', - __('Error adding network module to policy.') + __('Could not add network module to policy.') ); return; } @@ -7189,7 +7189,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) if ($name_module_policy !== false) { if ($name_module_policy[0]['name'] == $other['data'][0]) { - returnError('error_network_data_module_policy', __('Error adding network module to policy. The module is already in the policy.')); + returnError('error_network_data_module_policy', __('Could not add network module to policy. The module is already in the policy.')); return; } } @@ -7199,7 +7199,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) if ($success) { returnData('string', ['type' => 'string', 'data' => $success]); } else { - returnError('error_add_network_module_policy', 'Error adding network module to policy.'); + returnError('error_add_network_module_policy', 'Could not add network module to policy.'); } } @@ -7231,7 +7231,7 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3) if ($id == '') { returnError( 'error_update_network_module_policy', - __('Error updating network module in policy. Id_policy cannot be left blank.') + __('Could not update network module in policy. Id_policy cannot be left blank.') ); return; } @@ -7239,18 +7239,18 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3) if ($other['data'][0] == '') { returnError( 'error_update_network_module_policy', - __('Error updating network module in policy. Id_policy_module cannot be left blank.') + __('Could not update network module in policy. Id_policy_module cannot be left blank.') ); return; } - // Check if the module exists. + // Check if the module exist. $module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']); if ($module_policy === false) { returnError( 'error_update_network_module_policy', - __('Error updating network module in policy. Module doesn\'t exist.') + __('Could not update network module in policy. Module does not exist.') ); return; } @@ -7258,7 +7258,7 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3) if ($module_policy[0]['id_module'] != 2) { returnError( 'error_update_network_module_policy', - __('Error updating network module in policy. Module type is not network type.') + __('Could not update network module in policy. Module type is not network type.') ); return; } @@ -7300,7 +7300,7 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3) $result_update = enterprise_hook('policies_update_module', [$other['data'][0], $values, false]); if ($result_update < 0) { - returnError('error_update_network_module_policy', 'Error updating policy module.'); + returnError('error_update_network_module_policy', 'Could not update policy module.'); } else { returnData('string', ['type' => 'string', 'data' => __('Network policy module updated.')]); } @@ -7332,7 +7332,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) } if ($id == '') { - returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. Id_policy cannot be left blank.')); + returnError('error_add_plugin_module_policy', __('Could not add plugin module to policy. Id_policy cannot be left blank.')); return; } @@ -7342,12 +7342,12 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) } if ($other['data'][0] == '') { - returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. Module_name cannot be left blank.')); + returnError('error_add_plugin_module_policy', __('Could not add plugin module to policy. Module_name cannot be left blank.')); return; } if ($other['data'][22] == '') { - returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. Id_plugin cannot be left blank.')); + returnError('error_add_plugin_module_policy', __('Could not add plugin module to policy. Id_plugin cannot be left blank.')); return; } @@ -7355,7 +7355,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) $name_module_policy = enterprise_hook('policies_get_modules', [$id, ['name' => $other['data'][0]], 'name']); if ($name_module_policy === ENTERPRISE_NOT_HOOK) { - returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy.')); + returnError('error_add_plugin_module_policy', __('Could not add plugin module to policy.')); return; } @@ -7399,7 +7399,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) if ($name_module_policy !== false) { if ($name_module_policy[0]['name'] == $other['data'][0]) { - returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. The module is already in the policy.')); + returnError('error_add_plugin_module_policy', __('Could not add plugin module to policy. The module is already in the policy.')); return; } } @@ -7409,7 +7409,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) if ($success) { returnData('string', ['type' => 'string', 'data' => $success]); } else { - returnError('error_add_plugin_module_policy', 'Error adding plugin module to policy.'); + returnError('error_add_plugin_module_policy', 'Could not add plugin module to policy.'); } } @@ -7442,7 +7442,7 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) if ($id == '') { returnError( 'error_update_plugin_module_policy', - __('Error updating plugin module in policy. Id_policy cannot be left blank.') + __('Could not update plugin module in policy. Id_policy cannot be left blank.') ); return; } @@ -7450,18 +7450,18 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) if ($other['data'][0] == '') { returnError( 'error_update_plugin_module_policy', - __('Error updating plugin module in policy. Id_policy_module cannot be left blank.') + __('Could not update plugin module in policy. Id_policy_module cannot be left blank.') ); return; } - // Check if the module exists. + // Check if the module exist. $module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']); if ($module_policy === false) { returnError( 'error_updating_plugin_module_policy', - __('Error updating plugin module in policy. Module doesn\'t exist.') + __('Could not update plugin module in policy. Module does not exist.') ); return; } @@ -7469,7 +7469,7 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) if ($module_policy[0]['id_module'] != 4) { returnError( 'error_updating_plugin_module_policy', - __('Error updating plugin module in policy. Module type is not network type.') + __('Could not update plugin module in policy. Module type is not network type.') ); return; } @@ -7527,7 +7527,7 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) ); if ($result_update < 0) { - returnError('error_update_plugin_module_policy', 'Error updating policy module.'); + returnError('error_update_plugin_module_policy', 'Could not update policy module.'); } else { returnData('string', ['type' => 'string', 'data' => __('Plugin policy module updated.')]); } @@ -7615,7 +7615,7 @@ function api_get_module_from_conf($id_agent, $module_name, $thrash2, $thrash3) if ($result !== ENTERPRISE_NOT_HOOK && !empty($result)) { returnData('string', ['type' => 'string', 'data' => $result]); } else { - returnError('error_adding_module_conf', __('Remote config of module %s not available', $module_name)); + returnError('error_adding_module_conf', __('Remote config of module %s is not available', $module_name)); } } @@ -7732,7 +7732,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) } if ($id == '') { - returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. Id_policy cannot be left blank.')); + returnError('error_add_snmp_module_policy', __('Could not add SNMP module to policy. Id_policy cannot be left blank.')); return; } @@ -7742,7 +7742,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) } if ($other['data'][0] == '') { - returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. Module_name cannot be left blank.')); + returnError('error_add_snmp_module_policy', __('Could not add SNMP module to policy. Module_name cannot be left blank.')); return; } @@ -7750,12 +7750,12 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) $name_module_policy = enterprise_hook('policies_get_modules', [$id, ['name' => $other['data'][0]], 'name']); if ($name_module_policy === ENTERPRISE_NOT_HOOK) { - returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy.')); + returnError('error_add_snmp_module_policy', __('Could not add SNMP module to policy.')); return; } if ($other['data'][2] < 15 or $other['data'][2] > 18) { - returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. Id_module_type is not correct for SNMP modules.')); + returnError('error_add_snmp_module_policy', __('Could not add SNMP module to policy. Id_module_type is not correct for SNMP modules.')); return; } @@ -7766,17 +7766,17 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) // SNMP version 3 if ($other['data'][13] == '3') { if ($other['data'][22] != 'AES' and $other['data'][22] != 'DES') { - returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. ')); + returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_priv_method does not exist. Set it to \'AES\' or \'DES\'. ')); return; } if ($other['data'][24] != 'authNoPriv' and $other['data'][24] != 'authPriv' and $other['data'][24] != 'noAuthNoPriv') { - returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_sec_level doesn\'t exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ')); + returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_sec_level does not exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ')); return; } if ($other['data'][25] != 'MD5' and $other['data'][25] != 'SHA') { - returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_auth_method doesn\'t exist. Set it to \'MD5\' or \'SHA\'. ')); + returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_auth_method does not exist. Set it to \'MD5\' or \'SHA\'. ')); return; } @@ -7849,7 +7849,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) if ($name_module_policy !== false) { if ($name_module_policy[0]['name'] == $other['data'][0]) { - returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. The module is already in the policy.')); + returnError('error_add_snmp_module_policy', __('Could not add SNMP module to policy. The module is already in the policy.')); return; } } @@ -7859,7 +7859,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) if ($success) { returnData('string', ['type' => 'string', 'data' => $success]); } else { - returnError('error_add_snmp_module_policy', 'Error adding SNMP module to policy.'); + returnError('error_add_snmp_module_policy', 'Could not add SNMP module to policy.'); } } @@ -7891,12 +7891,12 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) } if ($id == '') { - returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Id_policy cannot be left blank.')); + returnError('error_update_snmp_module_policy', __('Could not update SNMP module in policy. Id_policy cannot be left blank.')); return; } if ($other['data'][0] == '') { - returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Id_policy_module cannot be left blank.')); + returnError('error_update_snmp_module_policy', __('Could not update SNMP module in policy. Id_policy_module cannot be left blank.')); return; } @@ -7904,12 +7904,12 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) $module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']); if ($module_policy === false) { - returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Module doesn\'t exist.')); + returnError('error_update_snmp_module_policy', __('Could not update SNMP module in policy. Module does not exist.')); return; } if ($module_policy[0]['id_module'] != 2) { - returnError('error_update_snmp_module_policy', __('Error updating SNMP module in policy. Module type is not SNMP type.')); + returnError('error_update_snmp_module_policy', __('Could not update SNMP module in policy. Module type is not SNMP type.')); return; } @@ -7918,7 +7918,7 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) if ($other['data'][21] != 'AES' and $other['data'][21] != 'DES') { returnError( 'error_update_snmp_module_policy', - __('Error updating SNMP module. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. ') + __('Could not update SNMP module. snmp3_priv_method does not exist. Set it to \'AES\' or \'DES\'. ') ); return; @@ -7930,7 +7930,7 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) ) { returnError( 'error_update_snmp_module_policy', - __('Error updating SNMP module. snmp3_sec_level doesn\'t exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ') + __('Could not update SNMP module. snmp3_sec_level does not exist. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ') ); return; @@ -7939,7 +7939,7 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) if ($other['data'][24] != 'MD5' and $other['data'][24] != 'SHA') { returnError( 'error_update_snmp_module_policy', - __('Error updating SNMP module. snmp3_auth_method doesn\'t exist. Set it to \'MD5\' or \'SHA\'. ') + __('Could not update SNMP module. snmp3_auth_method does not exist. Set it to \'MD5\' or \'SHA\'. ') ); return; @@ -8019,7 +8019,7 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) ); if ($result_update < 0) { - returnError('error_update_snmp_module_policy', 'Error updating policy module.'); + returnError('error_update_snmp_module_policy', 'Could not update policy module.'); } else { returnData( 'string', @@ -8046,18 +8046,18 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) function api_set_remove_agent_from_policy_by_id($id, $thrash1, $other, $thrash2) { if ($id == '' || !$id) { - returnError('error_parameter', __('Error deleting agent from policy. Policy cannot be left blank.')); + returnError('error_parameter', __('Could not delete agent from policy. Policy cannot be left blank.')); return; } if ($other['data'][0] == '' || !$other['data'][0]) { - returnError('error_parameter', __('Error deleting agent from policy. Agent cannot be left blank.')); + returnError('error_parameter', __('Could not delete agent from policy. Agent cannot be left blank.')); return; } // Require node id if is metaconsole if (is_metaconsole() && $other['data'][1] == '') { - returnError('error_add_agent_policy', __('Error deleting agent from policy. Node ID cannot be left blank.')); + returnError('error_add_agent_policy', __('Could not delete agent from policy. Node ID cannot be left blank.')); return; } @@ -8079,12 +8079,12 @@ function api_set_remove_agent_from_policy_by_id($id, $thrash1, $other, $thrash2) function api_set_remove_agent_from_policy_by_name($id, $thrash1, $other, $thrash2) { if ($id == '' || !$id) { - returnError('error_parameter', __('Error deleting agent from policy. Policy cannot be left blank.')); + returnError('error_parameter', __('Could not delete agent from policy. Policy cannot be left blank.')); return; } if ($other['data'][0] == '' || !$other['data'][0]) { - returnError('error_add_agent_policy', __('Error adding agent to policy. Agent name cannot be left blank.')); + returnError('error_add_agent_policy', __('Could not add agent to policy. Agent name cannot be left blank.')); return; } @@ -8129,7 +8129,7 @@ function api_set_create_group($id, $thrash1, $other, $thrash3) if ($id == '') { returnError( 'error_create_group', - __('Error in group creation. Group_name cannot be left blank.') + __('Could not create a group. Group_name cannot be left blank.') ); return; } @@ -8137,7 +8137,7 @@ function api_set_create_group($id, $thrash1, $other, $thrash3) if ($other['data'][0] == '') { returnError( 'error_create_group', - __('Error in group creation. Icon_name cannot be left blank.') + __('Could not create a group. Icon_name cannot be left blank.') ); return; } @@ -8150,7 +8150,7 @@ function api_set_create_group($id, $thrash1, $other, $thrash3) if ($group == false) { returnError( 'error_create_group', - __('Error in group creation. Id_parent_group doesn\'t exist.') + __('Could not create a group. Id_parent_group does not exist.') ); return; } @@ -8179,7 +8179,7 @@ function api_set_create_group($id, $thrash1, $other, $thrash3) if (is_error($id_group)) { // TODO: Improve the error returning more info - returnError('error_create_group', __('Error in group creation.')); + returnError('error_create_group', __('Could not create a group.')); } else { if (defined('METACONSOLE')) { $servers = db_get_all_rows_sql( @@ -8236,7 +8236,7 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3) } if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $id_group) === false) { - returnError('error_set_update_group', __('There is not any group with the id provided')); + returnError('error_set_update_group', __('There is no group with the ID provided')); return; } @@ -8304,7 +8304,7 @@ function api_set_delete_group($id_group, $thrash2, $other, $thrash3) $group = db_get_row_filter('tgrupo', ['id_grupo' => $id_group]); if (!$group) { - returnError('error_delete', 'Error in delete operation. Id does not exist.'); + returnError('error_delete', 'Could not delete group. ID does not exist.'); return; } @@ -8317,7 +8317,7 @@ function api_set_delete_group($id_group, $thrash2, $other, $thrash3) if ($usedGroup['return']) { returnError( 'error_delete', - 'Error in delete operation. The group is not empty (used in '.implode(', ', $usedGroup['tables']).').' + 'The delete action could not be performed. The group is not empty (used in '.implode(', ', $usedGroup['tables']).').' ); return; } @@ -8328,9 +8328,9 @@ function api_set_delete_group($id_group, $thrash2, $other, $thrash3) $result = db_process_sql_delete('tgrupo', ['id_grupo' => $id_group]); if (!$result) { - returnError('error_delete', 'Error in delete operation.'); + returnError('error_delete', 'The delete action could not be performed.'); } else { - returnData('string', ['type' => 'string', 'data' => __('Correct Delete')]); + returnData('string', ['type' => 'string', 'data' => __('Successful deletion')]); } } @@ -8366,18 +8366,18 @@ function api_set_create_netflow_filter($thrash1, $thrash2, $other, $thrash3) } if ($other['data'][0] == '') { - returnError('error_create_netflow_filter', __('Error in netflow filter creation. Filter name cannot be left blank.')); + returnError('error_create_netflow_filter', __('Could not create netflow filter. Filter name cannot be left blank.')); return; } if ($other['data'][1] == '') { - returnError('error_create_netflow_filter', __('Error in netflow filter creation. Group id cannot be left blank.')); + returnError('error_create_netflow_filter', __('Could not create netflow filter. Group id cannot be left blank.')); return; } else { $group = groups_get_group_by_id($other['data'][1]); if ($group == false) { - returnError('error_create_group', __('Error in netflow filter creation. Id_group doesn\'t exist.')); + returnError('error_create_group', __('Could not create netflow filter. Id_group does not exist.')); return; } @@ -8388,17 +8388,17 @@ function api_set_create_netflow_filter($thrash1, $thrash2, $other, $thrash3) } if ($other['data'][2] == '') { - returnError('error_create_netflow_filter', __('Error in netflow filter creation. Filter cannot be left blank.')); + returnError('error_create_netflow_filter', __('Could not create netflow filter. Filter cannot be left blank.')); return; } if ($other['data'][3] == '') { - returnError('error_create_netflow_filter', __('Error in netflow filter creation. Aggregate_by cannot be left blank.')); + returnError('error_create_netflow_filter', __('Could not create netflow filter. Aggregate_by cannot be left blank.')); return; } if ($other['data'][4] == '') { - returnError('error_create_netflow_filter', __('Error in netflow filter creation. Output_format cannot be left blank.')); + returnError('error_create_netflow_filter', __('Could not create netflow filter. Output_format cannot be left blank.')); return; } @@ -8416,7 +8416,7 @@ function api_set_create_netflow_filter($thrash1, $thrash2, $other, $thrash3) $id = db_process_sql_insert('tnetflow_filter', $values); if ($id === false) { - returnError('error_create_netflow_filter', __('Error in netflow filter creation.')); + returnError('error_create_netflow_filter', __('Could not create netflow filter.')); } else { returnData('string', ['type' => 'string', 'data' => $id]); } @@ -8515,7 +8515,7 @@ function api_get_module_data($id, $thrash1, $other, $returnType) ); if ($data === false) { - returnError('error_query_module_data', 'Error in the query of module data.'); + returnError('error_query_module_data', 'Module data query error.'); } else if ($data['data'] == '') { returnError('error_query_module_data', 'No data to show.'); } else { @@ -8636,9 +8636,9 @@ function api_set_new_user($id, $thrash2, $other, $thrash3) $values['session_time'] = $other['data'][12]; if (!create_user($id, $password, $values)) { - returnError('error_create_user', 'Error create user'); + returnError('error_create_user', 'The user could not created'); } else { - returnData('string', ['type' => 'string', 'data' => __('Create user.')]); + returnData('string', ['type' => 'string', 'data' => __('User created.')]); } } @@ -8692,7 +8692,7 @@ function api_set_update_user($id, $thrash2, $other, $thrash3) if ($id == '') { returnError( 'error_update_user', - __('Error updating user. Id_user cannot be left blank.') + __('Could not update user. Id_user cannot be left blank.') ); return; } @@ -8702,7 +8702,7 @@ function api_set_update_user($id, $thrash2, $other, $thrash3) if (!$result_user) { returnError( 'error_update_user', - __('Error updating user. Id_user doesn\'t exist.') + __('Could not update user. Id_user does not exist.') ); return; } @@ -8719,15 +8719,15 @@ function api_set_update_user($id, $thrash2, $other, $thrash3) // If password field has data if ($other['data'][4] != '') { if (!update_user_password($id, $other['data'][4])) { - returnError('error_update_user', __('Error updating user. Password info incorrect.')); + returnError('error_update_user', __('Could not update user. Password info incorrect.')); return; } } if (!update_user($id, $values)) { - returnError('error_create_user', 'Error updating user'); + returnError('error_create_user', 'Could not update user'); } else { - returnData('string', ['type' => 'string', 'data' => __('Updated user.')]); + returnData('string', ['type' => 'string', 'data' => __('User updated.')]); } } @@ -8769,7 +8769,7 @@ function api_set_enable_disable_user($id, $thrash2, $other, $thrash3) if ($id == '') { returnError( 'error_enable_disable_user', - __('Error enable/disable user. Id_user cannot be left blank.') + __('Failed switching enable/disable user. Id_user cannot be left blank.') ); return; } @@ -8777,7 +8777,7 @@ function api_set_enable_disable_user($id, $thrash2, $other, $thrash3) if ($other['data'][0] != '0' and $other['data'][0] != '1') { returnError( 'error_enable_disable_user', - __('Error enable/disable user. Enable/disable value cannot be left blank.') + __('Failed switching enable/disable user. Enable/disable value cannot be left blank.') ); return; } @@ -8785,7 +8785,7 @@ function api_set_enable_disable_user($id, $thrash2, $other, $thrash3) if (users_get_user_by_id($id) == false) { returnError( 'error_enable_disable_user', - __('Error enable/disable user. The user doesn\'t exist.') + __('Failed switching enable/disable user. The user does not exist.') ); return; } @@ -8796,7 +8796,7 @@ function api_set_enable_disable_user($id, $thrash2, $other, $thrash3) // TODO: Improve the error returning more info returnError( 'error_enable_disable_user', - __('Error in user enabling/disabling.') + __('Could not enable/disable user.') ); } else { if ($other['data'][0] == '0') { @@ -8878,11 +8878,6 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f } } - // Esto es extraño, hablar con Tati - /* - $filter['1'] = $filter['sql']; - unset($filter['sql']); */ - if (isset($other['data'][4]) && $other['data'][4] != '') { $idTemplate = db_get_value_filter('id', 'talert_templates', ['name' => $other['data'][4]]); if ($idTemplate !== false) { @@ -9036,7 +9031,7 @@ function api_set_new_alert_template($id, $id2, $other, $trash1) } if ($other['type'] == 'string') { - returnError('error_parameter', 'Error in the parameters0.'); + returnError('error_parameter', 'Parameter error.'); return; } else if ($other['type'] == 'array') { $agent_by_alias = false; @@ -9066,7 +9061,7 @@ function api_set_new_alert_template($id, $id2, $other, $trash1) $row = db_get_row_filter('talert_templates', ['name' => $id2]); if ($row === false) { - returnError('error_parameter', 'Error in the parameters1.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -9100,7 +9095,7 @@ function api_set_new_alert_template($id, $id2, $other, $trash1) $idAgentModule = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['id_agente' => $idAgent, 'nombre' => $other['data'][0]]); if ($idAgentModule === false) { - returnError('error_parameter', 'Error in the parameter2s.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -9189,7 +9184,7 @@ function api_set_delete_module($id, $id2, $other, $trash1) $idAgentModule = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['id_agente' => $idAgent, 'nombre' => $id2]); if ($idAgentModule === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -9235,7 +9230,7 @@ function api_set_module_data($id, $thrash2, $other, $trash1) $agentModule = db_get_row_filter('tagente_modulo', ['id_agente_modulo' => $idAgentModule]); if ($agentModule === false) { - returnError('error_parameter', 'Not found module agent.'); + returnError('error_parameter', 'Module agent not found.'); } else { $agent = db_get_row_filter('tagente', ['id_agente' => $agentModule['id_agente']]); @@ -9273,7 +9268,7 @@ function api_set_module_data($id, $thrash2, $other, $trash1) } } } else { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } } @@ -9286,7 +9281,7 @@ function api_set_new_module($id, $id2, $other, $trash1) } if ($other['type'] == 'string') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else if ($other['type'] == 'array') { $values = []; @@ -9319,12 +9314,12 @@ function api_set_new_module($id, $id2, $other, $trash1) $values['id_tipo_modulo'] = db_get_value_filter('id_tipo', 'ttipo_modulo', ['nombre' => $other['data'][0]]); if ($values['id_tipo_modulo'] === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } if ($other['data'][1] == '') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -9332,7 +9327,7 @@ function api_set_new_module($id, $id2, $other, $trash1) if (strstr($other['data'][0], 'icmp') === false) { if (($other['data'][2] == '') || ($other['data'][2] <= 0 || $other['data'][2] > 65535)) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -9451,7 +9446,7 @@ function api_set_alert_actions($id, $id2, $other, $trash1) } if ($other['type'] == 'string') { - returnError('error_parameter', 'Error in the parameters0.'); + returnError('error_parameter', 'Parameter error.'); return; } else if ($other['type'] == 'array') { $agent_by_alias = false; @@ -9480,7 +9475,7 @@ function api_set_alert_actions($id, $id2, $other, $trash1) $row = db_get_row_filter('talert_templates', ['name' => $id2]); if ($row === false) { - returnError('error_parameter', 'Error in the parameters1.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -9497,18 +9492,18 @@ function api_set_alert_actions($id, $id2, $other, $trash1) $idAlertTemplateModule = db_get_value_filter('id', 'talert_template_modules', ['id_alert_template' => $idTemplate, 'id_agent_module' => $idAgentModule]); if ($idAlertTemplateModule === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } if ($other['data'][1] != '') { $idAction = db_get_value_filter('id', 'talert_actions', ['name' => $other['data'][1]]); if ($idAction === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } } else { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -9535,24 +9530,24 @@ function api_set_alert_actions($id, $id2, $other, $trash1) } else { $idAgentModule = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['id_agente' => $idAgent, 'nombre' => $other['data'][0]]); if ($idAgentModule === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } $idAlertTemplateModule = db_get_value_filter('id', 'talert_template_modules', ['id_alert_template' => $idTemplate, 'id_agent_module' => $idAgentModule]); if ($idAlertTemplateModule === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } if ($other['data'][1] != '') { $idAction = db_get_value_filter('id', 'talert_actions', ['name' => $other['data'][1]]); if ($idAction === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } } else { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } @@ -9604,21 +9599,21 @@ function api_set_new_module_group($id, $thrash2, $other, $trash1) } if ($id == '' || !$id) { - returnError('error_parameter', __('Module group must have a name')); + returnError('error_parameter', __('Module group must have a name.')); return; } $name = db_get_value('name', 'tmodule_group', 'name', $id); if ($name) { - returnError('error_parameter', __('Each module group must have a different name')); + returnError('error_parameter', __('Each Module Group must have a different name.')); return; } $return = db_process_sql_insert('tmodule_group', ['name' => $id]); if ($return === false) { - returnError('error_new_moodule_group', 'There was a problem creating group'); + returnError('error_new_moodule_group', 'There was a problem creating group.'); } else { returnData('string', ['type' => 'string', 'data' => $return]); } @@ -9663,14 +9658,14 @@ function api_set_module_group_synch($thrash1, $thrash2, $other, $thrash4) // User feedback if ($module_group_create_err > 0 or $module_group_update_err > 0) { - returnError('module_group_synch_err', __('Error creating/updating %s/%s module groups
', $module_group_create_err, $module_group_update_err)); + returnError('module_group_synch_err', __('Could not create/update %s/%s module groups
', $module_group_create_err, $module_group_update_err)); } if ($module_group_create_ok > 0 or $module_group_update_ok > 0) { returnData('string', ['type' => 'string', 'data' => $string_ok]); } } else { - returnError('not_defined_in_metaconsole', __('This function is only for metaconsole')); + returnError('not_defined_in_metaconsole', __('This function is for metaconsole only')); } } @@ -9727,17 +9722,17 @@ function api_set_alert_commands($id, $thrash2, $other, $trash1) } if ($name) { - returnError('error_parameter', __('Name already exist')); + returnError('error_parameter', __('Name already exist.')); return; } if (!$group && $id_group != 0) { - returnError('error_parameter', __('Group does not exist')); + returnError('error_parameter', __('Group does not exist.')); return; } if ($other['type'] == 'string') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else if ($other['type'] == 'array') { $fields_descriptions = []; @@ -9792,21 +9787,21 @@ function api_set_new_event($trash1, $trash2, $other, $trash3) if ($other['type'] == 'string') { if ($other['data'] != '') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } } else if ($other['type'] == 'array') { $values = []; if (($other['data'][0] == null) && ($other['data'][0] == '')) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { $values['evento'] = $other['data'][0]; } if (($other['data'][1] == null) && ($other['data'][1] == '')) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { $valuesAvaliable = [ @@ -9831,27 +9826,27 @@ function api_set_new_event($trash1, $trash2, $other, $trash3) if (in_array($other['data'][1], $valuesAvaliable)) { $values['event_type'] = $other['data'][1]; } else { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } } if (($other['data'][2] == null) && ($other['data'][2] == '')) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { $values['estado'] = $other['data'][2]; } if (($other['data'][3] == null) && ($other['data'][3] == '')) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { $values['id_agente'] = agents_get_agent_id($other['data'][3]); } if (($other['data'][4] == null) && ($other['data'][4] == '')) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { $idAgentModule = db_get_value_filter( @@ -9865,14 +9860,14 @@ function api_set_new_event($trash1, $trash2, $other, $trash3) } if ($idAgentModule === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { $values['id_agentmodule'] = $idAgentModule; } if (($other['data'][5] == null) && ($other['data'][5] == '')) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { if ($other['data'][5] != 'all') { @@ -9882,7 +9877,7 @@ function api_set_new_event($trash1, $trash2, $other, $trash3) } if ($idGroup === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { $values['id_grupo'] = $idGroup; @@ -9890,13 +9885,13 @@ function api_set_new_event($trash1, $trash2, $other, $trash3) } if (($other['data'][6] == null) && ($other['data'][6] == '')) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { if (($other['data'][6] >= 0) && ($other['data'][6] <= 4)) { $values['criticity'] = $other['data'][6]; } else { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } } @@ -9914,7 +9909,7 @@ function api_set_new_event($trash1, $trash2, $other, $trash3) ); if ($idAlert === false) { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { $values['id_alert_am'] = $idAlert; @@ -9955,7 +9950,7 @@ function api_set_event_validate_filter_pro($trash1, $trash2, $other, $trash3) if ($other['type'] == 'string') { if ($other['data'] != '') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } } else if ($other['type'] == 'array') { @@ -10052,7 +10047,7 @@ function api_set_event_validate_filter($trash1, $trash2, $other, $trash3) if ($other['type'] == 'string') { if ($other['data'] != '') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } } else if ($other['type'] == 'array') { @@ -10132,7 +10127,7 @@ function api_set_validate_events($id_event, $trash1, $other, $return_type, $user ] ); } else { - returnError('Error in validation operation.'); + returnError('The event could not be validated.'); } } @@ -10163,7 +10158,7 @@ function api_get_gis_agent($id_agent, $trash1, $tresh2, $return_type, $user_in_d ] ); } else { - returnError('get_gis_agent', __('There is not gis data for the agent')); + returnError('get_gis_agent', __('There is not GIS data for the agent.')); } } @@ -10204,7 +10199,7 @@ function api_set_gis_agent_only_position($id_agent, $trash1, $other, $return_typ if (!$config['activate_gis']) { $correct = false; - returnError('error_gis_agent_only_position', __('Gis not activated')); + returnError('error_gis_agent_only_position', __('GIS not activated.')); return; } else { if ($correct) { @@ -10223,7 +10218,7 @@ function api_set_gis_agent_only_position($id_agent, $trash1, $other, $return_typ __('Insert by %s Console', get_product_name()) ); } else { - returnError('error_gis_agent_only_position', __('Missing parameters')); + returnError('error_gis_agent_only_position', __('Missing parameters.')); return; } } @@ -10322,7 +10317,7 @@ function api_set_gis_agent($id_agent, $trash1, $other, $return_type, $user_in_db if (!$config['activate_gis']) { $correct = false; - returnError('error_gis_agent_only_position', __('Gis not activated')); + returnError('error_gis_agent_only_position', __('GIS not activated.')); return; } else { if ($correct) { @@ -10341,7 +10336,7 @@ function api_set_gis_agent($id_agent, $trash1, $other, $return_type, $user_in_db $description_first_insert ); } else { - returnError('error_set_ig_agent', __('Missing parameters')); + returnError('error_set_ig_agent', __('Missing parameters.')); return; } } @@ -10735,7 +10730,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db if ($other['type'] == 'string') { if ($other['data'] != '') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { // Default values @@ -10880,11 +10875,11 @@ function api_set_event($id_event, $unused1, $params, $unused2, $unused3) if (empty($result) === true || $result === false) { returnError( 'failed_event_update', - __('Failed event update') + __('Could not update the event') ); return false; } else { - returnData('string', ['data' => 'Event updated']); + returnData('string', ['data' => 'Event updated.']); } return; @@ -10928,7 +10923,7 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null) if ($other['type'] == 'string') { if ($other['data'] != '') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { // Default values @@ -10987,9 +10982,9 @@ function api_set_delete_user($id, $thrash1, $thrash2, $thrash3) } if (!delete_user($id)) { - returnError('error_delete_user', 'Error delete user'); + returnError('error_delete_user', 'Could not delete user'); } else { - returnData('string', ['type' => 'string', 'data' => __('Delete user.')]); + returnData('string', ['type' => 'string', 'data' => __('User deleted.')]); } } @@ -11025,12 +11020,12 @@ function api_set_add_user_profile($id, $thrash1, $other, $thrash2) $profile = $other['data'][1]; if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $group) === false) { - returnError('error_set_add_user_profile', __('There is not any group with the id provided')); + returnError('error_set_add_user_profile', __('There is not any group with the ID provided.')); return; } if (db_get_value('id_perfil', 'tperfil', 'id_perfil', $profile) === false) { - returnError('error_set_add_user_profile', __('There is not any profile with the id provided')); + returnError('error_set_add_user_profile', __('There is not any profile with the ID provided.')); return; } @@ -11040,9 +11035,9 @@ function api_set_add_user_profile($id, $thrash1, $other, $thrash2) } if (!profile_create_user_profile($id, $profile, $group, 'API')) { - returnError('error_add_user_profile', 'Error add user profile.'); + returnError('error_add_user_profile', 'Could not add user profile.'); } else { - returnData('string', ['type' => 'string', 'data' => __('Add user profile.')]); + returnData('string', ['type' => 'string', 'data' => __('User profile added.')]); } } @@ -11078,12 +11073,12 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2) $profile = $other['data'][1]; if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $group) === false) { - returnError('error_set_add_user_profile', __('There is not any group with the id provided')); + returnError('error_set_add_user_profile', __('There is not any group with the ID provided.')); return; } if (db_get_value('id_perfil', 'tperfil', 'id_perfil', $profile) === false) { - returnError('error_set_add_user_profile', __('There is not any profile with the id provided')); + returnError('error_set_add_user_profile', __('There is not any profile with the ID provided.')); return; } @@ -11099,9 +11094,9 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2) ]; $result = db_process_sql_delete('tusuario_perfil', $where); if ($return === false) { - returnError('error_delete_user_profile', 'Error delete user profile.'); + returnError('error_delete_user_profile', 'Could not delete user profile.'); } else { - returnData('string', ['type' => 'string', 'data' => __('Delete user profile.')]); + returnData('string', ['type' => 'string', 'data' => __('User profile deleted.')]); } } @@ -11158,7 +11153,7 @@ function api_get_user_profiles_info($thrash1, $thrash2, $thrash3, $returnType) ); if ($profiles === false) { - returnError('error_list_profiles', __('Error retrieving profiles')); + returnError('error_list_profiles', __('Profiles could not be retrieved.')); } else { returnData($returnType, ['type' => 'array', 'data' => $profiles]); } @@ -11214,7 +11209,7 @@ function api_set_create_user_profile_info($thrash1, $thrash2, $other, $returnTyp $return = db_process_sql_insert('tperfil', $values); if ($return === false) { - returnError('error_create_user_profile_info', __('Error creating user profile')); + returnError('error_create_user_profile_info', __('Could not create user profile.')); } else { returnData($returnType, ['type' => 'array', 'data' => 1]); } @@ -11276,7 +11271,7 @@ function api_set_update_user_profile_info($id_profile, $thrash1, $other, $return $return = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]); if ($return === false) { - returnError('error_update_user_profile_info', __('Error updating user profile')); + returnError('error_update_user_profile_info', __('Could not update user profile')); } else { returnData($returnType, ['type' => 'array', 'data' => 1]); } @@ -11311,7 +11306,7 @@ function api_set_delete_user_profile_info($id_profile, $thrash1, $thrash2, $retu $return = profile_delete_profile_and_clean_users($id_profile); if ($return === false) { - returnError('error_delete_user_profile_info', __('Error deleting user profile')); + returnError('error_delete_user_profile_info', __('Could not delete user profile')); } else { returnData($returnType, ['type' => 'array', 'data' => 1]); } @@ -11369,7 +11364,7 @@ function api_set_new_incident($thrash1, $thrash2, $other, $thrash3) $idIncident = db_process_sql_insert('tincidencia', $values); if ($return === false) { - returnError('error_new_incident', 'Error create new incident.'); + returnError('error_new_incident', 'A new incident could not be created.'); } else { returnData('string', ['type' => 'string', 'data' => $idIncident]); } @@ -11406,7 +11401,7 @@ function api_set_new_note_incident($id, $id2, $other, $thrash2) $idNote = db_process_sql_insert('tnota', $values); if ($idNote === false) { - returnError('error_new_incident', 'Error create new incident.'); + returnError('error_new_incident', 'A new incident could not be created+.'); } else { returnData('string', ['type' => 'string', 'data' => $idNote]); } @@ -11472,9 +11467,9 @@ function api_set_disable_module($agent_name, $module_name, $other, $thrash4) $result = modules_change_disabled($id_agent_module, 1); if ($result === NOERR) { - returnData('string', ['type' => 'string', 'data' => __('Correct module disable')]); + returnData('string', ['type' => 'string', 'data' => __('Module disabled successfully.')]); } else { - returnData('string', ['type' => 'string', 'data' => __('Error disabling module')]); + returnData('string', ['type' => 'string', 'data' => __('The module could not be disabled.')]); } } } @@ -11538,9 +11533,9 @@ function api_set_enable_module($agent_name, $module_name, $other, $thrash4) $result = modules_change_disabled($id_agent_module, 0); if ($result === NOERR) { - returnData('string', ['type' => 'string', 'data' => __('Correct module enable')]); + returnData('string', ['type' => 'string', 'data' => __('Module enabled successfully.')]); } else { - returnData('string', ['type' => 'string', 'data' => __('Error enabling module')]); + returnData('string', ['type' => 'string', 'data' => __('The module could not be enabled.')]); } } } @@ -11586,9 +11581,9 @@ function api_set_disable_alert($agent_name, $module_name, $template_name, $thras ); if ($result) { - returnData('string', ['type' => 'string', 'data' => 'Correct alert disable']); + returnData('string', ['type' => 'string', 'data' => 'Alert disabled successfully.']); } else { - returnData('string', ['type' => 'string', 'data' => __('Error alert disable')]); + returnData('string', ['type' => 'string', 'data' => __('The alert could not be disabled.')]); } } @@ -11635,13 +11630,13 @@ function api_set_disable_alert_alias($agent_alias, $module_name, $template_name, ); if ($result) { - returnData('string', ['type' => 'string', 'data' => 'Correct alert disable']); + returnData('string', ['type' => 'string', 'data' => 'Alert disabled successfully.']); return; } } if (!$result) { - returnData('string', ['type' => 'string', 'data' => __('Error alert disable')]); + returnData('string', ['type' => 'string', 'data' => __('The alert could not be disabled.')]); } } @@ -11686,9 +11681,9 @@ function api_set_enable_alert($agent_name, $module_name, $template_name, $thrash ); if ($result) { - returnData('string', ['type' => 'string', 'data' => 'Correct alert enable']); + returnData('string', ['type' => 'string', 'data' => 'Alert enabled successfully.']); } else { - returnData('string', ['type' => 'string', 'data' => __('Error alert enable')]); + returnData('string', ['type' => 'string', 'data' => __('The alert could not be enabled.')]); } } @@ -11735,13 +11730,13 @@ function api_set_enable_alert_alias($agent_alias, $module_name, $template_name, ); if ($result) { - returnData('string', ['type' => 'string', 'data' => 'Correct alert enable']); + returnData('string', ['type' => 'string', 'data' => 'Alert enabled successfully.']); return; } } if (!$result) { - returnData('string', ['type' => 'string', 'data' => __('Error alert enable')]); + returnData('string', ['type' => 'string', 'data' => __('The alert could not be enabled.')]); } } @@ -11822,7 +11817,7 @@ function api_set_disable_module_alerts($agent_name, $module_name, $other, $thras WHERE id_agent_module = $id_agent_module" ); - returnData('string', ['type' => 'string', 'data' => 'Correct alerts disable']); + returnData('string', ['type' => 'string', 'data' => 'Alerts disabled successfully.']); } } @@ -11903,7 +11898,7 @@ function api_set_enable_module_alerts($agent_name, $module_name, $other, $thrash WHERE id_agent_module = $id_agent_module" ); - returnData('string', ['type' => 'string', 'data' => 'Correct alerts enable']); + returnData('string', ['type' => 'string', 'data' => 'Alerts enabled successfully.']); } } @@ -11923,7 +11918,7 @@ function api_get_tags($thrash1, $thrash2, $other, $returnType, $user_in_db) if ($other['type'] == 'string') { if ($other['data'] != '') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else { // Default values @@ -12323,7 +12318,7 @@ function api_set_create_tag($id, $trash1, $other, $returnType) ] ); } else { - returnError('error_set_tag_user_profile', 'Error create tag user profile.'); + returnError('error_set_tag_user_profile', 'Could not create tag for user profile.'); } } @@ -12339,7 +12334,7 @@ function api_set_create_event($id, $trash1, $other, $returnType) } if ($other['type'] == 'string') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else if ($other['type'] == 'array') { $values = []; @@ -12371,7 +12366,7 @@ function api_set_create_event($id, $trash1, $other, $returnType) if (!empty($other['data'][17]) && is_metaconsole()) { $id_server = db_get_row_filter('tmetaconsole_setup', ['id' => $other['data'][17]]); if ($id_server === false) { - returnError('error_create_event', __('Server id does not exist in database.')); + returnError('error_create_event', __('Server ID does not exist in database.')); return; } @@ -12627,7 +12622,7 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3) } if ($other['type'] == 'string') { - returnError('error_parameter', 'Error in the parameters.'); + returnError('error_parameter', 'Parameter error.'); return; } else if ($other['type'] == 'array') { $comment = $other['data'][0]; @@ -12643,7 +12638,7 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3) if (is_error($status)) { returnError( 'error_add_event_comment', - __('Error adding event comment.') + __('Could not add event comment.') ); return; } @@ -12787,11 +12782,11 @@ function api_set_validate_event_by_id($id, $trash1=null, $trash2=null, $returnTy $status = db_get_value('estado', $table_events, 'id_evento', $id); if ($status == 1) { // event already validated - $data['data'] = 'Event already validated'; + $data['data'] = 'Event already validated.'; } else { $ack_utimestamp = time(); - events_comment($id, '', 'Change status to validated'); + events_comment($id, '', 'Changed the status to validated.'); $values = [ 'ack_utimestamp' => $ack_utimestamp, @@ -12801,13 +12796,13 @@ function api_set_validate_event_by_id($id, $trash1=null, $trash2=null, $returnTy $result = db_process_sql_update($table_events, $values, ['id_evento' => $id]); if ($result === false) { - $data['data'] = 'Error validating event'; + $data['data'] = 'The event could not be validated.'; } else { - $data['data'] = 'Event validate'; + $data['data'] = 'Validated event.'; } } } else { - $data['data'] = 'Event not exists'; + $data['data'] = 'Event does not exist.'; } returnData($returnType, $data); @@ -12926,7 +12921,7 @@ function api_set_enable_disable_agent($id, $thrash2, $other, $thrash3) if ($id == '') { returnError( 'error_enable_disable_agent', - __('Error enable/disable agent. Id_agent cannot be left blank.') + __('Failed switching enable/disable agent. Id_agent cannot be left blank.') ); return; } @@ -12938,7 +12933,7 @@ function api_set_enable_disable_agent($id, $thrash2, $other, $thrash3) if ($other['data'][0] != '0' and $other['data'][0] != '1') { returnError( 'error_enable_disable_agent', - __('Error enable/disable agent. Enable/disable value cannot be left blank.') + __('Failed switching enable/disable agent. Enable/disable value cannot be left blank.') ); return; } @@ -12946,7 +12941,7 @@ function api_set_enable_disable_agent($id, $thrash2, $other, $thrash3) if (agents_get_name($id) == false) { returnError( 'error_enable_disable_agent', - __('Error enable/disable agent. The agent doesn\'t exist.') + __('Failed switching enable/disable agent. The agent does not exist.') ); return; } @@ -12970,7 +12965,7 @@ function api_set_enable_disable_agent($id, $thrash2, $other, $thrash3) if (is_error($result)) { // TODO: Improve the error returning more info - returnError('error_enable_disable_agent', __('Error in agent enabling/disabling.')); + returnError('error_enable_disable_agent', __('Failed switching enable/disable agent.')); } else { if ($disabled == 0) { returnData( @@ -13100,7 +13095,7 @@ function api_get_special_days($thrash1, $thrash2, $other, $thrash3) } if (!$special_days) { - returnError('error_get_special_days', __('Error getting special_days.')); + returnError('error_get_special_days', __('Could not get special_days.')); } else { returnData('csv', $data, $separator); } @@ -13140,23 +13135,23 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3) $check_id_special_day = db_get_value('id', 'talert_special_days', 'date', $special_day); if ($check_id_special_day) { - returnError('error_create_special_day', __('Error creating special day. Specified day already exists.')); + returnError('error_create_special_day', __('Could not create special day. Specified day already exist.')); return; } if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $special_day)) { - returnError('error_create_special_day', __('Error creating special day. Invalid date format.')); + returnError('error_create_special_day', __('Could not create special day. Invalid date format.')); return; } if (!isset($idGroup) || $idGroup == '') { - returnError('error_create_special_day', __('Error creating special day. Group id cannot be left blank.')); + returnError('error_create_special_day', __('Could not create special day. Group id cannot be left blank.')); return; } else { $group = groups_get_group_by_id($idGroup); if ($group == false) { - returnError('error_create_special_day', __('Error creating special day. Id_group doesn\'t exist.')); + returnError('error_create_special_day', __('Could not create special day. Id_group does not exist.')); return; } @@ -13174,7 +13169,7 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3) $idSpecialDay = alerts_create_alert_special_day($special_day, $same_day, $values); if (is_error($idSpecialDay)) { - returnError('error_create_special_day', __('Error in creation special day.')); + returnError('error_create_special_day', __('Could not create special day.')); } else { returnData('string', ['type' => 'string', 'data' => $idSpecialDay]); } @@ -13227,7 +13222,7 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) $server_name = $other['data'][16]; if (empty($name)) { - returnError('error_create_service', __('Error in creation service. No name')); + returnError('error_create_service', __('Could not create service. No name provided.')); return; } @@ -13250,7 +13245,7 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) } if (empty($id_agent)) { - returnError('error_create_service', __('Error in creation service. No agent id')); + returnError('error_create_service', __('Could not create service. No agent ID provided.')); return; } else { if (!util_api_check_agent_and_print_error($id_agent, 'string', 'AR')) { @@ -13330,7 +13325,7 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) if ($result) { returnData('string', ['type' => 'string', 'data' => $result]); } else { - returnError('error_create_service', __('Error in creation service')); + returnError('error_create_service', __('Could not create service.')); } } @@ -13362,7 +13357,7 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) $id_service = $thrash1; if (empty($id_service)) { - returnError('error_update_service', __('Error in update service. No service id')); + returnError('error_update_service', __('Could not update service. No service ID provided.')); return; } @@ -13505,7 +13500,7 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) if ($result) { returnData('string', ['type' => 'string', 'data' => $result]); } else { - returnError('error_update_service', __('Error in update service')); + returnError('error_update_service', __('Could not update service.')); } } @@ -13538,7 +13533,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) $id = $thrash1; if (empty($id)) { - returnError('error_add_service_element', __('Error adding elements to service. No service id')); + returnError('error_add_service_element', __('Could not add elements to service. No service ID provided.')); return; } @@ -13615,7 +13610,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) if ($results) { returnData('string', ['type' => 'string', 'data' => 1]); } else { - returnError('error_add_service_element', __('Error adding elements to service')); + returnError('error_add_service_element', __('Could not add elements to service')); } } @@ -13652,19 +13647,19 @@ function api_set_update_special_day($id_special_day, $thrash2, $other, $thrash3) $idGroup = $other['data'][3]; if ($id_special_day == '') { - returnError('error_update_special_day', __('Error updating special day. Id cannot be left blank.')); + returnError('error_update_special_day', __('Could not update special day. ID cannot be left blank.')); return; } $check_id_special_day = db_get_value('id', 'talert_special_days', 'id', $id_special_day); if (!$check_id_special_day) { - returnError('error_update_special_day', __('Error updating special day. Id doesn\'t exist.')); + returnError('error_update_special_day', __('Could not update special day. ID does not exist.')); return; } if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $special_day)) { - returnError('error_update_special_day', __('Error updating special day. Invalid date format.')); + returnError('error_update_special_day', __('Could not update special day. Invalid date format.')); return; } @@ -13714,21 +13709,21 @@ function api_set_delete_special_day($id_special_day, $thrash2, $thrash3, $thrash } if ($id_special_day == '') { - returnError('error_update_special_day', __('Error deleting special day. Id cannot be left blank.')); + returnError('error_update_special_day', __('Could not delete special day. ID cannot be left blank.')); return; } $check_id_special_day = db_get_value('id', 'talert_special_days', 'id', $id_special_day); if (!$check_id_special_day) { - returnError('error_delete_special_day', __('Error deleting special day. Id doesn\'t exist.')); + returnError('error_delete_special_day', __('Could not delete special day. ID does not exist.')); return; } $return = alerts_delete_alert_special_day($id_special_day); if (is_error($return)) { - returnError('error_delete_special_day', __('Error in deletion special day.')); + returnError('error_delete_special_day', __('Could not delete special day.')); } else { returnData('string', ['type' => 'string', 'data' => $return]); } @@ -13843,12 +13838,12 @@ function api_set_metaconsole_synch($keys) enterprise_include_once('include/functions_metaconsole.php'); $array_metaconsole_update = metaconsole_update_all_nodes_license(); if ($array_metaconsole_update[0] === 0) { - ui_print_success_message(__('Metaconsole and all nodes license updated')); + ui_print_success_message(__('Metaconsole and the licenses of all nodes were updated.')); } else { - ui_print_error_message(__('Metaconsole license updated but %d of %d node synchronization failed', $array_metaconsole_update[0], $array_metaconsole_update[1])); + ui_print_error_message(__('Metaconsole license updated but %d of %d node failed to sync.', $array_metaconsole_update[0], $array_metaconsole_update[1])); } } else { - echo __('This function is only for metaconsole'); + echo __('This function is for metaconsole only.'); } } @@ -13874,7 +13869,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) $name_exist = db_process_sql('select count(name) as already_exist from tcluster as already_exist where name = "'.$name.'"'); if ($name_exist[0]['already_exist'] > 0) { - returnError('error_set_new_cluster', __('A cluster with this name already exists.')); + returnError('error_set_new_cluster', __('A cluster with this name already exist.')); return false; } @@ -13956,7 +13951,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) ] ); } else { - returnError('error_set_new_cluster', __('Failed to create cluster.')); + returnError('error_set_new_cluster', __('A cluster could not be created.')); } } else { returnError('error_set_new_cluster', __('Agent name cannot be empty.')); @@ -13994,7 +13989,7 @@ function api_set_add_cluster_agent($thrash1, $thrash2, $other, $thrash3) if ($tcluster_agent !== false) { returnData('string', ['type' => 'string', 'data' => 1]); } else { - returnError('error_add_cluster_element', __('Error adding elements to cluster')); + returnError('error_add_cluster_element', __('Could not add elements to cluster')); } } @@ -14118,7 +14113,7 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3) if ($tcluster_balanced_module !== false) { db_pandora_audit('Report management', 'Module #'.$element['name'].' assigned to cluster #'.$element['id_cluster']); } else { - db_pandora_audit('Report management', 'Fail try to assign module to cluster'); + db_pandora_audit('Report management', 'The module could not be assigned to the cluster'); } } } @@ -14129,7 +14124,7 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3) if ($id_module !== false) { returnData('string', ['type' => 'string', 'data' => 1]); } else { - returnError('error_add_cluster_element', __('Error adding elements to cluster')); + returnError('error_add_cluster_element', __('Could not add elements to cluster')); } } @@ -14166,9 +14161,9 @@ function api_set_delete_cluster($id, $thrash1, $thrast2, $thrash3) $tcluster_agent_delete = $temp_id_cluster[0]['id_agent'] !== null ? agents_delete_agent($temp_id_cluster[0]['id_agent']) : 0; if (($tcluster_modules_delete + $tcluster_items_delete + $tcluster_agents_delete + $tcluster_delete + $tcluster_agent_delete) == 0) { - returnError('error_delete', 'Error in delete operation.'); + returnError('error_delete', 'Cluster could not be deleted.'); } else { - returnData('string', ['type' => 'string', 'data' => __('Successfully deleted')]); + returnData('string', ['type' => 'string', 'data' => __('Successfully deleted.')]); } } @@ -14198,7 +14193,7 @@ function api_set_delete_cluster_agents($thrash1, $thrast2, $other, $thrash3) || (!check_acl($config['id_user'], $cluster['group'], 'AW')) || (!agents_check_access_agent($ta['id_agent'], 'AW')) ) { - returnError('error_set_delete_cluster_agent', __('The user cannot access to the cluster')); + returnError('error_set_delete_cluster_agent', __('The user cannot access the cluster.')); return; } } @@ -14228,7 +14223,7 @@ function api_set_delete_cluster_item($id, $thrash1, $thrast2, $thrast3) $cluster = $clusters[0]; if (!check_acl($config['id_user'], $cluster['group'], 'AD')) { - returnError('error_set_delete_cluster_item', __('The user cannot access to the cluster')); + returnError('error_set_delete_cluster_item', __('The user cannot access the cluster')); return; } @@ -14239,7 +14234,7 @@ function api_set_delete_cluster_item($id, $thrash1, $thrast2, $thrast3) if (!$delete_item) { returnError('error_delete', 'Error in delete operation.'); } else { - returnData('string', ['type' => 'string', 'data' => __('Correct Delete')]); + returnData('string', ['type' => 'string', 'data' => __('Successfully deleted.')]); } } @@ -14379,9 +14374,9 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras if ($error_count > 0) { if (empty($modules_already_added)) { - returnError('set_apply_module_template', __('Error adding modules').sprintf(' (%s)', $error_count)); + returnError('set_apply_module_template', __('Could not add modules').sprintf(' (%s)', $error_count)); } else { - returnError('set_apply_module_template', __('Error adding modules. The following errors already exists: ').implode(', ', $modules_already_added)); + returnError('set_apply_module_template', __('Could not add modules. The following errors already exists: ').implode(', ', $modules_already_added)); } } @@ -14591,7 +14586,7 @@ function api_get_modules_id_name_by_cluster_id($cluster_id) $clusters = Cluster::search(['id' => $cluster_id]); if ($clusters === false) { - returnError('error_clusters', 'Id does not exist in database.'); + returnError('error_clusters', 'ID does not exist in database.'); } $cluster = $clusters[0]; @@ -14626,7 +14621,7 @@ function api_get_modules_id_name_by_cluster_id($cluster_id) returnData('json', $data); } else { - returnError('error_agent_modules', 'No modules retrieved.'); + returnError('error_agent_modules', 'No modules were retrieved.'); } } @@ -14673,7 +14668,7 @@ function api_get_modules_id_name_by_cluster_name($cluster_name) returnData('json', $data); } else { - returnError('error_agent_modules', 'No modules retrieved.'); + returnError('error_agent_modules', 'No modules were retrieved.'); } } @@ -14914,7 +14909,7 @@ function api_get_cluster_items($cluster_id) returnData('json', $data); } else { - returnError('error_cluster_items', 'No items retrieved.'); + returnError('error_cluster_items', 'No items were retrieved.'); } } @@ -14939,7 +14934,7 @@ function api_set_create_event_filter($name, $thrash1, $other, $thrash3) if ($name == '') { returnError( 'error_create_event_filter', - __('Error creating event filter. Event filter name cannot be left blank.') + __('Could not create event filter. Event filter name cannot be left blank.') ); return; } @@ -15079,7 +15074,7 @@ function api_set_create_event_filter($name, $thrash1, $other, $thrash3) $id_filter = db_process_sql_insert('tevent_filter', $values); if ($id_filter === false) { - returnError('error_create_event_filter', __('Error creating event filter.')); + returnError('error_create_event_filter', __('Could not create event filter.')); } else { returnData( 'string', @@ -15122,7 +15117,7 @@ function api_set_update_event_filter($id_event_filter, $thrash1, $other, $thrash if ($id_event_filter == '') { returnError( 'error_update_event_filter', - __('Error updating event filter. Event filter ID cannot be left blank.') + __('Could not update event filter. Event filter ID cannot be left blank.') ); return; } @@ -15133,7 +15128,7 @@ function api_set_update_event_filter($id_event_filter, $thrash1, $other, $thrash if (!$result_event_filter) { returnError( 'error_update_event_filter', - __('Error updating event filter. Event filter ID doesn\'t exist.') + __('Could not update event filter. Event filter ID does not exist.') ); return; } @@ -15314,7 +15309,7 @@ function api_set_update_event_filter($id_event_filter, $thrash1, $other, $thrash ); if ($result === false) { - returnError('error_update_event_filter', __('Error updating event filter.')); + returnError('error_update_event_filter', __('Could not update event filter.')); } else { returnData( 'string', @@ -15346,7 +15341,7 @@ function api_set_delete_event_filter($id_event_filter, $thrash1, $other, $thrash if ($id_event_filter == '') { returnError( 'error_delete_event_filter', - __('Error deleting event_filter. Event filter ID cannot be left blank.') + __('Could not delete event_filter. Event filter ID cannot be left blank.') ); return; } @@ -15356,7 +15351,7 @@ function api_set_delete_event_filter($id_event_filter, $thrash1, $other, $thrash if ($result == 0) { returnError( 'error_delete_event_filter', - __('Error deleting event filter.') + __('Could not delete event filter.') ); } else { returnData( @@ -15411,7 +15406,7 @@ function api_get_all_event_filters($thrash1, $thrash2, $other, $thrash3) if (!$event_filters) { returnError( 'error_get_all_event_filters', - __('Error getting all event filters.') + __('Could not get all event filters.') ); } else { returnData('csv', $data, $separator); @@ -15641,7 +15636,7 @@ function api_set_validate_traps($id, $thrash2, $other, $thrash3) if (is_error($result)) { // TODO: Improve the error returning more info - returnError('error_update_trap', __('Error in trap update.')); + returnError('error_update_trap', __('Could not update trap.')); } else { returnData( 'string', @@ -15668,7 +15663,7 @@ function api_set_delete_traps($id, $thrash2, $other, $thrash3) if (is_error($result)) { // TODO: Improve the error returning more info - returnError('error_delete_trap', __('Error in trap delete.')); + returnError('error_delete_trap', __('Could not deleted trap.')); } else { returnData( 'string', @@ -15702,7 +15697,7 @@ function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3) returnData('csv', $data, ';'); } else { - returnError('error_group_name', 'No groups retrieved.'); + returnError('error_group_name', 'No groups were retrieved.'); } } @@ -15728,7 +15723,7 @@ function api_get_timezone($thrash1, $thrash2, $other, $thrash3) returnData('string', ['type' => 'string', 'data' => $data['data'][0]['value']]); } else { - returnError('error_timezone', 'No timezone retrieved.'); + returnError('error_timezone', 'No timezone were retrieved.'); } } @@ -15754,7 +15749,7 @@ function api_get_language($thrash1, $thrash2, $other, $thrash3) returnData('string', ['type' => 'string', 'data' => $data['data'][0]['value']]); } else { - returnError('error_language', 'No language retrieved.'); + returnError('error_language', 'No language were retrieved.'); } } @@ -15780,7 +15775,7 @@ function api_get_session_timeout($thrash1, $thrash2, $other, $thrash3) returnData('string', ['type' => 'string', 'data' => $data['data'][0]['value']]); } else { - returnError('error_session_timeout', 'No session timeout retrieved.'); + returnError('error_session_timeout', 'No session timeout were retrieved.'); } } @@ -15805,7 +15800,7 @@ function api_get_users($thrash1, $thrash2, $other, $returnType) if (count($data) > 0 and $data !== false) { returnData($returnType, $data, $separator); } else { - returnError('error_users', 'No users retrieved.'); + returnError('error_users', 'No users were retrieved.'); } }