2009-06-30 08:05:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* delete_form.php
|
|
|
|
* Displays a last chance confirmation form to delete a dn.
|
|
|
|
*
|
|
|
|
* Variables that come in as GET vars:
|
|
|
|
* - dn (rawurlencoded)
|
|
|
|
* - server_id
|
|
|
|
*/
|
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
require 'common.php';
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
$dn = $_GET['dn'];
|
2009-06-30 08:05:37 +00:00
|
|
|
$encoded_dn = rawurlencode( $dn );
|
|
|
|
$server_id = $_GET['server_id'];
|
2009-06-30 08:07:14 +00:00
|
|
|
$rdn = pla_explode_dn( $dn );
|
2009-06-30 08:05:37 +00:00
|
|
|
$rdn = $rdn[0];
|
|
|
|
$server_name = $servers[$server_id]['name'];
|
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
if( is_server_read_only( $server_id ) )
|
|
|
|
pla_error( "You cannot perform updates while server is in read-only mode" );
|
|
|
|
|
2009-06-30 08:05:37 +00:00
|
|
|
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
|
|
|
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
|
|
|
|
|
|
|
$children = get_container_contents( $server_id, $dn );
|
|
|
|
$has_children = count($children)>0 ? true : false;
|
|
|
|
|
2009-06-30 08:09:20 +00:00
|
|
|
include 'header.php'; ?>
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2009-06-30 08:09:20 +00:00
|
|
|
<h3 class="title">Delete <b><?php echo htmlspecialchars( ( $rdn ) ); ?></b></h3>
|
|
|
|
<h3 class="subtitle">Server: <b><?php echo $server_name; ?></b> Distinguished Name: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
<?php if( 0 == strcasecmp( $dn, $servers[$server_id]['base'] ) ) { ?>
|
|
|
|
|
|
|
|
<center><b>You cannot delete the base <acronym title="Distinguished Name">DN</acronym> entry of the LDAP server.</b></center>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
<?php exit; ?>
|
|
|
|
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
<?php if( $has_children ) { ?>
|
|
|
|
|
|
|
|
<center><b>Permanently delete all children also?</b><br /><br />
|
|
|
|
|
|
|
|
<?php
|
|
|
|
flush(); // so the user can get something on their screen while we figure out how many children this object has
|
|
|
|
if( $has_children ) {
|
|
|
|
// get the total number of child objects (whole sub-tree)
|
|
|
|
$s = pla_ldap_search( $server_id, 'objectClass=*', $dn, array('dn'), 'sub' );
|
|
|
|
$sub_tree_count = count( $s );
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<table class="delete_confirm">
|
|
|
|
<td>
|
|
|
|
|
|
|
|
<p>This object is the root of a sub-tree containing <a href="search.php?search=true&server_id=<?php echo $server_id; ?>&filter=<?php echo rawurlencode('objectClass=*'); ?>&base_dn=<?php echo $encoded_dn; ?>&form=advanced&scope=sub"><?php echo ($sub_tree_count); ?> objects</a>
|
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
phpLDAPadmin can recursively delete this object and all <?php echo ($sub_tree_count-1); ?> of its children. See below for a list of DNs
|
2009-06-30 08:05:37 +00:00
|
|
|
that this will delete. Do you want to do this?<br />
|
|
|
|
<br />
|
|
|
|
<small>Note: This is potentially very dangerous and you do this at your own risk. This operation cannot be undone.
|
|
|
|
Take into consideration aliases and other such things that may cause problems.</small>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<table width="100%">
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<center>
|
|
|
|
<form action="rdelete.php" method="post">
|
2009-06-30 08:09:20 +00:00
|
|
|
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
2009-06-30 08:05:37 +00:00
|
|
|
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
|
|
|
<input type="submit" class="scary" value="Delete all <?php echo ($sub_tree_count); ?> objects" />
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
<center>
|
|
|
|
<form action="edit.php" method="get">
|
2009-06-30 08:09:20 +00:00
|
|
|
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
2009-06-30 08:05:37 +00:00
|
|
|
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
|
|
|
<input type="submit" name="submit" value="Cancel" class="cancel" />
|
|
|
|
</form>
|
|
|
|
</center>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<?php flush(); ?>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
A list of all the <?php echo ($sub_tree_count); ?> <acronym title="Distinguished Name">DN</acronym>s that this action will delete:<br />
|
|
|
|
<select size="<?php echo min( 10, $sub_tree_count );?>" multiple disabled style="background:white; color:black;width:500px" >
|
|
|
|
<?php $i=0; ?>
|
|
|
|
<?php foreach( $s as $dn => $junk ) { ?>
|
|
|
|
<?php $i++; ?>
|
2009-06-30 08:09:20 +00:00
|
|
|
<option><?php echo $i; ?>. <?php echo htmlspecialchars( ( $dn ) ); ?></option>
|
2009-06-30 08:05:37 +00:00
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<br />
|
|
|
|
|
|
|
|
<?php } else { ?>
|
|
|
|
|
|
|
|
<center>
|
|
|
|
|
|
|
|
<table class="delete_confirm">
|
|
|
|
<td>
|
|
|
|
|
|
|
|
Are you sure you want to permanently delete this object?<br />
|
|
|
|
<br />
|
2009-06-30 08:09:20 +00:00
|
|
|
<nobr><acronym title="Distinguished Name">DN</acronym>: <b><?php echo htmlspecialchars(($dn)); ?></b><nobr><br />
|
2009-06-30 08:05:37 +00:00
|
|
|
<nobr>Server: <b><?php echo htmlspecialchars($server_name); ?></b></nobr><br />
|
|
|
|
<br />
|
|
|
|
<table width="100%">
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<center>
|
|
|
|
<form action="delete.php" method="post">
|
2009-06-30 08:09:20 +00:00
|
|
|
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
2009-06-30 08:05:37 +00:00
|
|
|
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
|
|
|
<input type="submit" name="submit" value="Delete It" class="scary" />
|
|
|
|
</center>
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
<center>
|
|
|
|
<form action="edit.php" method="get">
|
2009-06-30 08:09:20 +00:00
|
|
|
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
2009-06-30 08:05:37 +00:00
|
|
|
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
|
|
|
<input type="submit" name="submit" value="Cancel" class="cancel" />
|
|
|
|
</form>
|
|
|
|
</center>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</center>
|
|
|
|
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|
|
|
|
|
|
|
|
|