Changeset 17994
- Timestamp:
- 05/22/2011 11:19:42 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r17897 r17994 397 397 die('1'); 398 398 399 if ( !current_user_can( 'edit_post', $meta->post_id ) )399 if ( !current_user_can( 'edit_post', $meta->post_id ) || is_protected_meta( $meta->meta_key ) ) 400 400 die('-1'); 401 401 if ( delete_meta( $meta->meta_id ) ) … … 866 866 if ( !current_user_can( 'edit_post', $meta->post_id ) ) 867 867 die('-1'); 868 if ( is_protected_meta( $meta->meta_key ) ) 869 die('-1'); 868 870 if ( $meta->meta_value != stripslashes($value) || $meta->meta_key != stripslashes($key) ) { 869 871 if ( !$u = update_meta( $mid, $key, $value ) ) -
trunk/wp-admin/includes/media.php
r17971 r17994 1202 1202 $toggle_off = __( 'Hide' ); 1203 1203 1204 $filename = basename( $post->guid);1204 $filename = esc_html( basename( $post->guid ) ); 1205 1205 $title = esc_attr( $post->post_title ); 1206 1206 -
trunk/wp-admin/includes/post.php
r17964 r17994 139 139 $post = get_post( $post_ID ); 140 140 $post_data['post_type'] = $post->post_type; 141 $post_data['post_mime_type'] = $post->post_mime_type; 141 142 142 143 $ptype = get_post_type_object($post_data['post_type']); … … 200 201 if ( $meta->post_id != $post_ID ) 201 202 continue; 203 if ( is_protected_meta( $key ) ) 204 continue; 202 205 update_meta( $key, $value['key'], $value['value'] ); 203 206 } … … 209 212 continue; 210 213 if ( $meta->post_id != $post_ID ) 214 continue; 215 if ( is_protected_meta( $key ) ) 211 216 continue; 212 217 delete_meta( $key ); … … 528 533 } 529 534 535 $_POST['post_mime_type'] = ''; 536 530 537 // Check for autosave collisions 531 538 // Does this need to be updated? ~ Mark … … 633 640 $post_ID = (int) $post_ID; 634 641 635 $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );636 637 642 $metakeyselect = isset($_POST['metakeyselect']) ? stripslashes( trim( $_POST['metakeyselect'] ) ) : ''; 638 643 $metakeyinput = isset($_POST['metakeyinput']) ? stripslashes( trim( $_POST['metakeyinput'] ) ) : ''; … … 651 656 $metakey = $metakeyinput; // default 652 657 653 if ( i n_array($metakey, $protected) )658 if ( is_protected_meta( $metakey ) ) 654 659 return false; 655 660 … … 757 762 global $wpdb; 758 763 759 $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );760 761 764 $meta_key = stripslashes($meta_key); 762 765 763 if ( i n_array($meta_key, $protected) )766 if ( is_protected_meta( $meta_key ) ) 764 767 return false; 765 768 -
trunk/wp-admin/includes/template.php
r17952 r17994 466 466 function _list_meta_row( $entry, &$count ) { 467 467 static $update_nonce = false; 468 469 if ( is_protected_meta( $entry['meta_key'] ) ) 470 return; 471 468 472 if ( !$update_nonce ) 469 473 $update_nonce = wp_create_nonce( 'add-meta' ); -
trunk/wp-includes/default-filters.php
r17918 r17994 59 59 // Save URL 60 60 foreach ( array( 'pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image', 61 'pre_link_rss' ) as $filter ) {61 'pre_link_rss', 'pre_post_guid' ) as $filter ) { 62 62 add_filter( $filter, 'wp_strip_all_tags' ); 63 63 add_filter( $filter, 'esc_url_raw' ); … … 66 66 67 67 // Display URL 68 foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url' ) as $filter ) {68 foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url', 'post_guid' ) as $filter ) { 69 69 if ( is_admin() ) 70 70 add_filter( $filter, 'wp_strip_all_tags' ); … … 86 86 add_filter( $filter, 'sanitize_key' ); 87 87 } 88 89 // Mime types 90 add_filter( 'pre_post_mime_type', 'sanitize_mime_type' ); 91 add_filter( 'post_mime_type', 'sanitize_mime_type' ); 88 92 89 93 // Places to balance tags on input -
trunk/wp-includes/formatting.php
r17990 r17994 2890 2890 } 2891 2891 2892 /** 2893 * Sanitize a mime type 2894 * 2895 * @since 3.2.0 2896 * 2897 * @param string $mime_type Mime type 2898 * @return string Sanitized mime type 2899 */ 2900 function sanitize_mime_type( $mime_type ) { 2901 $sani_mime_type = preg_replace( '/[^-*.a-zA-Z0-9\/]/', '', $mime_type ); 2902 return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type ); 2903 } 2904 2892 2905 ?> -
trunk/wp-includes/meta.php
r17746 r17994 46 46 $meta_key = stripslashes($meta_key); 47 47 $meta_value = stripslashes_deep($meta_value); 48 $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type ); 48 49 49 50 $check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique ); … … 114 115 $meta_key = stripslashes($meta_key); 115 116 $meta_value = stripslashes_deep($meta_value); 117 $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type ); 116 118 117 119 $check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value ); … … 577 579 return $wpdb->$table_name; 578 580 } 581 582 /** 583 * Determine whether a meta key is protected 584 * 585 * @since 3.2.0 586 * 587 * @param string $meta_key Meta key 588 * @return bool True if the key is protected, false otherwise. 589 */ 590 function is_protected_meta( $meta_key, $meta_type = null ) { 591 $protected = ( '_' == $meta_key[0] ); 592 593 return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type ); 594 } 595 596 /** 597 * Sanitize meta value 598 * 599 * @since 3.2.0 600 * 601 * @param string $meta_key Meta key 602 * @param mixed $meta_value Meta value to sanitize 603 * @param string $meta_type Type of meta 604 * @return mixed Sanitized $meta_value 605 */ 606 function sanitize_meta( $meta_key, $meta_value, $meta_type = null ) { 607 return apply_filters( 'sanitize_meta', $meta_value, $meta_key, $meta_type ); 608 } 609 579 610 ?> -
trunk/wp-includes/theme.php
r17989 r17994 1441 1441 $url = str_replace( 'https://', 'http://', $url ); 1442 1442 1443 return $url;1443 return esc_url_raw( $url ); 1444 1444 } 1445 1445 … … 1526 1526 1527 1527 foreach ( (array) $headers as $header ) { 1528 $url = $header->guid;1528 $url = esc_url_raw( $header->guid ); 1529 1529 $header = basename($url); 1530 1530 $header_images[$header] = array();
Note: See TracChangeset
for help on using the changeset viewer.