";
echo "
\n";
echo "
\n";
echo "\n";
?>
\n";
echo '';
echo "\n";
echo "
\n";
echo "
\n";
// Delete dns
$allOk = true;
$allErrors = array();
for ($m=0; $mload_account($_SESSION['delete_dn'][$m]);
// get commands and changes of each attribute
$moduleNames = array_keys($_SESSION['account']->getAccountModules());
$modules = $_SESSION['account']->getAccountModules();
$attributes = array();
$errors = array();
// predelete actions
if (!$stopprocessing) {
foreach ($moduleNames as $singlemodule) {
$success = true;
$messages = $modules[$singlemodule]->preDeleteActions();
for ($i = 0; $i < sizeof($messages); $i++) {
$errors[] = $messages[$i];
if ($messages[$i][0] == 'ERROR') {
$success = false;
$allOk = false;
}
elseif ($messages[$i][0] == 'WARN') {
$allOk = false;
}
}
if (!$success) {
$stopprocessing = true;
break;
}
}
}
if (!$stopprocessing) {
// load attributes
foreach ($moduleNames as $singlemodule) {
// load changes
$temp = $modules[$singlemodule]->delete_attributes();
if (is_array($temp)) {
// merge changes
$DNs = array_keys($temp);
$attributes = array_merge_recursive($temp, $attributes);
for ($i=0; $iserver(), $DNs[$i], $attributes[$DNs[$i]]['modify']);
if (!$success) {
$errors[] = array ('ERROR', sprintf(_('Was unable to modify attributes from DN: %s.'), $DNs[$i]), getDefaultLDAPErrorString($_SESSION['ldap']->server()));
$stopprocessing = true;
$allOk = false;
}
}
// add attributes
if (isset($attributes[$DNs[$i]]['add']) && !$stopprocessing) {
$success = @ldap_mod_add($_SESSION['ldap']->server(), $DNs[$i], $attributes[$DNs[$i]]['add']);
if (!$success) {
$errors[] = array ('ERROR', sprintf(_('Was unable to add attributes to DN: %s.'), $DNs[$i]), getDefaultLDAPErrorString($_SESSION['ldap']->server()));
$stopprocessing = true;
$allOk = false;
}
}
// remove attributes
if (isset($attributes[$DNs[$i]]['remove']) && !$stopprocessing) {
$success = @ldap_mod_del($_SESSION['ldap']->server(), $DNs[$i], $attributes[$DNs[$i]]['remove']);
if (!$success) {
$errors[] = array ('ERROR', sprintf(_('Was unable to remove attributes from DN: %s.'), $DNs[$i]), getDefaultLDAPErrorString($_SESSION['ldap']->server()));
$stopprocessing = true;
$allOk = false;
}
}
}
}
}
if (!$stopprocessing) {
$recursive = !$_SESSION['account']->hasOnlyVirtualChildren();
$messages = deleteDN($_SESSION['delete_dn'][$m], $recursive);
$errors = array_merge($errors, $messages);
if (sizeof($errors) > 0) {
$stopprocessing = true;
$allOk = false;
}
}
// post delete actions
if (!$stopprocessing) {
foreach ($moduleNames as $singlemodule) {
$messages = $modules[$singlemodule]->postDeleteActions();
for ($i = 0; $i < sizeof($messages); $i++) {
$errors[] = $messages[$i];
if (($messages[$i][0] == 'ERROR') || ($messages[$i][0] == 'WARN')) {
$allOk = false;
}
}
}
}
if (!$stopprocessing) {
echo sprintf(_('Deleted DN: %s'), $_SESSION['delete_dn'][$m]) . "
\n";
foreach ($errors as $error) {
call_user_func_array('StatusMessage', $error);
}
echo "
\n";
flush();
}
else {
echo sprintf(_('Error while deleting DN: %s'), $_SESSION['delete_dn'][$m]) . "
\n";
foreach ($errors as $error) {
call_user_func_array('StatusMessage', $error);
}
echo "
\n";
}
$allErrors = array_merge($allErrors, $errors);
}
echo "
\n";
echo "
\n";
echo "
\n";
echo "
\n";
echo "\n";
?>