2012-04-27 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_events.php: into the function
	"events_validate_event" fixed the return false when fail validation.
	
	* include/functions_network_components.php: fixed the includes.
	
	* operation/agentes/exportdata.php: cleaned source code style.
	
	* include/functions_api.php: fixed the checking error to healty
	level into the function "get_events".
	
	MERGED FROM 4.0.2




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6212 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-04-27 12:52:33 +00:00
parent 9b28c8ee1b
commit a3f8d63556
4 changed files with 158 additions and 137 deletions

View File

@ -1,3 +1,17 @@
2012-04-27 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_events.php: into the function
"events_validate_event" fixed the return false when fail validation.
* include/functions_network_components.php: fixed the includes.
* operation/agentes/exportdata.php: cleaned source code style.
* include/functions_api.php: fixed the checking error to healty
level into the function "get_events".
MERGED FROM 4.0.2
2012-04-27 Vanessa Gil <vanessa.gil@artica.es> 2012-04-27 Vanessa Gil <vanessa.gil@artica.es>
* godmode/alerts/alerts_list.list.php: Fixed: Action filter * godmode/alerts/alerts_list.list.php: Fixed: Action filter

View File

@ -1643,7 +1643,6 @@ function set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'ip_target', 'tcp_port', 'tcp_send', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'ip_target', 'tcp_port', 'tcp_send',
'snmp_community', 'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'descripcion', 'custom_string_1', 'snmp_community', 'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'descripcion', 'custom_string_1',
'custom_string_2', 'custom_string_3', 'plugin_parameter', 'plugin_user', 'plugin_pass'); 'custom_string_2', 'custom_string_3', 'plugin_parameter', 'plugin_user', 'plugin_pass');
} }
else { else {
$snmp_module_fields = array('id_agente', 'disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', $snmp_module_fields = array('id_agente', 'disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning',
@ -3723,7 +3722,7 @@ function set_enable_disable_user ($id, $thrash2, $other, $thrash3) {
} }
function otherParameter2Filter($other, $array = false) { function otherParameter2Filter($other, $return_as_array = false) {
$filter = array(); $filter = array();
if (($other['data'][1] != null) && ($other['data'][1] != -1) && ($other['data'][1] != '')) { if (($other['data'][1] != null) && ($other['data'][1] != -1) && ($other['data'][1] != '')) {
@ -3770,7 +3769,7 @@ function otherParameter2Filter($other, $array = false) {
} }
if (($other['data'][6] != null) && ($other['data'][6] != -1)) { if (($other['data'][6] != null) && ($other['data'][6] != -1)) {
if ($array) { if ($return_as_array) {
$filter['utimestamp']['>'] = $other['data'][6]; $filter['utimestamp']['>'] = $other['data'][6];
} }
else { else {
@ -3779,7 +3778,7 @@ function otherParameter2Filter($other, $array = false) {
} }
if (($other['data'][7] != null) && ($other['data'][7] != -1)) { if (($other['data'][7] != null) && ($other['data'][7] != -1)) {
if ($array) { if ($return_as_array) {
$filter['utimestamp']['<'] = $other['data'][7]; $filter['utimestamp']['<'] = $other['data'][7];
} }
else { else {
@ -3788,7 +3787,7 @@ function otherParameter2Filter($other, $array = false) {
} }
if (($other['data'][8] != null) && ($other['data'][8] != -1)) { if (($other['data'][8] != null) && ($other['data'][8] != -1)) {
if ($array) { if ($return_as_array) {
$filter['estado'] = $other['data'][8]; $filter['estado'] = $other['data'][8];
} }
else { else {
@ -3801,7 +3800,7 @@ function otherParameter2Filter($other, $array = false) {
} }
if (($other['data'][9] != null) && ($other['data'][9] != "")) { if (($other['data'][9] != null) && ($other['data'][9] != "")) {
if ($array) { if ($return_as_array) {
$filter['evento'] = $other['data'][9]; $filter['evento'] = $other['data'][9];
} }
else { else {
@ -3810,7 +3809,7 @@ function otherParameter2Filter($other, $array = false) {
} }
if ($other['data'][10] != null) { if ($other['data'][10] != null) {
if ($array) { if ($return_as_array) {
$filter['limit'] = $other['data'][10]; $filter['limit'] = $other['data'][10];
} }
else { else {
@ -3819,7 +3818,7 @@ function otherParameter2Filter($other, $array = false) {
} }
if ($other['data'][11] != null) { if ($other['data'][11] != null) {
if ($array) { if ($return_as_array) {
$filter['offset'] = $other['data'][11]; $filter['offset'] = $other['data'][11];
} }
else { else {
@ -3828,7 +3827,7 @@ function otherParameter2Filter($other, $array = false) {
} }
if (isset($other['data'][12]) && ($other['data'][12] != null)) { if (isset($other['data'][12]) && ($other['data'][12] != null)) {
if ($array) { if ($return_as_array) {
$filter['total'] = false; $filter['total'] = false;
$filter['more_criticity'] = false; $filter['more_criticity'] = false;
@ -3845,7 +3844,7 @@ function otherParameter2Filter($other, $array = false) {
} }
} }
else { else {
if ($array) { if ($return_as_array) {
$filter['total'] = false; $filter['total'] = false;
$filter['more_criticity'] = false; $filter['more_criticity'] = false;
} }
@ -3854,7 +3853,7 @@ function otherParameter2Filter($other, $array = false) {
} }
} }
if ($array) { if ($return_as_array) {
return $filter; return $filter;
} }
else { else {
@ -4408,6 +4407,8 @@ function set_validate_events($id_event, $trash1, $other, $return_type, $user_in_
$result = events_validate_event ($id_event, false, $text); $result = events_validate_event ($id_event, false, $text);
//html_debug_print($result, true);
if ($result) { if ($result) {
returnData('string', array('type' => 'string', 'data' => 'Correct validation')); returnData('string', array('type' => 'string', 'data' => 'Correct validation'));
} }
@ -4714,8 +4715,12 @@ function get_events($trash1, $trash2, $other, $returnType, $user_in_db = null) {
get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_db); get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_db);
$last_error = error_get_last(); $last_error = error_get_last();
if (!empty($last_error)) { if (!empty($last_error)) {
$errors = array(E_ERROR, E_WARNING, E_USER_ERROR,
E_USER_WARNING);
if (in_array($last_error['type'], $errors)) {
returnError('ERROR_API_PANDORAFMS', $returnType); returnError('ERROR_API_PANDORAFMS', $returnType);
} }
}
return; return;
} }

View File

@ -193,6 +193,8 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new
foreach ($id_event as $event) { foreach ($id_event as $event) {
if (check_acl ($config["id_user"], events_get_group ($event), "IW") == 0) { if (check_acl ($config["id_user"], events_get_group ($event), "IW") == 0) {
db_pandora_audit("ACL Violation", "Attempted updating event #".$event); db_pandora_audit("ACL Violation", "Attempted updating event #".$event);
return false;
} }
$comment = '<b>-- '.$new_status_string.' '.__('by').' '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox; $comment = '<b>-- '.$new_status_string.' '.__('by').' '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox;

View File

@ -23,9 +23,9 @@ global $config;
/** /**
* Include modules functions * Include modules functions
*/ */
include_once ($config['homedir'] . 'include/functions_modules.php'); include_once ($config['homedir'] . '/include/functions_modules.php');
include_once ($config['homedir'] . 'include/functions_agents.php'); include_once ($config['homedir'] . '/include/functions_agents.php');
include_once ($config['homedir'] . 'include/functions_users.php'); include_once ($config['homedir'] . '/include/functions_users.php');
/** /**
* Get a list of network components. * Get a list of network components.