2019-02-08 13:44:52 -05:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Deletes an attribute from an entry with NO confirmation.
|
|
|
|
*
|
|
|
|
* @package phpLDAPadmin
|
|
|
|
* @subpackage Page
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
|
|
|
|
require './common.php';
|
|
|
|
|
|
|
|
$request = array();
|
|
|
|
$request['dn'] = get_request('dn','REQUEST',true);
|
|
|
|
$request['attr'] = get_request('attr','REQUEST',true);
|
|
|
|
$request['index'] = get_request('index','REQUEST',true);
|
|
|
|
|
|
|
|
if ($app['server']->isAttrReadOnly($request['attr']))
|
2019-02-12 14:57:50 -05:00
|
|
|
{
|
|
|
|
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'), $request['attr']), 'error', 'index.php');
|
|
|
|
}
|
2019-02-08 13:44:52 -05:00
|
|
|
|
|
|
|
$update_array = array();
|
|
|
|
$update_array[$request['attr']] = $app['server']->getDNAttrValue($request['dn'],$request['attr']);
|
|
|
|
|
|
|
|
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
|
|
|
$app['server']->getIndex(),rawurlencode($request['dn']));
|
|
|
|
|
|
|
|
if (! isset($update_array[$request['attr']][$request['index']]))
|
2019-02-12 14:57:50 -05:00
|
|
|
{
|
2019-02-08 13:44:52 -05:00
|
|
|
system_message(array(
|
2019-02-12 14:57:50 -05:00
|
|
|
'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);
|
|
|
|
}
|
2019-02-08 13:44:52 -05:00
|
|
|
|
|
|
|
else {
|
|
|
|
unset($update_array[$request['attr']][$request['index']]);
|
|
|
|
foreach ($update_array as $key => $values)
|
2019-02-12 14:57:50 -05:00
|
|
|
{
|
2019-02-08 13:44:52 -05:00
|
|
|
$update_array[$key] = array_values($values);
|
2019-02-12 14:57:50 -05:00
|
|
|
}
|
2019-02-08 13:44:52 -05:00
|
|
|
|
|
|
|
$result = $app['server']->modify($request['dn'],$update_array);
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
foreach ($update_array as $attr => $junk)
|
2019-02-12 14:57:50 -05:00
|
|
|
{
|
|
|
|
$redirect_url .= sprintf('&modified_attrs[]=%s', $attr);
|
|
|
|
}
|
2019-02-08 13:44:52 -05:00
|
|
|
|
|
|
|
header("Location: $redirect_url");
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
}
|
2019-02-12 14:52:01 -05:00
|
|
|
|