diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index afdaeff89e..0212458998 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2012-04-18 Miguel de Dios + + * include/functions_agents.php: into the function + "agents_get_agent_id" the parameter "$io_safe_input" for transform + the names if true, by default false. + + * operation/agentes/networkmap.topology.php, + operation/agentes/networkmap.php, include/functions_ui.php: cleaned + source code style. + + Merged from th branch "pandora_4.0". + 2012-04-18 Dario Rodriguez * godmode/agentes/agent_manager.php: Fixed a problem with links diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 7b15c4852c..8d50dcfe3a 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1068,10 +1068,10 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false } $id_groups = array_keys($groups); - + $sql = "SELECT id_agente FROM tagente WHERE id_grupo IN (" . implode(',', $id_groups) . ")"; $id_agent = db_get_all_rows_sql($sql); - + if($id_agent == false) { $id_agent = array(); } @@ -1302,10 +1302,14 @@ function agents_get_module_id ($id_agente_modulo) { * Get agent id from an agent name. * * @param string $agent_name Agent name to get its id. + * @param boolean $io_safe_input If it is true transform to safe string, by default false. * * @return int Id from the agent of the given name. */ -function agents_get_agent_id ($agent_name) { +function agents_get_agent_id ($agent_name, $io_safe_input = false) { + if ($io_safe_input) { + $agent_name = io_safe_input($agent_name); + } return (int) db_get_value ('id_agente', 'tagente', 'nombre', $agent_name); } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 7d53edb581..cfcb7c5d36 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -79,7 +79,7 @@ function ui_print_truncate_text($text, $numChars = 25, $showTextInAToopTip = tru else{ if ($style !== false){ $truncateText = ''.$truncateText.''; - } + } } } else { @@ -87,7 +87,7 @@ function ui_print_truncate_text($text, $numChars = 25, $showTextInAToopTip = tru $truncateText = '' . $text . ''; } else{ - $truncateText = $text; + $truncateText = $text; } } diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index 7b9eff2a19..95a7b006c9 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -184,7 +184,7 @@ if($config['enterprise_installed']) { 'text' => '' . html_print_image("images/policies.png", true, array ("title" => __('Policies view'))) .''); } - + $buttons['groups'] = array('active' => $activeTab == 'groups', 'text' => '' . html_print_image("images/group.png", true, array ("title" => __('Groups view'))) .''); diff --git a/pandora_console/operation/agentes/networkmap.topology.php b/pandora_console/operation/agentes/networkmap.topology.php index 5f98261d33..bee75f72f4 100644 --- a/pandora_console/operation/agentes/networkmap.topology.php +++ b/pandora_console/operation/agentes/networkmap.topology.php @@ -61,7 +61,8 @@ $filename_dot .= "_".$id_networkmap.".dot"; if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) { $result = true; -} else { +} +else { $fh = @fopen ($filename_dot, 'w'); if ($fh === false) { $result = false; @@ -85,7 +86,8 @@ if ($result !== false) { } html_print_image ($filename_img, false, array ("alt" => __('Network map'), "usemap" => "#networkmap")); require ($filename_map); -} else { +} +else { ui_print_error_message (__('Map could not be generated')); echo $result; echo "
Apparently something went wrong executing the command or writing the output.
";