diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 536ea8b1b9..185a8ede8f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2012-06-04 Sergio Martin + + * include/functions_modules.php + include/functions_io.php: Added new safe string function + to scape strings to use it in regular expressions and + change the parameters of enterprise functions to be + compatible con last changes + Merged from 4.0.x + 2012-06-04 Vanessa Gil * godmode/setup/os.list.php: Fixed bug: you can delete diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index 3d044da4e0..7212effabf 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -30,6 +30,33 @@ function io_safe_input_array(&$item) { $item = io_safe_input($item); } +/** + * Scape in a string de reserved characters to use it + * into a regular expression + * + * @param string String to be scaped + * + * @return string Scaped string + */ +function io_safe_expreg($string) { + // Scape regular expression characters + $string = str_replace('(','\(',$string); + $string = str_replace(')','\)',$string); + $string = str_replace('{','\{',$string); + $string = str_replace('}','\}',$string); + $string = str_replace('[','\[',$string); + $string = str_replace(']','\]',$string); + $string = str_replace('.','\.',$string); + $string = str_replace('*','\*',$string); + $string = str_replace('+','\+',$string); + $string = str_replace('?','\?',$string); + $string = str_replace('|','\|',$string); + $string = str_replace('^','\^',$string); + $string = str_replace('$','\$',$string); + + return $string; +} + /** * Cleans a string by encoding to UTF-8 and replacing the HTML * entities. UTF-8 is necessary for foreign chars like asian diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index ddff5ac7a4..fe203f7343 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -172,7 +172,7 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent if ($remote_conf) { $result = enterprise_hook('config_agents_copy_agent_module_to_agent', - array($id_agente, $id_agent_module, $id_new_module)); + array($id_agent_module, $id_new_module)); } }