phpldapadmin/htdocs/delete_form.php

154 lines
4.4 KiB
PHP
Raw Normal View History

2009-06-30 09:22:30 +00:00
<?php
2009-06-30 09:40:37 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.20 2005/07/22 05:47:44 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.
*
2009-06-30 09:29:51 +00:00
* Variables that come in via common.php
* - server_id
2009-06-30 08:05:37 +00:00
* 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())
pla_error($lang['no_updates_in_read_only_mode']);
if (! $ldapserver->haveAuthInfo())
pla_error($lang['not_enough_login_info']);
2009-06-30 08:07:14 +00:00
$dn = $_GET['dn'];
2009-06-30 09:29:51 +00:00
2009-06-30 08:05:37 +00:00
$encoded_dn = rawurlencode( $dn );
2009-06-30 08:07:14 +00:00
$rdn = pla_explode_dn( $dn );
2009-06-30 08:05:37 +00:00
$rdn = $rdn[0];
2009-06-30 09:29:51 +00:00
$children = get_container_contents( $ldapserver,$dn,0,'(objectClass=*)',LDAP_DEREF_NEVER );
$has_children = count($children) > 0 ? true : false;
2009-06-30 08:05:37 +00:00
2009-06-30 09:22:30 +00:00
include './header.php'; ?>
2009-06-30 08:05:37 +00:00
<body>
2009-06-30 09:22:30 +00:00
<h3 class="title"><?php echo sprintf( $lang['delete_dn'], htmlspecialchars( $rdn ) ); ?></b></h3>
2009-06-30 09:29:51 +00:00
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $ldapserver->name; ?></b> &nbsp;&nbsp;&nbsp; <?php echo $lang['distinguished_name']; ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
<?php if( $has_children ) { ?>
2009-06-30 08:05:37 +00:00
2009-06-30 09:22:30 +00:00
<center><b><?php echo $lang['permanently_delete_children']; ?></b><br /><br />
2009-06-30 08:05:37 +00:00
<?php
2009-06-30 09:29:51 +00:00
flush();
# get the total number of child objects (whole sub-tree)
$s = pla_ldap_search( $ldapserver, 'objectClass=*', $dn, array('dn'), 'sub' );
2009-06-30 08:05:37 +00:00
$sub_tree_count = count( $s );
?>
<table class="delete_confirm">
<tr>
<td>
2009-06-30 09:29:51 +00:00
<p>
<?php echo sprintf( $lang['entry_is_root_sub_tree'], $sub_tree_count ); ?>
<small>(<a href="search.php?search=true&amp;server_id=<?php echo $ldapserver->server_id; ?>&amp;filter=<?php echo rawurlencode('objectClass=*'); ?>&amp;base_dn=<?php echo $encoded_dn; ?>&amp;form=advanced&amp;scope=sub"><?php echo $lang['view_entries']; ?></a>)</small>
<br />
<br />
<?php echo sprintf( $lang['confirm_recursive_delete'], ($sub_tree_count-1) ); ?><br />
<br />
<small><?php echo $lang['confirm_recursive_delete_note']; ?></small>
<br />
<br />
<table width="100%">
<tr>
<td>
<center>
<form action="rdelete.php" method="post">
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<input type="submit" class="scary" value="<?php echo sprintf( $lang['delete_all_x_objects'], $sub_tree_count ); ?>" />
</form>
</center>
</td>
<td>
<center>
<form action="edit.php" method="get">
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<input type="submit" name="submit" value="<?php echo $lang['cancel']; ?>" class="cancel" />
</form>
</center>
</td>
</tr>
</table>
2009-06-30 08:05:37 +00:00
</td>
</tr>
</table>
2009-06-30 09:29:51 +00:00
2009-06-30 08:05:37 +00:00
<?php flush(); ?>
<br />
<br />
2009-06-30 09:22:30 +00:00
<?php echo $lang['list_of_entries_to_be_deleted']; ?><br />
2009-06-30 09:29:51 +00:00
2009-06-30 08:05:37 +00:00
<select size="<?php echo min( 10, $sub_tree_count );?>" multiple disabled style="background:white; color:black;width:500px" >
2009-06-30 09:29:51 +00:00
<?php $i=0;
foreach( $s as $dn => $junk ) {
$i++; ?>
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
<option><?php echo $i; ?>. <?php echo htmlspecialchars( ( $dn ) ); ?></option>
<?php } ?>
2009-06-30 08:05:37 +00:00
</select>
<br />
2009-06-30 09:29:51 +00:00
<?php } else { ?>
2009-06-30 08:05:37 +00:00
<center>
<table class="delete_confirm">
<tr>
<td>
2009-06-30 09:29:51 +00:00
<?php echo $lang['sure_permanent_delete_object']; ?><br />
<br />
<nobr><acronym title="<?php echo $lang['distinguished_name']; ?>"><?php echo $lang['dn']; ?></acronym>: <b><?php echo pretty_print_dn( $dn ); ?></b><nobr><br />
<nobr><?php echo $lang['server']; ?>: <b><?php echo htmlspecialchars($ldapserver->name); ?></b></nobr><br />
<br />
<table width="100%">
<tr>
<td>
<center>
<form action="delete.php" method="post">
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<input type="submit" name="submit" value="<?php echo $lang['delete']; ?>" class="scary" />
</form>
</center>
</td>
<td>
<center>
<form action="edit.php" method="get">
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<input type="submit" name="submit" value="<?php echo $lang['cancel']; ?>" class="cancel" />
</form>
</center>
</td>
</tr>
</table>
2009-06-30 08:05:37 +00:00
</td>
</tr>
</table>
</center>
2009-06-30 09:29:51 +00:00
<?php } ?>
2009-06-30 08:05:37 +00:00
</body>
</html>