WordPress.org

Make WordPress Core

Changeset 18501


Ignore:
Timestamp:
08/03/11 18:20:15 (3 years ago)
Author:
ryan
Message:

Use *_metadata_by_mid() API in set_custom_fields(). Handle slashing when checking caps for key. see #18195

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r18445 r18501  
    263263                $meta['id'] = (int) $meta['id']; 
    264264                $pmeta = get_metadata_by_mid( 'post', $meta['id'] ); 
     265                $meta['value'] = stripslashes_deep( $meta['value'] ); 
    265266                if ( isset($meta['key']) ) { 
     267                    $meta['key'] = stripslashes( $meta['key'] ); 
    266268                    if ( $meta['key'] != $pmeta->meta_key ) 
    267269                        continue; 
    268270                    if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) ) 
    269                         update_meta( $meta['id'], $meta['key'], $meta['value'] ); 
     271                        update_metadata_by_mid( 'post', $meta['id'], $meta['value'] ); 
    270272                } elseif ( current_user_can( 'delete_post_meta', $post_id, $pmeta->meta_key ) ) { 
    271                         delete_meta( $meta['id'] ); 
     273                    delete_metadata_by_mid( 'post', $meta['id'] ); 
    272274                } 
    273             } elseif ( current_user_can( 'add_post_meta', $post_id, $meta['key'] ) ) { 
    274                     add_post_meta( $post_id, $meta['key'], $meta['value'] ); 
     275            } elseif ( current_user_can( 'add_post_meta', $post_id, stripslashes( $meta['key'] ) ) ) { 
     276                add_post_meta( $post_id, $meta['key'], $meta['value'] ); 
    275277            } 
    276278        } 
Note: See TracChangeset for help on using the changeset viewer.