isReadOnly()) pla_error(_('You cannot perform updates while server is in read-only mode')); if (! $_SESSION['plaConfig']->isCommandAvailable('entry_delete', 'simple_delete')) pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry'))); $entry['dn'] = $_POST['dn']; if (! $entry['dn']) pla_error(_('You must specify a DN')); if (! $ldapserver->dnExists($entry['dn'])) pla_error(sprintf(_('No such entry: %s'),htmlspecialchars($entry['dn']))); printf('

'._('Deleting %s').'

',htmlspecialchars(get_rdn($entry['dn']))); printf('

%s

',_('Recursive delete progress')); echo '

'; echo ''; # Prevent script from bailing early on a long delete @set_time_limit(0); $result = pla_rdelete($ldapserver,$entry['dn']); echo '
'; if ($result) { printf(_('Entry %s and sub-tree deleted successfully.'),''.htmlspecialchars($entry['dn']).''); } else { pla_error(sprintf(_('Could not delete the entry: %s'),htmlspecialchars($entry['dn'])), $ldapserver->error(),$ldapserver->errno()); } function pla_rdelete($ldapserver,$dn) { # we delete all children, not only the visible children in the tree $children = $ldapserver->getContainerContents($dn); if (! is_array($children) || count($children) == 0) { printf('%s %s...',_('Deleting'),htmlspecialchars($dn)); if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) if ($ldapserver->delete($dn)) { run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); printf(' %s
',_('Success')); return true; } else { pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)), $ldapserver->error(),$ldapserver->errno()); } } else { foreach ($children as $child_dn) pla_rdelete($ldapserver,$child_dn); printf('%s %s...',_('Deleting'),htmlspecialchars($dn)); if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) if ($ldapserver->delete($dn)) { run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); printf(' %s
',_('Success')); return true; } else { pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)), $ldapserver->error(),$ldapserver->errno()); } } } ?>