2013-01-29 Miguel de Dios <miguel.dedios@artica.es>

* godmode/groups/group_list.php, include/ajax/events.php,
	include/functions_api.php: improved the style code.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7547 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-01-29 18:03:08 +00:00
parent 3ccd6225d2
commit 3b22a943a8
4 changed files with 66 additions and 87 deletions

View File

@ -1,3 +1,8 @@
2013-01-29 Miguel de Dios <miguel.dedios@artica.es>
* godmode/groups/group_list.php, include/ajax/events.php,
include/functions_api.php: improved the style code.
2013-01-29 Dario Rodriguez <dario@artica.es> 2013-01-29 Dario Rodriguez <dario@artica.es>
* images/pandora_report_logo.png: Added new images missed for * images/pandora_report_logo.png: Added new images missed for

View File

@ -87,37 +87,8 @@ if (is_ajax ()) {
$filter['string'] = $search; $filter['string'] = $search;
} }
/*if ($config['metaconsole'] == 1) {
enterprise_include_once('include/functions_metaconsole.php');
$connection_names = enterprise_hook('metaconsole_get_connection_names'); $agents = agents_get_group_agents ($id_group, $filter, "none", false, $recursion);
if ($connection_names === false)
$connection_names = array();
$agents_tmp = array();
$agents = array();
foreach ($connection_names as $connection) {
$connection_data = enterprise_hook('metaconsole_get_connection', array($connection));
$connection_result = enterprise_hook('metaconsole_load_external_db', array($connection_data));
if ($connection_result == NOERR) {
$agents_tmp = agents_get_group_agents ($id_group, $filter, "none", false, $recursion);
if ($agents_tmp === false)
$agents_tmp = array();
foreach ($agents_tmp as $agent_key => $agent_name) {
$agents[$connection_data['server_name'] . '|' . $agent_key] = $agent_name;
}
}
enterprise_hook('metaconsole_restore_db');
}
}
else { */
$agents = agents_get_group_agents ($id_group, $filter, "none", false, $recursion);
//}
echo json_encode ($agents); echo json_encode ($agents);
return; return;
@ -163,7 +134,7 @@ if ($create_group) {
$description = (string) get_parameter ('description'); $description = (string) get_parameter ('description');
$contact = (string) get_parameter ('contact'); $contact = (string) get_parameter ('contact');
$other = (string) get_parameter ('other'); $other = (string) get_parameter ('other');
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name); $check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
/*Check if name field is empty*/ /*Check if name field is empty*/

View File

@ -37,7 +37,7 @@ $get_event_name = (bool) get_parameter ('get_event_name');
$meta = get_parameter ('meta', 0); $meta = get_parameter ('meta', 0);
$history = get_parameter ('history', 0); $history = get_parameter ('history', 0);
if($get_event_name) { if ($get_event_name) {
$event_id = get_parameter ('event_id'); $event_id = get_parameter ('event_id');
if($meta) { if($meta) {
@ -56,12 +56,12 @@ if($get_event_name) {
return; return;
} }
if($get_response_description) { if ($get_response_description) {
$response_id = get_parameter ('response_id'); $response_id = get_parameter ('response_id');
$description = db_get_value('description','tevent_response','id',$response_id); $description = db_get_value('description','tevent_response','id',$response_id);
if($description === false) { if ($description === false) {
return; return;
} }
@ -73,7 +73,7 @@ if($get_response_description) {
return; return;
} }
if($get_response_params) { if ($get_response_params) {
$response_id = get_parameter ('response_id'); $response_id = get_parameter ('response_id');
$params = db_get_value('params','tevent_response','id',$response_id); $params = db_get_value('params','tevent_response','id',$response_id);

View File

@ -802,7 +802,7 @@ function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
$where .= " AND tconfig_os.id_os = " . $other['data'][0]; $where .= " AND tconfig_os.id_os = " . $other['data'][0];
} }
} }
if (isset($other['data'][1])){ if (isset($other['data'][1])) {
// Filter by group // Filter by group
if ($other['data'][1] != "") { if ($other['data'][1] != "") {
$where .= " AND id_grupo = " . $other['data'][1]; $where .= " AND id_grupo = " . $other['data'][1];
@ -2608,7 +2608,7 @@ function api_set_validate_all_alerts($id, $thrash1, $other, $thrash3) {
foreach ($alerts as $alert) { foreach ($alerts as $alert) {
$result = alerts_validate_alert_agent_module($alert['id'], true); $result = alerts_validate_alert_agent_module($alert['id'], true);
if ($result){ if ($result) {
$count_results++; $count_results++;
} }
} }
@ -2684,7 +2684,7 @@ function api_set_validate_all_policy_alerts($id, $thrash1, $other, $thrash3) {
} }
// Validate alerts of these modules // Validate alerts of these modules
foreach ($result_alerts as $result_alert){ foreach ($result_alerts as $result_alert) {
$result = alerts_validate_alert_agent_module($result_alert, true); $result = alerts_validate_alert_agent_module($result_alert, true);
if ($result) { if ($result) {
@ -2719,7 +2719,7 @@ function api_set_validate_all_policy_alerts($id, $thrash1, $other, $thrash3) {
* @param $thrash3 Don't use * @param $thrash3 Don't use
*/ */
function api_set_stop_downtime($id, $thrash1, $other, $thrash3) { function api_set_stop_downtime($id, $thrash1, $other, $thrash3) {
if ($id == ""){ if ($id == "") {
returnError('error_stop_downtime', __('Error stopping downtime. Id_downtime cannot be left blank.')); returnError('error_stop_downtime', __('Error stopping downtime. Id_downtime cannot be left blank.'));
return; return;
} }
@ -3273,7 +3273,7 @@ function api_set_add_module_in_conf($id_agent, $module_name, $configuration_data
function api_get_module_from_conf($id_agent, $module_name, $thrash2, $thrash3) { function api_get_module_from_conf($id_agent, $module_name, $thrash2, $thrash3) {
$result = enterprise_hook('config_agents_get_module_from_conf', array($id_agent, io_safe_output($module_name))); $result = enterprise_hook('config_agents_get_module_from_conf', array($id_agent, io_safe_output($module_name)));
if($result !== ENTERPRISE_NOT_HOOK) { if ($result !== ENTERPRISE_NOT_HOOK) {
returnData('string', array('type' => 'string', 'data' => $result)); returnData('string', array('type' => 'string', 'data' => $result));
} }
else { else {
@ -3526,32 +3526,35 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
# SNMP version 3 # SNMP version 3
if ($other['data'][12] == "3"){ if ($other['data'][12] == "3") {
if ($other['data'][21] != "AES" and $other['data'][21] != "DES"){ 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 exists. Set it to \'AES\' or \'DES\'. ')); returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
return; return;
} }
if ($other['data'][23] != "authNoPriv" and $other['data'][23] != "authPriv" and $other['data'][23] != "noAuthNoPriv"){ if ($other['data'][23] != "authNoPriv" and $other['data'][23] != "authPriv" and $other['data'][23] != "noAuthNoPriv"){
returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ')); returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
return; return;
} }
if ($other['data'][24] != "MD5" and $other['data'][24] != "SHA"){ 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 exists. Set it to \'MD5\' or \'SHA\'. ')); returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
return; return;
} }
$fields_snmp_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical', $fields_snmp_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical',
'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'tcp_send', 'snmp_community', 'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'tcp_send', 'snmp_community',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description', 'custom_string_1', 'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description', '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 {
$fields_snmp_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical', $fields_snmp_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical',
'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'tcp_send', 'snmp_community', 'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'tcp_send', 'snmp_community',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description'); 'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description');
} }
$cont = 0; $cont = 0;
@ -3809,11 +3812,11 @@ function api_set_create_netflow_filter($thrash1, $thrash2, $other, $thrash3) {
} }
$values = array ( $values = array (
'id_name'=> $other['data'][0], 'id_name'=> $other['data'][0],
'id_group' => $other['data'][1], 'id_group' => $other['data'][1],
'advanced_filter'=> $other['data'][2], 'advanced_filter'=> $other['data'][2],
'aggregate'=> $other['data'][3], 'aggregate'=> $other['data'][3],
'output'=> $other['data'][4] 'output'=> $other['data'][4]
); );
// Save filter args // Save filter args