File: delete.php

package info (click to toggle)
ldap-account-manager 5.5-1%2Bdeb9u1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 46,776 kB
  • sloc: php: 72,313; perl: 409; pascal: 369; xml: 219; sh: 195; makefile: 168
file content (40 lines) | stat: -rw-r--r-- 1,171 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
 * Deletes a DN and presents a "job's done" message.
 *
 * @package phpLDAPadmin
 * @subpackage Page
 */

/**
 */

require './common.php';

# The DNs we are working with
$request = array();
$request['dn'] = get_request('dn','REQUEST',true);

if (! $app['server']->dnExists($request['dn']))
	error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn(htmlspecialchars($request['dn'])).'</b>'),'error','index.php');

# Delete the entry.
$result = $app['server']->delete($request['dn']);

if ($result) {
	$redirect_url = '';

	if (isAjaxEnabled())
		$redirect_url .= sprintf('&refresh=SID_%s_nodes&noheader=1',$app['server']->getIndex());

	system_message(array(
		'title'=>_('Delete DN'),
		'body'=>sprintf('<b>' . _('Successfully deleted DN %s') . '</b>',htmlspecialchars($request['dn'])),
		'type'=>'info'),
		sprintf('index.php?server_id=%s%s',$app['server']->getIndex(),$redirect_url));
} else
	system_message(array(
		'title'=>_('Could not delete the entry.').sprintf(' (%s)',htmlspecialchars(pretty_print_dn($request['dn']))),
		'body'=>ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null)),
		'type'=>'error'));
?>