Make WordPress Core


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

Prevent editing of protected meta keys.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/wp-admin/admin-functions.php

    r5710 r5724  
    11101110    $post_ID = (int) $post_ID;
    11111111
     1112    $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug' );
     1113
    11121114    $metakeyselect = $wpdb->escape( stripslashes( trim( $_POST['metakeyselect'] ) ) );
    11131115    $metakeyinput = $wpdb->escape( stripslashes( trim( $_POST['metakeyinput'] ) ) );
     
    11241126        if ( $metakeyinput)
    11251127            $metakey = $metakeyinput; // default
     1128
     1129        if ( in_array($metakey, $protected) )
     1130            return false;
    11261131
    11271132        $result = $wpdb->query( "
     
    11441149function update_meta( $mid, $mkey, $mvalue ) {
    11451150    global $wpdb;
     1151
     1152    $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug' );
     1153
     1154    if ( in_array($mkey, $protected) )
     1155        return false;
     1156
    11461157    $mvalue = maybe_serialize( stripslashes( $mvalue ));
    11471158    $mvalue = $wpdb->escape( $mvalue );
Note: See TracChangeset for help on using the changeset viewer.