index 4b578a8f9f910fde6e4bc0d93a31ba7f1958e103..bf5385e011fbc79fe6e6ece3ef59c7df5bd36303 100644 (file)
\2C => CO
( => OB
) => CB
- / => SL */
+ / => SL
+ \22 => DQ */
static function convert($dn)
{
if (SPECIALS_OVERRIDE == TRUE){
- $tmp= preg_replace(array("/\\\\,/", "/\\\\2C/", "/\(/", "/\)/", "/\//"),
- array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL"),
+ $tmp= preg_replace(array("/\\\\,/", "/\\\\2C/", "/\(/", "/\)/", "/\//", "/\\\\22/", '/\\\\"/'),
+ array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL", "\001DQ", "\001DQ"),
$dn);
return (preg_replace('/,\s+/', ',', $tmp));
} else {
static function fix($dn)
{
if (SPECIALS_OVERRIDE == TRUE){
- return (preg_replace(array("/\001CO/", "/\001OB/", "/\001CB/", "/\001SL/"),
- array("\,", "(", ")", "/"),
+ return (preg_replace(array("/\001CO/", "/\001OB/", "/\001CB/", "/\001SL/", "/\001DQ/"),
+ array("\,", "(", ")", "/", '\"'),
$dn));
} else {
return ($dn);
}
}
+ function makeReadableErrors($error,$attrs)
+ {
+ global $config;
+
+ if($this->success()) return("");
+
+ $str = "";
+ if(preg_match("/^objectClass: value #([0-9]*) invalid per syntax$/", $this->get_additional_error())){
+ $oc = preg_replace("/^objectClass: value #([0-9]*) invalid per syntax$/","\\1", $this->get_additional_error());
+ if(isset($attrs['objectClass'][$oc])){
+ $str.= " - <b>objectClass: ".$attrs['objectClass'][$oc]."</b>";
+ }
+ }
+ if($error == "Undefined attribute type"){
+ $str = " - <b>attribute: ".preg_replace("/:.*$/","",$this->get_additional_error())."</b>";
+ }
+
+ if(is_object($config) && $config->get_cfg_value("displayerrors") == "true" && function_exists("print_a")){
+ $str .= print_a($attrs,true);
+ }
+
+ return($str);
+ }
function modify($attrs)
{
return (0);
}
if($this->hascon){
+
+ $attrs['objectClass'][0] = "Herb ert";
if ($this->reconnect) $this->connect();
$r = @ldap_modify($this->cid, LDAP::fix($this->basedn), $attrs);
$this->error = @ldap_error($this->cid);
- if(!$this->success() && preg_match("/^objectClass: value #([0-9]*) invalid per syntax$/", $this->get_additional_error())){
- $oc = preg_replace("/^objectClass: value #([0-9]*) invalid per syntax$/","\\1", $this->get_additional_error());
- if(isset($attrs['objectClass'][$oc])){
- $this->error.= " <b>objectClass: ".$attrs['objectClass'][$oc]."</b>";
- }
+ if(!$this->success()){
+ $this->error.= $this->makeReadableErrors($this->error,$attrs);
}
return($r ? $r : 0);
}else{
if ($this->reconnect) $this->connect();
$r = @ldap_add($this->cid, LDAP::fix($this->basedn), $attrs);
$this->error = @ldap_error($this->cid);
- if(!$this->success() && preg_match("/^objectClass: value #([0-9]*) invalid per syntax$/", $this->get_additional_error())){
- $oc = preg_replace("/^objectClass: value #([0-9]*) invalid per syntax$/","\\1", $this->get_additional_error());
- if(isset($attrs['objectClass'][$oc])){
- $this->error.= " <b>objectClass: ".$attrs['objectClass'][$oc]."</b>";
- }
+ if(!$this->success()){
+ $this->error.= $this->makeReadableErrors($this->error,$attrs);
}
return($r ? $r : 0);
}else{