isReadOnly() )
pla_error( $lang['copy_server_read_only'] );
if( ! $ldapserver_source->haveAuthInfo())
pla_error( $lang['not_enough_login_info'] );
if( ! $ldapserver_dest->haveAuthInfo())
pla_error( $lang['not_enough_login_info'] );
$source_dn = $_POST['old_dn'];
$dest_dn = $_POST['new_dn'];
$do_recursive = ( isset( $_POST['recursive'] ) && $_POST['recursive'] == 'on' ) ? true : false;
$remove = ( isset( $_POST['remove'] ) && $_POST['remove'] == 'yes' ) ? true : false;
$encoded_dn = rawurlencode( $source_dn );
include './header.php';
/* Error checking */
if( 0 == strlen( trim( $dest_dn ) ) )
pla_error( $lang['copy_dest_dn_blank'] );
if( pla_compare_dns( $source_dn,$dest_dn ) == 0 && $source_server_id == $dest_server_id )
pla_error( $lang['copy_source_dest_dn_same'] );
if( dn_exists( $ldapserver_dest, $dest_dn ) )
pla_error( sprintf( $lang['copy_dest_already_exists'], pretty_print_dn( $dest_dn ) ) );
if( ! dn_exists( $ldapserver_dest, get_container( $dest_dn ) ) )
pla_error( sprintf( $lang['copy_dest_container_does_not_exist'], pretty_print_dn( get_container($dest_dn) ) ) );
if( $do_recursive ) {
$filter = isset( $_POST['filter'] ) ? $_POST['filter'] : '(objectClass=*)';
// build a tree similar to that of the tree browser to give to r_copy_dn
$snapshot_tree = array();
echo "
\n";
echo "". $lang['copy_copying'] . htmlspecialchars( $source_dn ) . "
\n";
echo "" . $lang['copy_recursive_copy_progress'] ."
\n";
echo "
";
echo "\n";
echo $lang['copy_building_snapshot'];
flush();
build_tree( $ldapserver_source, $source_dn, $snapshot_tree, $filter );
echo " " . $lang['success'] . "
\n";
flush();
// prevent script from bailing early on a long delete
@set_time_limit( 0 );
$copy_result = r_copy_dn( $ldapserver_source, $ldapserver_dest, $snapshot_tree, $source_dn, $dest_dn );
echo "\n";
} else {
$copy_result = copy_dn( $ldapserver_source, $source_dn, $ldapserver_dest, $dest_dn );
}
if( $copy_result ) {
$edit_url="edit.php?server_id=$dest_server_id&dn=" . rawurlencode( $dest_dn );
$new_rdn = get_rdn( $dest_dn );
$container = get_container( $dest_dn );
if( array_key_exists( 'tree', $_SESSION ) ) {
// do we not have a tree and tree icons yet? Build a new ones.
initialize_session_tree();
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
if( isset( $tree[$dest_server_id][$container] ) ) {
$tree[$dest_server_id][$container][] = $dest_dn;
sort( $tree[ $dest_server_id ][ $container ] );
$tree_icons[$dest_server_id][$dest_dn] = get_icon( $ldapserver_dest, $dest_dn );
$_SESSION['tree'] = $tree;
$_SESSION['tree_icons'] = $tree_icons;
session_write_close();
}
} ?>
" . $lang['copy_view_new_entry'] .""?>