"; echo _("Delete Account"); echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "
"; echo _('Please confirm:'); echo "\n"; echo "\n"; echo "" . _("Do you really want to remove the following accounts?") . ""; echo "

\n"; echo "\n\n"; echo "\n"; echo "\n"; } echo "
"; for ($i=0; $i\n"; echo "" . _("Account name:") . " $users[$i]" . _('DN') . ": " . $_SESSION['delete_dn'][$i] . "
\n"; echo "
\n"; // Print delete rows from modules echo "\n
"; $modules = $_SESSION['config']->get_AccountModules($_GET['type']); foreach ($modules as $module) { $module = new $module($_GET['type']); $module->display_html_delete($_POST); } echo "
\n"; echo "
\n"; echo " \n"; echo "\n"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; } if ($_POST['cancel']) { if (isset($_SESSION['delete_dn'])) unset($_SESSION['delete_dn']); metaRefresh("lists/list" . $_POST['type'] . "s.php"); } if ($_POST['delete']) { // Show HTML Page echo $_SESSION['header']; echo ""; echo _("Delete Account"); echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "
"; echo _('Deleting. Please stand by ...'); echo "\n"; // Delete dns for ($m=0; $mload_account($_SESSION['delete_dn'][$m]); // get commands and changes of each attribute $module = array_keys ($_SESSION['account']->module); $attributes = array(); $errors = array(); // load attributes foreach ($module as $singlemodule) { // load changes $temp = $_SESSION['account']->module[$singlemodule]->delete_attributes($_POST); if (is_array($temp)) { // merge changes $DNs = array_keys($temp); // *** fixme don't include references $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; } else $_SESSION['cache']->update_cache($DNs[$i], 'modify', $attributes[$DNs[$i]]['modify']); } // 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; } else $_SESSION['cache']->update_cache($DNs[$i], 'add', $attributes[$DNs[$i]]['add']); } // 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; } else $_SESSION['cache']->update_cache($DNs[$i], 'remove', $attributes[$DNs[$i]]['remove']); } } } if (!$stopprocessing) { foreach ($attributes as $DN) { if (is_array($DN['lamdaemon']['command'])) $result = lamdaemon($DN['lamdaemon']['command']); if (!is_array($result)) continue; // check for error somewhere in lamdaemon foreach ($result as $singleresult) { if (is_array($singleresult)) { if ($singleresult[0] == 'ERROR') { $stopprocessing = true; $temparray[0] = $singleresult[0]; $temparray[1] = $singleresult[1]; $temparray[2] = $singleresult[2]; $errors[] = $temparray; } } } } } if (!$stopprocessing) { $success = @ldap_delete($_SESSION['ldap']->server(), $_SESSION['delete_dn'][$m]); if (!$success) { $errors[] = array ('ERROR', sprintf(_('Was unable to delete DN: %s.'), $_SESSION['delete_dn'][$m]), ldap_error($_SESSION['ldap']->server())); $stopprocessing = true; } else $_SESSION['cache']->update_cache($_SESSION['delete_dn'][$m], 'delete_dn'); } 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"; } 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"; echo "\n"; echo "\n"; } ?>