"%$name")); $values = array( 'name' => ($check ? "($sql) $name" : $name), 'type' => $activeTab, 'layout' => $layout, 'nooverlap' => $nooverlap, 'simple' => $simple, 'regenerate' => $regen, 'font_size' => $font_size, 'store_group' => $store_group, 'id_group' => $group, 'id_module_group' => $module_group, 'depth' => $depth, 'only_modules_with_alerts' => $modwithalerts, 'hide_policy_modules' => $hidepolicymodules, 'zoom' => $zoom, 'distance_nodes' => $ranksep, 'text_filter' => $text_filter, 'dont_show_subgroups' => $dont_show_subgroups, 'center' => $center, 'show_snmp_modules' => $show_snmp_modules, 'l2_network' => $l2_network ); $id_networkmap = networkmap_create_networkmap($values); $message = ui_print_result_message ($id_networkmap, __('Network map created successfully'), __('Could not create network map'), '', true); // Exit when the networkmap was not created if ($id_networkmap === false) { return; } } // Action in existing networkmap else if ($delete_networkmap || $save_networkmap || $update_networkmap) { // ACL for the network map // if (!isset($networkmap_read)) // $networkmap_read = check_acl ($config['id_user'], $store_group, "MR"); if (!isset($networkmap_write)) $networkmap_write = check_acl ($config['id_user'], $store_group, "MW"); if (!isset($networkmap_manage)) $networkmap_manage = check_acl ($config['id_user'], $store_group, "MM"); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit("ACL Violation", "Trying to accessnode graph builder"); require ("general/noaccess.php"); exit; } // Actions // // Not used now. The new behaviour is delete the map posting to the list. if ($delete_networkmap) { $result = networkmap_delete_networkmap($id_networkmap); $message = ui_print_result_message ($result, __('Network map deleted successfully'), __('Could not delete network map'), '', true); return; } // Save updates the db data, update only updates the view. if ($save_networkmap || $update_networkmap) { // Load variables $layout = (string) get_parameter ('layout', 'radial'); $depth = (string) get_parameter ('depth', 'all'); $nooverlap = (bool) get_parameter ('nooverlap', 0); $modwithalerts = (int) get_parameter ('modwithalerts', 0); $hidepolicymodules = (int) get_parameter ('hidepolicymodules', 0); $zoom = (float) get_parameter ('zoom', 1); $ranksep = (float) get_parameter ('ranksep', 2.5); $simple = (int) get_parameter ('simple', 0); $regen = (int) get_parameter ('regen', 0); $show_snmp_modules = (int) get_parameter ('show_snmp_modules', 0); $font_size = (int) get_parameter ('font_size', 12); $text_filter = get_parameter ('text_filter', ''); $dont_show_subgroups = (bool)get_parameter ('dont_show_subgroups', 0); $store_group = (int) get_parameter ('store_group', 0); $group = (int) get_parameter ('group', 0); $module_group = (int) get_parameter ('module_group', 0); $center = (int) get_parameter ('center', 0); $name = (string) get_parameter ('name', $activeTab); $l2_network = (int) get_parameter ('l2_network', 0); if ($save_networkmap) { // ACL for the new network map $networkmap_read_new = check_acl ($config['id_user'], $store_group, "MR"); $networkmap_write_new = check_acl ($config['id_user'], $store_group, "MW"); $networkmap_manage_new = check_acl ($config['id_user'], $store_group, "MM"); if (!$networkmap_write_new && !$networkmap_manage_new) { db_pandora_audit("ACL Violation", "Trying to accessnode graph builder"); require ("general/noaccess.php"); exit; } $result = networkmap_update_networkmap($id_networkmap, array('name' => $name, 'type' => $activeTab, 'layout' => $layout, 'nooverlap' => $nooverlap, 'simple' => $simple, 'regenerate' => $regen, 'font_size' => $font_size, 'store_group' => $store_group, 'id_group' => $group, 'id_module_group' => $module_group, 'depth' => $depth, 'only_modules_with_alerts' => $modwithalerts, 'hide_policy_modules' => $hidepolicymodules, 'zoom' => $zoom, 'distance_nodes' => $ranksep, 'text_filter' => $text_filter, 'dont_show_subgroups' => $dont_show_subgroups, 'center' => $center, 'show_snmp_modules' => (int)$show_snmp_modules, 'l2_network' => (int)$l2_network)); $message = ui_print_result_message ($result, __('Network map saved successfully'), __('Could not save network map'), '', true); if ($result) { // Save the new ACL permisison $networkmap_read = $networkmap_read_new; $networkmap_write = $networkmap_write_new; $networkmap_manage = $networkmap_manage_new; } } } } if (!$update_networkmap && !$save_networkmap) { $networkmap_data = networkmap_get_networkmap($id_networkmap); if (empty($networkmap_data)) { ui_print_error_message(__('There was an error loading the network map')); return; } // Load variables $layout = $networkmap_data['layout']; $depth = $networkmap_data['depth']; $nooverlap = (bool)$networkmap_data['nooverlap']; $modwithalerts = $networkmap_data['only_modules_with_alerts']; $hidepolicymodules = $networkmap_data['hide_policy_modules']; $zoom = $networkmap_data['zoom']; $ranksep = $networkmap_data['distance_nodes']; $simple = $networkmap_data['simple']; $regen = $networkmap_data['regenerate']; $show_snmp_modules = $networkmap_data['show_snmp_modules']; $font_size = $networkmap_data['font_size']; $text_filter = $networkmap_data['text_filter']; $dont_show_subgroups = $networkmap_data['dont_show_subgroups']; $store_group = $networkmap_data['store_group']; $group = $networkmap_data['id_group']; $module_group = $networkmap_data['id_module_group']; $center = $networkmap_data['center']; $name = io_safe_output($networkmap_data['name']); $activeTab = $networkmap_data['type']; $l2_network = $networkmap_data['l2_network']; } if ($recenter_networkmap) { $center = (int) get_parameter ('center', 0); } /* Main code */ $qs = http_build_query(array( "sec" => "network", "sec2" => "operation/agentes/networkmap_list" )); $href = "index.php?$qs"; $buttons['list'] = array('active' => false, 'text' => "" . html_print_image("images/list.png", true, array ("title" => __('List'))) .""); if ($pure == 1) { $qs = http_build_query(array( "sec" => "network", "sec2" => "operation/agentes/networkmap", "id_networkmap" => $id_networkmap, "tab" => $activeTab )); $href = "index.php?$qs"; $buttons['screen'] = array('active' => false, 'text' => "" . html_print_image("images/normal_screen.png", true, array ('title' => __('Normal screen'))) .""); } else { $qs = http_build_query(array( "sec" => "network", "sec2" => "operation/agentes/networkmap", "id_networkmap" => $id_networkmap, "tab" => $activeTab, "pure" => 1 )); $href = "index.php?$qs"; $buttons['screen'] = array('active' => false, 'text' => "" . html_print_image("images/full_screen.png", true, array ('title' => __('Full screen'))) .""); } if ($networkmap_write || $networkmap_manage) { $qs = http_build_query(array( "sec" => "network", "sec2" => "operation/agentes/networkmap_list", "id_networkmap" => $id_networkmap, "delete_networkmap" => 1 )); $href = "index.php?$qs"; $buttons['deletemap'] = array('active' => false, 'text' => "" . html_print_image("images/delete_mc.png", true, array ("title" => __('Delete map'))) .""); $qs = http_build_query(array( "sec" => "network", "sec2" => "operation/agentes/networkmap", "id_networkmap" => $id_networkmap, "save_networkmap" => 1, "tab" => $activeTab, "name" => $name, "store_group" => $store_group, "group" => $group, "layout" => $layout, "nooverlap" => $nooverlap, "simple" => $simple, "regen" => $regen, "zoom" => $zoom, "ranksep" => $ranksep, "font_size" => $font_size, "depth" => $depth, "modwithalerts" => $modwithalerts, "text_filter" => $text_filter, "dont_show_subgroups" => $dont_show_subgroups, "hidepolicymodules" => $hidepolicymodules, "module_group" => $module_group, "hidden_options" => (int)$hidden_options, "show_snmp_modules" => (int)$show_snmp_modules, "l2_network" => (int)$l2_network, "pure" => $pure )); $href = "index.php?$qs"; $buttons['savemap'] = array('active' => false, 'text' => "" . html_print_image("images/save_mc.png", true, array ("title" => __('Save map'))) .''); } // Disabled. It's a waste of resources to check the ACL of every networkmap // for only provide a shorthand feature. // $combolist = '
'; // $buttons['combolist'] = $combolist; $title = ''; $icon = "images/op_network.png"; switch ($activeTab) { case 'topology': $title = __('Topology view'); $icon = "images/op_network.png"; break; case 'groups': $title = __('Groups view'); $icon = "images/group.png"; break; case 'policies': $title = __('Policies view'); $icon = "images/policies_mc.png"; break; case 'dynamic': $title = __('Dynamic view'); $icon = "images/dynamic_network_icon.png"; break; case 'radial_dynamic': $title = __('Radial dynamic view'); $icon = "images/radial_dynamic_network_icon.png"; break; } if (!empty($name)) { $title .= " » ". mb_substr($name, 0, 25); } ui_print_page_header (__('Network map') . " - " . $title, $icon, false, "network_map", false, $buttons); if ((tags_has_user_acl_tags()) && (!$strict_user)) { ui_print_tags_warning(); } if ($delete_networkmap || $add_networkmap || $save_networkmap) { echo $message; } // CONFIGURATION FORM // Layout selection $layout_array = array ( 'circular' => 'circular', 'radial' => 'radial', 'spring1' => 'spring 1', 'spring2' => 'spring 2', 'flat' => 'flat'); $options_form = ''; ui_toggle($options_form, __('Map options'), '', $hidden_options); switch ($activeTab) { case 'groups': require_once('operation/agentes/networkmap.groups.php'); break; case 'policies': require_once(ENTERPRISE_DIR . '/operation/policies/networkmap.policies.php'); break; case 'dynamic': require_once('operation/agentes/networkmap.dinamic.php'); break; case 'radial_dynamic': require_once('operation/agentes/networkmap.dinamic.php'); break; default: case 'topology': require_once('operation/agentes/networkmap.topology.php'); break; } ?>