summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4991bce)
raw | patch | inline | side by side (parent: 4991bce)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 5 Nov 2009 07:01:07 +0000 (07:01 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 5 Nov 2009 07:01:07 +0000 (07:01 +0000) |
-Displays attribute list in case of an error, id display_errors is true.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14748 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14748 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_ldap.inc | patch | blob | history |
index 9b968fd9d91b79598919fbaa6c8e2a2114be5446..bf5385e011fbc79fe6e6ece3ef59c7df5bd36303 100644 (file)
}
}
+ 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{