From 3af47c0e5fb0c4ecefb1f729bc0edeed22792a37 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 17 Sep 2021 10:45:01 +0200 Subject: [PATCH] Open network maps --- .../pandora_networkmap_empty.editor.php | 195 ++++++++ .../include/functions_networkmap.php | 75 +-- .../operation/agentes/pandora_networkmap.php | 445 ++++++++---------- 3 files changed, 423 insertions(+), 292 deletions(-) create mode 100644 pandora_console/godmode/agentes/pandora_networkmap_empty.editor.php diff --git a/pandora_console/godmode/agentes/pandora_networkmap_empty.editor.php b/pandora_console/godmode/agentes/pandora_networkmap_empty.editor.php new file mode 100644 index 0000000000..9616d568a3 --- /dev/null +++ b/pandora_console/godmode/agentes/pandora_networkmap_empty.editor.php @@ -0,0 +1,195 @@ + '', + 'label' => __('Topology maps'), + ], + [ + 'link' => '', + 'label' => __('Networkmap'), + ], + ] +); + + +if ($not_found) { + ui_print_error_message(__('Not found networkmap.')); +} else { + $table = new StdClass(); + $table->id = 'form_editor'; + + $table->width = '98%'; + $table->class = 'databox_color'; + + $table->head = []; + + $table->size = []; + $table->size[0] = '30%'; + + $table->style = []; + $table->style[0] = 'font-weight: bold; width: 150px;'; + $table->data = []; + + $table->data[0][0] = __('Name'); + $table->data[0][1] = html_print_input_text( + 'name', + $name, + '', + 30, + 100, + true + ); + $table->data[1][0] = __('Group'); + $table->data[1][1] = '
'.html_print_select_groups( + false, + 'AR', + true, + 'id_group', + $id_group, + '', + '', + 0, + true + ).'
'; + + $table->data[2][0] = __('Node radius'); + $table->data[2][1] = html_print_input_text( + 'node_radius', + $node_radius, + '', + 2, + 10, + true + ); + + $table->data[3][0] = __('Description'); + $table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true); + + echo '
'; + + html_print_table($table); + + echo "
"; + if ($new_empty_networkmap) { + html_print_input_hidden('save_empty_networkmap', 1); + html_print_submit_button( + __('Save networkmap'), + 'crt', + false, + 'class="sub next"' + ); + } + + if ($edit_networkmap) { + html_print_input_hidden('id_networkmap', $id); + html_print_input_hidden('update_empty_networkmap', 1); + html_print_submit_button( + __('Update networkmap'), + 'crt', + false, + 'class="sub upd"' + ); + } + + echo ''; + echo '
'; +} diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 7137cc6e3e..805f8853bb 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1462,13 +1462,11 @@ function modules_get_all_interfaces($id_agent) */ function networkmap_delete_networkmap($id=0) { - if (enterprise_installed() === true) { - // Relations. - $result = delete_relations($id); + // Relations. + $result = delete_relations($id); - // Nodes. - $result = delete_nodes($id); - } + // Nodes. + $result = delete_nodes($id); // Map. $result = db_process_sql_delete('tmap', ['id' => $id]); @@ -1562,18 +1560,13 @@ function networkmap_db_node_to_js_node( $item = []; $item['id'] = $count; - if (enterprise_installed() && $simulated === false) { - enterprise_include_once('include/functions_networkmap.php'); - $item['id_db'] = $node['id_in_db']; - } else { - $item['id_db'] = (int) $node['id']; - } + $item['id_db'] = ($simulated === true) ? (int) $node['id'] : (int) $node['id_in_db']; - if ((int) $node['type'] == 0) { + if ((int) $node['type'] === 0) { $item['type'] = 0; $item['id_agent'] = (int) $node['source_data']; $item['id_module'] = ''; - } else if ((int) $node['type'] == 1) { + } else if ((int) $node['type'] === 1) { $item['type'] = 1; $item['id_agent'] = (int) $node['style']['id_agent']; $item['id_module'] = (int) $node['source_data']; @@ -1770,10 +1763,6 @@ function networkmap_links_to_js_links( ) { $return = []; - if (enterprise_installed() && $simulated === false) { - enterprise_include_once('include/functions_networkmap.php'); - } - $count = 0; foreach ($relations as $key => $relation) { if (($relation['parent_type'] == NODE_MODULE) @@ -1811,11 +1800,7 @@ function networkmap_links_to_js_links( $item = []; $item['id'] = $count; $count++; - if (enterprise_installed() && $simulated === false) { - $item['id_db'] = get_relation_id($relation); - } else { - $item['id_db'] = $key; - } + $item['id_db'] = ($simulated === true) ? $key : get_relation_id($relation); $item['arrow_start'] = ''; $item['arrow_end'] = ''; @@ -1830,7 +1815,7 @@ function networkmap_links_to_js_links( $item['source'] = -1; $item['deleted'] = $relation['deleted']; - if (enterprise_installed() && $simulated === false) { + if ($simulated === false) { $target_and_source = []; $target_and_source = get_id_target_and_source_in_db($relation); $item['target_id_db'] = (int) $target_and_source['target']; @@ -2095,24 +2080,18 @@ function duplicate_networkmap($id) if ($correct_or_id === false) { $return = false; } else { - if (enterprise_installed() === true) { - $new_id = $correct_or_id; - duplicate_map_insert_nodes_and_relations($id, $new_id); - } + $new_id = $correct_or_id; + duplicate_map_insert_nodes_and_relations($id, $new_id); } if ($return === true) { return true; } else { + // Relations. + delete_relations($new_id); + // Nodes. + delete_nodes($new_id); // Clean DB. - if (enterprise_installed() === true) { - // Relations. - delete_relations($new_id); - - // Nodes. - delete_nodes($new_id); - } - db_process_sql_delete('tmap', ['id' => $new_id]); return false; @@ -2122,10 +2101,6 @@ function duplicate_networkmap($id) function clean_duplicate_links($relations) { - if (enterprise_installed()) { - enterprise_include_once('include/functions_networkmap.php'); - } - $segregation_links = []; $index = 0; $index2 = 0; @@ -2159,9 +2134,7 @@ function clean_duplicate_links($relations) foreach ($segregation_links['aa'] as $link) { foreach ($segregation_links['aa'] as $link2) { if ($link['id_parent'] == $link2['id_child'] && $link['id_child'] == $link2['id_parent']) { - if (enterprise_installed() === true) { - delete_link($segregation_links['aa'][$index_to_del]); - } + delete_link($segregation_links['aa'][$index_to_del]); unset($segregation_links['aa'][$index_to_del]); } @@ -2184,9 +2157,7 @@ function clean_duplicate_links($relations) foreach ($segregation_links['mm'] as $link) { foreach ($segregation_links['mm'] as $link2) { if ($link['id_parent'] == $link2['id_child'] && $link['id_child'] == $link2['id_parent']) { - if (enterprise_installed() === true) { - delete_link($segregation_links['mm'][$index_to_del]); - } + delete_link($segregation_links['mm'][$index_to_del]); } $index_to_del++; @@ -2208,9 +2179,7 @@ function clean_duplicate_links($relations) foreach ($segregation_links['ff'] as $link) { foreach ($segregation_links['ff'] as $link2) { if ($link['id_parent'] == $link2['id_child'] && $link['id_child'] == $link2['id_parent']) { - if (enterprise_installed() === true) { - delete_link($segregation_links['ff'][$index_to_del]); - } + delete_link($segregation_links['ff'][$index_to_del]); unset($segregation_links['ff'][$index_to_del]); } @@ -2259,9 +2228,7 @@ function clean_duplicate_links($relations) || (($id_p_source_data == $agent2) && ($id_c_source_data == $agent1)) ) { - if (enterprise_installed()) { - delete_link($final_links['aa'][$key]); - } + delete_link($final_links['aa'][$key]); unset($final_links['aa'][$key]); } @@ -2305,9 +2272,7 @@ function clean_duplicate_links($relations) || (($rel_aa['id_child_source_data'] == $rel_am['parent']['id_parent_source_data']) && ($rel_aa['id_parent_source_data'] == $rel_am['rel']['id_parent_source_data'])) ) { - if (enterprise_installed()) { - delete_link($final_links2['aa'][$key]); - } + delete_link($final_links2['aa'][$key]); unset($final_links2['aa'][$key]); } diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index c960a333aa..4756f5bdbb 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -31,13 +31,14 @@ global $config; // Check user credentials. check_login(); - +// error_reporting(E_ALL); +// ini_set("display_errors", 1); // General ACL for the network maps. -$networkmaps_read = check_acl($config['id_user'], 0, 'MR'); -$networkmaps_write = check_acl($config['id_user'], 0, 'MW'); -$networkmaps_manage = check_acl($config['id_user'], 0, 'MM'); +$networkmaps_read = (bool) check_acl($config['id_user'], 0, 'MR'); +$networkmaps_write = (bool) check_acl($config['id_user'], 0, 'MW'); +$networkmaps_manage = (bool) check_acl($config['id_user'], 0, 'MM'); -if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) { +if ($networkmaps_read === false && $networkmaps_write === false && $networkmaps_manage === false) { db_pandora_audit( 'ACL Violation', 'Trying to access networkmap' @@ -48,179 +49,175 @@ if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) { require_once 'include/functions_networkmap.php'; -$new_networkmap = (bool) get_parameter('new_networkmap', false); -$save_networkmap = (bool) get_parameter('save_networkmap', false); -$save_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false); +$new_networkmap = (bool) get_parameter('new_networkmap', false); +$save_networkmap = (bool) get_parameter('save_networkmap', false); +$save_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false); $update_empty_networkmap = (bool) get_parameter('update_empty_networkmap', false); -$update_networkmap = (bool) get_parameter('update_networkmap', false); -$copy_networkmap = (bool) get_parameter('copy_networkmap', false); -$delete = (bool) get_parameter('delete', false); -$tab = (string) get_parameter('tab', 'list'); -$new_empty_networkmap = get_parameter('new_empty_networkmap', false); +$update_networkmap = (bool) get_parameter('update_networkmap', false); +$copy_networkmap = (bool) get_parameter('copy_networkmap', false); +$delete = (bool) get_parameter('delete', false); +$tab = (string) get_parameter('tab', 'list'); +$new_empty_networkmap = (bool) get_parameter('new_empty_networkmap', false); -if (enterprise_installed()) { - if ($new_empty_networkmap) { - if ($networkmaps_write || $networkmaps_manage) { - enterprise_include( - 'godmode/agentes/pandora_networkmap_empty.editor.php' - ); - return; - } +if ($new_empty_networkmap === true) { + if ($networkmaps_write === true || $networkmaps_manage === true) { + include_once 'godmode/agentes/pandora_networkmap_empty.editor.php'; + return; + } +} + +if ($save_empty_networkmap === true) { + $id_group = (int) get_parameter('id_group', 0); + $id_group_map = (int) get_parameter('id_group_map', 0); + + // ACL for the network map. + $networkmap_write = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); + + if ($networkmap_write === false && $networkmap_manage === false) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access networkmap' + ); + include 'general/noaccess.php'; + return; } - if ($save_empty_networkmap) { - $id_group = (int) get_parameter('id_group', 0); - $id_group_map = (int) get_parameter('id_group_map', 0); + hd('papapapa'); + $name = (string) get_parameter('name', ''); - // ACL for the network map. - // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); - $networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); - $networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); + // Default size values. + $width = $config['networkmap_max_width']; + $height = $config['networkmap_max_width']; - if (!$networkmap_write && !$networkmap_manage) { - db_pandora_audit( - 'ACL Violation', - 'Trying to access networkmap' - ); - include 'general/noaccess.php'; - return; - } + $method = (string) get_parameter('method', 'fdp'); - $name = (string) get_parameter('name', ''); + $dont_show_subgroups = (int) get_parameter_checkbox( + 'dont_show_subgroups', + 0 + ); + $node_radius = (int) get_parameter('node_radius', 40); + $description = get_parameter('description', ''); - // Default size values - $width = $config['networkmap_max_width']; - $height = $config['networkmap_max_width']; + $values = []; + $values['name'] = $name; + $values['id_group'] = $id_group; + $values['source_period'] = 60; + $values['width'] = $width; + $values['height'] = $height; + $values['id_user'] = $config['id_user']; + $values['description'] = $description; + $values['source'] = 0; + $values['source_data'] = $id_group; + $values['id_group_map'] = $id_group_map; - $method = (string) get_parameter('method', 'fdp'); - $dont_show_subgroups = (int) get_parameter_checkbox( - 'dont_show_subgroups', - 0 + if (!$networkmap_write && !$networkmap_manage) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access networkmap' ); - $node_radius = (int) get_parameter('node_radius', 40); - $description = get_parameter('description', ''); + include 'general/noaccess.php'; + return; + } - $values = []; - $values['name'] = $name; - $values['id_group'] = $id_group; - $values['source_period'] = 60; - $values['width'] = $width; - $values['height'] = $height; - $values['id_user'] = $config['id_user']; - $values['description'] = $description; - $values['source'] = 0; - $values['source_data'] = $id_group; - $values['id_group_map'] = $id_group_map; + $filter = []; + $filter['dont_show_subgroups'] = $dont_show_subgroups; + $filter['node_radius'] = $node_radius; + $filter['empty_map'] = 1; + $values['filter'] = json_encode($filter); - - if (!$networkmap_write && !$networkmap_manage) { - db_pandora_audit( - 'ACL Violation', - 'Trying to access networkmap' - ); - include 'general/noaccess.php'; - return; - } - - $filter = []; - $filter['dont_show_subgroups'] = $dont_show_subgroups; - $filter['node_radius'] = $node_radius; - $filter['empty_map'] = 1; - $values['filter'] = json_encode($filter); - - $result = false; - if (!empty($name)) { - $result = db_process_sql_insert( - 'tmap', - $values - ); - } - - $result_txt = ui_print_result_message( - $result, - __('Succesfully created'), - __('Could not be created'), - '', - true - ); - - $id = $result; - define('_id_', $id); - - if ($result !== false) { - $tab = 'view'; - header( - 'Location: '.ui_get_full_url( - 'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab='.$tab.'&id_networkmap='.$id - ) - ); - } - } else if ($update_empty_networkmap) { - $id_group = (int) get_parameter('id_group', 0); - $id_group_map = (int) get_parameter('id_group_map', 0); - - - // ACL for the new network map - $networkmap_write_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); - $networkmap_manage_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); - - if (!$networkmap_write && !$networkmap_manage) { - db_pandora_audit( - 'ACL Violation', - 'Trying to access networkmap' - ); - include 'general/noaccess.php'; - return; - } - - $name = (string) get_parameter('name', ''); - - $recon_task_id = (int) get_parameter( - 'recon_task_id', - 0 - ); - - $source = (string) get_parameter('source', 'group'); - - $values = []; - $values['name'] = $name; - $values['id_group'] = $id_group; - - $values['generation_method'] = 4; - - $description = get_parameter('description', ''); - $values['description'] = $description; - - $dont_show_subgroups = (int) get_parameter_checkbox( - 'dont_show_subgroups', - 0 - ); - $node_radius = (int) get_parameter('node_radius', 40); - $row = db_get_row('tmap', 'id', $id); - $filter = json_decode($row['filter'], true); - $filter['dont_show_subgroups'] = $dont_show_subgroups; - $filter['node_radius'] = $node_radius; - - $values['filter'] = json_encode($filter); - - $result = false; - if (!empty($name)) { - $result = db_process_sql_update( - 'tmap', - $values, - ['id' => $id] - ); - } - - $result_txt = ui_print_result_message( - $result, - __('Succesfully updated'), - __('Could not be updated'), - '', - true + $result = false; + if (!empty($name)) { + $result = db_process_sql_insert( + 'tmap', + $values ); } + + $result_txt = ui_print_result_message( + $result, + __('Succesfully created'), + __('Could not be created'), + '', + true + ); + + $id = $result; + define('_id_', $id); + + if ($result !== false) { + $tab = 'view'; + header( + 'Location: '.ui_get_full_url( + 'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab='.$tab.'&id_networkmap='.$id + ) + ); + } +} else if ($update_empty_networkmap) { + $id_group = (int) get_parameter('id_group', 0); + $id_group_map = (int) get_parameter('id_group_map', 0); + + + // ACL for the new network map + $networkmap_write_new = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage_new = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); + + if (!$networkmap_write && !$networkmap_manage) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access networkmap' + ); + include 'general/noaccess.php'; + return; + } + + $name = (string) get_parameter('name', ''); + + $recon_task_id = (int) get_parameter( + 'recon_task_id', + 0 + ); + + $source = (string) get_parameter('source', 'group'); + + $values = []; + $values['name'] = $name; + $values['id_group'] = $id_group; + + $values['generation_method'] = 4; + + $description = get_parameter('description', ''); + $values['description'] = $description; + + $dont_show_subgroups = (int) get_parameter_checkbox( + 'dont_show_subgroups', + 0 + ); + $node_radius = (int) get_parameter('node_radius', 40); + $row = db_get_row('tmap', 'id', $id); + $filter = json_decode($row['filter'], true); + $filter['dont_show_subgroups'] = $dont_show_subgroups; + $filter['node_radius'] = $node_radius; + + $values['filter'] = json_encode($filter); + + $result = false; + if (empty($name) === false) { + $result = db_process_sql_update( + 'tmap', + $values, + ['id' => $id] + ); + } + + $result_txt = ui_print_result_message( + $result, + __('Succesfully updated'), + __('Could not be updated'), + '', + true + ); } // The networkmap doesn't exist yet @@ -245,12 +242,11 @@ if ($new_networkmap || $save_networkmap) { $id_group_map = (int) get_parameter('id_group_map', 0); - // ACL for the network map - // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); - $networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); - $networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); + // ACL for the network map. + $networkmap_write = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); - if (!$networkmap_write && !$networkmap_manage) { + if ($networkmap_write === false && $networkmap_manage === false) { db_pandora_audit( 'ACL Violation', 'Trying to access networkmap' @@ -259,9 +255,9 @@ if ($new_networkmap || $save_networkmap) { return; } - $name = (string) get_parameter('name', ''); + $name = (string) get_parameter('name'); - // Default size values + // Default size values. $width = $config['networkmap_max_width']; $height = $config['networkmap_max_width']; @@ -288,11 +284,7 @@ if ($new_networkmap || $save_networkmap) { $scale_z = get_parameter('scale_z', 0.5); $node_sep = get_parameter('node_sep', '0.25'); - if ($method == 'twopi') { - $rank_sep = get_parameter('rank_sep', '1.0'); - } else { - $rank_sep = get_parameter('rank_sep', '0.5'); - } + $rank_sep = get_parameter('rank_sep', ($method === 'twopi') ? '1.0' : '0.5'); $mindist = get_parameter('mindist', '1.0'); $kval = get_parameter('kval', '0.3'); @@ -348,7 +340,7 @@ if ($new_networkmap || $save_networkmap) { $values['source_data'] = $ip_mask; } - if (!$networkmap_write && !$networkmap_manage) { + if ($networkmap_write === false && $networkmap_manage === false) { db_pandora_audit( 'ACL Violation', 'Trying to access networkmap' @@ -437,10 +429,10 @@ else if ($update_networkmap || $copy_networkmap || $delete) { return; } - $networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MW'); - $networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MM'); + $networkmap_write = (bool) check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MW'); + $networkmap_manage = (bool) check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MM'); - if (!$networkmap_write && !$networkmap_manage) { + if ($networkmap_write === false && $networkmap_manage === false) { db_pandora_audit( 'ACL Violation', 'Trying to access networkmap' @@ -455,12 +447,12 @@ else if ($update_networkmap || $copy_networkmap || $delete) { $id_group_old = db_get_value('id_group', 'tmap', 'id', $id); - // ACL for the new network map - $id_group_map = (int) get_parameter('id_group_map', 0); - $networkmap_write_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); - $networkmap_manage_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); + // ACL for the new network map. + $id_group_map = (int) get_parameter('id_group_map', 0); + $networkmap_write_new = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage_new = (bool) check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); - if (!$networkmap_write && !$networkmap_manage) { + if ($networkmap_write === false && $networkmap_manage === false) { db_pandora_audit( 'ACL Violation', 'Trying to access networkmap' @@ -503,7 +495,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) { $values['filter'] = json_encode($filter); $result = false; - if (!empty($name)) { + if (empty($name) === false) { $result = db_process_sql_update( 'tmap', $values, @@ -577,11 +569,9 @@ switch ($tab) { $old_networkmaps_enterprise = []; $old_networkmaps_open = []; - if (enterprise_installed()) { - $old_networkmaps_enterprise = db_get_all_rows_sql('SELECT * FROM tnetworkmap_enterprise'); - if ($old_networkmaps_enterprise === false) { - $old_networkmaps_enterprise = []; - } + $old_networkmaps_enterprise = db_get_all_rows_sql('SELECT * FROM tnetworkmap_enterprise'); + if ($old_networkmaps_enterprise === false) { + $old_networkmaps_enterprise = []; } $old_networkmaps_open = db_get_all_rows_sql('SELECT * FROM tnetwork_map'); @@ -590,13 +580,13 @@ switch ($tab) { foreach ($old_networkmaps_enterprise as $old_map_ent) { $old_map_options = json_decode($old_map_ent['options'], true); - if (!isset($old_map_options['migrated'])) { + if (isset($old_map_options['migrated']) === false) { $ent_maps_to_migrate[] = $old_map_ent['id']; } } $open_maps_to_migrate = []; - if (isset($old_networkmaps_open) && is_array($old_networkmaps_open)) { + if (isset($old_networkmaps_open) === true && is_array($old_networkmaps_open) === true) { foreach ($old_networkmaps_open as $old_map_open) { $text_filter = $old_map_open['text_filter']; if ($text_filter != 'migrated') { @@ -605,7 +595,7 @@ switch ($tab) { } } - if (!empty($ent_maps_to_migrate) || !empty($open_maps_to_migrate)) { + if (empty($ent_maps_to_migrate) === false || empty($open_maps_to_migrate) === false) { ?>

Networkmaps are not migrated, wait while migration is processed...

@@ -694,12 +684,10 @@ switch ($tab) { $table->style = []; $table->style['name'] = ''; - if (enterprise_installed()) { - $table->style['nodes'] = 'text-align: center;'; - } + $table->style['nodes'] = 'text-align: center;'; $table->style['groups'] = 'text-align: left;'; - if ($networkmaps_write || $networkmaps_manage) { + if ($networkmaps_write === true || $networkmaps_manage === true) { $table->style['copy'] = 'text-align: center;'; $table->style['edit'] = 'text-align: center;'; $table->style['delete'] = 'text-align: center;'; @@ -707,12 +695,10 @@ switch ($tab) { $table->size = []; $table->size['name'] = '60%'; - if (enterprise_installed()) { - $table->size['nodes'] = '30px'; - } + $table->size['nodes'] = '30px'; $table->size['groups'] = '400px'; - if ($networkmaps_write || $networkmaps_manage) { + if ($networkmaps_write === true || $networkmaps_manage === true) { $table->size['copy'] = '30px'; $table->size['edit'] = '30px'; $table->size['delete'] = '30px'; @@ -720,12 +706,10 @@ switch ($tab) { $table->head = []; $table->head['name'] = __('Name'); - if (enterprise_installed()) { - $table->head['nodes'] = __('Nodes'); - } + $table->head['nodes'] = __('Nodes'); $table->head['groups'] = __('Groups'); - if ($networkmaps_write || $networkmaps_manage) { + if ($networkmaps_write === true || $networkmaps_manage === true) { $table->head['copy'] = __('Copy'); $table->head['edit'] = __('Edit'); $table->head['delete'] = __('Delete'); @@ -755,19 +739,10 @@ switch ($tab) { $table->data = []; foreach ($network_maps as $network_map) { - // ACL for the network map - $networkmap_read = check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MR'); - $networkmap_write = check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MW'); - $networkmap_manage = check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MM'); - - if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) { - db_pandora_audit( - 'ACL Violation', - 'Trying to access networkmap enterprise' - ); - include 'general/noaccess.php'; - continue; - } + // ACL for the network map. + $networkmap_read = (bool) check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MR'); + $networkmap_write = (bool) check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MW'); + $networkmap_manage = (bool) check_acl_restricted_all($config['id_user'], $network_map['id_group_map'], 'MM'); $data = []; if ($network_map['generation_method'] == 6) { @@ -797,19 +772,17 @@ switch ($tab) { $count = 0; } - if (enterprise_installed()) { - if (($count == 0) && ($network_map['source'] != 'empty')) { - if ($network_map['generated']) { - $data['nodes'] = __('Empty map'); - } else if ($network_map['generation_method'] == LAYOUT_RADIAL_DYNAMIC) { - $data['nodes'] = __('Dynamic'); - } else { - $data['nodes'] = __('Pending to generate'); - } + if (($count == 0) && ($network_map['source'] != 'empty')) { + if ($network_map['generated']) { + $data['nodes'] = __('Empty map'); + } else if ($network_map['generation_method'] == LAYOUT_RADIAL_DYNAMIC) { + $data['nodes'] = __('Dynamic'); } else { - $data['nodes'] = ($network_map['id_group'] == 0) ? ($count - 1) : $count; - // PandoraFMS node is not an agent + $data['nodes'] = __('Pending to generate'); } + } else { + $data['nodes'] = ($network_map['id_group'] == 0) ? ($count - 1) : $count; + // PandoraFMS node is not an agent } $data['groups'] = ui_print_group_icon($network_map['id_group_map'], true); @@ -847,14 +820,12 @@ switch ($tab) { echo ''; echo '
'; - if (enterprise_installed()) { - echo "
"; - echo '
'; - html_print_input_hidden('new_empty_networkmap', 1); - html_print_submit_button(__('Create empty network map'), 'crt', false, 'class="sub next float-right mrgn_right_20px"'); - echo '
'; - echo '
'; - } + echo "
"; + echo '
'; + html_print_input_hidden('new_empty_networkmap', 1); + html_print_submit_button(__('Create empty network map'), 'crt', false, 'class="sub next float-right mrgn_right_20px"'); + echo '
'; + echo '
'; } break; }