Code

msgPool
[gosa.git] / gosa-core / include / functions.inc
index f37347fd32f96a7756442d1dd8e51b9b4381b429..4d47e5019a9ca387ae9613613a07da1a88a9416a 100644 (file)
@@ -617,7 +617,7 @@ function add_lock ($object, $user)
     $attrs["cn"] = "$name";
     $ldap->add($attrs);
     if (!$ldap->success()){
-      msg_dialog::display(_("Internal error"), sprintf(_("Adding a lock failed.")."<br><br>"._('LDAP server returned: %s'), "<br><br><i>".$ldap->get_error()."</i>"), ERROR_DIALOG);
+      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "cn=$name,".$config->current['CONFIG'], 0, ERROR_DIALOG));
       return;
     }
   }
@@ -1547,7 +1547,7 @@ function apply_filter()
 function back_to_main()
 {
   $string= '<br><p class="plugbottom"><input type=submit name="password_back" value="'.
-    _("Back").'"></p><input type="hidden" name="ignore">';
+    msgPool::backButton().'"></p><input type="hidden" name="ignore">';
 
   return ($string);
 }
@@ -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("&", "&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;
+  return (htmlentities($str,ENT_QUOTES));
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: