_('No entry selected'), 'body' => _('No entry was selected to delete'), 'type' => 'warn'), 'index.php'); } if (! is_array($request['dn'])) { $request['dn'] = array($request['dn']); } $request['children'] = array(); $request['parent'] = array(); foreach ($request['dn'] as $dn) { # Check if the entry exists. if (! $dn || ! $app['server']->dnExists($dn)) { system_message(array( 'title' => _('Entry does not exist'), 'body' => sprintf('%s (%s/%s)', _('The entry does not exist and will be ignored'), $dn), 'type' => 'error')); } # We search all children, not only the visible children in the tree if (! in_array_ignore_case($dn,$request['children'])) { $request['children'] = array_merge($request['children'],$app['server']->getContainerContents($dn,null,0,'(objectClass=*)',LDAP_DEREF_NEVER)); $request['parent'][] = $dn; } } printf('

%s

',_('Mass Delete')); printf('

%s: %s

',_('Server'),$app['server']->getName()); echo "\n"; echo '
'; echo ''; if (count($request['parent']) == 1) { printf('',_('Are you sure you want to permanently delete this object?')); } else { printf('', _('Are you sure you want to permanently delete these objects?')); } echo ''; printf('',_('Server'),$app['server']->getName()); foreach ($request['parent'] as $dn) { printf('', _('Distinguished Name'), _('DN'), $dn); } echo ''; $request['delete'] = $request['parent']; if (count($request['children'])) { printf('',_('Permanently delete all children also?')); echo ''; # We need to see if the children have children $query = array(); $query['scope'] = 'sub'; $query['attrs'] = array('dn'); $query['size_limit'] = 0; $query['deref'] = LDAP_DEREF_NEVER; $request['search'] = array(); foreach ($request['children'] as $dn) { $query['base'] = $dn; $request['search'] = array_merge($request['search'],$app['server']->query($query,null)); } foreach ($request['search'] as $value) { $request['delete'][] = $value['dn']; } echo ''; echo ''; printf('', sprintf(_('phpLDAPadmin can also recursively delete all %s of the child entries. See below for a list of all the entries that this action will delete. Do you want to do this?'),count($request['children']))); echo ''; printf('', _('Note: this is potentially very dangerous and you do this at your own risk. This operation cannot be undone. Take into consideration aliases, referrals, and other things that may cause problems.')); echo "\n"; echo ''; echo "\n"; printf('',_('List of entries to be deleted:')); echo ''; $i = 0; echo ''; echo "\n"; echo ''; } echo ''; echo ''; echo ''; echo ''; echo "\n"; echo '
%s
%s
 
%s:%s
%s%s
 
%s
 
'; printf(_('This request also includes %s children entries.'),count($request['children'])); echo '
%s
 
%s
 
%s
 
'; printf(''; echo '
 
'; echo '
'; echo ''; printf('',$app['server']->getIndex()); foreach ($request['parent'] as $dn) { printf('', htmlspecialchars($dn)); } printf('',sprintf(_('Delete all %s objects'),count($request['delete']))); echo '
'; echo '
'; echo '
'; echo ''; printf('',$app['server']->getIndex()); printf('',_('Cancel')); echo '
'; echo '
'; echo '
'; echo '
';