diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c859325125..7b10dd4c06 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,16 +1,7 @@ -2014-07-30 Alejandro Gallardo +2014-07-30 Miguel de Dios - * include/functions_graph.php: Finished the function - "graph_monitor_wheel". This function returns a sunburst - graph representing all the group>agent>module group>module - hierarchy. - - * include/functions_groups.php: Added the function - "groups_get_tree". This function returns an array representing - the group hierarchy of the passed groups array. - - * include/graphs/pandora.d3.js: Improved the function - "sunburst". Now this graph can show tooltips. + * include/ajax/module.php: tiny fixes for the improve the support of + postgreSQL databases. 2014-07-30 Miguel de Dios diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 6e0894d806..81ef02fc34 100644 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -89,6 +89,9 @@ if ($get_module_detail) { $conexion = mysql_connect ($server['dbhost'], $server['dbuser'], $server['dbpass']); $select_db = mysql_select_db ($server['dbname'], $conexion); } + else { + $conexion = false; + } $selection_mode = get_parameter('selection_mode', 'fromnow'); $date_from = (string) get_parameter ('date_from', date ('Y-m-j')); @@ -230,14 +233,30 @@ if ($get_module_detail) { ); } + $sql_body = io_safe_output($sql_body); // Clean all codification characters $sql = "SELECT * " . $sql_body; - $sql_count = "SELECT count(*) " . $sql_body; + + switch ($config['dbtype']) { + case "mysql": + $sql_count = "SELECT count(*) " . $sql_body; + break; + case "postgresql": + $sql_body = str_replace("ORDER BY utimestamp DESC", + "GROUP BY utimestamp ORDER BY utimestamp DESC", + $sql_body); + $sql_count = "SELECT count(DISTINCT utimestamp) " . $sql_body; + break; + case "oracle": + $sql_count = "SELECT count(*) " . $sql_body; + break; + } $count = db_get_value_sql ($sql_count, $conexion); + switch ($config["dbtype"]) { case "mysql": $sql .= " LIMIT " . $offset . "," . $block_size;