diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 579da36f31..3cf2ce569e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,25 @@ +2008-06-30 Esteban Sanchez + + * godmode/groups/configure_group.php: Complete rewritten. Use Pandora + functions and added javascript support. + + * godmode/groups/group_list.php: Rewrite to use Pandora functions. + Code cleanup. + + * godmode/reporting/map_builder.php: Added width and height support to + graphics layout items type. + + * godmode/reporting/reporting_builder.php: Style correction. + + * operation/agentes/networkmap.php: Unused code cleanup. Style + correction. Use hex color codes instead of names, because graphviz was + complaining about them. Avoid a warning on graphviz about "color" in a + TD. Replaced lang_label with lang_string(). Show error if map could + not be generated. + + * operation/reporting/reporting_viewer_pdf.php: Style correction and + code cleanup. + 2008-06-30 Sancho Lerena * agent_manager.php: Agent names are now show in order. diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 28b7290267..cad913e463 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -22,134 +22,135 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Load global vars + require("include/config.php"); -if (comprueba_login() == 0) - $id_user = $_SESSION["id_usuario"]; - if (give_acl($id_user, 0, "PM")==1) { - // Init vars - $id_grupo = ""; - $nombre = ""; - $id_parent = ""; - $disabled = 0; - - if (isset($_GET["create_g"])){ // - $create_g = entrada_limpia($_GET["create_g"]); - } else - $create_g = 0; - - if (isset($_GET["id_grupo"])){ - $id_grupo = entrada_limpia($_GET["id_grupo"]); - $sql1='SELECT * FROM tgrupo WHERE id_grupo = '.$id_grupo; - $result=mysql_query($sql1); - if ($row=mysql_fetch_array($result)){ - $nombre = $row["nombre"]; - $icono = $row["icon"]; - $disabled = $row["disabled"]; - $id_parent = entrada_limpia($row["parent"]); - } else - { - echo "

".$lang_label["group_error"]."

"; - echo ""; - include ("general/footer.php"); - exit; - } - } - - echo "

".$lang_label["group_management"]." > "; - if (isset($_GET["create_g"])) { - echo $lang_label["create_group"]; - } - if (isset($_GET["id_grupo"])) { - echo $lang_label["update_group"]; - } - echo "

" - -?> - - - - -"; - else { - echo ""; - echo ""; - } -?> - - -
- -
-'; - - echo ''; - - // Parent - - echo "
"; - echo $lang_label["parent"]; - echo ''; - echo ''; - - // Disabled - echo "
"; - echo $lang_label["alerts"]; - echo ''; - echo '"; - - echo "
"; - echo ""; - echo '
'; - if (isset($_GET["create_g"])) - echo ""; - else - echo ""; - - echo "
"; - -} else { - audit_db($id_user,$REMOTE_ADDR, "ACL Violation", - "Trying to access Group Management2"); +if (comprueba_login ()) { + audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access Group Management2"); require ("general/noaccess.php"); + return; +} + +if (! give_acl ($config['id_user'], 0, "PM")) { + audit_db ($id_user, $REMOTE_ADDR, "ACL Violation", "Trying to access Group Management2"); + require ("general/noaccess.php"); + return; +} + +// Init vars +$icon = ""; +$name = ""; +$id_parent = 0; +$alerts_disabled = 0; + +$create_group = (bool) get_parameter ('create_group'); +$id_group = (int) get_parameter ('id_group'); + +if ($id_group) { + $group = get_db_row ('tgrupo', 'id_grupo', $id_group); + if ($group) { + $name = $group["nombre"]; + $icon = $group["icon"].'.png'; + $alerts_isabled = $group["disabled"]; + $id_parent = $group["parent"]; + } else { + echo "

".$lang_label["group_error"]."

"; + echo ""; + include ("general/footer.php"); + exit; } +} + +echo "

".$lang_label["group_management"]." > "; +if ($id_group) { + echo $lang_label["update_group"]; +} else { + echo $lang_label["create_group"]; +} +echo "

"; + +$table->width = '450px'; +$table->data = array (); +$table->data[0][0] = lang_string ('name'); +$table->data[0][1] = print_input_text ('name', $name, '', 35, 100, true); +$table->data[1][0] = lang_string ('icon'); +$files = list_files ('images/groups_small/', "png", 1, 0); +$table->data[1][1] = print_select ($files, 'icon', $icon, '', 'None', '', true); +$table->data[1][1] .= ' '; +if ($icon) { + $table->data[1][1] .= ''; +} +$table->data[1][1] .= ''; +$table->data[2][0] = lang_string ('parent'); +$sql = 'SELECT * FROM tgrupo '; +if ($id_group) + $sql .= sprintf ('WHERE id_grupo != %d', $id_group); +$table->data[2][1] = print_select_from_sql ($sql, 'parent', $id_parent, '', 'None', 0, true); +$table->data[2][1] .= ' '; +if ($id_parent) { + echo ''; +} +echo''; +$table->data[3][0] = lang_string ('alerts'); +$table->data[3][1] = print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true); + +echo '
'; +print_table ($table); +echo '
'; +if ($id_group) { + print_input_hidden ('update_group', 1); + print_input_hidden ('id_group', $id_group); + print_submit_button (lang_string ('update'), 'updbutton', false, 'class="sub upd"'); +} else { + print_input_hidden ('create_group', 1); + print_submit_button (lang_string ('create'), 'crtbutton', false, 'class="sub wand"'); +} +echo '
'; +echo '
'; ?> + + + + diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index e26b7177f1..00fc2136ed 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -51,101 +51,97 @@ if (defined ('AJAX')) { exit (); } -if (isset($_POST["create_g"])) { // Create group - $nombre = entrada_limpia($_POST["nombre"]); - $icon = entrada_limpia($_POST["icon"]); - $parent = entrada_limpia($_POST["parent"]); - $disabled = entrada_limpia($_POST["disabled"]); - $sql_insert="INSERT INTO tgrupo (nombre, icon, parent, disabled) - VALUES ('$nombre', '$icon', '$parent', $disabled) "; - $result=mysql_query($sql_insert); - if (! $result) - echo "

".$lang_label["create_group_no"]."

"; - else { - echo "

".$lang_label["create_group_ok"]."

"; - $id_grupo = mysql_insert_id(); - } +$create_group = (bool) get_parameter ('create_group'); +$update_group = (bool) get_parameter ('update_group'); +$delete_group = (bool) get_parameter ('delete_group'); + +/* Create group */ +if ($create_group) { + $name = (string) get_parameter ('name'); + $icon = (string) get_parameter ('icon'); + $id_parent = (int) get_parameter ('id_parent'); + $alerts_disabled = (bool) get_parameter ('alerts_disabled'); + + $sql = sprintf ('INSERT INTO tgrupo (nombre, icon, parent, disabled) + VALUES ("%s", "%s", %d, %d)', + $name, substr ($icon, 0, -4), $id_parent, $alerts_disabled); + $result = mysql_query ($sql); + if ($result) { + echo "

".lang_string ("create_group_ok")."

"; + } else { + echo "

".lang_string ("create_group_no")."

"; } } -if (isset($_POST["update_g"])){ // if modified any parameter - $nombre = entrada_limpia($_POST["nombre"]); - $id_grupo = entrada_limpia($_POST["id_grupo"]); - $icon = entrada_limpia($_POST["icon"]); - $disabled = entrada_limpia($_POST["disabled"]); - $parent = entrada_limpia($_POST["parent"]); - $sql_update ="UPDATE tgrupo - SET nombre = '$nombre', icon = '$icon', disabled = $disabled, parent = '$parent' - WHERE id_grupo = '$id_grupo'"; - $result=mysql_query($sql_update); - if (! $result) - echo "

".$lang_label["modify_group_no"]."

"; - else - echo "

".$lang_label["modify_group_ok"]."

"; -} - -if (isset($_GET["delete_g"])){ // if delete - $id_borrar_modulo = entrada_limpia($_GET["id_grupo"]); +/* Update group */ +if ($update_group) { + $id_group = (int) get_parameter ('id_group'); + $name = (string) get_parameter ('name'); + $icon = (string) get_parameter ('icon'); + $id_parent = (int) get_parameter ('id_parent'); + $alerts_enabled = (bool) get_parameter ('alerts_enabled'); - // First delete from tagente_modulo - $sql_delete= "DELETE FROM tgrupo WHERE id_grupo = ".$id_borrar_modulo; - $result=mysql_query($sql_delete); + $sql = sprintf ('UPDATE tgrupo SET nombre = "%s", + icon = "%s", disabled = %d, parent = %d + WHERE id_grupo = %d', + $name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $id_group); + $result = mysql_query ($sql); + if ($result) { + echo "

".lang_string ("modify_group_ok")."

"; + } else { + echo "

".lang_string ("modify_group_no")."

"; + } +} + +/* Delete group */ +if ($delete_group) { + $id_group = (int) get_parameter ('id_group'); + + $sql = sprintf ('UPDATE tagente set id_grupo = 1 WHERE id_grupo = %d', $id_group); + $result = mysql_query ($sql); + $sql = sprintf ('DELETE FROM tgrupo WHERE id_grupo = %d', $id_group); + $result = mysql_query ($sql); if (! $result) - echo "

".$lang_label["delete_group_no"]."

"; + echo "

".lang_string ("delete_group_no")."

"; else - echo "

".$lang_label["delete_group_ok"]."

"; + echo "

".lang_string ("delete_group_ok")."

"; } -echo "

".$lang_label["group_management"]." > "; -echo $lang_label["definedgroups"]."

"; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -$sql1='SELECT * FROM tgrupo ORDER BY nombre'; -$result=mysql_query($sql1); -$color=0; -while ($row=mysql_fetch_array($result)){ - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - if ($row["id_grupo"] != 1){ - echo ""; - echo ""; - echo ""; +echo "

".lang_string ("group_management")." > "; +echo lang_string ("definedgroups")."

"; - // Disabled? - echo ""; +$table->width = '400px'; +$table->head = array (); +$table->head[0] = lang_string ("icon"); +$table->head[1] = lang_string ("name"); +$table->head[2] = lang_string ("parent"); +$table->head[3] = lang_string ("alerts"); +$table->head[4] = lang_string ("delete"); +$table->align = array (); +$table->align[4] = 'center'; +$table->data = array (); - echo ""; - } +$groups = get_user_groups ($config['id_user']); + +foreach ($groups as $id_group => $group_name) { + $data = array (); + + $group = get_db_row ('tgrupo', 'id_grupo', $id_group); + + $data[0] = ''; + $data[1] = ''.$group_name.''; + $data[2] = dame_nombre_grupo ($group["parent"]); + $data[3] = $group['disabled'] ? lang_string ('disabled') : lang_string ('enabled'); + $data[4] = ''; + + array_push ($table->data, $data); } -echo "
".$lang_label["icon"]."".$lang_label["group_name"]."".$lang_label["parent"]."".$lang_label["alerts"]."".$lang_label["delete"]."
"; - echo ""; - echo ""; - echo "".$row["nombre"].""; - echo ""; - echo dame_nombre_grupo ($row["parent"]); - echo ""; - if ($row["disabled"]==1) - echo " ".$lang_label["disabled"]; - else - echo " ".$lang_label["enabled"]; - echo ""; - echo "'; - echo "
"; -echo ""; -echo "
"; -echo "
"; -echo ""; -echo "
"; + +print_table ($table); + +echo '
'; +echo '
'; +print_submit_button (lang_string ("create_group"), 'crt', false, 'class="sub next"'); +echo '
'; +echo '
'; ?> diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 3de9dad1c3..db2350db29 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -145,16 +145,20 @@ if ($create_layout_data) { $layout_data_parent_item = (int) get_parameter ("parent_item"); $layout_data_period = (int) get_parameter ("period"); $layout_data_map_linked = (int) get_parameter ("map_linked"); + $layout_data_width = (int) get_parameter ("width"); + $layout_data_height = (int) get_parameter ("height"); $sql = sprintf ('INSERT INTO tlayout_data (id_layout, label, id_layout_linked, - label_color, image, type, id_agente_modulo, parent_item, period, no_link_color) - VALUES (%d, "%s", %d, "%s", "%s", %d, %d, %d, %d, 1)', + label_color, image, type, id_agente_modulo, parent_item, period, no_link_color, + width, height) + VALUES (%d, "%s", %d, "%s", "%s", %d, %d, %d, %d, 1, %d, %d)', $id_layout, $layout_data_label, $layout_data_map_linked, $layout_data_label_color, $layout_data_image, $layout_data_type, $layout_data_id_agent_module, - $layout_data_parent_item, $layout_data_period * 3600); + $layout_data_parent_item, $layout_data_period * 3600, + $layout_data_width, $layout_data_height); $result = mysql_query ($sql); if ($result) { @@ -171,6 +175,7 @@ if ($update_layout_data_coords) { $id_layout_data = (int) get_parameter ('id_layout_data'); $layout_data_x = (int) get_parameter ("coord_x"); $layout_data_y = (int) get_parameter ("coord_y"); + $sql = sprintf ('UPDATE tlayout_data SET pos_x = %d, pos_y = %d WHERE id = %d', @@ -209,13 +214,16 @@ if ($update_layout_data) { $layout_data_parent_item = (int) get_parameter ("parent_item"); $layout_data_period = (int) get_parameter ("period"); $layout_data_map_linked = (int) get_parameter ("map_linked"); + $layout_data_width = (int) get_parameter ("width"); + $layout_data_height = (int) get_parameter ("height"); $sql = sprintf ('UPDATE tlayout_data SET image = "%s", label = "%s", label_color = "%s", id_agente_modulo = %d, type = %d, parent_item = %d, - period = %d, id_layout_linked = %d + period = %d, id_layout_linked = %d, + width = %d, height = %d WHERE id = %d', $layout_data_image, $layout_data_label, $layout_data_label_color, @@ -223,6 +231,7 @@ if ($update_layout_data) { $layout_data_type, $layout_data_parent_item, $layout_data_period * 3600, $layout_data_map_linked, + $layout_data_width, $layout_data_height, $id_layout_data); $result = mysql_query ($sql); @@ -371,6 +380,9 @@ if (! $edit_layout && ! $id_layout) { $table->data = array (); $table->id = 'table_layout_data'; + $table->rowstyle = array (); + $table->rowstyle[3] = 'display: none'; + $table->rowstyle[4] = 'display: none'; $table->data[0][0] = lang_string ('label'); $table->data[0][1] = print_input_text ('label', '', '', 20, 200, true); @@ -378,20 +390,24 @@ if (! $edit_layout && ! $id_layout) { $table->data[1][1] = print_input_text ('label_color', '#000000', '', 7, 7, true); $table->data[2][0] = lang_string ('type'); $table->data[2][1] = print_select (get_layout_data_types (), 'type', '', '', '', '', true); - $table->data[3][0] = lang_string ('agent'); - $table->data[3][1] = print_select ($agents, 'agent', '', '', '--', 0, true); - $table->data[4][0] = lang_string ('module'); - $table->data[4][1] = print_select (array (), 'module', '', '', '--', 0, true); - $table->data[5][0] = lang_string ('period'); - $table->data[5][1] = print_select ($intervals, 'period', '', '', '--', 0, true); - $table->data[6][0] = lang_string ('image'); - $table->data[6][1] = print_select ($images_list, 'image', '', '', 'None', '', true); - $table->data[6][1] .= '
'; - $table->data[7][0] = lang_string ('parent'); - $table->data[7][1] = print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '.$id_layout, + $table->data[3][0] = lang_string ('height'); + $table->data[3][1] = print_input_text ('height', '', '', 5, 5, true); + $table->data[4][0] = lang_string ('width'); + $table->data[4][1] = print_input_text ('width', '', '', 5, 5, true); + $table->data[5][0] = lang_string ('agent'); + $table->data[5][1] = print_select ($agents, 'agent', '', '', '--', 0, true); + $table->data[6][0] = lang_string ('module'); + $table->data[6][1] = print_select (array (), 'module', '', '', '--', 0, true); + $table->data[7][0] = lang_string ('period'); + $table->data[7][1] = print_select ($intervals, 'period', '', '', '--', 0, true); + $table->data[8][0] = lang_string ('image'); + $table->data[8][1] = print_select ($images_list, 'image', '', '', 'None', '', true); + $table->data[8][1] .= '
'; + $table->data[9][0] = lang_string ('parent'); + $table->data[9][1] = print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '.$id_layout, 'parent_item', '', '', 'None', '', true); - $table->data[8][0] = lang_string ('map_linked'); - $table->data[8][1] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != '.$id_layout, + $table->data[10][0] = lang_string ('map_linked'); + $table->data[10][1] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != '.$id_layout, 'map_linked', '', '', 'None', '', true); echo '
'; @@ -518,13 +534,18 @@ $(document).ready (function () { id_layout_data: id }, function (data) { + console.log (data); $("#form_layout_data_editor #text-label").attr ('value', data['label']); $("#form_layout_data_editor #type").attr ('value', data['type']); + $("#form_layout_data_editor #type").change (); $("#form_layout_data_editor #image").attr ('value', data['image']); + $("#form_layout_data_editor #width").attr ('value', data['width']); + $("#form_layout_data_editor #height").attr ('value', data['height']); $("#form_layout_data_editor #image").change (); $("#form_layout_data_editor #id_layout_data").attr ('value', data['id']); $("#form_layout_data_editor #period").attr ('value', data['period'] / 3600); $("#form_layout_data_editor #agent").attr ('value', data['id_agent']); + $("#form_layout_data_editor #parent_item").attr ('value', data['parent_item']); $("#form_layout_data_editor #map_linked").attr ('value', data['id_layout_linked']); $("#form_layout_data_editor #hidden-update_layout_data").attr ('value', 1); $("#form_layout_data_editor #hidden-create_layout_data").attr ('value', 0); @@ -563,6 +584,16 @@ $(document).ready (function () { } }); $("#form_layout_data_editor #agent").change (agent_changed); + $("#form_layout_data_editor #type").change (function () { + if (this.value == 0) { + $("#table_layout_data #table_layout_data-3, #table_layout_data #table_layout_data-4").fadeOut (); + $("#table_layout_data #table_layout_data-8").fadeIn (); + } else { + $("#table_layout_data #table_layout_data-3, #table_layout_data #table_layout_data-4").fadeIn (); + $("#table_layout_data #table_layout_data-8").fadeOut (); + } + + }); $("#form_layout_data_editor #text-label_color").attachColorPicker(); }); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 1e3dc4e21c..3a4222d3ff 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -27,7 +27,7 @@ if (comprueba_login() != 0) { exit; } -if ((give_acl($id_user,0,"AW") != 1 ) AND (dame_admin($id_user)!=1)) { +if ((give_acl($id_user, 0, "AW") != 1) && (dame_admin ($id_user) != 1)) { audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index f560ffc979..f22f07adf2 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -45,39 +45,24 @@ function generate_dot ($simple = 0) { else { $orphans[$agent['id_agente']] = 1; } - - // Start a new subgraph for the group - //if ($group_id != $agent['id_grupo'] && isset($_POST['group'])) { - // Close the previous group - //if ($group_id != -1) { - // $graph .= close_group(); - //} - //$group_id = $agent['id_grupo']; - //$graph .= open_group($group_id); - //} - + // Add node - $graph .= create_node($agent , $simple); + $graph .= create_node($agent , $simple)."\n\t\t"; } - // Close the last subgraph - //if (isset($_POST['group'])) { - // $graph .= close_group(); - //} - // Create a central node if orphan nodes exist - if (count($orphans) > 0) { + if (count ($orphans)) { $graph .= create_pandora_node ($pandora_name); } // Define edges foreach ($parents as $node => $parent_id) { - $graph .= create_edge($node, $parent_id); + $graph .= create_edge ($node, $parent_id); } // Define edges for orphan nodes - foreach(array_keys($orphans) as $node) { - $graph .= create_edge('0', $node); + foreach (array_keys($orphans) as $node) { + $graph .= create_edge ('0', $node); } // Close graph @@ -88,7 +73,7 @@ function generate_dot ($simple = 0) { // Returns an edge definition function create_edge ($head, $tail) { - $edge = $head . ' -- ' . $tail . '[color="#BDBDBD", headclip=false, tailclip=false];'; + $edge = $head.' -- '.$tail.'[color="#BDBDBD", headclip=false, tailclip=false];'; return $edge; } @@ -112,27 +97,23 @@ function create_node ($agent, $simple = 0) { // Short name $name = strtolower ($agent["nombre"]); - if (strlen($name) > 12) - $name = substr($name,0,12); + if (strlen ($name) > 12) + $name = substr ($name, 0, 12); if ($simple == 0){ // Set node icon - if (file_exists('images/networkmap/' . $agent['id_os'] . '.png')) { - $img_node = 'images/networkmap/' . $agent['id_os'] . '.png'; + 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=9, style="filled", fixedsize=true, width=0.40, height=0.40, label=< - -
' . $name . '
>, + $node = $agent['id_agente'].' [ color="'.$status_color.'", fontsize=9, style="filled", fixedsize=true, width=0.40, height=0.40, label=< +
'.$name.'
>, shape="ellipse", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'", - tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent=' - . $agent['id_agente'].'"];'; + tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];'; } else { - $node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=7, style="filled", fixedsize=true, width=0.20, height=0.20, label="", - tooltip="ajax.php?page=operation/agentes/ver_agente& - get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];'; + $node = $agent['id_agente'].' [ color="'.$status_color.'", fontsize=7, style="filled", fixedsize=true, width=0.20, height=0.20, label="", + tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];'; } return $node; } @@ -141,8 +122,8 @@ function create_node ($agent, $simple = 0) { function create_pandora_node ($name) { $node = '0 [ color="#364D1F", fontsize=10, style="filled", fixedsize=true, width=0.8, height=0.6, label=< -
' . $name . '
>, - shape="ellipse", tooltip="' . $name . '", URL="index.php?sec=estado&sec2=operation/agentes/estado_grupo" ];'; + '.$name.'>, + shape="ellipse", tooltip="'.$name.'", URL="index.php?sec=estado&sec2=operation/agentes/estado_grupo" ];'; return $node; } @@ -154,8 +135,8 @@ function open_group ($id) { $group = 'subgraph cluster_' . $id . ' { style=filled; color=darkolivegreen3; label=< - -
' . $name . '
>; tooltip="' . $name . '"; + '.$name.' + >; tooltip="'.$name.'"; URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=' . $id . '";'; @@ -168,7 +149,7 @@ function close_group () { } // Opens a graph definition -function open_graph() { +function open_graph () { global $config, $layout, $nooverlap, $pure, $zoom, $ranksep; $overlap = 'compress'; $size_x = 8; @@ -205,12 +186,12 @@ function open_graph() { } // Closes a graph definition -function close_graph() { +function close_graph () { return '}'; } // Returns the filter used to achieve the desired layout -function set_filter() { +function set_filter () { global $layout; switch($layout) { @@ -254,7 +235,7 @@ if ((give_acl($id_user, 0, "AR") != 1 ) && (dame_admin($id_user) !=1 )) { exit; } -echo '

' . $lang_label['ag_title'].' > '.lang_string("Network Map").' '; +echo '

'.lang_string ('ag_title').' > '.lang_string("Network Map").' '; if ($pure == 1) { echo ''; } else { @@ -303,7 +284,7 @@ if ($pure == "1") { //echo ' Display groups '; echo ''; echo ''; + lang_string ("update").'">'; echo ''; echo ''; echo ''; @@ -328,6 +309,10 @@ if ($result !== false) { } echo ''; include $config["attachment_store"]."/networkmap.map"; +} else { + echo '

'.lang_string ('Map could not be generated').'

'; + echo $result; + return; } ?> diff --git a/pandora_console/operation/reporting/reporting_viewer_pdf.php b/pandora_console/operation/reporting/reporting_viewer_pdf.php index df588b3900..3c9a09aa54 100644 --- a/pandora_console/operation/reporting/reporting_viewer_pdf.php +++ b/pandora_console/operation/reporting/reporting_viewer_pdf.php @@ -24,36 +24,32 @@ require_once ("../../include/functions_db.php"); require_once ("../../include/languages/language_".$config["language"].".php"); require_once ("../../include/functions_reporting_pdf.php"); -if (!isset($_SESSION["id_usuario"])){ - session_start(); - session_write_close(); +if (!isset ($_SESSION["id_usuario"])) { + session_start(); + session_write_close(); } -$config ["id_user"] = $_SESSION["id_usuario"]; - // Session check check_login (); // Login check -$id_user=$_SESSION["id_usuario"]; global $REMOTE_ADDR; -if (comprueba_login() != 0) { +if (comprueba_login ()) { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder"); include ("general/noaccess.php"); exit; } -if ((give_acl($id_user,0,"AR") != 1 ) AND (dame_admin($id_user)!=1)) { +if (! give_acl ($id_user, 0, "AR") && ! dame_admin ($id_user)) { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder"); include ("general/noaccess.php"); exit; } - -$id_report = get_parameter ('id'); -if ($id_report == ""){ - audit_db($id_user,$REMOTE_ADDR, "HACK Attempt","Trying to access graph viewer withoud ID"); +$id_report = (int) get_parameter ('id'); +if (! $id_report) { + audit_db ($id_user, $REMOTE_ADDR, "HACK Attempt", "Trying to access graph viewer withoud ID"); include ("general/noaccess.php"); exit; } @@ -61,22 +57,21 @@ if ($id_report == ""){ $report_private= get_db_value ("private", "treport", "id_report", $id_report); $report_user = get_db_value ("id_user", "treport", "id_report", $id_report); -if (($report_user == $id_user) OR (dame_admin($id_user)==1) OR ($report_private == 0)) { - // Without report type parameter: ABORT - if (isset($_GET["rtype"])) // YES, R-type was a classic game :-) - $report_type = get_parameter ("rtype"); - else { - echo "

No access without report type

"; - audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access report without specify reportype"); - exit; - } - - // Available PDF reports: - switch ($report_type){ - case "general": - general_report ($id_report); - break; - } +if ($report_user == $id_user || dame_admin ($id_user) || ! $report_private) { + $report_type = get_parameter ("rtype"); + // Without report type parameter: ABORT + if (! $report_type) { + echo "

No access without report type

"; + audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access report without specify reportype"); + exit; + } + + // Available PDF reports: + switch ($report_type) { + case "general": + general_report ($id_report); + break; + } } ?>