"; echo "
\n"; echo "
\n"; echo "\n"; echo "" . _("Do you really want to remove the following accounts?") . ""; echo "

\n"; echo "\n"; for ($i=0; $i\n"; echo "\n"; echo "\n"; $childCount = getChildCount($_SESSION['delete_dn'][$i]); if ($childCount > 0) { echo "\n"; } echo "\n"; } echo "
" . _("Account name:") . " $users[$i]  " . _('DN') . ": " . $_SESSION['delete_dn'][$i] . "  " . _('Number of child entries') . ": " . $childCount . "
\n"; echo "
\n"; // Print delete rows from modules echo "\n
"; $modules = $_SESSION['config']->get_AccountModules($_GET['type']); $values = array(); $tabindex = 100; foreach ($modules as $module) { $module = new $module($_GET['type']); parseHtml(get_class($module), $module->display_html_delete(), $values, true, $tabindex, $_GET['type']); } echo "
\n"; echo "
\n"; echo " \n"; echo "\n"; echo "
\n"; echo "\n"; ?> \n"; echo "\n"; echo "

\n"; echo "
\n"; // Delete dns 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 = $modules[$singlemodule]->preDeleteActions(); 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 attribtues from DN: %s.'), $DNs[$i]), ldap_error($_SESSION['ldap']->server())); $stopprocessing = true; } } // 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 attribtues to DN: %s.'), $DNs[$i]), ldap_error($_SESSION['ldap']->server())); $stopprocessing = true; } } // removce 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 attribtues from DN: %s.'), $DNs[$i]), ldap_error($_SESSION['ldap']->server())); $stopprocessing = true; } } } } } if (!$stopprocessing) { $errors = deleteDN($_SESSION['delete_dn'][$m]); if (sizeof($errors) > 0) $stopprocessing = true; } // post delete actions if (!$stopprocessing) { foreach ($moduleNames as $singlemodule) { $modules[$singlemodule]->postDeleteActions(); } } if (!$stopprocessing) { echo sprintf(_('Deleted DN: %s'), $_SESSION['delete_dn'][$m]) . "
\n"; foreach ($errors as $error) StatusMessage($error[0], $error[1], $error[2]); echo "
\n"; flush(); } else { echo sprintf(_('Error while deleting DN: %s'), $_SESSION['delete_dn'][$m]) . "
\n"; foreach ($errors as $error) StatusMessage($error[0], $error[1], $error[2]); echo "
\n"; } } echo "
\n"; echo "
\n"; echo "
\n"; echo "\n"; ?> server(), $dn, 'objectClass=*', array('dn'), 0, 0, 0, LDAP_DEREF_NEVER); if ($sr) { $entries = ldap_get_entries($_SESSION['ldap']->server(), $sr); $entries = cleanLDAPResult($entries); for ($i = 0; $i < sizeof($entries); $i++) { // delete recursively $subErrors = deleteDN($entries[$i]['dn']); for ($e = 0; $e < sizeof($subErrors); $e++) $errors[] = $subErrors[$e]; } } else { $errors[] = array ('ERROR', sprintf(_('Was unable to delete DN: %s.'), $dn), ldap_error($_SESSION['ldap']->server())); return $errors; } // delete parent DN $success = @ldap_delete($_SESSION['ldap']->server(), $dn); $ldapUser = $_SESSION['ldap']->decrypt_login(); $ldapUser = $ldapUser[0]; if (!$success) { logNewMessage(LOG_ERR, '[' . $ldapUser .'] Unable to delete DN: ' . $dn . ' (' . ldap_err2str(ldap_errno($_SESSION['ldap']->server())) . ').'); $errors[] = array ('ERROR', sprintf(_('Was unable to delete DN: %s.'), $dn), ldap_error($_SESSION['ldap']->server())); } else { logNewMessage(LOG_NOTICE, '[' . $ldapUser .'] Deleted DN: ' . $dn); } return $errors; } ?>