load_account($_SESSION['delete_dn'][0]); // Show HTML Page echo $_SESSION['header']; echo ""; 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 = array_keys($_SESSION['account']->module); for ($i=0; $imodule[$modules[$i]]->display_html_delete($_POST); } echo "
\n"; echo "
\n"; echo "\n\n"; echo "\n"; echo "
"; 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"; echo "\n\n"; echo "\n"; echo "\n"; foreach ($errors as $error) StatusMessage($error[0], $error[1], $error[2]); } else { echo "\n"; echo "\n"; echo "\n"; foreach ($errors as $error) StatusMessage($error[0], $error[1], $error[2]); } } echo "
"; // 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; $ildap]->server(), $DNs[$i], $attributes[$DNs[$i]]['modify']); if (!$success) { $errors[] = array ('ERROR', 'LDAP', sprintf(_('Was unable to modify attribtues from DN: %s.'), $DNs[$i])); $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[$_SESSION['account']->ldap]->server(), $DNs[$i], $attributes[$DNs[$i]]['add']); if (!$success) { $errors[] = array ('ERROR', 'LDAP', sprintf(_('Was unable to add attribtues to DN: %s.'), $DNs[$i])); $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[$_SESSION['account']->ldap]->server(), $DNs[$i], $attributes[$DNs[$i]]['remove']); if (!$success) { $errors[] = array ('ERROR', 'LDAP', sprintf(_('Was unable to remove attribtues from DN: %s.'), $DNs[$i])); $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']); // 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]); } } } } if (!$stopprocessing) { $success = @ldap_delete($_SESSION[$_SESSION['account']->ldap]->server(), $_SESSION['delete_dn'][$m]); if (!$success) $errors[] = array ('ERROR', 'LDAP', sprintf(_('Was unable to remove attribtues from DN: %s.'), $DNs[$i])); else $_SESSION['cache']->update_cache($_SESSION['delete_dn'][$m], 'delete_dn'); } if (!$stopprocessing) { echo "
" . sprintf(_('Deleted DN: %s'), $_SESSION['delete_dn'][$m]) . "
" . sprintf(_('Error while deleting DN: %s'), $_SESSION['delete_dn'][$m]) . "
\n"; echo "
\n"; echo "\n\n"; echo "
"; echo "
\n"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; } ?>