on * [cn=bob,dc=example,dc=com] => on * etc. * * @package phpLDAPadmin */ /** */ require './common.php'; if( $ldapserver->isReadOnly() ) pla_error( $lang['no_deletes_in_read_only_mode'] ); if( ! $ldapserver->haveAuthInfo()) pla_error( $lang['not_enough_login_info'] ); $confirmed = isset( $_POST['confirmed'] ) ? true : false; isset( $_POST['mass_delete'] ) or pla_error( $lang['error_calling_mass_delete'] ); $mass_delete = $_POST['mass_delete']; is_array( $mass_delete ) or pla_error( $lang['mass_delete_not_array'] ); $ldapserver->isMassDeleteEnabled() or pla_error( $lang['mass_delete_not_enabled'] ); require './header.php'; echo "
\n"; echo ""; echo "\n"; $successfully_delete_dns = array(); $failed_dns = array(); if( ! is_array( $mass_delete ) ) pla_error( $lang['malformed_mass_delete_array'] ); if( count( $mass_delete ) == 0 ) { echo "
"; echo "" . $lang['no_entries_to_delete'] . " "; die(); } foreach( $mass_delete as $dn => $junk ) { echo sprintf( $lang['deleting_dn'], htmlspecialchars($dn) ); flush(); if( true === run_hook ( 'pre_entry_delete', array ( 'server_id' => $ldapserver->server_id, 'dn' => $dn ) ) ) { $success = @ldap_delete( $ldapserver->connect(), $dn ); if( $success ) { run_hook ( 'post_entry_delete', array ( 'server_id' => $ldapserver->server_id, 'dn' => $dn ) ); echo " " . $lang['success'] . ".
\n"; $successfully_delete_dns[] = $dn; } else { echo " " . $lang['failed'] . ".\n"; echo "(" . $ldapserver->error() . ")
\n"; $failed_dns[] = $dn; } } flush(); } echo ""; echo "\n"; $failed_count = count( $failed_dns ); $total_count = count( $mass_delete ); if( $failed_count > 0 ) { echo "\n"; echo sprintf( $lang['total_entries_failed'], $failed_count, $total_count ) . "\n"; } else { echo "\n"; echo $lang['all_entries_successful'] . "\n"; } // kill the deleted DNs from the tree browser session variable and // refresh the tree viewer frame (left_frame) if( array_key_exists( 'tree', $_SESSION ) ) { $tree = $_SESSION['tree']; foreach( $successfully_delete_dns as $dn ) { // does it have children? (it shouldn't, but hey, you never know) if( isset( $tree[$ldapserver->server_id][$dn] ) ) unset( $tree[$ldapserver->server_id][$dn] ); // search and destroy foreach( $tree[$ldapserver->server_id] as $tree_dn => $subtree ) foreach( $subtree as $key => $sub_tree_dn ) if( 0 == strcasecmp( $sub_tree_dn, $dn ) ) unset( $tree[$ldapserver->server_id][$tree_dn][$key] ); } $_SESSION['tree'] = $tree; session_write_close(); ?> " . sprintf( $lang['confirm_mass_delete'], $n, $ldapserver->name ) . "\n"; ?>Do you really want to delete ?