'."\n"; echo ''; echo _('Delete Account'); echo ''."\n". ''."\n". ''."\n". ''."\n". ''."\n". ''."\n". ''."\n". '
'."\n". ''."\n". ''."\n"; foreach ($DN2 as $dn) echo ''; echo ''."\n".''."\n".''."\n".''."\n".''."\n"; echo '
'; if ($_GET['type']) { $DN2 = explode(";", str_replace("\'", '',$_GET['DN'])); echo ''; echo ''; switch ($_GET['type']) { case 'user': echo _('Do you really want to delete user(s):'); break; case 'host': echo _('Do you really want to delete host(s):'); break; case 'group': echo _('Do you really want to delete group(s):'); break; } echo '
'.$dn.'
'; if (($_GET['type']== user) && $_SESSION['config']->scriptServer) { echo _('Delete also Homedirectories'); echo ''. '
'; } echo '
'. ''. ''; } if ($_POST['delete_yes']) { $DN2 = explode(";", str_replace("\\", '',str_replace("\'", '',$_POST['DN']))); foreach ($DN2 as $dn) { switch ($_POST['type5']) { case 'user': $temp=explode(',', $dn); $username = str_replace('uid=', '', $temp[0]); if ($_SESSION['config']->scriptServer) { if ($_POST['f_rem_home']) remhomedir($username); remquotas($username, $_POST['type5']); } $result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), 'objectClass=PosixGroup', array('memberUid')); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result); while ($entry) { $attr2 = ldap_get_attributes($_SESSION['ldap']->server(), $entry); if ($attr2['memberUid']) { array_shift($attr2['memberUid']); foreach ($attr2['memberUid'] as $nam) { if ($nam==$username) { $todelete['memberUid'] = $nam; $success = ldap_mod_del($_SESSION['ldap']->server(), ldap_get_dn($_SESSION['ldap']->server(), $entry) ,$todelete); } } } $entry = ldap_next_entry($_SESSION['ldap']->server(), $entry); } $success = ldap_delete($_SESSION['ldap']->server(), $dn); if (!$success) $error = _('Could not delete user:').' '.$dn; break; case 'host': $success = ldap_delete($_SESSION['ldap']->server(), $dn); if (!$success) $error = _('Could not delete host:').' '.$dn; break; case 'group': $temp=explode(',', $dn); $groupname = str_replace('cn=', '', $temp[0]); $result = ldap_search($_SESSION['ldap']->server(), $dn, 'objectClass=*', array('gidNumber')); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result); while ($entry) { $attr2 = ldap_get_attributes($_SESSION['ldap']->server(), $entry); if ($attr2['gidNumber']==getgid($groupname)) $error = _('Could not delete group. Still users in group:').' '.$dn; $entry = ldap_next_entry($_SESSION['ldap']->server(), $entry); } if (!$error) { if ($_SESSION['config']->scriptServer) remquotas($groupname, $_POST['type5']); $success = ldap_delete($_SESSION['ldap']->server(), $dn); if (!$success) $error = _('Could not delete group:').' '.$dn; } break; } if (!$error) echo $dn.' '. _('deleted').'.'; else echo $error; echo '
'; } } if ($_POST['delete_no']) echo _('Nothing was deleted.'); echo '
'."\n"; ?>