on * [cn=bob,dc=example,dc=com] => on * etc. * * @package phpLDAPadmin */ /** */ require './common.php'; if( $ldapserver->isReadOnly() ) pla_error(_('Unable to delete, server is in READY-ONLY mode.')); if( ! $ldapserver->haveAuthInfo()) pla_error(_('Not enough information to login to server. Please check your configuration.')); $confirmed = isset($_POST['confirmed']) ? true : false; isset($_POST['mass_delete']) or pla_error(_('Error calling mass_delete.php. Missing mass_delete in POST vars.')); $mass_delete = $_POST['mass_delete']; is_array($mass_delete) or pla_error(_('mass_delete POST var is not an array.')); $ldapserver->isMassDeleteEnabled() or pla_error(_('Mass deletion is not enabled. Please enable it in config.php before proceeding.')); require './header.php'; echo ''; printf('

%s

',_('Mass Deleting')); if ($confirmed == true) { printf('

'._('Deletion progress on server "%s"').'

',$ldapserver->name); echo '
'; echo ''; $successfully_delete_dns = array(); $failed_dns = array(); if (! is_array($mass_delete)) pla_error(_('Malformed mass_delete array.')); if (count($mass_delete) == 0) { echo '
'; printf('
%s
',_('You did not select any entries to delete.')); die(); } // @todo: Should sort these entries, so that they are deleted in order, if a user selects children. foreach ($mass_delete as $dn => $junk) { printf(_('Deleting %s'),htmlspecialchars($dn)); flush(); if(run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) { $success = $ldapserver->delete($dn); if ($success) { run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); printf(' %s.
',_('Success')); $successfully_delete_dns[] = $dn; } else { printf(' %s.
(%s)
',_('Failed'),$ldapserver->error()); $failed_dns[] = $dn; } } flush(); } echo '
'; echo ''; $failed_count = count($failed_dns); $total_count = count($mass_delete); if ($failed_count > 0) printf(''._('%s of %s entries failed to be deleted.').'',$failed_count,$total_count); else printf('%s',_('All entries deleted successfully.')); echo ''; } else { $n = count($mass_delete); printf('

'._('Confirm mass delete of %s entries on server %s').'

',$n,$ldapserver->name); echo'
'; printf(_('Do you really want to delete %s %s %s'), ($n == 1? _('this') : _('these')),$n,($n == 1 ? _('entry') : _('entries'))); echo '
'; echo ''; printf('',$ldapserver->server_id); echo '
    '; foreach ($mass_delete as $dn => $junk) printf('
  1. %s
  2. ',htmlspecialchars($dn),htmlspecialchars($dn)); echo '
'; printf('
',_('Yes, delete!')); echo ''; } ?>