Latest SANDPIT - MERGE from CVS (MERGE-GIT)

This commit is contained in:
Deon George
2009-07-01 16:09:17 +10:00
parent 388783fc84
commit ea17aadef4
210 changed files with 37284 additions and 52716 deletions

View File

@@ -1,55 +1,40 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete.php,v 1.27.2.3 2008/12/12 12:20:22 wurley Exp $
// $Header$
/**
* Deletes a DN and presents a "job's done" message.
*
* Variables that come in as POST vars:
* - dn (rawurlencoded)
*
* @package phpLDAPadmin
* @subpackage Page
*/
/**
*/
require './common.php';
if ($ldapserver->isReadOnly())
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
# The DNs we are working with
$request = array();
$request['dn'] = get_request('dn','REQUEST',true);
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'simple_delete'))
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')),'error','index.php');
if (! $app['server']->dnExists($request['dn']))
error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn($request['dn']).'</b>'),'error','index.php');
$entry = array();
$entry['dn'] = get_request('dn');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete','simple_delete'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('delete entry')),'error','index.php');
if (! $entry['dn'])
error(_('You must specify a DN'),'error','index.php');
if (! $ldapserver->dnExists($entry['dn']))
error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn($entry['dn']).'</b>'),'error','index.php');
# Check the user-defined custom callback first.
if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn'])))
$result = $ldapserver->delete($entry['dn']);
else
error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'),'error','index.php');
if ($result) {
# Custom callback
run_hook('post_entry_delete',
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']));
# Delete the entry.
$result = $app['server']->delete($request['dn']);
if ($result)
system_message(array(
'title'=>_('Delete DN'),
'body'=>_('Successfully deleted DN ').sprintf('<b>%s</b>',$entry['dn']),
'body'=>_('Successfully deleted DN ').sprintf('<b>%s</b>',$request['dn']),
'type'=>'info'),
sprintf('index.php?server_id=%s',$ldapserver->server_id));
} else {
sprintf('index.php?server_id=%s',$app['server']->getIndex()));
else
system_message(array(
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($request['dn'])),
'body'=>ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null)),
'type'=>'error'));
}
?>