diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ef4909c737..5e3e39ff09 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,18 @@ +2008-10-02 Esteban Sanchez + + * include/functions_db.php: Removed quotes when using $order_field so + it can be used order (ASC or DESC). + + * include/functions_html.php: Added thead and tbody to be more XHTML + compliant. + + * operation/reporting/graph_viewer.php: Fixed a typo error that was + not allowing to remove a graph. Style correction, variables renamed to + have a meaning ($row has no scope or meaning, please do not use it!) + and better use of the parameters. + + * godmode/extensions.php: Style correction. + 2008-10-01 Ramon Novoa * godmode/agentes/module_manager_editor_network.php: Added support for diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index 58ed4a9f1a..23934d7736 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -30,7 +30,7 @@ if (sizeof ($config['extensions']) == 0) { return; } -echo '

'.__('Defined extensions')."

"; +echo '

'.__('Defined extensions').'

'; $table->width = '95%'; $table->head = array (); $table->head[0] = __('Name'); diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index d35f068327..cb0d41fb70 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1466,7 +1466,7 @@ function process_sql ($sql, $rettype = "affected_rows") { */ function get_db_all_rows_in_table ($table, $order_field = "") { if ($order_field != "") { - return get_db_all_rows_sql ("SELECT * FROM `".$table."` ORDER BY `".$order_field."` "); + return get_db_all_rows_sql ("SELECT * FROM `".$table."` ORDER BY ".$order_field); } else { return get_db_all_rows_sql ("SELECT * FROM `".$table."`"); } @@ -1491,7 +1491,7 @@ function get_db_all_rows_field_filter ($table, $field, $condition, $order_field } if ($order_field != "") - $sql .= sprintf(" ORDER BY `%s`",$order_field); + $sql .= sprintf(" ORDER BY %s",$order_field); return get_db_all_rows_sql ($sql); } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 9f5dde8d3f..36436151e5 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -368,10 +368,9 @@ function print_table (&$table, $return = false) { $output .= " cellpadding=\"$table->cellpadding\" cellspacing=\"$table->cellspacing\" "; $output .= " border=\"$table->border\" class=\"$table->class\" id=\"$tableid\" >\n"; $countcols = 0; - if (!empty ($table->head)) { $countcols = count ($table->head); - $output .= ''; + $output .= ''; foreach ($table->head as $key => $heading) { if (!isset ($size[$key])) { $size[$key] = ''; @@ -382,8 +381,10 @@ function print_table (&$table, $return = false) { $output .= ''. $heading .''; } - $output .= ''."\n"; + $output .= ''."\n"; } + + $output .= ''."\n"; if (!empty ($table->data)) { $oddeven = 1; foreach ($table->data as $keyrow => $row) { @@ -428,7 +429,7 @@ function print_table (&$table, $return = false) { $output .= ''."\n"; } } - $output .= ''."\n"; + $output .= ''."\n"; if ($return) return $output; diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index 376b88256d..ec66a7f900 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -21,10 +21,13 @@ check_login (); +$delete_graph = (bool) get_parameter ('delete_graph'); +$view_graph = (bool) get_parameter ('view_graph'); +$id = (int) get_parameter ('id'); + // Delete module SQL code -if (isset($_GET["delete"])) { - if (! give_acl($config['id_user'], 0, "AW")) { - $id = $_GET["delete"]; +if ($delete_graph) { + if (give_acl ($config['id_user'], 0, "AW")) { $sql = "DELETE FROM tgraph_source WHERE id_graph = $id"; if ($res=mysql_query($sql)) $result = "

".__('Deleted successfully')."

"; @@ -38,23 +41,22 @@ if (isset($_GET["delete"])) { echo $result; } else { audit_db ($config['id_user'],$REMOTE_ADDR, "ACL Violation","Trying to delete a graph from access graph builder"); - include ("general/noaccess.php"); - exit; + include ("general/noaccess.php"); + exit; } } -if (isset($_GET["view_graph"])){ - $id_graph = $_GET["view_graph"]; - $sql="SELECT * FROM tgraph WHERE id_graph = $id_graph"; +if ($view_graph) { + $sql="SELECT * FROM tgraph WHERE id_graph = $id"; $res=mysql_query($sql); - if ($row = mysql_fetch_array($res)){ - $id_user = $row["id_user"]; - $private = $row["private"]; - $width = $row["width"]; - $height = $row["height"]; + if ($graph = mysql_fetch_array($res)){ + $id_user = $graph["id_user"]; + $private = $graph["private"]; + $width = $graph["width"]; + $height = $graph["height"]; $zoom = (int) get_parameter ('zoom', 0); - if ($zoom > 0){ - switch ($zoom){ + if ($zoom > 0) { + switch ($zoom) { case 1: $width = 500; $height = 210; @@ -71,28 +73,28 @@ if (isset($_GET["view_graph"])){ } $period = (int) get_parameter ('period'); if (! $period) - $period = $row["period"]; + $period = $graph["period"]; else $period = 3600 * $period; - $events = $row["events"]; - $description = $row["description"]; + $events = $graph["events"]; + $description = $graph["description"]; $stacked = (int) get_parameter ('stacked', -1); if ($stacked == -1) - $stacked = $row["stacked"]; + $stacked = $graph["stacked"]; - $name = $row["name"]; - if (($row["private"]==1) && ($row["id_user"] != $id_user)){ + $name = $graph["name"]; + if (($graph["private"]==1) && ($graph["id_user"] != $id_user)){ audit_db($config['id_user'],$REMOTE_ADDR, "ACL Violation","Trying to access to a custom graph not allowed"); include ("general/noaccess.php"); exit; } - $sql2="SELECT * FROM tgraph_source WHERE id_graph = $id_graph"; + $sql2="SELECT * FROM tgraph_source WHERE id_graph = $id"; $res2=mysql_query($sql2); - while ( $row2 = mysql_fetch_array($res2)){ - $weight = $row2["weight"]; - $id_agent_module = $row2["id_agent_module"]; + while ($graph_source = mysql_fetch_array($res2)) { + $weight = $graph_source["weight"]; + $id_agent_module = $graph_source["id_agent_module"]; $id_grupo = get_db_sql ("SELECT id_grupo FROM tagente, tagente_modulo WHERE tagente_modulo.id_agente_modulo = $id_agent_module AND tagente.id_agente = tagente_modulo.id_agente"); if (give_acl($config["id_user"], $id_grupo, "AR")==1){ if (!isset($modules)){ @@ -113,7 +115,7 @@ src='reporting/fgraph.php?tipo=combined&height=$height&width=$width&id=$modules& border=1 alt=''>"; echo ""; $period_label = human_time_description ($period); - echo "
"; + echo ""; echo ""; echo ""; echo ""; - while ($row = mysql_fetch_array($res)){ - if (($row["private"]==0) || ($row["id_user"] == $id_user)){ + while ($graph = mysql_fetch_array($res)){ + if (($graph["private"] == 0) || ($graph["id_user"] == $id_user)) { // Calculate table line color if ($color == 1){ $tdcolor = "datos"; @@ -181,13 +183,13 @@ if (mysql_num_rows($res)) { $color = 1; } echo ""; - echo ""; - echo ""; - $id_graph = $row["id_graph"]; - echo ""; + echo ""; + $id = $graph["id_graph"]; + echo ""; } }
"; echo "".__('Period').""; @@ -169,8 +171,8 @@ if (mysql_num_rows($res)) { echo "".__('Delete')."
".$row["name"]."".$row["description"].""; + echo "".$graph["name"]."".$graph["description"].""; if (give_acl ($config['id_user'], 0, "AW")) { - echo "'; + echo "'; echo "