2009-06-30 09:22:30 +00:00
< ? php
2009-06-30 10:26:08 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.20.4.5 2005/12/11 08:21:03 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 ())
2009-06-30 10:26:08 +00:00
pla_error ( _ ( 'You cannot perform updates while server is in read-only mode' ));
2009-06-30 09:29:51 +00:00
if ( ! $ldapserver -> haveAuthInfo ())
2009-06-30 10:26:08 +00:00
pla_error ( _ ( 'Not enough information to login to server. Please check your configuration.' ));
2009-06-30 09:29:51 +00:00
2009-06-30 08:07:14 +00:00
$dn = $_GET [ 'dn' ];
2009-06-30 10:26:08 +00:00
$children = $ldapserver -> getContainerContents ( $dn , 0 , '(objectClass=*)' , LDAP_DEREF_NEVER );
2009-06-30 09:29:51 +00:00
$has_children = count ( $children ) > 0 ? true : false ;
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
include './header.php' ;
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
echo '<body>' ;
printf ( '<h3 class="title">' . _ ( 'Delete %s' ) . '</h3>' , htmlspecialchars ( get_rdn ( $dn )));
printf ( '<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s</b></h3>' ,
_ ( 'Server' ), $ldapserver -> name , _ ( 'Distinguished Name' ), htmlspecialchars (( $dn )));
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
if ( $has_children ) {
echo '<center>' ;
printf ( '<b>%s</b><br /><br />' , _ ( 'Permanently delete all children also?' ));
2009-06-30 09:29:51 +00:00
flush ();
# get the total number of child objects (whole sub-tree)
2009-06-30 10:26:08 +00:00
$s = $ldapserver -> search ( null , dn_escape ( $dn ), 'objectClass=*' , array ( 'dn' ));
$sub_tree_count = count ( $s );
2009-06-30 08:05:37 +00:00
?>
< table class = " delete_confirm " >
< tr >
< td >
2009-06-30 09:29:51 +00:00
< p >
2009-06-30 10:26:08 +00:00
< ? php printf ( _ ( 'This entry is the root of a sub-tree containing %s entries.' ), $sub_tree_count ); ?>
< small > ( < a href = " search.php?search=true&server_id=<?php echo $ldapserver->server_id ; ?>&filter=<?php echo rawurlencode('objectClass=*'); ?>&base_dn=<?php echo rawurlencode( $dn ); ?>&form=advanced&scope=sub " >< ? php echo _ ( 'view entries' ); ?> </a>)</small>
2009-06-30 09:29:51 +00:00
< br />
< br />
2009-06-30 10:26:08 +00:00
< ? php printf ( _ ( '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?' ),( $sub_tree_count - 1 )); ?> <br />
2009-06-30 09:29:51 +00:00
< br />
2009-06-30 10:26:08 +00:00
< small >< ? php echo _ ( '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.' ); ?> </small>
2009-06-30 09:29:51 +00:00
< 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 ; ?> " />
2009-06-30 10:26:08 +00:00
< input type = " submit " class = " scary " value = " <?php printf(_('Delete all %s objects'), $sub_tree_count ); ?> " />
2009-06-30 09:29:51 +00:00
</ form >
</ center >
</ td >
< td >
< center >
2009-06-30 10:26:08 +00:00
< form action = " template_engine.php " method = " get " >
2009-06-30 09:29:51 +00:00
< input type = " hidden " name = " dn " value = " <?php echo htmlspecialchars( $dn ); ?> " />
< input type = " hidden " name = " server_id " value = " <?php echo $ldapserver->server_id ; ?> " />
2009-06-30 10:26:08 +00:00
< input type = " submit " name = " submit " value = " <?php echo _('Cancel'); ?> " class = " cancel " />
2009-06-30 09:29:51 +00:00
</ 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 10:26:08 +00:00
< ? php echo _ ( 'List of entries to be deleted:' ); ?> <br />
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +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 ;
2009-06-30 10:26:08 +00:00
foreach ( $s as $dn => $junk ) {
2009-06-30 09:29:51 +00:00
$i ++ ; ?>
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
< option >< ? php echo $i ; ?> . <?php echo htmlspecialchars((dn_unescape($dn))); ?></option>
2009-06-30 09:29:51 +00:00
< ? php } ?>
2009-06-30 08:05:37 +00:00
</ select >
2009-06-30 10:26:08 +00:00
</ center >
2009-06-30 08:05:37 +00:00
< 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 10:26:08 +00:00
< ? php echo _ ( 'Are you sure you want to permanently delete this object?' ); ?> <br />
2009-06-30 09:29:51 +00:00
< br />
2009-06-30 10:26:08 +00:00
< nobr >< acronym title = " <?php echo _('Distinguished Name'); ?> " >< ? php echo _ ( 'DN' ); ?> </acronym>: <b><?php echo pretty_print_dn($dn); ?></b></nobr><br />
< nobr >< ? php echo _ ( 'Server' ); ?> : <b><?php echo htmlspecialchars($ldapserver->name); ?></b></nobr><br />
2009-06-30 09:29:51 +00:00
< 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 ; ?> " />
2009-06-30 10:26:08 +00:00
< input type = " submit " name = " submit " value = " <?php echo _('Delete'); ?> " class = " scary " />
2009-06-30 09:29:51 +00:00
</ form >
</ center >
</ td >
< td >
< center >
2009-06-30 10:26:08 +00:00
< form action = " template_engine.php " method = " get " >
2009-06-30 09:29:51 +00:00
< input type = " hidden " name = " dn " value = " <?php echo $dn ; ?> " />
< input type = " hidden " name = " server_id " value = " <?php echo $ldapserver->server_id ; ?> " />
2009-06-30 10:26:08 +00:00
< input type = " submit " name = " submit " value = " <?php echo _('Cancel'); ?> " class = " cancel " />
2009-06-30 09:29:51 +00:00
</ 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 >