$node) { if ($center > 0 && ! is_descendant ($node_id, $center, $parents)) { unset ($parents[$node_id]); unset ($orphans[$node_id]); unset ($nodes[$node_id]); continue; } $graph .= create_node ($node , $simple, $font_size)."\n\t\t"; } // Define edges foreach ($parents as $node => $parent_id) { // Verify that the parent is in the graph if (isset ($nodes[$parent_id])) { $graph .= create_edge ($node, $parent_id); } else { $orphans[$node] = 1; } } // Create a central node if orphan nodes exist if (count ($orphans)) { $graph .= create_pandora_node ($pandora_name, $font_size); } // Define edges for orphan nodes foreach (array_keys($orphans) as $node) { $graph .= create_edge ('0', $node); } // Close graph $graph .= close_graph (); return $graph; } // Returns an edge definition function create_edge ($head, $tail) { global $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group; // edgeURL allows node navigation $edge = $head.' -- '.$tail.'[color="#BDBDBD", headclip=false, tailclip=false, edgeURL="index.php?sec=estado&sec2=operation/agentes/networkmap¢er='.$head. '&layout='.$layout.'&nooverlap=' .$nooverlap.'&pure='.$pure. '&zoom='.$zoom.'&ranksep='.$ranksep.'&simple='.$simple.'®en=1'. '&font_size='.$font_size.'&group='.$group.'"];'; return $edge; } // Returns a node definition function create_node ($agent, $simple = 0, $font_size = 10) { $sql = sprintf ('SELECT COUNT(tagente_modulo.id_agente) FROM tagente_estado, tagente_modulo WHERE tagente_modulo.id_agente = %d AND tagente_modulo.id_tipo_modulo in (2, 6, 9, 18, 21, 100) AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_estado.estado = 1', $agent['id_agente']); $bad_modules = get_db_sql ($sql); // Set node status if ($bad_modules) { $status_color = '#FF1D1D'; } else { $status_color = '#8DFF1D'; } // Check for alert $sql = sprintf ('SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente WHERE tagente.id_agente = %d AND tagente.disabled = 0 AND tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module AND talert_template_modules.times_fired > 0 ', $agent['id_agente']); $alert_modules = get_db_sql ($sql); if ($alert_modules) $status_color = '#FFE308'; // Short name $name = strtolower ($agent["nombre"]); if (strlen ($name) > 16) $name = substr ($name, 0, 16); if ($simple == 0){ // Set node icon if (file_exists ('images/networkmap/'.$agent['id_os'].'.png')) { $img_node = 'images/networkmap/'.$agent['id_os'].'.png'; } else { $img_node = 'images/networkmap/0.png'; } $node = $agent['id_agente'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<
'.$name.' |
'.$name.' |
system()
call (PHP Safe Mode or SELinux)";
echo "