diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 6125b992bc..5c70ad727e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2010-10-28 Sergio Martin + + * include/functions_io.php + include/functions_ui.php: Fixed the html setting in the header + for the dashboard bug 3094692 + 2010-10-27 Miguel de Dios * include/javascript/jquery.ui.datepicker.js, @@ -247,6 +253,7 @@ * godmode/setup/setup.php: Use added images. +>>>>>>> .r3474 2010-10-25 Junichi Satoh * godmode/agentes/module_manager_editor_network.php: Added enterprise diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index 8b31218be1..e4768aa4e5 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -92,11 +92,6 @@ function safe_input_html($value) { if (! mb_check_encoding ($value, 'UTF-8')) $value = utf8_encode ($value); - //Replace some characteres for html entities - for ($i=0;$i<33;$i++) { - $value = str_ireplace(chr($i),ascii_to_html($i), $value); - } - return $value; } @@ -175,6 +170,41 @@ function safe_output($value, $utf8 = true) return $valueHtmlEncode; } +/** + * Convert the $value encode in html entity to clear char string. This function + * should be called always to "clean" HTML encoded data; to render to a text + * plain ascii file, to render to console, or to put in any kind of data field + * who doesn't make the HTML render by itself. + * + * @param mixed String or array of strings to be cleaned. + * @param boolean $utf8 Flag, set the output encoding in utf8, by default true. + * + * @return unknown_type + */ +function safe_output_html($value, $utf8 = true) +{ + if (is_numeric($value)) + return $value; + + if (is_array($value)) { + array_walk($value, "safe_output"); + return $value; + } + + //Replace the html entitie of ( for the char + $value = str_replace("(", '(', $value); + + //Replace the html entitie of ) for the char + $value = str_replace(")", ')', $value); + + //Revert html entities to chars + for ($i=0;$i<33;$i++) { + $value = str_ireplace("&#x".dechex($i).";",html_to_ascii(dechex($i)), $value); + } + + return $value; +} + /** * Use to clean HTML entities when get_parameter or safe_input functions dont work * diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 2503e5e310..96dc0fc1f9 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -31,7 +31,7 @@ * @param string $suffix String at the end of a strimmed string. */ function printTruncateText($text, $numChars = 25, $showTextInAToopTip = true, $return = true, $showTextInTitle = true, $suffix = '…') { - $text = safe_output($text); + $text = safe_output_html($text); if (strlen($text) > ($numChars - 1)) { $truncateText = mb_strimwidth($text, 0, ($numChars - 1)) . $suffix;