mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
New networkmap in progess... (Changed db structure and more important things)
This commit is contained in:
parent
37fb0a2ed1
commit
831e7ca314
@ -1798,8 +1798,8 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
|
|||||||
"id_agent_module", $where_modules, true);
|
"id_agent_module", $where_modules, true);
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
$nodes = db_get_all_rows_filter(
|
$nodes = db_get_all_rows_filter(
|
||||||
"tnetworkmap_enterprise_nodes",
|
"titem",
|
||||||
array("id_agent" => $id_agent));
|
array("source_data" => $id_agent, "type" => 0));
|
||||||
if (empty($nodes)) {
|
if (empty($nodes)) {
|
||||||
$nodes = array();
|
$nodes = array();
|
||||||
}
|
}
|
||||||
@ -1811,8 +1811,8 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
|
|||||||
"child", $node['id']);
|
"child", $node['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
db_process_delete_temp ("tnetworkmap_enterprise_nodes",
|
db_process_delete_temp ("titem",
|
||||||
"id_agent", $id_agent);
|
"source_data", $id_agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Planned Downtime
|
//Planned Downtime
|
||||||
|
@ -224,18 +224,6 @@ function networkmap_generate_hash($pandora_name, $group = 0,
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function networkmap_get_nodes_and_links($pandora_name, $group = 0,
|
function networkmap_get_nodes_and_links($pandora_name, $group = 0,
|
||||||
$simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0,
|
$simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0,
|
||||||
$zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
|
$zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
|
||||||
@ -512,7 +500,7 @@ function networkmap_get_nodes_and_links($pandora_name, $group = 0,
|
|||||||
$node_ref[$agent['id_agente']] = $node_count;
|
$node_ref[$agent['id_agente']] = $node_count;
|
||||||
|
|
||||||
$agent['id_node'] = $node_count;
|
$agent['id_node'] = $node_count;
|
||||||
$agent['type'] = 'agent';
|
$agent['type'] = 0;
|
||||||
|
|
||||||
// Add node
|
// Add node
|
||||||
$nodes[$node_count] = $agent;
|
$nodes[$node_count] = $agent;
|
||||||
@ -566,13 +554,10 @@ function networkmap_get_nodes_and_links($pandora_name, $group = 0,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$node_count ++;
|
$node_count ++;
|
||||||
$modules_node_ref[$module['id_agente_modulo']] = $node_count;
|
$modules_node_ref[$module['id_agente_modulo']] = $node_count;
|
||||||
$module['id_node'] = $node_count;
|
$module['id_node'] = $node_count;
|
||||||
$module['type'] = 'module';
|
$module['type'] = 1;
|
||||||
$module['status'] = $status_module;
|
$module['status'] = $status_module;
|
||||||
|
|
||||||
// Try to get the interface name
|
// Try to get the interface name
|
||||||
@ -1077,8 +1062,6 @@ function networkmap_get_nodes_and_links($pandora_name, $group = 0,
|
|||||||
//~ }
|
//~ }
|
||||||
//~ }
|
//~ }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return array("nodes" => $nodes, "edges" => $edges, "orphans" => $orphans);
|
return array("nodes" => $nodes, "edges" => $edges, "orphans" => $orphans);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1118,7 +1101,6 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||||||
$filter_module_group = 0, $show_modulegroup = false,
|
$filter_module_group = 0, $show_modulegroup = false,
|
||||||
$show_groups = false, $show_agents = true, $show_policies = false) {
|
$show_groups = false, $show_agents = true, $show_policies = false) {
|
||||||
|
|
||||||
|
|
||||||
$networkmap_data = networkmap_get_nodes_and_links($pandora_name,
|
$networkmap_data = networkmap_get_nodes_and_links($pandora_name,
|
||||||
$group, $simple, $font_size, $layout, $nooverlap, $zoom,
|
$group, $simple, $font_size, $layout, $nooverlap, $zoom,
|
||||||
$ranksep, $center, $regen, $pure, $id_networkmap,
|
$ranksep, $center, $regen, $pure, $id_networkmap,
|
||||||
@ -1128,8 +1110,6 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||||||
$show_all_modules, $only_modules_alerts, $filter_module_group,
|
$show_all_modules, $only_modules_alerts, $filter_module_group,
|
||||||
$show_modulegroup, $show_groups, $show_agents, $show_policies);
|
$show_modulegroup, $show_groups, $show_agents, $show_policies);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($l2_network_or_mixed === 'mix_l2_l3') {
|
if ($l2_network_or_mixed === 'mix_l2_l3') {
|
||||||
$l2_network = true;
|
$l2_network = true;
|
||||||
}
|
}
|
||||||
@ -1148,25 +1128,30 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||||||
// Create nodes
|
// Create nodes
|
||||||
foreach ($networkmap_data['nodes'] as $node_id => $node) {
|
foreach ($networkmap_data['nodes'] as $node_id => $node) {
|
||||||
switch ($node['type']) {
|
switch ($node['type']) {
|
||||||
case 'policy':
|
// Policy
|
||||||
|
case 4:
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
enterprise_include_once("include/functions_policies.php");
|
enterprise_include_once("include/functions_policies.php");
|
||||||
$graph .= policies_create_node($node, $simple, $font_size)."\n\t\t";
|
$graph .= policies_create_node($node, $simple, $font_size)."\n\t\t";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'group':
|
// Group
|
||||||
|
case 2:
|
||||||
$graph .= networkmap_create_group_node ($node , $simple, $font_size, $metaconsole = false, null, $strict_user) .
|
$graph .= networkmap_create_group_node ($node , $simple, $font_size, $metaconsole = false, null, $strict_user) .
|
||||||
"\n\t\t";
|
"\n\t\t";
|
||||||
break;
|
break;
|
||||||
case 'agent':
|
// Agent
|
||||||
|
case 0:
|
||||||
$graph .= networkmap_create_agent_node($node, $simple,
|
$graph .= networkmap_create_agent_node($node, $simple,
|
||||||
$font_size, $cut_names, $relative) . "\n\t\t";
|
$font_size, $cut_names, $relative) . "\n\t\t";
|
||||||
break;
|
break;
|
||||||
case 'module':
|
// Module
|
||||||
|
case 1:
|
||||||
$graph .= networkmap_create_module_node($node, $simple,
|
$graph .= networkmap_create_module_node($node, $simple,
|
||||||
$font_size) . "\n\t\t";
|
$font_size) . "\n\t\t";
|
||||||
break;
|
break;
|
||||||
case 'module_group':
|
// Module group
|
||||||
|
case 3:
|
||||||
$graph .= networkmap_create_module_group_node ($node , $simple, $font_size, true, $node['id_server']) . "\n\t\t";
|
$graph .= networkmap_create_module_group_node ($node , $simple, $font_size, true, $node['id_server']) . "\n\t\t";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1196,9 +1181,6 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//The orphans
|
//The orphans
|
||||||
if ($l2_network || $old_mode) {
|
if ($l2_network || $old_mode) {
|
||||||
$count = 0;
|
$count = 0;
|
||||||
@ -2294,23 +2276,6 @@ function networkmap_type_to_str_type($type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes a network map.
|
|
||||||
*
|
|
||||||
* @param int Map id to be deleted.
|
|
||||||
*
|
|
||||||
* @return bool True if the map was deleted, false otherwise.
|
|
||||||
*/
|
|
||||||
function networkmap_delete_networkmap ($id_networkmap) {
|
|
||||||
$id_networkmap = safe_int ($id_networkmap);
|
|
||||||
if (empty ($id_networkmap))
|
|
||||||
return false;
|
|
||||||
$networkmap = networkmap_get_networkmap ($id_networkmap);
|
|
||||||
if ($networkmap === false)
|
|
||||||
return false;
|
|
||||||
return @db_process_sql_delete ('tnetwork_map', array ('id_networkmap' => $id_networkmap));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a network map if the property is that user.
|
* Deletes a network map if the property is that user.
|
||||||
*
|
*
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1680,7 +1680,6 @@ function init_graph(parameter_object) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Set the height in the pure view (fullscreen).
|
//Set the height in the pure view (fullscreen).
|
||||||
|
|
||||||
window.height_svg = $(window).height() -
|
window.height_svg = $(window).height() -
|
||||||
$("#menu_tab_frame_view").height() -
|
$("#menu_tab_frame_view").height() -
|
||||||
20; // 20 of margin
|
20; // 20 of margin
|
||||||
@ -1760,21 +1759,19 @@ function init_graph(parameter_object) {
|
|||||||
|
|
||||||
window.url_background_grid = '';
|
window.url_background_grid = '';
|
||||||
if (typeof(parameter_object.url_background_grid) != "undefined") {
|
if (typeof(parameter_object.url_background_grid) != "undefined") {
|
||||||
window.url_background_grid = parameter_object.url_background_grid;
|
// GRID
|
||||||
|
window.url_background_grid = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//For to catch the keyevent for the ctrl key
|
//For to catch the keyevent for the ctrl key
|
||||||
d3.select(document)
|
d3.select(document)
|
||||||
.on("keydown", function() {
|
.on("keydown", function() {
|
||||||
|
|
||||||
if (d3.event.keyCode == key_multiple_selection) {
|
if (d3.event.keyCode == key_multiple_selection) {
|
||||||
flag_multiple_selection = true;
|
flag_multiple_selection = true;
|
||||||
disabled_drag_zoom = true;
|
disabled_drag_zoom = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on("keyup", function() {
|
.on("keyup", function() {
|
||||||
|
|
||||||
if (d3.event.keyCode == key_multiple_selection) {
|
if (d3.event.keyCode == key_multiple_selection) {
|
||||||
flag_multiple_selection = false;
|
flag_multiple_selection = false;
|
||||||
disabled_drag_zoom = false;
|
disabled_drag_zoom = false;
|
||||||
@ -1785,25 +1782,17 @@ function init_graph(parameter_object) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.force = d3.layout.force()
|
window.force = d3.layout.force()
|
||||||
.charge(10)
|
.charge(10)
|
||||||
.linkDistance(0)
|
.linkDistance(0)
|
||||||
.size([width_svg, height_svg]);
|
.size([width_svg, height_svg]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.zoom_obj = d3.behavior.zoom();
|
window.zoom_obj = d3.behavior.zoom();
|
||||||
zoom_obj.scaleExtent([0.3, 1])
|
zoom_obj.scaleExtent([0.3, 1])
|
||||||
.on("zoom", zoom)
|
.on("zoom", zoom)
|
||||||
.translate(translation)
|
.translate(translation)
|
||||||
.scale(scale);
|
.scale(scale);
|
||||||
|
|
||||||
|
|
||||||
window.svg = d3.select("#networkconsole")
|
window.svg = d3.select("#networkconsole")
|
||||||
.append("svg")
|
.append("svg")
|
||||||
.attr("id", "dinamic_networkmap_svg")
|
.attr("id", "dinamic_networkmap_svg")
|
||||||
@ -1907,13 +1896,13 @@ function init_graph(parameter_object) {
|
|||||||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||||
.attr("orient", "auto")
|
.attr("orient", "auto")
|
||||||
.append("circle")
|
.append("circle")
|
||||||
//~ .attr("class", "link")
|
|
||||||
.attr("cx", (node_radius / 2) - (interface_radius / 2))
|
.attr("cx", (node_radius / 2) - (interface_radius / 2))
|
||||||
.attr("cy", interface_radius)
|
.attr("cy", interface_radius)
|
||||||
.attr("r", interface_radius)
|
.attr("r", interface_radius)
|
||||||
.attr("style", function(d) {
|
.attr("style", function(d) {
|
||||||
return "fill: " + d.color + ";";
|
return "fill: " + d.color + ";";
|
||||||
});
|
});
|
||||||
|
|
||||||
defs.selectAll("defs")
|
defs.selectAll("defs")
|
||||||
.data(module_color_status)
|
.data(module_color_status)
|
||||||
.enter()
|
.enter()
|
||||||
@ -1925,42 +1914,40 @@ function init_graph(parameter_object) {
|
|||||||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||||
.attr("orient", "auto")
|
.attr("orient", "auto")
|
||||||
.append("circle")
|
.append("circle")
|
||||||
//~ .attr("class", "link")
|
|
||||||
.attr("cx", interface_radius)
|
.attr("cx", interface_radius)
|
||||||
.attr("cy", interface_radius)
|
.attr("cy", interface_radius)
|
||||||
.attr("r", interface_radius)
|
.attr("r", interface_radius)
|
||||||
.attr("style", function(d) {
|
.attr("style", function(d) {
|
||||||
return "fill: " + d.color + ";";
|
return "fill: " + d.color + ";";
|
||||||
});
|
});
|
||||||
defs
|
|
||||||
.append("marker")
|
defs.append("marker")
|
||||||
.attr("id", "interface_start")
|
.attr("id", "interface_start")
|
||||||
.attr("refX", 0)
|
.attr("refX", 0)
|
||||||
.attr("refY", interface_radius)
|
.attr("refY", interface_radius)
|
||||||
.attr("markerWidth", (node_radius / 2) + interface_radius)
|
.attr("markerWidth", (node_radius / 2) + interface_radius)
|
||||||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||||
.attr("orient", "auto")
|
.attr("orient", "auto")
|
||||||
.append("circle")
|
.append("circle")
|
||||||
//~ .attr("class", "link")
|
//~ .attr("class", "link")
|
||||||
.attr("cx", (node_radius / 2) - (interface_radius / 2))
|
.attr("cx", (node_radius / 2) - (interface_radius / 2))
|
||||||
.attr("cy", interface_radius)
|
.attr("cy", interface_radius)
|
||||||
.attr("r", interface_radius)
|
.attr("r", interface_radius)
|
||||||
.attr("style", "fill:" + module_color_status_unknown + ";");
|
.attr("style", "fill:" + module_color_status_unknown + ";");
|
||||||
defs
|
|
||||||
.append("marker")
|
defs.append("marker")
|
||||||
.attr("id", "interface_end")
|
.attr("id", "interface_end")
|
||||||
.attr("refX", (node_radius / 2) + (interface_radius / 2))
|
.attr("refX", (node_radius / 2) + (interface_radius / 2))
|
||||||
.attr("refY", interface_radius)
|
.attr("refY", interface_radius)
|
||||||
.attr("markerWidth", (node_radius / 2) + interface_radius)
|
.attr("markerWidth", (node_radius / 2) + interface_radius)
|
||||||
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
.attr("markerHeight", (node_radius / 2) + interface_radius)
|
||||||
.attr("orient", "auto")
|
.attr("orient", "auto")
|
||||||
.append("circle")
|
.append("circle")
|
||||||
//~ .attr("class", "link")
|
//~ .attr("class", "link")
|
||||||
.attr("cx", interface_radius)
|
.attr("cx", interface_radius)
|
||||||
.attr("cy", interface_radius)
|
.attr("cy", interface_radius)
|
||||||
.attr("r", interface_radius)
|
.attr("r", interface_radius)
|
||||||
.attr("style", "fill:" + module_color_status_unknown + ";");
|
.attr("style", "fill:" + module_color_status_unknown + ";");
|
||||||
|
|
||||||
|
|
||||||
//Added pattern for the background grid
|
//Added pattern for the background grid
|
||||||
svg.append("pattern")
|
svg.append("pattern")
|
||||||
@ -1975,7 +1962,6 @@ function init_graph(parameter_object) {
|
|||||||
.attr("height", 24)
|
.attr("height", 24)
|
||||||
.attr("width", 25);
|
.attr("width", 25);
|
||||||
|
|
||||||
|
|
||||||
window.layer_graph = svg
|
window.layer_graph = svg
|
||||||
.append("g")
|
.append("g")
|
||||||
.attr("id", "layer_graph")
|
.attr("id", "layer_graph")
|
||||||
@ -2034,7 +2020,6 @@ function init_graph(parameter_object) {
|
|||||||
.attr("y", networkmap_dimensions[1] + node_radius - holding_area_dimensions[1])
|
.attr("y", networkmap_dimensions[1] + node_radius - holding_area_dimensions[1])
|
||||||
.text(holding_area_title);
|
.text(holding_area_title);
|
||||||
|
|
||||||
|
|
||||||
window.layer_graph_links = window.layer_graph
|
window.layer_graph_links = window.layer_graph
|
||||||
.append("g")
|
.append("g")
|
||||||
.attr("id", "layer_graph_links");
|
.attr("id", "layer_graph_links");
|
||||||
@ -2042,23 +2027,17 @@ function init_graph(parameter_object) {
|
|||||||
.append("g")
|
.append("g")
|
||||||
.attr("id", "layer_graph_nodes");
|
.attr("id", "layer_graph_nodes");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.layer_selection_rectangle = svg
|
window.layer_selection_rectangle = svg
|
||||||
.append("g")
|
.append("g")
|
||||||
.attr("id", "layer_selection_rectangle");
|
.attr("id", "layer_selection_rectangle");
|
||||||
|
|
||||||
|
force.nodes(graph.nodes)
|
||||||
|
|
||||||
force
|
|
||||||
.nodes(graph.nodes)
|
|
||||||
.links(graph.links)
|
.links(graph.links)
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
window.node = layer_graph_nodes.selectAll(".node");
|
window.node = layer_graph_nodes.selectAll(".node");
|
||||||
window.link = layer_graph_links.selectAll(".link");
|
window.link = layer_graph_links.selectAll(".link");
|
||||||
|
|
||||||
|
|
||||||
draw_elements_graph();
|
draw_elements_graph();
|
||||||
set_positions_graph();
|
set_positions_graph();
|
||||||
|
|
||||||
@ -2077,7 +2056,6 @@ function init_graph(parameter_object) {
|
|||||||
"stroke-opacity:1; " +
|
"stroke-opacity:1; " +
|
||||||
"stroke-dasharray:none;");
|
"stroke-dasharray:none;");
|
||||||
|
|
||||||
|
|
||||||
$("#dialog_node_edit").dialog({
|
$("#dialog_node_edit").dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
width: 650
|
width: 650
|
||||||
@ -2090,7 +2068,6 @@ function init_graph(parameter_object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function draw_elements_graph() {
|
function draw_elements_graph() {
|
||||||
|
|
||||||
link = link.data(force.links(), function(d) {
|
link = link.data(force.links(), function(d) {
|
||||||
return d.source.id + "-" + d.target.id;
|
return d.source.id + "-" + d.target.id;
|
||||||
});
|
});
|
||||||
@ -2098,63 +2075,61 @@ function draw_elements_graph() {
|
|||||||
.append("g");
|
.append("g");
|
||||||
link.exit().remove();
|
link.exit().remove();
|
||||||
|
|
||||||
link_temp
|
link_temp.append("path")
|
||||||
.append("path")
|
.attr("id", function(d) {
|
||||||
.attr("id", function(d) {
|
return "link_id_" + d.id_db;
|
||||||
return "link_id_" + d.id_db;
|
})
|
||||||
})
|
.attr("class", function(d) {
|
||||||
.attr("class", function(d) {
|
var holding_area_text = "";
|
||||||
var holding_area_text = "";
|
if ((d.source.state == 'holding_area') ||
|
||||||
if ((d.source.state == 'holding_area') ||
|
(d.target.state == 'holding_area')) {
|
||||||
(d.target.state == 'holding_area')) {
|
|
||||||
|
|
||||||
holding_area_text = " holding_area_link ";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return "link " +
|
holding_area_text = " holding_area_link ";
|
||||||
"source_" + d.source.id + " " +
|
|
||||||
"target_" + d.target.id + " " +
|
}
|
||||||
holding_area_text +
|
|
||||||
"id_module_start_" + d.id_module_start + " " +
|
return "link " +
|
||||||
"id_module_end_" + d.id_module_end;
|
"source_" + d.source.id + " " +
|
||||||
})
|
"target_" + d.target.id + " " +
|
||||||
.attr("stroke-width", 3)
|
holding_area_text +
|
||||||
.attr("d", null)
|
"id_module_start_" + d.id_module_start + " " +
|
||||||
.attr('marker-start', function(d) {
|
"id_module_end_" + d.id_module_end;
|
||||||
if (d.arrow_start == "") {
|
})
|
||||||
return "";
|
.attr("stroke-width", 3)
|
||||||
}
|
.attr("d", null)
|
||||||
else if (d.arrow_start == "module") {
|
.attr('marker-start', function(d) {
|
||||||
if (typeof(module_color_status[d.status_start]) == "undefined")
|
if (d.arrow_start == "") {
|
||||||
return "url(#interface_start)";
|
return "";
|
||||||
else
|
}
|
||||||
return "url(#interface_start_" + d.status_start + ")";
|
else if (d.arrow_start == "module") {
|
||||||
}
|
if (typeof(module_color_status[d.status_start]) == "undefined")
|
||||||
})
|
return "url(#interface_start)";
|
||||||
.attr('marker-end', function(d) {
|
else
|
||||||
if (d.arrow_end == "") {
|
return "url(#interface_start_" + d.status_start + ")";
|
||||||
return "";
|
}
|
||||||
}
|
})
|
||||||
else if (d.arrow_end == "module") {
|
.attr('marker-end', function(d) {
|
||||||
if (typeof(module_color_status[d.status_end]) == "undefined")
|
if (d.arrow_end == "") {
|
||||||
return "url(#interface_end)";
|
return "";
|
||||||
else
|
}
|
||||||
return "url(#interface_end_" + d.status_end + ")";
|
else if (d.arrow_end == "module") {
|
||||||
}
|
if (typeof(module_color_status[d.status_end]) == "undefined")
|
||||||
})
|
return "url(#interface_end)";
|
||||||
|
else
|
||||||
|
return "url(#interface_end_" + d.status_end + ")";
|
||||||
|
}
|
||||||
|
})
|
||||||
.on("mouseover", function(d) {
|
.on("mouseover", function(d) {
|
||||||
d3.select(this)
|
d3.select(this)
|
||||||
.classed("link_over", true);
|
.classed("link_over", true);
|
||||||
})
|
})
|
||||||
.on("mouseout", function(d) {
|
.on("mouseout", function(d) {
|
||||||
d3.select(this)
|
d3.select(this)
|
||||||
.classed("link_over", false);
|
.classed("link_over", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
//Add the reverse line for the end marker, it is invisible
|
//Add the reverse line for the end marker, it is invisible
|
||||||
link_temp
|
link_temp.append("path")
|
||||||
.append("path")
|
|
||||||
.attr("id", function(d) {
|
.attr("id", function(d) {
|
||||||
return "link_reverse_id_" + d.id_db;
|
return "link_reverse_id_" + d.id_db;
|
||||||
})
|
})
|
||||||
@ -2164,64 +2139,57 @@ function draw_elements_graph() {
|
|||||||
return "link_reverse";
|
return "link_reverse";
|
||||||
});
|
});
|
||||||
|
|
||||||
link_temp
|
link_temp.append("text")
|
||||||
.append("text")
|
.attr("xml:space", "preserve")
|
||||||
.attr("xml:space", "preserve")
|
.append("textPath")
|
||||||
.append("textPath")
|
.attr("xlink:href", function(d) {
|
||||||
.attr("xlink:href", function(d) {
|
return "#link_id_" + d.id_db;
|
||||||
return "#link_id_" + d.id_db;
|
})
|
||||||
})
|
.append("tspan")
|
||||||
.append("tspan")
|
.attr("style", "font-size: 8px; " +
|
||||||
.attr("style", "font-size: 8px; " +
|
"font-style:normal; " +
|
||||||
"font-style:normal; " +
|
"font-weight:normal; " +
|
||||||
"font-weight:normal; " +
|
"line-height: 100%; " +
|
||||||
"line-height: 100%; " +
|
"letter-spacing:0px; " +
|
||||||
"letter-spacing:0px; " +
|
"word-spacing:0px; " +
|
||||||
"word-spacing:0px; " +
|
"fill:#000000; " +
|
||||||
"fill:#000000; " +
|
"fill-opacity:1; " +
|
||||||
"fill-opacity:1; " +
|
"stroke:none; " +
|
||||||
"stroke:none; " +
|
"text-align:end; ")
|
||||||
"text-align:end; ")
|
.text(function(d) {
|
||||||
.text(function(d) {
|
var text_link = "";
|
||||||
var text_link = "";
|
if (d.text_start) {
|
||||||
if (d.text_start) {
|
text_link = d.text_start;
|
||||||
text_link = d.text_start;
|
}
|
||||||
}
|
|
||||||
|
return (Array(25).join(" ")) + text_link;
|
||||||
return (Array(25).join(" ")) + text_link;
|
});
|
||||||
});
|
|
||||||
|
|
||||||
link_temp
|
|
||||||
.append("text")
|
|
||||||
.attr("xml:space", "preserve")
|
|
||||||
.append("textPath")
|
|
||||||
.attr("xlink:href", function(d) {
|
|
||||||
return "#link_reverse_id_" + d.id_db;
|
|
||||||
})
|
|
||||||
.append("tspan")
|
|
||||||
.attr("style", "font-size: 8px; " +
|
|
||||||
"font-style:normal; " +
|
|
||||||
"font-weight:normal; " +
|
|
||||||
"line-height: 100%; " +
|
|
||||||
"letter-spacing:0px; " +
|
|
||||||
"word-spacing:0px; " +
|
|
||||||
"fill:#000000; " +
|
|
||||||
"fill-opacity:1; " +
|
|
||||||
"stroke:none; " +
|
|
||||||
"text-align:end; ")
|
|
||||||
.text(function(d) {
|
|
||||||
var text_link = "";
|
|
||||||
if (d.text_end) {
|
|
||||||
text_link = d.text_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (Array(25).join(" ")) + text_link;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
link_temp.append("text")
|
||||||
|
.attr("xml:space", "preserve")
|
||||||
|
.append("textPath")
|
||||||
|
.attr("xlink:href", function(d) {
|
||||||
|
return "#link_reverse_id_" + d.id_db;
|
||||||
|
})
|
||||||
|
.append("tspan")
|
||||||
|
.attr("style", "font-size: 8px; " +
|
||||||
|
"font-style:normal; " +
|
||||||
|
"font-weight:normal; " +
|
||||||
|
"line-height: 100%; " +
|
||||||
|
"letter-spacing:0px; " +
|
||||||
|
"word-spacing:0px; " +
|
||||||
|
"fill:#000000; " +
|
||||||
|
"fill-opacity:1; " +
|
||||||
|
"stroke:none; " +
|
||||||
|
"text-align:end; ")
|
||||||
|
.text(function(d) {
|
||||||
|
var text_link = "";
|
||||||
|
if (d.text_end) {
|
||||||
|
text_link = d.text_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (Array(25).join(" ")) + text_link;
|
||||||
|
});
|
||||||
|
|
||||||
node = node.data(force.nodes(), function(d) { return d.id;});
|
node = node.data(force.nodes(), function(d) { return d.id;});
|
||||||
node_temp = node.enter()
|
node_temp = node.enter()
|
||||||
@ -2255,6 +2223,7 @@ function draw_elements_graph() {
|
|||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", show_details_agent)
|
.on("dblclick", show_details_agent)
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
//Shape square
|
//Shape square
|
||||||
node_temp.filter(function(d) {
|
node_temp.filter(function(d) {
|
||||||
if (d.shape == 'square') {return true;}
|
if (d.shape == 'square') {return true;}
|
||||||
@ -2273,6 +2242,7 @@ function draw_elements_graph() {
|
|||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", show_details_agent)
|
.on("dblclick", show_details_agent)
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
//Shape square
|
//Shape square
|
||||||
node_temp.filter(function(d) {
|
node_temp.filter(function(d) {
|
||||||
if (d.shape == 'rhombus') {return true;}
|
if (d.shape == 'rhombus') {return true;}
|
||||||
@ -2294,40 +2264,35 @@ function draw_elements_graph() {
|
|||||||
.on("dblclick", show_details_agent)
|
.on("dblclick", show_details_agent)
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
|
node_temp.append("title")
|
||||||
|
|
||||||
node_temp
|
|
||||||
.append("title")
|
|
||||||
.text(function(d) {return d.text; });
|
.text(function(d) {return d.text; });
|
||||||
|
|
||||||
node_temp
|
node_temp.append("image")
|
||||||
.append("image")
|
.attr("class", "node_image")
|
||||||
.attr("class", "node_image")
|
.attr("xlink:href", function(d) {
|
||||||
.attr("xlink:href", function(d) {
|
return d.image_url;
|
||||||
return d.image_url;
|
})
|
||||||
})
|
.attr("x", function(d) {
|
||||||
.attr("x", function(d) {
|
return d.x - (d.image_width / 2);
|
||||||
return d.x - (d.image_width / 2);
|
})
|
||||||
})
|
.attr("y", function(d) {
|
||||||
.attr("y", function(d) {
|
return d.y - (d.image_height / 2);
|
||||||
return d.y - (d.image_height / 2);
|
})
|
||||||
})
|
.attr("width", function(d) {
|
||||||
.attr("width", function(d) {
|
return d.image_width;
|
||||||
return d.image_width;
|
})
|
||||||
})
|
.attr("height", function(d) {
|
||||||
.attr("height", function(d) {
|
return d.image_height;
|
||||||
return d.image_height;
|
})
|
||||||
})
|
.attr("id", "image2995")
|
||||||
.attr("id", "image2995")
|
.classed('dragable_node', true) //own dragable
|
||||||
.classed('dragable_node', true) //own dragable
|
|
||||||
.on("mouseover", over_node)
|
.on("mouseover", over_node)
|
||||||
.on("mouseout", over_node)
|
.on("mouseout", over_node)
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", show_details_agent)
|
.on("dblclick", show_details_agent)
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
node_temp
|
node_temp.append("text")
|
||||||
.append("text")
|
|
||||||
.attr("class", "node_text")
|
.attr("class", "node_text")
|
||||||
.attr("style", "font-size: 32px; font-style:normal; font-weight:normal; line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans")
|
.attr("style", "font-size: 32px; font-style:normal; font-weight:normal; line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans")
|
||||||
.attr("x", function(d) {
|
.attr("x", function(d) {
|
||||||
@ -2341,12 +2306,13 @@ function draw_elements_graph() {
|
|||||||
.text(function(d) {
|
.text(function(d) {
|
||||||
return d.text;
|
return d.text;
|
||||||
})
|
})
|
||||||
.classed('dragable_node', true) //own dragable
|
.classed('dragable_node', true) //own dragable
|
||||||
.on("mouseover", over_node)
|
.on("mouseover", over_node)
|
||||||
.on("mouseout", over_node)
|
.on("mouseout", over_node)
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", show_details_agent)
|
.on("dblclick", show_details_agent)
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
node.exit().remove();
|
node.exit().remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@ if (is_ajax ()) {
|
|||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
|
|
||||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $id);
|
$id_group = db_get_value('id_group', 'tmap', 'id', $id);
|
||||||
// ACL for the network map
|
// ACL for the network map
|
||||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||||
@ -35,18 +35,18 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
if (!$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$min_x = db_get_sql('SELECT MIN(x)
|
$min_x = db_get_sql('SELECT MIN(x)
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
WHERE id_map = ' . $id . ';');
|
||||||
|
|
||||||
$min_x_options = db_get_sql('SELECT options
|
$min_x_options = db_get_sql('SELECT style
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $id . '
|
WHERE id_map = ' . $id . '
|
||||||
ORDER BY x ASC LIMIT 1;');
|
ORDER BY x ASC LIMIT 1;');
|
||||||
|
|
||||||
$min_x_options = json_decode($min_x_options, true);
|
$min_x_options = json_decode($min_x_options, true);
|
||||||
@ -54,29 +54,29 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
|
|
||||||
$min_y = db_get_sql('SELECT MIN(y)
|
$min_y = db_get_sql('SELECT MIN(y)
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
WHERE id_map = ' . $id . ';');
|
||||||
|
|
||||||
$min_y_options = db_get_sql('SELECT options
|
$min_y_options = db_get_sql('SELECT style
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $id . '
|
WHERE id_map = ' . $id . '
|
||||||
ORDER BY y ASC LIMIT 1;');
|
ORDER BY y ASC LIMIT 1;');
|
||||||
|
|
||||||
$min_y_options = json_decode($min_y_options, true);
|
$min_y_options = json_decode($min_y_options, true);
|
||||||
$min_y = $min_y - $min_y_options['height'] - 10; //For prevent the exit icons of networkmap, -10 for the text
|
$min_y = $min_y - $min_y_options['height'] - 10; //For prevent the exit icons of networkmap, -10 for the text
|
||||||
|
|
||||||
$result = db_process_sql('UPDATE tnetworkmap_enterprise_nodes
|
$result = db_process_sql('UPDATE titem
|
||||||
SET x = x - ' . $min_x . ', y = y - ' . $min_y . '
|
SET x = x - ' . $min_x . ', y = y - ' . $min_y . '
|
||||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
WHERE id_map = ' . $id . ';');
|
||||||
|
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
$max_x = db_get_sql('SELECT MAX(x)
|
$max_x = db_get_sql('SELECT MAX(x)
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
WHERE id_map = ' . $id . ';');
|
||||||
|
|
||||||
$max_x_options = db_get_sql('SELECT options
|
$max_x_options = db_get_sql('SELECT style
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $id . '
|
WHERE id_map = ' . $id . '
|
||||||
ORDER BY x DESC LIMIT 1;');
|
ORDER BY x DESC LIMIT 1;');
|
||||||
|
|
||||||
$max_x_options = json_decode($max_x_options, true);
|
$max_x_options = json_decode($max_x_options, true);
|
||||||
@ -84,27 +84,28 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
|
|
||||||
$max_y = db_get_sql('SELECT MAX(y)
|
$max_y = db_get_sql('SELECT MAX(y)
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
WHERE tmap = ' . $id . ';');
|
||||||
|
|
||||||
$max_y_options = db_get_sql('SELECT options
|
$max_y_options = db_get_sql('SELECT style
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $id . '
|
WHERE tmap = ' . $id . '
|
||||||
ORDER BY y DESC LIMIT 1;');
|
ORDER BY y DESC LIMIT 1;');
|
||||||
|
|
||||||
$max_y_options = json_decode($max_y_options, true);
|
$max_y_options = json_decode($max_y_options, true);
|
||||||
$max_y = $max_y + $max_y_options['height'] + 10; //For prevent the exit icons of networkmap, +10 for the text
|
$max_y = $max_y + $max_y_options['height'] + 10; //For prevent the exit icons of networkmap, +10 for the text
|
||||||
|
|
||||||
|
|
||||||
$options = db_get_value_filter('options',
|
$options_w = db_get_value_filter('width',
|
||||||
'tnetworkmap_enterprise', array('id' => $id));
|
'tmap', array('id' => $id));
|
||||||
$options = json_decode($options, true);
|
$options_h = db_get_value_filter('height',
|
||||||
|
'tmap', array('id' => $id));
|
||||||
|
|
||||||
$options['width'] = $max_x;
|
$options_w = $max_x;
|
||||||
$options['height'] = $max_y;
|
$options_h = $max_y;
|
||||||
|
|
||||||
$result = db_process_sql_update('tnetworkmap_enterprise',
|
$result = db_process_sql_update('tmap',
|
||||||
array('options' => json_encode($options)),
|
array('width' => $options_w, 'height' => $options_h),
|
||||||
array('id' => $id));
|
array('id' => $id));
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -133,22 +134,6 @@ if (empty($id)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($new_networkmap) {
|
if ($new_networkmap) {
|
||||||
/*
|
|
||||||
// Open the cipher.
|
|
||||||
$td = mcrypt_module_open('blowfish', '', 'ecb', '');
|
|
||||||
|
|
||||||
// An IV should not be necessary for ECB. Prevents a warning.
|
|
||||||
$iv = str_repeat('0', mcrypt_enc_get_iv_size($td));
|
|
||||||
|
|
||||||
// Intialize decryption.
|
|
||||||
mcrypt_generic_init($td, "1234", $iv);
|
|
||||||
|
|
||||||
// Crypt the pass
|
|
||||||
$new_pass = "[[" . rtrim(bin2hex(mcrypt_generic($td, "ramonmelaponecomounjamon")), "\0") . "]]";
|
|
||||||
|
|
||||||
html_debug($new_pass, true);
|
|
||||||
*/
|
|
||||||
|
|
||||||
$name = '';
|
$name = '';
|
||||||
$id_group = 0;
|
$id_group = 0;
|
||||||
$width = 3000;
|
$width = 3000;
|
||||||
@ -169,7 +154,7 @@ $disabled_generation_method_select = false;
|
|||||||
if ($edit_networkmap) {
|
if ($edit_networkmap) {
|
||||||
$disabled_generation_method_select = true;
|
$disabled_generation_method_select = true;
|
||||||
|
|
||||||
$values = db_get_row('tnetworkmap_enterprise', 'id', $id);
|
$values = db_get_row('tmap', 'id', $id);
|
||||||
|
|
||||||
$not_found = false;
|
$not_found = false;
|
||||||
if ($values === false) {
|
if ($values === false) {
|
||||||
@ -185,45 +170,70 @@ if ($edit_networkmap) {
|
|||||||
|
|
||||||
if (!$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = io_safe_output($values['name']);
|
$name = io_safe_output($values['name']);
|
||||||
|
|
||||||
$options = json_decode($values['options'], true);
|
$filter = json_decode($values['filter'], true);
|
||||||
$source_data = $options['source_data'];
|
$source_data = $values['source_data'];
|
||||||
$width = $options['width'];
|
$width = $values['width'];
|
||||||
$height = $options['height'];
|
$height = $values['height'];
|
||||||
$method = $options['method'];
|
switch ($values['generation_method']) {
|
||||||
$refresh_value = $options['refresh_state'];
|
case 0:
|
||||||
|
$method = "circo";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$method = "dot";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$method = "twopi";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$method = "neato";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$method = "neato";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
$method = "fdp";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$refresh_value = $values['source_period'];
|
||||||
$l2_network_interfaces = false;
|
$l2_network_interfaces = false;
|
||||||
|
/* NO CONTEMPLADO
|
||||||
if (isset($options['l2_network_interfaces']))
|
if (isset($options['l2_network_interfaces']))
|
||||||
$l2_network_interfaces = $options['l2_network_interfaces'];
|
$l2_network_interfaces = $options['l2_network_interfaces'];
|
||||||
|
*/
|
||||||
// --------- DEPRECATED ----------------------------------------
|
// --------- DEPRECATED ----------------------------------------
|
||||||
$old_mode = false;
|
$old_mode = false;
|
||||||
|
/* NO CONTEMPLADO
|
||||||
if (isset($options['old_mode']))
|
if (isset($options['old_mode']))
|
||||||
$old_mode = (bool)$options['old_mode'];
|
$old_mode = (bool)$options['old_mode'];
|
||||||
|
*/
|
||||||
// --------- END DEPRECATED ------------------------------------
|
// --------- END DEPRECATED ------------------------------------
|
||||||
$recon_task_id = 0;
|
$recon_task_id = 0;
|
||||||
if (isset($options['recon_task_id'])) {
|
if ($values['source'] == 1) {
|
||||||
$recon_task_id = $options['recon_task_id'];
|
$recon_task_id = $values['source_data'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ip_mask = '';
|
$ip_mask = '';
|
||||||
if (isset($options['ip_mask'])) {
|
if (isset($filter['ip_mask'])) {
|
||||||
$ip_mask = $options['ip_mask'];
|
$ip_mask = $filter['ip_mask'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$dont_show_subgroups = false;
|
$dont_show_subgroups = false;
|
||||||
|
/* NO CONTEMPLADO
|
||||||
if (isset($options['dont_show_subgroups']))
|
if (isset($options['dont_show_subgroups']))
|
||||||
$dont_show_subgroups = $options['dont_show_subgroups'];
|
$dont_show_subgroups = $options['dont_show_subgroups'];
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_page_header(__('Networkmap enterprise'), "images/bricks.png",
|
ui_print_page_header(__('Networkmap'), "images/bricks.png",
|
||||||
false, "network_map_enterprise", false);
|
false, "network_map_enterprise", false);
|
||||||
|
|
||||||
$id_snmp_l2_recon = db_get_value('id_recon_script', 'trecon_script',
|
$id_snmp_l2_recon = db_get_value('id_recon_script', 'trecon_script',
|
||||||
@ -361,13 +371,8 @@ else {
|
|||||||
'process', !((bool)$id), 'resize_networkmap_enterprise(' . $id . ');', 'class="sub"', true) .
|
'process', !((bool)$id), 'resize_networkmap_enterprise(' . $id . ');', 'class="sub"', true) .
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||||
|
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo "<div style='width: " . $table->width . "; text-align: right;'>";
|
echo "<div style='width: " . $table->width . "; text-align: right;'>";
|
||||||
@ -409,7 +414,7 @@ function resize_networkmap_enterprise(id) {
|
|||||||
var params = [];
|
var params = [];
|
||||||
params.push("resize_networkmap_enterprise=1");
|
params.push("resize_networkmap_enterprise=1");
|
||||||
params.push("id=" + id);
|
params.push("id=" + id);
|
||||||
params.push("page=enterprise/operation/agentes/networkmap_enterprise.editor");
|
params.push("page=operation/agentes/pandora_networkmap.editor");
|
||||||
jQuery.ajax ({
|
jQuery.ajax ({
|
||||||
data: params.join ("&"),
|
data: params.join ("&"),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
@ -39,7 +39,6 @@ $delete = (bool) get_parameter('delete', false);
|
|||||||
$tab = (string) get_parameter('tab', 'list');
|
$tab = (string) get_parameter('tab', 'list');
|
||||||
|
|
||||||
$result_txt = '';
|
$result_txt = '';
|
||||||
|
|
||||||
// The networkmap doesn't exist yet
|
// The networkmap doesn't exist yet
|
||||||
if ($new_networkmap || $save_networkmap) {
|
if ($new_networkmap || $save_networkmap) {
|
||||||
if ($new_networkmap) {
|
if ($new_networkmap) {
|
||||||
@ -146,7 +145,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id_group_old = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $id);
|
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id);
|
||||||
if ($id_group_old === false) {
|
if ($id_group_old === false) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to accessnode graph builder");
|
"Trying to accessnode graph builder");
|
||||||
@ -305,7 +304,7 @@ switch ($tab) {
|
|||||||
}
|
}
|
||||||
$id_groups = array_keys(users_get_groups());
|
$id_groups = array_keys(users_get_groups());
|
||||||
|
|
||||||
$network_maps = db_get_all_rows_filter('tnetworkmap_enterprise',
|
$network_maps = db_get_all_rows_filter('tmap',
|
||||||
array('id_group' => $id_groups));
|
array('id_group' => $id_groups));
|
||||||
|
|
||||||
if ($network_maps !== false) {
|
if ($network_maps !== false) {
|
||||||
@ -324,8 +323,6 @@ switch ($tab) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = json_decode($network_map['options'], true);
|
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['name'] = '<a href="index.php?' .
|
$data['name'] = '<a href="index.php?' .
|
||||||
'sec=network&' .
|
'sec=network&' .
|
||||||
@ -336,13 +333,12 @@ switch ($tab) {
|
|||||||
|
|
||||||
$count = db_get_value_sql(
|
$count = db_get_value_sql(
|
||||||
'SELECT COUNT(*)
|
'SELECT COUNT(*)
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $network_map['id'] . ' AND
|
WHERE id_map = ' . $network_map['id'] . ' AND deleted = 0');
|
||||||
id_agent_module = 0 AND id_module = 0 AND deleted = 0');
|
|
||||||
if (empty($count))
|
if (empty($count))
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
if (($count == 0) && ($options['generation_process'] != 'empty')) {
|
if (($count == 0) && ($network_map['source'] != 'empty')) {
|
||||||
$data['nodes'] = __('Pending to generate');
|
$data['nodes'] = __('Pending to generate');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -383,7 +379,6 @@ switch ($tab) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($networkmaps_write || $networkmaps_manage) {
|
if ($networkmaps_write || $networkmaps_manage) {
|
||||||
|
|
||||||
echo "<div style='width: " . $table->width . "; text-align: right; margin-top: 5px;'>";
|
echo "<div style='width: " . $table->width . "; text-align: right; margin-top: 5px;'>";
|
||||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||||
html_print_input_hidden ('new_networkmap', 1);
|
html_print_input_hidden ('new_networkmap', 1);
|
||||||
|
@ -33,8 +33,8 @@ require_once ($config['homedir'] . '/include/functions_pandora_networkmap.php');
|
|||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
$id_node = (int)get_parameter('id', 0);
|
$id_node = (int)get_parameter('id', 0);
|
||||||
$row = db_get_row('tnetworkmap_enterprise_nodes', 'id', $id_node);
|
$row = db_get_row('titem', 'id', $id_node);
|
||||||
$networkmap = db_get_row('tnetworkmap_enterprise', 'id', $row['id_networkmap_enterprise']);
|
$networkmap = db_get_row('tmap', 'id', $row['id_map']);
|
||||||
|
|
||||||
// ACL for the network map
|
// ACL for the network map
|
||||||
$networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR");
|
$networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR");
|
||||||
@ -43,7 +43,7 @@ $networkmap_manage = check_acl ($config['id_user'], $networkmap['id_group'], "MM
|
|||||||
|
|
||||||
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -52,8 +52,8 @@ $user_readonly = !$networkmap_write && !$networkmap_manage;
|
|||||||
|
|
||||||
$refresh_state = (int)get_parameter('refresh_state', 0);
|
$refresh_state = (int)get_parameter('refresh_state', 0);
|
||||||
|
|
||||||
$options = db_get_value('options', 'tnetworkmap_enterprise_nodes', 'id', $id_node);
|
$style = db_get_value('style', 'titem', 'id', $id_node);
|
||||||
$options = json_decode($options, true);
|
$style = json_decode($style, true);
|
||||||
|
|
||||||
//The next line "<!DOCTYPE...." it is necesary for the fucking IE9 because
|
//The next line "<!DOCTYPE...." it is necesary for the fucking IE9 because
|
||||||
//this crap browser doesn't execute correcly the getContext without this line.
|
//this crap browser doesn't execute correcly the getContext without this line.
|
||||||
@ -61,10 +61,9 @@ $options = json_decode($options, true);
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><?php echo __('Details of node:') . ' ' . $options['text'];?></title>
|
<title><?php echo __('Details of node:') . ' ' . $style['label'];?></title>
|
||||||
<script type="text/javascript" src="../../include/javascript/jquery-1.6.1.min.js"></script>
|
<script type="text/javascript" src="../../include/javascript/jquery-1.6.1.min.js"></script>
|
||||||
<script type="text/javascript" src="../../../include/javascript/jquery.colorpicker.js"></script>
|
<script type="text/javascript" src="../../../include/javascript/jquery.colorpicker.js"></script>
|
||||||
<!-- ui_require_jquery_file('colorpicker'); -->
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
@ -16,7 +16,7 @@ global $config;
|
|||||||
// Check user credentials
|
// Check user credentials
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
require_once ('/include/functions_pandora_networkmap.php');
|
require_once ('include/functions_pandora_networkmap.php');
|
||||||
require_once ('enterprise/include/functions_policies.php');
|
require_once ('enterprise/include/functions_policies.php');
|
||||||
require_once ('include/functions_modules.php');
|
require_once ('include/functions_modules.php');
|
||||||
|
|
||||||
@ -66,14 +66,14 @@ if (is_ajax ()) {
|
|||||||
$return['holding_area'] = array();
|
$return['holding_area'] = array();
|
||||||
|
|
||||||
// ACL for the network map
|
// ACL for the network map
|
||||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||||
|
|
||||||
if (!$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -100,27 +100,27 @@ if (is_ajax ()) {
|
|||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
|
|
||||||
// ACL for the network map
|
// ACL for the network map
|
||||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||||
|
|
||||||
if (!$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$node = db_get_row('tnetworkmap_enterprise_nodes', 'id',
|
$node = db_get_row('titem', 'id',
|
||||||
$node_id);
|
$node_id);
|
||||||
$node['options'] = json_decode($node['options'], true);
|
$node['style'] = json_decode($node['style'], true);
|
||||||
$node['options']['text'] = $name;
|
$node['style']['label'] = $name;
|
||||||
$node['options']['networkmap'] = $networkmap_to_link;
|
$node['style']['networkmap'] = $networkmap_to_link;
|
||||||
$node['options'] = json_encode($node['options']);
|
$node['style'] = json_encode($node['style']);
|
||||||
|
|
||||||
$return['correct'] = (bool)db_process_sql_update(
|
$return['correct'] = (bool)db_process_sql_update(
|
||||||
'tnetworkmap_enterprise_nodes', $node,
|
'titem', $node,
|
||||||
array('id' => $node_id));
|
array('id' => $node_id));
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
@ -138,14 +138,14 @@ if (is_ajax ()) {
|
|||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
|
|
||||||
// ACL for the network map
|
// ACL for the network map
|
||||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||||
|
|
||||||
if (!$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -188,28 +188,28 @@ if (is_ajax ()) {
|
|||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
|
|
||||||
// ACL for the network map
|
// ACL for the network map
|
||||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||||
|
|
||||||
if (!$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$node = db_get_row_filter('tnetworkmap_enterprise_nodes',
|
$node = db_get_row_filter('titem',
|
||||||
array('id_networkmap_enterprise' => $networkmap_id,
|
array('id_map' => $networkmap_id,
|
||||||
'id' => $id));
|
'id' => $id));
|
||||||
|
|
||||||
$node['options'] = json_decode($node['options'], true);
|
$node['style'] = json_decode($node['style'], true);
|
||||||
$node['options']['shape'] = $shape;
|
$node['style']['shape'] = $shape;
|
||||||
$node['options'] = json_encode($node['options']);
|
$node['style'] = json_encode($node['style']);
|
||||||
|
|
||||||
$return['correct'] = db_process_sql_update('tnetworkmap_enterprise_nodes',
|
$return['correct'] = db_process_sql_update('titem',
|
||||||
$node, array('id_networkmap_enterprise' => $networkmap_id,
|
$node, array('tmap' => $networkmap_id,
|
||||||
'id' => $id));
|
'id' => $id));
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
|
|
||||||
@ -229,14 +229,14 @@ if (is_ajax ()) {
|
|||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
|
|
||||||
// ACL for the network map
|
// ACL for the network map
|
||||||
$id_group = db_get_value('id_group', 'tnetworkmap_enterprise', 'id', $networkmap_id);
|
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||||
|
|
||||||
if (!$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -286,13 +286,13 @@ if (is_ajax ()) {
|
|||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
|
|
||||||
$z = db_get_value('z', 'tnetworkmap_enterprise_nodes', 'id',
|
$z = db_get_value('z', 'titem', 'id',
|
||||||
$node);
|
$node);
|
||||||
|
|
||||||
$z++;
|
$z++;
|
||||||
|
|
||||||
$return['correct'] = (bool)db_process_sql_update(
|
$return['correct'] = (bool)db_process_sql_update(
|
||||||
'tnetworkmap_enterprise_nodes', array('z' => $z),
|
'titem', array('z' => $z),
|
||||||
array('id' => $node));
|
array('id' => $node));
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
@ -311,22 +311,22 @@ if (is_ajax ()) {
|
|||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
|
|
||||||
$row = db_get_row('tnetworkmap_enterprise_nodes', 'id',
|
$row = db_get_row('titem', 'id',
|
||||||
$id_node);
|
$id_node);
|
||||||
$row['options'] = json_decode($row['options'], true);
|
$row['style'] = json_decode($row['style'], true);
|
||||||
$row['options']['shape'] = $shape;
|
$row['style']['shape'] = $shape;
|
||||||
//WORK AROUND FOR THE JSON ENCODE WITH FOR EXAMPLE Ñ OR Á
|
//WORK AROUND FOR THE JSON ENCODE WITH FOR EXAMPLE Ñ OR Á
|
||||||
$row['options']['text'] = 'json_encode_crash_with_ut8_chars';
|
$row['style']['label'] = 'json_encode_crash_with_ut8_chars';
|
||||||
$row['options']['color'] = $color;
|
$row['style']['color'] = $color;
|
||||||
$row['options']['networkmap'] = $networkmap;
|
$row['style']['networkmap'] = $networkmap;
|
||||||
$row['options']['width'] = $radious * 2;
|
$row['style']['width'] = $radious * 2;
|
||||||
$row['options']['height'] = $radious * 2;
|
$row['style']['height'] = $radious * 2;
|
||||||
$row['options'] = json_encode($row['options']);
|
$row['style'] = json_encode($row['style']);
|
||||||
$row['options'] = str_replace(
|
$row['style'] = str_replace(
|
||||||
'json_encode_crash_with_ut8_chars', $name, $row['options']);
|
'json_encode_crash_with_ut8_chars', $name, $row['style']);
|
||||||
|
|
||||||
$return['correct'] = (bool)db_process_sql_update(
|
$return['correct'] = (bool)db_process_sql_update(
|
||||||
'tnetworkmap_enterprise_nodes', $row,
|
'titem', $row,
|
||||||
array('id' => $id_node));
|
array('id' => $id_node));
|
||||||
|
|
||||||
if ($return['correct']) {
|
if ($return['correct']) {
|
||||||
@ -363,28 +363,27 @@ if (is_ajax ()) {
|
|||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
|
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['id_networkmap_enterprise'] = $id;
|
$data['id_map'] = $id;
|
||||||
$data['x'] = $x;
|
$data['x'] = $x;
|
||||||
$data['y'] = $y;
|
$data['y'] = $y;
|
||||||
$data['id_agent'] = -2; //The id for the fictional points.
|
$data['source_data'] = -2; //The id for the fictional points.
|
||||||
$data['parent'] = 0;
|
$data['parent'] = 0;
|
||||||
$options = array();
|
$style = array();
|
||||||
$options['shape'] = $shape;
|
$style['shape'] = $shape;
|
||||||
$options['image'] = '';
|
$style['image'] = '';
|
||||||
$options['width'] = $radious * 2;
|
$style['width'] = $radious * 2;
|
||||||
$options['height'] = $radious * 2;
|
$style['height'] = $radious * 2;
|
||||||
//WORK AROUND FOR THE JSON ENCODE WITH FOR EXAMPLE Ñ OR Á
|
//WORK AROUND FOR THE JSON ENCODE WITH FOR EXAMPLE Ñ OR Á
|
||||||
$options['text'] = 'json_encode_crash_with_ut8_chars';
|
$style['label'] = 'json_encode_crash_with_ut8_chars';
|
||||||
$options['color'] = $color;
|
$style['color'] = $color;
|
||||||
$options['networkmap'] = $networkmap;
|
$style['networkmap'] = $networkmap;
|
||||||
$data['options'] = json_encode($options);
|
$data['style'] = json_encode($style);
|
||||||
$data['options'] = str_replace(
|
$data['style'] = str_replace(
|
||||||
'json_encode_crash_with_ut8_chars', $name,
|
'json_encode_crash_with_ut8_chars', $name,
|
||||||
$data['options']);
|
$data['style']);
|
||||||
|
|
||||||
$id_node = db_process_sql_insert('tnetworkmap_enterprise_nodes',
|
$id_node = db_process_sql_insert('titem',
|
||||||
$data);
|
$data);
|
||||||
|
|
||||||
$return['correct'] = (bool)$id_node;
|
$return['correct'] = (bool)$id_node;
|
||||||
@ -426,19 +425,19 @@ if (is_ajax ()) {
|
|||||||
$x + ($count * 20), $y + ($count * 20), $id_agent);
|
$x + ($count * 20), $y + ($count * 20), $id_agent);
|
||||||
|
|
||||||
if ($id_node !== false) {
|
if ($id_node !== false) {
|
||||||
$node = db_get_row('tnetworkmap_enterprise_nodes', 'id',
|
$node = db_get_row('titem', 'id',
|
||||||
$id_node);
|
$id_node);
|
||||||
$options = json_decode($node['options'], true);
|
$options = json_decode($node['options'], true);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['id_node'] = $id_node;
|
$data['id_node'] = $id_node;
|
||||||
$data['id_agent'] = $node['id_agent'];
|
$data['source_data'] = $node['id_agent'];
|
||||||
$data['parent'] = $node['parent'];
|
$data['parent'] = $node['parent'];
|
||||||
$data['shape'] = $options['shape'];
|
$data['shape'] = $options['shape'];
|
||||||
$data['image'] = $options['image'];
|
$data['image'] = $options['image'];
|
||||||
$data['width'] = $options['width'];
|
$data['width'] = $options['width'];
|
||||||
$data['height'] = $options['height'];
|
$data['height'] = $options['height'];
|
||||||
$data['text'] = $options['text'];
|
$data['label'] = $options['text'];
|
||||||
$data['x'] = $node['x'];
|
$data['x'] = $node['x'];
|
||||||
$data['y'] = $node['y'];
|
$data['y'] = $node['y'];
|
||||||
$data['status'] = get_status_color_networkmap(
|
$data['status'] = get_status_color_networkmap(
|
||||||
@ -464,13 +463,15 @@ if (is_ajax ()) {
|
|||||||
$where_id_agente = ' 1=1 ';
|
$where_id_agente = ' 1=1 ';
|
||||||
|
|
||||||
$agents_in_networkmap = db_get_all_rows_filter(
|
$agents_in_networkmap = db_get_all_rows_filter(
|
||||||
'tnetworkmap_enterprise_nodes',
|
'titem',
|
||||||
array('id_networkmap_enterprise' => $id,
|
array('tmap' => $id,
|
||||||
'deleted' => 0));
|
'deleted' => 0));
|
||||||
if ($agents_in_networkmap !== false) {
|
if ($agents_in_networkmap !== false) {
|
||||||
$ids = array();
|
$ids = array();
|
||||||
foreach ($agents_in_networkmap as $agent) {
|
foreach ($agents_in_networkmap as $agent) {
|
||||||
$ids[] = $agent['id_agent'];
|
if ($agent['type'] == 0) {
|
||||||
|
$ids[] = $agent['source_data'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$where_id_agente = ' id_agente NOT IN (' .
|
$where_id_agente = ' id_agente NOT IN (' .
|
||||||
implode(',', $ids) . ')';
|
implode(',', $ids) . ')';
|
||||||
@ -552,8 +553,6 @@ if (is_ajax ()) {
|
|||||||
$module = $modules[0];
|
$module = $modules[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = true;
|
$return['correct'] = true;
|
||||||
|
|
||||||
@ -665,8 +664,6 @@ if (is_ajax ()) {
|
|||||||
"<b>" . __('Status: ') . "</b>" .
|
"<b>" . __('Status: ') . "</b>" .
|
||||||
ui_print_status_image($status, $title, true) . "<br />";
|
ui_print_status_image($status, $title, true) . "<br />";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($module["id_tipo_modulo"] == 24) { // log4x
|
if ($module["id_tipo_modulo"] == 24) { // log4x
|
||||||
switch($module["datos"]) {
|
switch($module["datos"]) {
|
||||||
case 10:
|
case 10:
|
||||||
@ -732,17 +729,16 @@ if (is_ajax ()) {
|
|||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
|
|
||||||
$node = db_get_row_filter('tnetworkmap_enterprise_nodes',
|
$node = db_get_row_filter('titem',
|
||||||
array('id' => $id));
|
array('id' => $id));
|
||||||
$options = json_decode($node['options'], true);
|
$style = json_decode($node['style'], true);
|
||||||
|
|
||||||
$options['shape'] = $shape;
|
$style['shape'] = $shape;
|
||||||
$options = json_encode($options);
|
$style = json_encode($style);
|
||||||
|
|
||||||
$return['correct'] = db_process_sql_update(
|
$return['correct'] = db_process_sql_update(
|
||||||
'tnetworkmap_enterprise_nodes',
|
'titem',
|
||||||
array('options' => $options), array('id' => $id));
|
array('style' => $style), array('id' => $id));
|
||||||
|
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
|
|
||||||
@ -755,11 +751,11 @@ if (is_ajax ()) {
|
|||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = true;
|
$return['correct'] = true;
|
||||||
|
|
||||||
$node = db_get_row_filter('tnetworkmap_enterprise_nodes',
|
$node = db_get_row_filter('titem',
|
||||||
array('id' => $id));
|
array('id' => $id));
|
||||||
$node['options'] = json_decode($node['options'], true);
|
$node['style'] = json_decode($node['style'], true);
|
||||||
|
|
||||||
$return['shape'] = $node['options']['shape'];
|
$return['shape'] = $node['style']['shape'];
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
|
|
||||||
@ -773,13 +769,12 @@ if (is_ajax ()) {
|
|||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = true;
|
$return['correct'] = true;
|
||||||
|
|
||||||
$node = db_get_row_filter('tnetworkmap_enterprise_nodes',
|
$node = db_get_row_filter('titem',
|
||||||
array('id_networkmap_enterprise' => $id,
|
array('id_map' => $id,
|
||||||
'options' => '%\"text\":\"%' . $name . '%\"%'));
|
'options' => '%\"label\":\"%' . $name . '%\"%'));
|
||||||
$return['x'] = $node['x'];
|
$return['x'] = $node['x'];
|
||||||
$return['y'] = $node['y'];
|
$return['y'] = $node['y'];
|
||||||
|
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -792,17 +787,17 @@ if (is_ajax ()) {
|
|||||||
/* q is what autocomplete plugin gives */
|
/* q is what autocomplete plugin gives */
|
||||||
$string = io_safe_output((string) get_parameter ('q'));
|
$string = io_safe_output((string) get_parameter ('q'));
|
||||||
|
|
||||||
$agents = db_get_all_rows_filter('tnetworkmap_enterprise_nodes',
|
$agents = db_get_all_rows_filter('titem',
|
||||||
array('id_networkmap_enterprise' => $id,
|
array('id_map' => $id,
|
||||||
'options' => '%\"text\":\"%' . $string . '%\"%'));
|
'options' => '%\"label\":\"%' . $string . '%\"%'));
|
||||||
|
|
||||||
if ($agents === false)
|
if ($agents === false)
|
||||||
$agents = array();
|
$agents = array();
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$options = json_decode($agent['options'], true);
|
$style = json_decode($agent['style'], true);
|
||||||
$data[] = array('name' => io_safe_output($options['text']));
|
$data[] = array('name' => io_safe_output($style['label']));
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
@ -840,8 +835,8 @@ if (is_ajax ()) {
|
|||||||
$id = (int)get_parameter('id', 0);
|
$id = (int)get_parameter('id', 0);
|
||||||
|
|
||||||
|
|
||||||
$id_agent = db_get_value('id_agent',
|
$id_agent = db_get_value('source_data',
|
||||||
'tnetworkmap_enterprise_nodes', 'id', $id);
|
'titem', 'id', $id);
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = true;
|
$return['correct'] = true;
|
||||||
@ -849,16 +844,16 @@ if (is_ajax ()) {
|
|||||||
$return['color'] = get_status_color_networkmap($id_agent);
|
$return['color'] = get_status_color_networkmap($id_agent);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$options = db_get_value('options',
|
$style = db_get_value('style',
|
||||||
'tnetworkmap_enterprise_nodes', 'id', $id);
|
'titem', 'id', $id);
|
||||||
$options = json_decode($options, true);
|
$style = json_decode($style, true);
|
||||||
if ($options['networkmap'] == 0) {
|
if ($style['networkmap'] == 0) {
|
||||||
$return['color'] = $options['color'];
|
$return['color'] = $style['color'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return['color'] =
|
$return['color'] =
|
||||||
get_status_color_networkmap_fictional_point(
|
get_status_color_networkmap_fictional_point(
|
||||||
$options['networkmap']);
|
$style['networkmap']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -873,10 +868,10 @@ if (is_ajax ()) {
|
|||||||
$parent = (int)get_parameter('parent');
|
$parent = (int)get_parameter('parent');
|
||||||
|
|
||||||
$correct = db_process_sql_insert(
|
$correct = db_process_sql_insert(
|
||||||
'tnetworkmap_ent_rel_nodes',
|
'trel_item',
|
||||||
array('id_networkmap_enterprise' => $id,
|
array('id_map' => $id,
|
||||||
'parent' => $parent,
|
'id_parent' => $parent,
|
||||||
'child' => $child));
|
'id_child' => $child));
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
@ -884,8 +879,8 @@ if (is_ajax ()) {
|
|||||||
if ($correct) {
|
if ($correct) {
|
||||||
$return['correct'] = true;
|
$return['correct'] = true;
|
||||||
$return['id'] = $correct;
|
$return['id'] = $correct;
|
||||||
$return['child'] = $child;
|
$return['id_child'] = $child;
|
||||||
$return['parent'] = $parent;
|
$return['id_parent'] = $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
@ -897,14 +892,14 @@ if (is_ajax ()) {
|
|||||||
$refresh_state = (int)get_parameter('refresh_state', 60);
|
$refresh_state = (int)get_parameter('refresh_state', 60);
|
||||||
$id = (int)get_parameter('id', 0);
|
$id = (int)get_parameter('id', 0);
|
||||||
|
|
||||||
$options = db_get_value('options', 'tnetworkmap_enterprise',
|
$filter = db_get_value('filter', 'tmap',
|
||||||
'id', $id);
|
'id', $id);
|
||||||
$options = json_decode($options, true);
|
$filter = json_decode($filter, true);
|
||||||
$options['refresh_state'] = $refresh_state;
|
$filter['source_period'] = $refresh_state;
|
||||||
$options = json_encode($options);
|
$filter = json_encode($filter);
|
||||||
|
|
||||||
$correct = db_process_sql_update('tnetworkmap_enterprise',
|
$correct = db_process_sql_update('tmap',
|
||||||
array('options' => $options), array('id' => $id));
|
array('filter' => $filter), array('id' => $id));
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = false;
|
$return['correct'] = false;
|
||||||
@ -934,20 +929,20 @@ if (is_ajax ()) {
|
|||||||
if ($id_node !== false) {
|
if ($id_node !== false) {
|
||||||
$return['correct'] = true;
|
$return['correct'] = true;
|
||||||
|
|
||||||
$node = db_get_row('tnetworkmap_enterprise_nodes', 'id',
|
$node = db_get_row('titem', 'id',
|
||||||
$id_node);
|
$id_node);
|
||||||
$options = json_decode($node['options'], true);
|
$style = json_decode($node['style'], true);
|
||||||
|
|
||||||
$return['id_node'] = $id_node;
|
$return['id_node'] = $id_node;
|
||||||
$return['id_agent'] = $node['id_agent'];
|
$return['source_data'] = $node['id_agent'];
|
||||||
$return['parent'] = $node['parent'];
|
$return['parent'] = $node['parent'];
|
||||||
$return['shape'] = $options['shape'];
|
$return['shape'] = $style['shape'];
|
||||||
$return['image'] = $options['image'];
|
$return['image'] = $style['image'];
|
||||||
$return['image_url'] = html_print_image(
|
$return['image_url'] = html_print_image(
|
||||||
$options['image'], true, false, true);
|
$style['image'], true, false, true);
|
||||||
$return['width'] = $options['width'];
|
$return['width'] = $style['width'];
|
||||||
$return['height'] = $options['height'];
|
$return['height'] = $style['height'];
|
||||||
$return['text'] = $options['text'];
|
$return['text'] = $style['text'];
|
||||||
$return['x'] = $x;
|
$return['x'] = $x;
|
||||||
$return['y'] = $y;
|
$return['y'] = $y;
|
||||||
$return['status'] = get_status_color_networkmap($id_agent);
|
$return['status'] = get_status_color_networkmap($id_agent);
|
||||||
@ -963,7 +958,7 @@ if (is_ajax ()) {
|
|||||||
$x = (int)get_parameter('x', 0);
|
$x = (int)get_parameter('x', 0);
|
||||||
$y = (int)get_parameter('y', 0);
|
$y = (int)get_parameter('y', 0);
|
||||||
|
|
||||||
$networkmap = db_get_row('tnetworkmap_enterprise', 'id', $id);
|
$networkmap = db_get_row('tmap', 'id', $id);
|
||||||
|
|
||||||
// ACL for the network map
|
// ACL for the network map
|
||||||
// $networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR");
|
// $networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR");
|
||||||
@ -972,17 +967,15 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
if (!$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = json_decode($networkmap['options'], true);
|
$networkmap['center_x'] = $x;
|
||||||
$options['center_x'] = $x;
|
$networkmap['center_y'] = $y;
|
||||||
$options['center_y'] = $y;
|
db_process_sql_update('tmap',
|
||||||
$networkmap['options'] = json_encode($options);
|
array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']),
|
||||||
db_process_sql_update('tnetworkmap_enterprise',
|
|
||||||
array('options' => $networkmap['options']),
|
|
||||||
array('id' => $id));
|
array('id' => $id));
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
@ -999,20 +992,19 @@ if (is_ajax ()) {
|
|||||||
$parent = (int)get_parameter('parent', 0);
|
$parent = (int)get_parameter('parent', 0);
|
||||||
|
|
||||||
$where = array();
|
$where = array();
|
||||||
$where['id_networkmap_enterprise'] = $id;
|
$where['id_map'] = $id;
|
||||||
$where['child'] = $child;
|
$where['id_child'] = $child;
|
||||||
$where['parent'] = $parent;
|
$where['id_parent'] = $parent;
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
$return['correct'] = db_process_sql_delete(
|
$return['correct'] = db_process_sql_delete(
|
||||||
'tnetworkmap_ent_rel_nodes', $where);
|
'trel_item', $where);
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Popup
|
//Popup
|
||||||
$get_status_node = (bool)get_parameter('get_status_node', false);
|
$get_status_node = (bool)get_parameter('get_status_node', false);
|
||||||
$get_status_module = (bool)get_parameter('get_status_module',
|
$get_status_module = (bool)get_parameter('get_status_module',
|
||||||
@ -1067,10 +1059,10 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
$id = (int) get_parameter('id_networkmap', 0);
|
$id = (int) get_parameter('id_networkmap', 0);
|
||||||
|
|
||||||
$networkmap = db_get_row('tnetworkmap_enterprise', 'id', $id);
|
$networkmap = db_get_row('tmap', 'id', $id);
|
||||||
|
|
||||||
if ($networkmap === false) {
|
if ($networkmap === false) {
|
||||||
ui_print_page_header(__('Networkmap enterprise'),
|
ui_print_page_header(__('Networkmap'),
|
||||||
"images/bricks.png", false, "network_map_enterprise", false);
|
"images/bricks.png", false, "network_map_enterprise", false);
|
||||||
ui_print_error_message(__('Not found networkmap.'));
|
ui_print_error_message(__('Not found networkmap.'));
|
||||||
|
|
||||||
@ -1084,7 +1076,7 @@ else {
|
|||||||
|
|
||||||
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access networkmap enterprise");
|
"Trying to access networkmap");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1115,7 +1107,7 @@ else {
|
|||||||
'text' => '<a href="index.php?sec=networkmapconsole&' .
|
'text' => '<a href="index.php?sec=networkmapconsole&' .
|
||||||
'sec2=operation/agentes/pandora_networkmap">' .
|
'sec2=operation/agentes/pandora_networkmap">' .
|
||||||
html_print_image("images/list.png", true,
|
html_print_image("images/list.png", true,
|
||||||
array ('title' => __('List of networkmap Enterprise'))) .
|
array ('title' => __('List of networkmap'))) .
|
||||||
'</a>');
|
'</a>');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1125,13 +1117,19 @@ else {
|
|||||||
|
|
||||||
$numNodes = (int)db_get_num_rows('
|
$numNodes = (int)db_get_num_rows('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM tnetworkmap_enterprise_nodes
|
FROM titem
|
||||||
WHERE id_networkmap_enterprise = ' . $id . ';');
|
WHERE id_map = ' . $id . ';');
|
||||||
|
|
||||||
if ($numNodes == 0) {
|
if ($numNodes == 0) {
|
||||||
networkmap_process_networkmap($id);
|
networkmap_process_networkmap($id);
|
||||||
|
show_networkmap($id, $user_readonly);
|
||||||
|
}
|
||||||
|
else if (enterprise_installed()) {
|
||||||
|
show_networkmap($id, $user_readonly);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui_print_error_message(__('MENSAJE DE ADVERTENCIA OPEN'));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_networkmap($id, $user_readonly);
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user