Error fixes and improvements

This commit is contained in:
Alejandro Gallardo Escobar 2015-03-31 12:23:40 +02:00
parent e90406abaf
commit 973f0c3e2e
1 changed files with 33 additions and 28 deletions

View File

@ -689,7 +689,6 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
} }
$filter['id_grupo'] = $id_groups; $filter['id_grupo'] = $id_groups;
$filter['id_group'] = $id_groups;
} }
else { else {
if ($strict_user) { if ($strict_user) {
@ -746,10 +745,12 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
if ($depth != 'group') { if ($depth != 'group') {
if ($strict_user) { if ($strict_user) {
$filter['group_by'] = 'tagente.nombre'; $filter['group_by'] = 'tagente.nombre';
$filter['id_group'] = $filter['id_grupo'];
$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_agente, $fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_agente,
tagente.normal_count, tagente.warning_count, tagente.critical_count, tagente.normal_count, tagente.warning_count, tagente.critical_count,
tagente.unknown_count, tagente.total_count, tagente.notinit_count'); tagente.unknown_count, tagente.total_count, tagente.notinit_count');
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true); $agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
unset($filter['id_group']);
} else { } else {
// Get agents data // Get agents data
$agents = agents_get_agents ($filter, $agents = agents_get_agents ($filter,
@ -1491,36 +1492,40 @@ function networkmap_get_filter ($layout) {
* *
* @return mixed New networkmap id if created. False if it could not be created. * @return mixed New networkmap id if created. False if it could not be created.
*/ */
function networkmap_create_networkmap ($name, $type = 'topology', $layout = 'radial', $nooverlap = true, $simple = false, $regenerate = true, $font_size = 12, $id_group = 0, $id_module_group = 0, $depth = 'all', $only_modules_with_alerts = false, $hide_policy_modules = false, $zoom = 1, $distance_nodes = 2.5, $center = 0, $text_filter = '', $dont_show_subgroups = 0, $show_groups = false, $show_modules = false, $pandoras_children = false) { function networkmap_create_networkmap ($values) {
global $config; global $config;
$values = array(); // The name is required
if (! isset($values['name']))
return false;
$values['name'] = $name; // Set defaults for the empty values
$values['type'] = $type; set_unless_defined ($values['type'], 'topology');
$values['layout'] = $layout; set_unless_defined ($values['layout'], 'radial');
$values['nooverlap'] = $nooverlap; set_unless_defined ($values['nooverlap'], true);
$values['simple'] = $simple; set_unless_defined ($values['simple'], false);
$values['regenerate'] = $regenerate; set_unless_defined ($values['regenerate'], true);
$values['font_size'] = $font_size; set_unless_defined ($values['font_size'], 12);
$values['id_group'] = $id_group; set_unless_defined ($values['store_group'], 0);
$values['id_module_group'] = $id_module_group; set_unless_defined ($values['id_group'], 0);
$values['depth'] = $depth; set_unless_defined ($values['regenerate'], true);
$values['only_modules_with_alerts'] = $only_modules_with_alerts; set_unless_defined ($values['id_module_group'], 0);
$values['hide_policy_modules'] = $hide_policy_modules; set_unless_defined ($values['depth'], 'all');
$values['zoom'] = $zoom; set_unless_defined ($values['only_modules_with_alerts'], false);
$values['distance_nodes'] = $distance_nodes; set_unless_defined ($values['hide_policy_modules'], false);
$values['center'] = $center; set_unless_defined ($values['zoom'], 1);
$values['id_user'] = $config['id_user']; set_unless_defined ($values['distance_nodes'], 2.5);
$values['text_filter'] = $text_filter; set_unless_defined ($values['center'], 0);
$values['dont_show_subgroups'] = $dont_show_subgroups; set_unless_defined ($values['id_user'], $config['id_user']);
set_unless_defined ($values['text_filter'], '');
$values['pandoras_children'] = $pandoras_children; set_unless_defined ($values['regenerate'], true);
$values['show_groups'] = $show_groups; set_unless_defined ($values['dont_show_subgroups'], 0);
$values['show_modules'] = $show_modules; set_unless_defined ($values['show_groups'], false);
set_unless_defined ($values['pandoras_children'], false);
$values['server_name'] = ""; set_unless_defined ($values['show_modules'], false);
set_unless_defined ($values['show_snmp_modules'], 0);
set_unless_defined ($values['l2_network'], 0);
set_unless_defined ($values['server_name'], '');
return @db_process_sql_insert('tnetwork_map', $values); return @db_process_sql_insert('tnetwork_map', $values);
} }