phpldapadmin/htdocs/delete_form.php

140 lines
5.3 KiB
PHP
Raw Normal View History

2009-06-30 09:22:30 +00:00
<?php
2009-06-30 11:52:55 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.26.2.2 2008/12/12 12:20:22 wurley Exp $
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
/**
2009-06-30 08:05:37 +00:00
* delete_form.php
* Displays a last chance confirmation form to delete a dn.
*
* Variables that come in as GET vars:
* - dn (rawurlencoded)
2009-06-30 09:29:51 +00:00
*
* @package phpLDAPadmin
*/
/**
2009-06-30 08:05:37 +00:00
*/
2009-06-30 09:22:30 +00:00
require './common.php';
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
if ($ldapserver->isReadOnly())
2009-06-30 11:52:55 +00:00
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
2009-06-30 09:29:51 +00:00
2009-06-30 11:52:55 +00:00
$entry = array();
2009-06-30 10:46:00 +00:00
$entry['dn']['string'] = get_request('dn','GET');
$entry['dn']['html'] = htmlspecialchars($entry['dn']['string']);
2009-06-30 08:05:37 +00:00
2009-06-30 10:46:00 +00:00
# We search all children, not only the visible children in the tree
$entry['children'] = $ldapserver->getContainerContents($entry['dn']['string'],0,'(objectClass=*)',LDAP_DEREF_NEVER);
2009-06-30 08:05:37 +00:00
2009-06-30 10:46:00 +00:00
printf('<h3 class="title">'._('Delete %s').'</h3>',htmlspecialchars(get_rdn($entry['dn']['string'])));
2009-06-30 10:26:08 +00:00
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
2009-06-30 10:46:00 +00:00
_('Server'),$ldapserver->name,_('Distinguished Name'),$entry['dn']['html']);
2009-06-30 10:40:33 +00:00
echo "\n";
echo '<center>';
2009-06-30 08:05:37 +00:00
2009-06-30 10:46:00 +00:00
if (count($entry['children'])) {
2009-06-30 10:26:08 +00:00
printf('<b>%s</b><br /><br />',_('Permanently delete all children also?'));
2009-06-30 09:29:51 +00:00
2009-06-30 10:46:00 +00:00
# Get the total number of child objects (whole sub-tree)
$search['entries'] = $ldapserver->search(null,dn_escape($entry['dn']['string']),'objectClass=*',array('dn'));
$search['count'] = count($search['entries']);
$search['href'] = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&;server_id=%s&filter=%s&base_dn=%s&form=advanced&scope=sub',
$ldapserver->server_id,rawurlencode('objectClass=*'),rawurlencode($entry['dn']['string'])));
2009-06-30 08:05:37 +00:00
2009-06-30 11:51:50 +00:00
echo '<table class="forminput" border=0>';
2009-06-30 10:40:33 +00:00
echo '<tr>';
2009-06-30 10:46:00 +00:00
echo '<td colspan=2>';
printf(_('This entry is the root of a sub-tree containing %s entries.'),$search['count']);
printf(' <small>(<a href="%s">%s</a>)</small>',
$search['href'],_('view entries'));
echo '</td></tr>';
2009-06-30 10:40:33 +00:00
2009-06-30 10:46:00 +00:00
echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td colspan=2>%s</td></tr>',
sprintf(_('phpLDAPadmin can recursively delete this entry and all %s of its children. See below for a list of all the entries that this action will delete. Do you want to do this?'),$search['count']-1));
2009-06-30 10:40:33 +00:00
2009-06-30 10:46:00 +00:00
echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td colspan=2><small>%s</small></td></tr>',
2009-06-30 10:40:33 +00:00
_('Note: this is potentially very dangerous and you do this at your own risk. This operation cannot be undone. Take into consideration aliases, referrals, and other things that may cause problems.'));
echo "\n";
echo '<tr>';
2009-06-30 10:46:00 +00:00
echo '<td width=50%><center>';
echo '<form action="cmd.php" method="post">';
echo '<input type="hidden" name="cmd" value="rdelete" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
2009-06-30 10:40:33 +00:00
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
2009-06-30 11:51:50 +00:00
printf('<input type="submit" value="%s" />',sprintf(_('Delete all %s objects'),$search['count']));
2009-06-30 10:40:33 +00:00
echo '</form>';
echo '</center></td>';
2009-06-30 10:46:00 +00:00
echo '<td width=50%><center>';
echo '<form action="cmd.php" method="get">';
echo '<input type="hidden" name="cmd" value="template_engine" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
2009-06-30 10:40:33 +00:00
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
2009-06-30 11:51:50 +00:00
printf('<input type="submit" name="submit" value="%s" />',_('Cancel'));
2009-06-30 10:40:33 +00:00
echo '</form>';
echo '</center></td>';
echo '</tr>';
echo "\n";
echo '</table>';
echo "\n";
echo '<br /><br />';
echo _('List of entries to be deleted:');
echo '<br />';
2009-06-30 10:46:00 +00:00
printf('<select size="%s" multiple disabled style="background:white; color:black;width:500px" >',min(10,$search['count']));
$i = 0;
foreach ($search['entries'] as $dn => $junk) {
2009-06-30 10:40:33 +00:00
$i++;
printf('<option>%s. %s</option>',$i,htmlspecialchars(dn_unescape($dn)));
}
echo '</select>';
echo "\n";
} else {
2009-06-30 11:51:50 +00:00
echo '<table class="forminput" border=0>';
2009-06-30 10:40:33 +00:00
2009-06-30 10:46:00 +00:00
printf('<tr><td colspan=4>%s</td></tr>',_('Are you sure you want to permanently delete this object?'));
echo '<tr><td colspan=4>&nbsp;</td></tr>';
2009-06-30 10:40:33 +00:00
2009-06-30 10:46:00 +00:00
printf('<tr><td width=10%%>%s:</td><td colspan=3 width=75%%><b>%s</b></td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
printf('<tr><td width=10%%><acronym title="%s">%s</acronym></td><td colspan=3 width=75%%><b>%s</b></td></tr>',
_('Distinguished Name'),_('DN'),$entry['dn']['string']);
echo '<tr><td colspan=4>&nbsp;</td></tr>';
2009-06-30 10:40:33 +00:00
echo "\n";
echo '<tr>';
2009-06-30 10:46:00 +00:00
echo '<td colspan=2 width=50%><center>';
echo '<form action="cmd.php" method="post">';
echo '<input type="hidden" name="cmd" value="delete" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
2009-06-30 10:40:33 +00:00
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
2009-06-30 11:51:50 +00:00
printf('<input type="submit" name="submit" value="%s" />',_('Delete'));
2009-06-30 10:40:33 +00:00
echo '</form>';
echo '</center></td>';
2009-06-30 10:46:00 +00:00
echo '<td colspan=2 width=50%><center>';
2009-06-30 10:40:33 +00:00
2009-06-30 10:46:00 +00:00
echo '<form action="cmd.php" method="get">';
echo '<input type="hidden" name="cmd" value="template_engine" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
2009-06-30 10:40:33 +00:00
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
2009-06-30 11:51:50 +00:00
printf('<input type="submit" name="submit" value="%s" />',_('Cancel'));
2009-06-30 10:40:33 +00:00
echo '</form>';
echo '</center></td>';
echo '</tr>';
echo '</table>';
echo "\n";
}
echo '</center>';
echo '<br />';
?>