From befd0dbc86b0bbc4f9c369837096d0a80f62ef79 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 11 Mar 2008 06:49:27 +0000 Subject: [PATCH] Updated xmlencode function git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9627 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/functions.inc | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index f37347fd3..a8e8c29f0 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -2703,25 +2703,14 @@ function send_binary_content($data,$name,$type = "application/octet-stream") } +/*! \brief Encode special string characters so we can use the string in \ + HTML output, without breaking quotes. + @param The String we want to encode. + @return The encoded String +*/ function xmlentities($str) { - static $asc2uni= array(); - - if (!count($asc2uni)){ - for($i=128;$i<256;$i++){ - $asc2uni[chr($i)] = "&#x".dechex($i).";"; - } - } - - $str = str_replace("&", "&", $str); - $str = str_replace("<", "<", $str); - $str = str_replace(">", ">", $str); - $str = str_replace("'", "'", $str); - $str = str_replace("\"", """, $str); - $str = str_replace("\r", "", $str); - $str = strtr($str,$asc2uni); - - return $str; + return (htmlentities($str,ENT_QUOTES)); } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -- 2.30.2