Code

Fixed Setup, allow passwords with '" without breaking to setup ui.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jun 2008 08:41:17 +0000 (08:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jun 2008 08:41:17 +0000 (08:41 +0000)
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
gosa-core/setup/class_setupStep_Ldap.inc

index 62ca20be90ef9dd3ef3e39363cb94139ba1f7d7a..ab153dd0ad5665ab84989a507a9222029493840f 100644 (file)
@@ -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("&", "&amp;", $str);
+    $str = str_replace("<", "&lt;", $str);
+    $str = str_replace(">", "&gt;", $str);
+    $str = str_replace("'", "&apos;", $str);
+    $str = str_replace("\"", "&quot;", $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);
index e831ec1055f6fbf57d52cfe65db249dcfea652a0..a590a3bf07c503c8ab13a486784649a3f8675c92 100644 (file)
@@ -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 */