\n";
echo "
" . sprintf( $lang['deleting_dn'], htmlspecialchars($rdn) ) . "
\n";
echo "" . $lang['recursive_delete_progress'] . "
";
echo "
";
echo "\n";
flush();
// prevent script from bailing early on a long delete
@set_time_limit( 0 );
$del_result = pla_rdelete( $server_id, $dn );
echo "
\n";
if( $del_result )
{
// kill the DN from the tree browser session variable and
// refresh the tree viewer frame (left_frame)
if( array_key_exists( 'tree', $_SESSION ) )
{
$tree = $_SESSION['tree'];
// does it have children? (it shouldn't, but hey, you never know)
if( isset( $tree[$server_id][$dn] ) )
unset( $tree[$server_id][$dn] );
// Get a tree in the session if not already gotten
initialize_session_tree();
// search and destroy from the tree sesssion
foreach( $tree[$server_id] as $tree_dn => $subtree )
foreach( $subtree as $key => $sub_tree_dn )
if( 0 == strcasecmp( $sub_tree_dn, $dn ) )
unset( $tree[$server_id][$tree_dn][$key] );
}
$_SESSION['tree'] = $tree;
session_write_close();
?>
' . htmlspecialchars( $dn ) . '' );
} else {
pla_error( sprintf( $lang['could_not_delete_entry'], htmlspecialchars( $dn ) ), ldap_error( $ds ), ldap_errno( $ds ) );
}
exit;
function pla_rdelete( $server_id, $dn )
{
global $lang;
$children = get_container_contents( $server_id, $dn );
global $ds;
$ds = pla_ldap_connect( $server_id );
if( ! is_array( $children ) || count( $children ) == 0 ) {
echo "" . sprintf( $lang['deleting_dn'], htmlspecialchars( $dn ) ) . "...";
flush();
if( true === preEntryDelete( $server_id, $dn ) )
if( @ldap_delete( $ds, $dn ) ) {
postEntryDelete( $server_id, $dn );
echo " " . $lang['success'] . "
\n";
return true;
} else {
pla_error( sprintf( $lang['failed_to_delete_entry'], htmlspecialchars( $dn ) ),
ldap_error( $ds ), ldap_errno( $ds ) );
}
} else {
foreach( $children as $child_dn ) {
pla_rdelete( $server_id, $child_dn );
}
echo "" . sprintf( $lang['deleting_dn'], htmlspecialchars( $dn ) ) . "...";
flush();
if( true === preEntryDelete( $server_id, $dn ) )
if( @ldap_delete( $ds, $dn ) ) {
postEntryDelete( $server_id, $dn );
echo " " . $lang['success'] . "
\n";
return true;
} else {
pla_error( sprintf( $lang['failed_to_delete_entry'], htmlspecialchars( $dn ) ),
ldap_error( $ds ), ldap_errno( $ds ) );
}
}
}