WordPress.org

Make WordPress Core

Changeset 4383


Ignore:
Timestamp:
10/13/2006 12:23:25 AM (12 years ago)
Author:
markjaquith
Message:

cleanup [4382] a bit

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r4382 r4383  
    984984
    985985        if ( is_serialized($entry['meta_value']) ) {
    986             if ( 's' == $entry['meta_value']{0} ) {
     986            if ( is_serialized_string($entry['meta_value']) ) {
    987987                // this is a serialized string, so we should display it
    988988                $entry['meta_value'] = maybe_unserialize($entry['meta_value']);
     
    10691069    $metakeyselect = $wpdb->escape(stripslashes(trim($_POST['metakeyselect'])));
    10701070    $metakeyinput = $wpdb->escape(stripslashes(trim($_POST['metakeyinput'])));
    1071     $metavalue = prepare_data(stripslashes((trim($_POST['metavalue']))));
     1071    $metavalue = maybe_serialize(stripslashes((trim($_POST['metavalue']))));
    10721072    $metavalue = $wpdb->escape($metavalue);
    10731073
     
    11011101function update_meta($mid, $mkey, $mvalue) {
    11021102    global $wpdb;
    1103     if ( is_serialized(stripslashes($mvalue)) ) // $mvalue looks to be already serialized, so we should serialize it again to prevent the data from coming out in a different form than it came in
    1104         $mvalue = serialize($mvalue);
     1103    $mvalue = maybe_serialize(stripslashes($mvalue));
     1104    $mvalue = $wpdb->escape($mvalue);
    11051105    $mid = (int) $mid;
    11061106    return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
  • trunk/wp-admin/options.php

    r4382 r4383  
    129129    $disabled = '';
    130130    if ( is_serialized($option->option_value) ) {
    131         if ( 's' == $option->option_value{0} ) {
     131        if ( is_serialized_string($option->option_value) ) {
    132132            // this is a serialized string, so we should display it
    133133            $value = wp_specialchars(maybe_unserialize($option->option_value), 'single');
  • trunk/wp-includes/functions.php

    r4382 r4383  
    258258
    259259    $_newvalue = $newvalue;
    260     $newvalue = prepare_data($newvalue);
     260    $newvalue = maybe_serialize($newvalue);
    261261
    262262    wp_cache_set($option_name, $newvalue, 'options');
     
    280280        return;
    281281
    282     $value = prepare_data($value);
     282    $value = maybe_serialize($value);
    283283
    284284    wp_cache_set($name, $value, 'options');
     
    302302}
    303303
    304 function prepare_data($data) {
     304function maybe_serialize($data) {
    305305    if ( is_string($data) )
    306306        $data = trim($data);
  • trunk/wp-includes/post.php

    r4382 r4383  
    232232    $post_meta_cache[$post_id][$key][] = $value;
    233233
    234     $value = prepare_data($value);
     234    $value = maybe_serialize($value);
    235235    $value = $wpdb->escape($value);
    236236
     
    311311
    312312    $original_value = $value;
    313     $value = prepare_data($value);
     313    $value = maybe_serialize($value);
    314314    $value = $wpdb->escape($value);
    315315
    316316    $original_prev = $prev_value;
    317     $prev_value = prepare_data($prev_value);
     317    $prev_value = maybe_serialize($prev_value);
    318318    $prev_value = $wpdb->escape($prev_value);
    319319
  • trunk/wp-includes/user.php

    r4382 r4383  
    117117    // FIXME: usermeta data is assumed to be already escaped
    118118    $meta_value = stripslashes($meta_value);
    119     $meta_value = prepare_data($meta_value);
     119    $meta_value = maybe_serialize($meta_value);
    120120    $meta_value = $wpdb->escape($meta_value);
    121121
Note: See TracChangeset for help on using the changeset viewer.