Make WordPress Core

Changeset 5723


Ignore:
Timestamp:
06/18/2007 04:28:11 PM (17 years ago)
Author:
ryan
Message:

Prevent editing of protected meta keys.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r5707 r5723  
    337337    $post_ID = (int) $post_ID;
    338338
     339    $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug' );
     340
    339341    $metakeyselect = $wpdb->escape( stripslashes( trim( $_POST['metakeyselect'] ) ) );
    340342    $metakeyinput = $wpdb->escape( stripslashes( trim( $_POST['metakeyinput'] ) ) );
     
    351353        if ( $metakeyinput)
    352354            $metakey = $metakeyinput; // default
     355
     356        if ( in_array($metakey, $protected) )
     357            return false;
    353358
    354359        $result = $wpdb->query( "
     
    406411function update_meta( $mid, $mkey, $mvalue ) {
    407412    global $wpdb;
     413
     414    $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug' );
     415
     416    if ( in_array($mkey, $protected) )
     417        return false;
     418
    408419    $mvalue = maybe_serialize( stripslashes( $mvalue ));
    409420    $mvalue = $wpdb->escape( $mvalue );
Note: See TracChangeset for help on using the changeset viewer.