phpldapadmin/htdocs/delete.php

41 lines
1.1 KiB
PHP
Raw Normal View History

2009-06-30 09:22:30 +00:00
<?php
// $Header$
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
/**
2009-06-30 08:05:37 +00:00
* Deletes a DN and presents a "job's done" message.
*
2009-06-30 09:29:51 +00:00
* @package phpLDAPadmin
* @subpackage Page
2009-06-30 09:29:51 +00:00
*/
2009-06-30 09:29:51 +00:00
/**
2009-06-30 08:05:37 +00:00
*/
2009-06-30 09:29:51 +00:00
require './common.php';
2009-06-30 08:05:37 +00:00
# The DNs we are working with
$request = array();
$request['dn'] = get_request('dn','REQUEST',true);
2009-06-30 10:46:00 +00:00
if (! $app['server']->dnExists($request['dn']))
error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn($request['dn']).'</b>'),'error','index.php');
2009-06-30 08:05:37 +00:00
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');
2009-06-30 08:05:37 +00:00
# Delete the entry.
$result = $app['server']->delete($request['dn']);
2009-06-30 09:29:51 +00:00
if ($result)
2009-06-30 10:46:00 +00:00
system_message(array(
'title'=>_('Delete DN'),
'body'=>_('Successfully deleted DN ').sprintf('<b>%s</b>',$request['dn']),
2009-06-30 10:46:00 +00:00
'type'=>'info'),
sprintf('index.php?server_id=%s',$app['server']->getIndex()));
else
2009-06-30 11:52:55 +00:00
system_message(array(
'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)),
2009-06-30 11:52:55 +00:00
'type'=>'error'));
2009-06-30 09:29:51 +00:00
?>