$vals ) if( is_array( $vals ) ) foreach( $vals as $i => $v ) $old_values[ $attr ][ $i ] = utf8_decode( $v ); else $old_values[ $attr ] = utf8_decode( $vals ); foreach( $new_values as $attr => $vals ) if( is_array( $vals ) ) foreach( $vals as $i => $v ) $new_values[ $attr ][ $i ] = utf8_decode( $v ); else $new_values[ $attr ] = utf8_decode( $vals ); ?>

Server:     :

$new_val ) { // did the user change the field? if( $new_val != $old_values[ $attr ] ) { // special case for userPassword attributes if( 0 == strcasecmp( $attr, 'userPassword' ) && $new_val != '' ) $new_val = password_hash( $new_val, $_POST['enc_type'] ); $update_array[ $attr ] = $new_val; } } // special case check for a new enc_type for userPassword (not otherwise detected) if( isset( $_POST['enc_type'] ) && $_POST['enc_type'] != $_POST['old_enc_type'] && $_POST['enc_type'] != 'clear' && $_POST['new_values']['userpassword'] != '' ) { $new_password = password_hash( $_POST['new_values']['userpassword'], $_POST['enc_type'] ); $update_array[ 'userpassword' ] = $new_password; } // strip empty vals from update_array and ensure consecutive indices for each attribute foreach( $update_array as $attr => $val ) { if( is_array( $val ) ) { foreach( $val as $i => $v ) if( null == $v || 0 == strlen( $v ) ) unset( $update_array[$attr][$i] ); $update_array[$attr] = array_values( $update_array[$attr] ); } } // at this point, the update_array should look like this (example): // Array ( // cn => Array( // [0] => 'Dave', // [1] => 'Bob' ) // sn => 'Smith', // telephoneNumber => '555-1234' ) // This array should be ready to be passed to ldap_modify() ?> 0 ) { ?>


$new_val ) { $counter++ ?> \n\n"; } ?>
"; else echo htmlspecialchars( utf8_encode( $old_values[ $attr ] ) ) . "
"; echo "
"; // is this a multi-valued attribute? if( is_array( $new_val ) ) { foreach( $new_val as $i => $v ) { if( $v == '' ) { // remove it from the update array if it's empty unset( $update_array[ $attr ][ $i ] ); $update_array[ $attr ] = array_values( $update_array[ $attr ] ); } else { echo htmlspecialchars( utf8_encode( $v ) ) . "
"; } } // was this a multi-valued attribute deletion? If so, // fix the $update_array to reflect that per update_confirm.php's // expectations if( $update_array[ $attr ] == array( 0 => '' ) || $update_array[ $attr ] == array() ) { $update_array[ $attr ] = ''; echo '' . $lang['attr_deleted'] . ''; } } else if( $new_val != '' ) echo htmlspecialchars( $new_val ) . "
"; else echo '' . $lang['attr_deleted'] . ''; echo "

$val ) { ?> $v ) { ?>
.