LDAP Account Manager\n"; echo "\n"; echo "\n"; $dn = $_POST['dn']; $encoded_dn = rawurlencode( $dn ); $rdn = get_rdn( $dn ); $ds = $_SESSION['ldap']->server; echo "\n"; echo "

" . sprintf( _('Deleting %s'), htmlspecialchars($rdn) ) . "

\n"; echo "

" . _('Recursive delete progress') . "

"; echo "

"; echo "\n"; flush(); // prevent script from bailing early on a long delete @set_time_limit( 0 ); $del_result = pla_rdelete( $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[$dn] ) ) unset( $tree[$dn] ); // Get a tree in the session if not already gotten initialize_session_tree(); // search and destroy from the tree sesssion foreach( $tree as $tree_dn => $subtree ) foreach( $subtree as $key => $sub_tree_dn ) if( 0 == strcasecmp( $sub_tree_dn, $dn ) ) unset( $tree[$tree_dn][$key] ); } $_SESSION['tree'] = $tree; ?> ' . htmlspecialchars( $dn ) . '' ); } else { StatusMessage("ERROR", _('Failed to delete entry %s'), '', array(htmlspecialchars($dn))); } echo ""; exit; function pla_rdelete( $dn ) { $children = get_container_contents( $dn ); global $ds; $ds = $_SESSION['ldap']->server; if( ! is_array( $children ) || count( $children ) == 0 ) { echo "" . sprintf( _('Deleting %s'), htmlspecialchars( $dn ) ) . "..."; flush(); if( @ldap_delete( $ds, $dn ) ) { echo " " . _('Success') . "
\n"; return true; } else { StatusMessage("ERROR", _('Failed to delete entry %s'), '', array(htmlspecialchars($dn))); } } else { foreach( $children as $child_dn ) { pla_rdelete( $child_dn ); } echo "" . sprintf( _('Deleting %s'), htmlspecialchars( $dn ) ) . "..."; flush(); if( @ldap_delete( $ds, $dn ) ) { echo " " . _('Success') . "
\n"; return true; } else { StatusMessage("ERROR", _('Failed to delete entry %s'), '', array(htmlspecialchars($dn))); } } return false; }