From a57406488bb8dda562141f52d090d59f3678b412 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 11 Oct 2003 15:23:08 +0000 Subject: [PATCH] print LDAP error if add failed --- lam/templates/initsuff.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lam/templates/initsuff.php b/lam/templates/initsuff.php index 0eb61d86..1f66a743 100644 --- a/lam/templates/initsuff.php +++ b/lam/templates/initsuff.php @@ -37,6 +37,7 @@ setlanguage(); if ($_POST['add_suff'] || $_POST['cancel']) { if ($_POST['add_suff']) { $fail = array(); + $errors = array(); $new_suff = $_POST['new_suff']; $new_suff = str_replace("\\'", "", $new_suff); $new_suff = explode(";", $new_suff); @@ -58,7 +59,10 @@ if ($_POST['add_suff'] || $_POST['cancel']) { $attr['objectClass'] = "organizationalunit"; $attr['ou'] = $name; $dn = "ou=" . $name . "," . $end; - if (!@ldap_add($_SESSION['ldap']->server(), $dn, $attr)) $fail[] = $suff; + if (!@ldap_add($_SESSION['ldap']->server(), $dn, $attr)) { + $fail[] = $suff; + $error[] = ldap_error($_SESSION['ldap']->server()); + } } } } @@ -71,7 +75,7 @@ if ($_POST['add_suff'] || $_POST['cancel']) { if ($_POST['add_suff']) { if (sizeof($fail) > 0) { for ($i = 0; $i < sizeof($fail); $i++) { - StatusMessage("ERROR", _("Failed to create entry!"), $fail[$i]); + StatusMessage("ERROR", _("Failed to create entry!") . "
" . $error[$i], $fail[$i]); } } else StatusMessage("INFO", "", _("All changes were successful."));