From a2b85ae2ff9c0e3ba37142aa5292cb801653c46f Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 18 Jun 2008 08:41:17 +0000 Subject: [PATCH] Fixed Setup, allow passwords with '" without breaking to setup ui. Fixed problem with unusable configuration file, xml tags are now replaced correctly. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11353 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/functions.inc | 17 ++++++++++++++++- gosa-core/setup/class_setupStep_Ldap.inc | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 62ca20be9..ab153dd0a 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -2715,7 +2715,22 @@ function send_binary_content($data,$name,$type = "application/octet-stream") function xmlentities($str) { if(is_string($str)){ - return(htmlentities($str,ENT_QUOTES)); + + 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; }elseif(is_array($str)){ foreach($str as $name => $value){ $str[$name] = xmlentities($value); diff --git a/gosa-core/setup/class_setupStep_Ldap.inc b/gosa-core/setup/class_setupStep_Ldap.inc index e831ec105..a590a3bf0 100644 --- a/gosa-core/setup/class_setupStep_Ldap.inc +++ b/gosa-core/setup/class_setupStep_Ldap.inc @@ -60,7 +60,7 @@ class Step_Ldap extends setup_step { $smarty = get_smarty(); foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); + $smarty->assign($attr,htmlentities($this->$attr,ENT_QUOTES,"UTF-8")); } /* Assign connection status */ -- 2.30.2