2009-06-30 09:22:30 +00:00
|
|
|
<?php
|
2009-07-01 06:09:17 +00:00
|
|
|
// $Header$
|
2009-06-30 10:26:08 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
/**
|
2009-06-30 08:07:14 +00:00
|
|
|
* Deletes an attribute from an entry with NO confirmation.
|
|
|
|
*
|
2009-06-30 09:29:51 +00:00
|
|
|
* @package phpLDAPadmin
|
2009-07-01 06:09:17 +00:00
|
|
|
* @subpackage Page
|
2009-06-30 09:29:51 +00:00
|
|
|
*/
|
2009-07-01 06:09:17 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
/**
|
2009-06-30 08:07:14 +00:00
|
|
|
*/
|
|
|
|
|
2009-06-30 09:22:30 +00:00
|
|
|
require './common.php';
|
2009-06-30 08:07:14 +00:00
|
|
|
|
2009-07-01 06:09:17 +00:00
|
|
|
$request = array();
|
|
|
|
$request['dn'] = get_request('dn','REQUEST',true);
|
|
|
|
$request['attr'] = get_request('attr','REQUEST',true);
|
|
|
|
$request['index'] = get_request('index','REQUEST',true);
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-07-01 06:09:17 +00:00
|
|
|
if ($app['server']->isAttrReadOnly($request['attr']))
|
|
|
|
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$request['attr']),'error','index.php');
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-07-01 06:09:17 +00:00
|
|
|
$update_array = array();
|
|
|
|
$update_array[$request['attr']] = $app['server']->getDNAttrValue($request['dn'],$request['attr']);
|
2009-06-30 08:09:20 +00:00
|
|
|
|
2009-07-01 06:09:17 +00:00
|
|
|
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
|
|
|
$app['server']->getIndex(),rawurlencode($request['dn']));
|
2009-06-30 08:07:14 +00:00
|
|
|
|
2009-07-01 06:09:17 +00:00
|
|
|
if (! isset($update_array[$request['attr']][$request['index']]))
|
|
|
|
system_message(array(
|
|
|
|
'title'=>_('Could not delete attribute value.'),
|
|
|
|
'body'=>sprintf('%s. %s/%s',_('The attribute value does not exist'),$request['attr'],$request['index']),
|
|
|
|
'type'=>'warn'),$redirect_url);
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-07-01 06:09:17 +00:00
|
|
|
else {
|
|
|
|
unset($update_array[$request['attr']][$request['index']]);
|
|
|
|
foreach ($update_array as $key => $values)
|
|
|
|
$update_array[$key] = array_values($values);
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-07-01 06:09:17 +00:00
|
|
|
$result = $app['server']->modify($request['dn'],$update_array);
|
2009-06-30 08:07:14 +00:00
|
|
|
|
2009-07-01 06:09:17 +00:00
|
|
|
if ($result) {
|
|
|
|
foreach ($update_array as $attr => $junk)
|
|
|
|
$redirect_url .= sprintf('&modified_attrs[]=%s',$attr);
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-07-01 06:09:17 +00:00
|
|
|
header("Location: $redirect_url");
|
|
|
|
die();
|
|
|
|
}
|
2009-06-30 09:29:51 +00:00
|
|
|
}
|
2009-06-30 08:07:14 +00:00
|
|
|
?>
|