Ticket #21767: 21767.15.diff
File 21767.15.diff, 156.3 KB (added by , 11 years ago) |
---|
-
wp-comments-post.php
17 17 18 18 nocache_headers(); 19 19 20 $ comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0;20 $post_data = wp_unslash( $_POST ); 21 21 22 $comment_post_ID = isset($post_data['comment_post_ID']) ? (int) $post_data['comment_post_ID'] : 0; 23 22 24 $post = get_post($comment_post_ID); 23 25 24 26 if ( empty($post->comment_status) ) { … … 47 49 do_action('pre_comment_on_post', $comment_post_ID); 48 50 } 49 51 50 $comment_author = ( isset( $_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null;51 $comment_author_email = ( isset( $_POST['email']) ) ? trim($_POST['email']) : null;52 $comment_author_url = ( isset( $_POST['url']) ) ? trim($_POST['url']) : null;53 $comment_content = ( isset( $_POST['comment']) ) ? trim($_POST['comment']) : null;52 $comment_author = ( isset( $post_data['author'] ) ) ? trim( strip_tags( $post_data['author'] ) ) : null; 53 $comment_author_email = ( isset( $post_data['email'] ) ) ? trim( $post_data['email'] ) : null; 54 $comment_author_url = ( isset( $post_data['url'] ) ) ? trim( $post_data['url'] ) : null; 55 $comment_content = ( isset( $post_data['comment'] ) ) ? trim( $post_data['comment'] ) : null; 54 56 55 57 // If the user is logged in 56 58 $user = wp_get_current_user(); 57 59 if ( $user->exists() ) { 58 60 if ( empty( $user->display_name ) ) 59 $user->display_name =$user->user_login;60 $comment_author = $ wpdb->escape($user->display_name);61 $comment_author_email = $ wpdb->escape($user->user_email);62 $comment_author_url = $ wpdb->escape($user->user_url);61 $user->display_name = $user->user_login; 62 $comment_author = $user->display_name; 63 $comment_author_email = $user->user_email; 64 $comment_author_url = $user->user_url; 63 65 if ( current_user_can('unfiltered_html') ) { 64 if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $ _POST['_wp_unfiltered_html_comment'] ) {66 if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $post_data['_wp_unfiltered_html_comment'] ) { 65 67 kses_remove_filters(); // start with a clean slate 66 68 kses_init_filters(); // set up the filters 67 69 } … … 83 85 if ( '' == $comment_content ) 84 86 wp_die( __('<strong>ERROR</strong>: please type a comment.') ); 85 87 86 $comment_parent = isset($ _POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;88 $comment_parent = isset($post_data['comment_parent']) ? absint($post_data['comment_parent']) : 0; 87 89 88 90 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); 89 91 … … 92 94 $comment = get_comment($comment_id); 93 95 do_action('set_comment_cookies', $comment, $user); 94 96 95 $location = empty($ _POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;97 $location = empty($post_data['redirect_to']) ? get_comment_link($comment_id) : $post_data['redirect_to'] . '#comment-' . $comment_id; 96 98 $location = apply_filters('comment_post_redirect', $location, $comment); 97 99 98 100 wp_safe_redirect( $location ); -
wp-login.php
396 396 } 397 397 398 398 // 10 days 399 setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH );399 setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH ); 400 400 401 401 wp_safe_redirect( wp_get_referer() ); 402 402 exit(); … … 431 431 do_action('lost_password'); 432 432 login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '</p>', $errors); 433 433 434 $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';434 $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : ''; 435 435 436 436 ?> 437 437 … … 530 530 $user_login = ''; 531 531 $user_email = ''; 532 532 if ( $http_post ) { 533 $user_login = $_POST['user_login'];534 $user_email = $_POST['user_email'];533 $user_login = wp_unslash( $_POST['user_login'] ); 534 $user_email = wp_unslash( $_POST['user_email'] ); 535 535 $errors = register_new_user($user_login, $user_email); 536 536 if ( !is_wp_error($errors) ) { 537 537 $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; … … 547 547 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post"> 548 548 <p> 549 549 <label for="user_login"><?php _e('Username') ?><br /> 550 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( stripslashes($user_login)); ?>" size="20" /></label>550 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" /></label> 551 551 </p> 552 552 <p> 553 553 <label for="user_email"><?php _e('E-mail') ?><br /> 554 <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( stripslashes($user_email)); ?>" size="25" /></label>554 <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( $user_email ); ?>" size="25" /></label> 555 555 </p> 556 556 <?php do_action('register_form'); ?> 557 557 <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p> … … 673 673 login_header(__('Log In'), '', $errors); 674 674 675 675 if ( isset($_POST['log']) ) 676 $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr( stripslashes($_POST['log'])) : '';676 $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr( wp_unslash( $_POST['log'] ) ) : ''; 677 677 $rememberme = ! empty( $_POST['rememberme'] ); 678 678 ?> 679 679 -
wp-includes/default-filters.php
14 14 15 15 // Strip, trim, kses, special chars for string saves 16 16 foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname' ) as $filter ) { 17 add_filter( $filter, 'sanitize_text_field' 18 add_filter( $filter, 'wp_ filter_kses');17 add_filter( $filter, 'sanitize_text_field' ); 18 add_filter( $filter, 'wp_kses_data' ); 19 19 add_filter( $filter, '_wp_specialchars', 30 ); 20 20 } 21 21 … … 31 31 32 32 // Kses only for textarea saves 33 33 foreach ( array( 'pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description' ) as $filter ) { 34 add_filter( $filter, 'wp_ filter_kses' );34 add_filter( $filter, 'wp_kses_data' ); 35 35 } 36 36 37 37 // Kses only for textarea admin displays 38 38 if ( is_admin() ) { 39 foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description' ) as $filter ) {39 foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description', 'comment_text' ) as $filter ) { 40 40 add_filter( $filter, 'wp_kses_data' ); 41 41 } 42 add_filter( 'comment_text', 'wp_kses_post' );43 42 } 44 43 45 44 // Email saves 46 45 foreach ( array( 'pre_comment_author_email', 'pre_user_email' ) as $filter ) { 47 46 add_filter( $filter, 'trim' ); 48 47 add_filter( $filter, 'sanitize_email' ); 49 add_filter( $filter, 'wp_ filter_kses' );48 add_filter( $filter, 'wp_kses_data' ); 50 49 } 51 50 52 51 // Email admin display -
wp-includes/post-template.php
583 583 $wp_hasher = new PasswordHash(8, true); 584 584 } 585 585 586 $hash = stripslashes( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );586 $hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ); 587 587 588 588 return ! $wp_hasher->CheckPassword( $post->post_password, $hash ); 589 589 } -
wp-includes/taxonomy.php
953 953 if ( empty($value) ) 954 954 return false; 955 955 } else if ( 'name' == $field ) { 956 // Assume already escaped 957 $value = stripslashes($value); 956 $value = $value; 958 957 $field = 't.name'; 959 958 } else { 960 959 $term = get_term( (int) $value, $taxonomy, $output, $filter); … … 1494 1493 return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) ); 1495 1494 } 1496 1495 1497 $term = trim( stripslashes( $term ));1496 $term = trim( $term ); 1498 1497 1499 1498 if ( '' === $slug = sanitize_title($term) ) 1500 1499 return 0; … … 2056 2055 $args = sanitize_term($args, $taxonomy, 'db'); 2057 2056 extract($args, EXTR_SKIP); 2058 2057 2059 // expected_slashed ($name)2060 $name = stripslashes($name);2061 $description = stripslashes($description);2062 2063 2058 if ( empty($slug) ) 2064 2059 $slug = sanitize_title($name); 2065 2060 … … 2439 2434 if ( is_wp_error( $term ) ) 2440 2435 return $term; 2441 2436 2442 // Escape data pulled from DB.2443 $term = add_magic_quotes($term);2444 2445 2437 // Merge old and new args with new args overwriting old ones. 2446 2438 $args = array_merge($term, $args); 2447 2439 … … 2450 2442 $args = sanitize_term($args, $taxonomy, 'db'); 2451 2443 extract($args, EXTR_SKIP); 2452 2444 2453 // expected_slashed ($name)2454 $name = stripslashes($name);2455 $description = stripslashes($description);2456 2457 2445 if ( '' == trim($name) ) 2458 2446 return new WP_Error('empty_term_name', __('A name is required for this term')); 2459 2447 -
wp-includes/ms-files.php
58 58 header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 100000000 ) . ' GMT' ); 59 59 60 60 // Support for Conditional GET 61 $client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false;61 $client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false; 62 62 63 63 if( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) 64 64 $_SERVER['HTTP_IF_MODIFIED_SINCE'] = false; -
wp-includes/class-wp-customize-manager.php
310 310 public function post_value( $setting ) { 311 311 if ( ! isset( $this->_post_values ) ) { 312 312 if ( isset( $_POST['customized'] ) ) 313 $this->_post_values = json_decode( stripslashes( $_POST['customized'] ), true );313 $this->_post_values = json_decode( wp_unslash( $_POST['customized'] ), true ); 314 314 else 315 315 $this->_post_values = false; 316 316 } -
wp-includes/post.php
1742 1742 * @link http://codex.wordpress.org/Function_Reference/add_post_meta 1743 1743 * 1744 1744 * @param int $post_id Post ID. 1745 * @param string $meta_key Metadata name .1746 * @param mixed $meta_value Metadata value .1745 * @param string $meta_key Metadata name (expected slashed). 1746 * @param mixed $meta_value Metadata value (expected slashed). 1747 1747 * @param bool $unique Optional, default is false. Whether the same key should not be added. 1748 1748 * @return bool False for failure. True for success. 1749 1749 */ 1750 function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) { 1750 function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) { 1751 _deprecated_function( __FUNCTION__, '3.6', 'wp_add_post_meta() (expects unslashed data)' ); 1752 1753 // expected slashed 1754 $meta_key = stripslashes( $meta_key ); 1755 $meta_value = stripslashes_deep( $meta_value ); 1756 1757 return wp_add_post_meta( $post_id, $meta_key, $meta_value, $unique ); 1758 } 1759 1760 /** 1761 * Add meta data field to a post. 1762 * 1763 * Post meta data is called "Custom Fields" on the Administration Screen. 1764 * 1765 * @since 3.6.0 1766 * @link http://codex.wordpress.org/Function_Reference/wp_add_post_meta 1767 * 1768 * @param int $post_id Post ID. 1769 * @param string $meta_key Metadata name (clean, slashes already stripped). 1770 * @param mixed $meta_value Metadata value (clean, slashes already stripped). 1771 * @param bool $unique Optional, default is false. Whether the same key should not be added. 1772 * @return bool False for failure. True for success. 1773 */ 1774 function wp_add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) { 1751 1775 // make sure meta is added to the post, not a revision 1752 if ( $the_post = wp_is_post_revision( $post_id) )1776 if ( $the_post = wp_is_post_revision( $post_id ) ) 1753 1777 $post_id = $the_post; 1754 1778 1755 return add_metadata( 'post', $post_id, $meta_key, $meta_value, $unique);1779 return add_metadata( 'post', $post_id, $meta_key, $meta_value, $unique ); 1756 1780 } 1757 1781 1758 1782 /** … … 1809 1833 * @link http://codex.wordpress.org/Function_Reference/update_post_meta 1810 1834 * 1811 1835 * @param int $post_id Post ID. 1812 * @param string $meta_key Metadata key .1813 * @param mixed $meta_value Metadata value .1836 * @param string $meta_key Metadata key (expected slashed). 1837 * @param mixed $meta_value Metadata value (expected slashed). 1814 1838 * @param mixed $prev_value Optional. Previous value to check before removing. 1815 1839 * @return bool False on failure, true if success. 1816 1840 */ 1817 function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') { 1841 function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) { 1842 _deprecated_function( __FUNCTION__, '3.6', 'wp_update_post_meta() (expects unslashed data)' ); 1843 1844 // expected slashed 1845 $meta_key = stripslashes( $meta_key ); 1846 $meta_value = stripslashes_deep( $meta_value ); 1847 1848 return wp_update_post_meta( $post_id, $meta_key, $meta_value, $prev_value ); 1849 } 1850 1851 /** 1852 * Update post meta field based on post ID. 1853 * 1854 * Use the $prev_value parameter to differentiate between meta fields with the 1855 * same key and post ID. 1856 * 1857 * If the meta field for the post does not exist, it will be added. 1858 * 1859 * @since 3.6.0 1860 * @uses $wpdb 1861 * @link http://codex.wordpress.org/Function_Reference/wp_update_post_meta 1862 * 1863 * @param int $post_id Post ID. 1864 * @param string $meta_key Metadata key (clean, slashes already stripped). 1865 * @param mixed $meta_value Metadata value (clean, slashes already stripped). 1866 * @param mixed $prev_value Optional. Previous value to check before removing. 1867 * @return bool False on failure, true if success. 1868 */ 1869 function wp_update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) { 1818 1870 // make sure meta is added to the post, not a revision 1819 if ( $the_post = wp_is_post_revision( $post_id) )1871 if ( $the_post = wp_is_post_revision( $post_id ) ) 1820 1872 $post_id = $the_post; 1821 1873 1822 return update_metadata( 'post', $post_id, $meta_key, $meta_value, $prev_value);1874 return update_metadata( 'post', $post_id, $meta_key, $meta_value, $prev_value ); 1823 1875 } 1824 1876 1825 1877 /** … … 2406 2458 2407 2459 do_action('wp_trash_post', $post_id); 2408 2460 2409 add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);2410 add_post_meta($post_id,'_wp_trash_meta_time', time());2461 wp_add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']); 2462 wp_add_post_meta($post_id,'_wp_trash_meta_time', time()); 2411 2463 2412 2464 $post['post_status'] = 'trash'; 2413 2465 wp_insert_post($post); … … 2483 2535 $statuses = array(); 2484 2536 foreach ( $comments as $comment ) 2485 2537 $statuses[$comment->comment_ID] = $comment->comment_approved; 2486 add_post_meta($post_id, '_wp_trash_meta_comments_status', $statuses);2538 wp_add_post_meta($post_id, '_wp_trash_meta_comments_status', $statuses); 2487 2539 2488 2540 // Set status for all comments to post-trashed 2489 2541 $result = $wpdb->update($wpdb->comments, array('comment_approved' => 'post-trashed'), array('comment_post_ID' => $post_id)); … … 2859 2911 2860 2912 $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent); 2861 2913 2862 // expected_slashed (everything!)2863 2914 $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) ); 2864 2915 $data = apply_filters('wp_insert_post_data', $data, $postarr); 2865 $data = stripslashes_deep( $data );2866 2916 $where = array( 'ID' => $post_ID ); 2867 2917 2868 2918 if ( $update ) { … … 2875 2925 } 2876 2926 } else { 2877 2927 if ( isset($post_mime_type) ) 2878 $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update2928 $data['post_mime_type'] = $post_mime_type; // This isn't in the update 2879 2929 // If there is a suggested ID, use it if not already present 2880 2930 if ( !empty($import_id) ) { 2881 2931 $import_id = (int) $import_id; … … 2936 2986 else 2937 2987 return 0; 2938 2988 } 2939 update_post_meta($post_ID, '_wp_page_template', $page_template);2989 wp_update_post_meta($post_ID, '_wp_page_template', $page_template); 2940 2990 } 2941 2991 2942 2992 wp_transition_post_status($data['post_status'], $previous_status, $post); … … 2969 3019 if ( is_object($postarr) ) { 2970 3020 // non-escaped post was passed 2971 3021 $postarr = get_object_vars($postarr); 2972 $postarr = add_magic_quotes($postarr);2973 3022 } 2974 3023 2975 3024 // First, get all of the original fields 2976 3025 $post = get_post($postarr['ID'], ARRAY_A); 2977 3026 2978 // Escape data pulled from DB.2979 $post = add_magic_quotes($post);2980 2981 3027 // Passed post category list overwrites existing category list if not empty. 2982 3028 if ( isset($postarr['post_category']) && is_array($postarr['post_category']) 2983 3029 && 0 != count($postarr['post_category']) ) … … 3392 3438 $trackback_urls = explode(',', $tb_list); 3393 3439 foreach( (array) $trackback_urls as $tb_url) { 3394 3440 $tb_url = trim($tb_url); 3395 trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);3441 trackback($tb_url, $post_title, $excerpt, $post_id); 3396 3442 } 3397 3443 } 3398 3444 } … … 3735 3781 if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) { 3736 3782 $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )"; 3737 3783 3738 // meta_key and meta_value might be slashed3739 $meta_key = stripslashes($meta_key);3740 $meta_value = stripslashes($meta_value);3741 3784 if ( ! empty( $meta_key ) ) 3742 3785 $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key); 3743 3786 if ( ! empty( $meta_value ) ) … … 3962 4005 else 3963 4006 $post_name = sanitize_title($post_name); 3964 4007 3965 // expected_slashed ($post_name)3966 4008 $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent); 3967 4009 3968 4010 if ( empty($post_date) ) … … 4005 4047 if ( ! isset($pinged) ) 4006 4048 $pinged = ''; 4007 4049 4008 // expected_slashed (everything!)4009 4050 $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' ) ); 4010 $data = stripslashes_deep( $data );4011 4051 4012 4052 if ( $update ) { 4013 4053 $wpdb->update( $wpdb->posts, $data, array( 'ID' => $post_ID ) ); … … 4052 4092 clean_post_cache( $post_ID ); 4053 4093 4054 4094 if ( ! empty( $context ) ) 4055 add_post_meta( $post_ID, '_wp_attachment_context', $context, true );4095 wp_add_post_meta( $post_ID, '_wp_attachment_context', $context, true ); 4056 4096 4057 4097 if ( $update) { 4058 4098 do_action('edit_attachment', $post_ID); … … 4439 4479 4440 4480 // if we haven't added this old slug before, add it now 4441 4481 if ( !empty( $post_before->post_name ) && !in_array($post_before->post_name, $old_slugs) ) 4442 add_post_meta($post_id, '_wp_old_slug', $post_before->post_name);4482 wp_add_post_meta($post_id, '_wp_old_slug', $post_before->post_name); 4443 4483 4444 4484 // if the new slug was used previously, delete it from the list 4445 4485 if ( in_array($post->post_name, $old_slugs) ) … … 4856 4896 return; 4857 4897 4858 4898 if ( get_option('default_pingback_flag') ) 4859 add_post_meta( $post_id, '_pingme', '1' );4860 add_post_meta( $post_id, '_encloseme', '1' );4899 wp_add_post_meta( $post_id, '_pingme', '1' ); 4900 wp_add_post_meta( $post_id, '_encloseme', '1' ); 4861 4901 4862 4902 wp_schedule_single_event(time(), 'do_pings'); 4863 4903 } … … 5083 5123 return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) ); 5084 5124 5085 5125 $post = _wp_post_revision_fields( $post, $autosave ); 5086 $post = add_magic_quotes($post); //since data is from db5087 5126 5088 5127 $revision_id = wp_insert_post( $post ); 5089 5128 if ( is_wp_error($revision_id) ) … … 5162 5201 5163 5202 $update['ID'] = $revision['post_parent']; 5164 5203 5165 $update = add_magic_quotes( $update ); //since data is from db5166 5167 5204 $post_id = wp_update_post( $update ); 5168 5205 if ( is_wp_error( $post_id ) ) 5169 5206 return $post_id; … … 5385 5422 $thumbnail_id = absint( $thumbnail_id ); 5386 5423 if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) { 5387 5424 if ( $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) ) 5388 return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );5425 return wp_update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id ); 5389 5426 else 5390 5427 return delete_post_meta( $post->ID, '_thumbnail_id' ); 5391 5428 } -
wp-includes/default-widgets.php
412 412 if ( current_user_can('unfiltered_html') ) 413 413 $instance['text'] = $new_instance['text']; 414 414 else 415 $instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed415 $instance['text'] = wp_kses_post( $new_instance['text'] ); 416 416 $instance['filter'] = isset($new_instance['filter']); 417 417 return $instance; 418 418 } … … 1056 1056 } 1057 1057 1058 1058 function update( $new_instance, $old_instance ) { 1059 $instance['title'] = strip_tags( stripslashes($new_instance['title']));1060 $instance['taxonomy'] = stripslashes($new_instance['taxonomy']);1059 $instance['title'] = strip_tags( $new_instance['title'] ); 1060 $instance['taxonomy'] = $new_instance['taxonomy']; 1061 1061 return $instance; 1062 1062 } 1063 1063 … … 1118 1118 } 1119 1119 1120 1120 function update( $new_instance, $old_instance ) { 1121 $instance['title'] = strip_tags( stripslashes($new_instance['title']));1121 $instance['title'] = strip_tags( $new_instance['title'] ); 1122 1122 $instance['nav_menu'] = (int) $new_instance['nav_menu']; 1123 1123 return $instance; 1124 1124 } -
wp-includes/comment.php
633 633 */ 634 634 function sanitize_comment_cookies() { 635 635 if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) { 636 $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]);637 $comment_author = stripslashes($comment_author);636 $comment_author = wp_unslash( $_COOKIE['comment_author_'.COOKIEHASH] ); 637 $comment_author = apply_filters('pre_comment_author_name', $comment_author); 638 638 $comment_author = esc_attr($comment_author); 639 639 $_COOKIE['comment_author_'.COOKIEHASH] = $comment_author; 640 640 } 641 641 642 642 if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) { 643 $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);644 $comment_author_email = stripslashes($comment_author_email);643 $comment_author_email = wp_unslash( $_COOKIE['comment_author_email_'.COOKIEHASH] ); 644 $comment_author_email = apply_filters('pre_comment_author_email', $comment_author_email); 645 645 $comment_author_email = esc_attr($comment_author_email); 646 646 $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email; 647 647 } 648 648 649 649 if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) { 650 $comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]);651 $comment_author_url = stripslashes($comment_author_url);650 $comment_author_url = wp_unslash( $_COOKIE['comment_author_url_'.COOKIEHASH] ); 651 $comment_author_url = apply_filters('pre_comment_author_url', $comment_author_url); 652 652 $_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url; 653 653 } 654 654 } … … 670 670 extract($commentdata, EXTR_SKIP); 671 671 672 672 // Simple duplicate check 673 // expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content) 674 $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_parent = '$comment_parent' AND comment_approved != 'trash' AND ( comment_author = '$comment_author' "; 673 $dupe = $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = %s AND comment_approved != 'trash' AND ( comment_author = %s ", $comment_post_ID, $comment_parent, $comment_author ); 675 674 if ( $comment_author_email ) 676 $dupe .= "OR comment_author_email = '$comment_author_email' ";677 $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";675 $dupe .= $wpdb->prepare( "OR comment_author_email = %s ", $comment_author_email ); 676 $dupe .= $wpdb->prepare( ") AND comment_content = %s LIMIT 1", $comment_content ); 678 677 if ( $wpdb->get_var($dupe) ) { 679 678 do_action( 'comment_duplicate_trigger', $commentdata ); 680 679 if ( defined('DOING_AJAX') ) … … 1262 1261 */ 1263 1262 function wp_insert_comment($commentdata) { 1264 1263 global $wpdb; 1265 extract( stripslashes_deep($commentdata), EXTR_SKIP);1264 extract($commentdata, EXTR_SKIP); 1266 1265 1267 1266 if ( ! isset($comment_author_IP) ) 1268 1267 $comment_author_IP = ''; … … 1491 1490 // First, get all of the original fields 1492 1491 $comment = get_comment($commentarr['comment_ID'], ARRAY_A); 1493 1492 1494 // Escape data pulled from DB.1495 $comment = esc_sql($comment);1496 1497 1493 $old_status = $comment['comment_approved']; 1498 1494 1499 1495 // Merge old and new fields with new fields overwriting old ones. … … 1502 1498 $commentarr = wp_filter_comment( $commentarr ); 1503 1499 1504 1500 // Now extract the merged array. 1505 extract( stripslashes_deep($commentarr), EXTR_SKIP);1501 extract($commentarr, EXTR_SKIP); 1506 1502 1507 1503 $comment_content = apply_filters('comment_save_pre', $comment_content); 1508 1504 -
wp-includes/functions.php
468 468 } 469 469 470 470 if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) { 471 add_post_meta( $post_ID, 'enclosure', "$url\n$len\n$mime\n" );471 wp_add_post_meta( $post_ID, 'enclosure', "$url\n$len\n$mime\n" ); 472 472 } 473 473 } 474 474 } … … 1256 1256 * @return string Original referer field. 1257 1257 */ 1258 1258 function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) { 1259 $jump_back_to = ( 'previous' == $jump_back_to ) ? wp_get_referer() : $_SERVER['REQUEST_URI'];1259 $jump_back_to = ( 'previous' == $jump_back_to ) ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] ); 1260 1260 $ref = ( wp_get_original_referer() ) ? wp_get_original_referer() : $jump_back_to; 1261 $orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( stripslashes( $ref )) . '" />';1261 $orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />'; 1262 1262 if ( $echo ) 1263 1263 echo $orig_referer_field; 1264 1264 return $orig_referer_field; … … 1277 1277 function wp_get_referer() { 1278 1278 $ref = false; 1279 1279 if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) 1280 $ref = $_REQUEST['_wp_http_referer'];1280 $ref = wp_unslash( $_REQUEST['_wp_http_referer'] ); 1281 1281 else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) 1282 $ref = $_SERVER['HTTP_REFERER'];1282 $ref = wp_unslash( $_SERVER['HTTP_REFERER'] ); 1283 1283 1284 if ( $ref && $ref !== $_SERVER['REQUEST_URI'])1284 if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) ) 1285 1285 return $ref; 1286 1286 return false; 1287 1287 } … … 1297 1297 */ 1298 1298 function wp_get_original_referer() { 1299 1299 if ( !empty( $_REQUEST['_wp_original_http_referer'] ) ) 1300 return $_REQUEST['_wp_original_http_referer'];1300 return wp_unslash( $_REQUEST['_wp_original_http_referer'] ); 1301 1301 return false; 1302 1302 } 1303 1303 … … 3879 3879 */ 3880 3880 function wp_checkdate( $month, $day, $year, $source_date ) { 3881 3881 return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date ); 3882 } 3882 } 3883 No newline at end of file -
wp-includes/user.php
1390 1390 } 1391 1391 1392 1392 $data = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' ); 1393 $data = stripslashes_deep( $data );1394 1393 1395 1394 if ( $update ) { 1396 1395 $wpdb->update( $wpdb->users, $data, compact( 'ID' ) ); … … 1462 1461 $user[ $key ] = get_user_meta( $ID, $key, true ); 1463 1462 } 1464 1463 1465 // Escape data pulled from DB.1466 $user = add_magic_quotes( $user );1467 1468 1464 // If password is changing, hash it now. 1469 1465 if ( ! empty($userdata['user_pass']) ) { 1470 1466 $plaintext_pass = $userdata['user_pass']; … … 1504 1500 * @return int The new user's ID. 1505 1501 */ 1506 1502 function wp_create_user($username, $password, $email = '') { 1507 $user_login = esc_sql( $username );1508 $user_email = esc_sql( $email );1503 $user_login = $username; 1504 $user_email = $email; 1509 1505 $user_pass = $password; 1510 1506 1511 1507 $userdata = compact('user_login', 'user_email', 'user_pass'); -
wp-includes/class-wp-xmlrpc-server.php
280 280 $meta['id'] = (int) $meta['id']; 281 281 $pmeta = get_metadata_by_mid( 'post', $meta['id'] ); 282 282 if ( isset($meta['key']) ) { 283 $meta['key'] = stripslashes( $meta['key'] );284 283 if ( $meta['key'] != $pmeta->meta_key ) 285 284 continue; 286 $meta['value'] = stripslashes_deep( $meta['value'] );287 285 if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) ) 288 286 update_metadata_by_mid( 'post', $meta['id'], $meta['value'] ); 289 287 } elseif ( current_user_can( 'delete_post_meta', $post_id, $pmeta->meta_key ) ) { 290 288 delete_metadata_by_mid( 'post', $meta['id'] ); 291 289 } 292 } elseif ( current_user_can( 'add_post_meta', $post_id, stripslashes( $meta['key'] )) ) {293 add_post_meta( $post_id, $meta['key'], $meta['value'] );290 } elseif ( current_user_can( 'add_post_meta', $post_id, $meta['key'] ) ) { 291 wp_add_post_meta( $post_id, $meta['key'], $meta['value'] ); 294 292 } 295 293 } 296 294 } … … 462 460 return $this->blogger_getUsersBlogs( $args ); 463 461 } 464 462 465 $this->escape( $args );466 467 463 $username = $args[0]; 468 464 $password = $args[1]; 469 465 … … 955 951 if ( ! $this->minimum_args( $args, 4 ) ) 956 952 return $this->error; 957 953 958 $this->escape( $args );959 960 954 $blog_id = (int) $args[0]; 961 955 $username = $args[1]; 962 956 $password = $args[2]; … … 1239 1233 if ( ! $this->minimum_args( $args, 5 ) ) 1240 1234 return $this->error; 1241 1235 1242 $this->escape( $args );1243 1244 1236 $blog_id = (int) $args[0]; 1245 1237 $username = $args[1]; 1246 1238 $password = $args[2]; … … 1274 1266 else 1275 1267 $post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] ); 1276 1268 1277 $this->escape( $post );1278 1269 $merged_content_struct = array_merge( $post, $content_struct ); 1279 1270 1280 1271 $retval = $this->_insert_post( $user, $merged_content_struct ); … … 1301 1292 if ( ! $this->minimum_args( $args, 4 ) ) 1302 1293 return $this->error; 1303 1294 1304 $this->escape( $args );1305 1306 1295 $blog_id = (int) $args[0]; 1307 1296 $username = $args[1]; 1308 1297 $password = $args[2]; … … 1377 1366 if ( ! $this->minimum_args( $args, 4 ) ) 1378 1367 return $this->error; 1379 1368 1380 $this->escape( $args );1381 1382 1369 $blog_id = (int) $args[0]; 1383 1370 $username = $args[1]; 1384 1371 $password = $args[2]; … … 1434 1421 if ( ! $this->minimum_args( $args, 3 ) ) 1435 1422 return $this->error; 1436 1423 1437 $this->escape( $args );1438 1439 1424 $blog_id = (int) $args[0]; 1440 1425 $username = $args[1]; 1441 1426 $password = $args[2]; … … 1529 1514 if ( ! $this->minimum_args( $args, 4 ) ) 1530 1515 return $this->error; 1531 1516 1532 $this->escape( $args );1533 1534 1517 $blog_id = (int) $args[0]; 1535 1518 $username = $args[1]; 1536 1519 $password = $args[2]; … … 1616 1599 if ( ! $this->minimum_args( $args, 5 ) ) 1617 1600 return $this->error; 1618 1601 1619 $this->escape( $args );1620 1621 1602 $blog_id = (int) $args[0]; 1622 1603 $username = $args[1]; 1623 1604 $password = $args[2]; … … 1708 1689 if ( ! $this->minimum_args( $args, 5 ) ) 1709 1690 return $this->error; 1710 1691 1711 $this->escape( $args );1712 1713 1692 $blog_id = (int) $args[0]; 1714 1693 $username = $args[1]; 1715 1694 $password = $args[2]; … … 1775 1754 if ( ! $this->minimum_args( $args, 5 ) ) 1776 1755 return $this->error; 1777 1756 1778 $this->escape( $args );1779 1780 1757 $blog_id = (int) $args[0]; 1781 1758 $username = $args[1]; 1782 1759 $password = $args[2]; … … 1828 1805 if ( ! $this->minimum_args( $args, 4 ) ) 1829 1806 return $this->error; 1830 1807 1831 $this->escape( $args );1832 1833 1808 $blog_id = (int) $args[0]; 1834 1809 $username = $args[1]; 1835 1810 $password = $args[2]; … … 1903 1878 if ( ! $this->minimum_args( $args, 4 ) ) 1904 1879 return $this->error; 1905 1880 1906 $this->escape( $args );1907 1908 1881 $blog_id = (int) $args[0]; 1909 1882 $username = $args[1]; 1910 1883 $password = $args[2]; … … 1947 1920 if ( ! $this->minimum_args( $args, 3 ) ) 1948 1921 return $this->error; 1949 1922 1950 $this->escape( $args );1951 1952 1923 $blog_id = (int) $args[0]; 1953 1924 $username = $args[1]; 1954 1925 $password = $args[2]; … … 2016 1987 if ( ! $this->minimum_args( $args, 4 ) ) 2017 1988 return $this->error; 2018 1989 2019 $this->escape( $args );2020 2021 1990 $blog_id = (int) $args[0]; 2022 1991 $username = $args[1]; 2023 1992 $password = $args[2]; … … 2069 2038 if ( ! $this->minimum_args( $args, 3 ) ) 2070 2039 return $this->error; 2071 2040 2072 $this->escape( $args );2073 2074 2041 $blog_id = (int) $args[0]; 2075 2042 $username = $args[1]; 2076 2043 $password = $args[2]; … … 2137 2104 if ( ! $this->minimum_args( $args, 3 ) ) 2138 2105 return $this->error; 2139 2106 2140 $this->escape( $args );2141 2142 2107 $blog_id = (int) $args[0]; 2143 2108 $username = $args[1]; 2144 2109 $password = $args[2]; … … 2184 2149 if ( ! $this->minimum_args( $args, 4 ) ) 2185 2150 return $this->error; 2186 2151 2187 $this->escape( $args );2188 2189 2152 $blog_id = (int) $args[0]; 2190 2153 $username = $args[1]; 2191 2154 $password = $args[2]; … … 2249 2212 * @return array 2250 2213 */ 2251 2214 function wp_getPage($args) { 2252 $this->escape($args);2253 2254 2215 $blog_id = (int) $args[0]; 2255 2216 $page_id = (int) $args[1]; 2256 2217 $username = $args[2]; … … 2292 2253 * @return array 2293 2254 */ 2294 2255 function wp_getPages($args) { 2295 $this->escape($args);2296 2297 2256 $blog_id = (int) $args[0]; 2298 2257 $username = $args[1]; 2299 2258 $password = $args[2]; … … 2336 2295 * @return unknown 2337 2296 */ 2338 2297 function wp_newPage($args) { 2339 // Items not escaped here will be escaped in newPost. 2340 $username = $this->escape($args[1]); 2341 $password = $this->escape($args[2]); 2298 $username = $args[1]; 2299 $password = $args[2]; 2342 2300 $page = $args[3]; 2343 2301 $publish = $args[4]; 2344 2302 … … 2363 2321 * @return bool True, if success. 2364 2322 */ 2365 2323 function wp_deletePage($args) { 2366 $this->escape($args);2367 2368 2324 $blog_id = (int) $args[0]; 2369 2325 $username = $args[1]; 2370 2326 $password = $args[2]; … … 2404 2360 * @return unknown 2405 2361 */ 2406 2362 function wp_editPage($args) { 2407 // Items not escaped here will be escaped in editPost.2408 2363 $blog_id = (int) $args[0]; 2409 $page_id = (int) $ this->escape($args[1]);2410 $username = $ this->escape($args[2]);2411 $password = $ this->escape($args[3]);2364 $page_id = (int) $args[1]; 2365 $username = $args[2]; 2366 $password = $args[3]; 2412 2367 $content = $args[4]; 2413 2368 $publish = $args[5]; 2414 2369 … … 2453 2408 function wp_getPageList($args) { 2454 2409 global $wpdb; 2455 2410 2456 $this->escape($args);2457 2458 2411 $blog_id = (int) $args[0]; 2459 2412 $username = $args[1]; 2460 2413 $password = $args[2]; … … 2503 2456 * @return array 2504 2457 */ 2505 2458 function wp_getAuthors($args) { 2506 2507 $this->escape($args);2508 2509 2459 $blog_id = (int) $args[0]; 2510 2460 $username = $args[1]; 2511 2461 $password = $args[2]; … … 2539 2489 * @return array 2540 2490 */ 2541 2491 function wp_getTags( $args ) { 2542 $this->escape( $args );2543 2544 2492 $blog_id = (int) $args[0]; 2545 2493 $username = $args[1]; 2546 2494 $password = $args[2]; … … 2580 2528 * @return int Category ID. 2581 2529 */ 2582 2530 function wp_newCategory($args) { 2583 $this->escape($args);2584 2585 2531 $blog_id = (int) $args[0]; 2586 2532 $username = $args[1]; 2587 2533 $password = $args[2]; … … 2641 2587 * @return mixed See {@link wp_delete_term()} for return info. 2642 2588 */ 2643 2589 function wp_deleteCategory($args) { 2644 $this->escape($args);2645 2646 2590 $blog_id = (int) $args[0]; 2647 2591 $username = $args[1]; 2648 2592 $password = $args[2]; … … 2673 2617 * @return array 2674 2618 */ 2675 2619 function wp_suggestCategories($args) { 2676 $this->escape($args);2677 2678 2620 $blog_id = (int) $args[0]; 2679 2621 $username = $args[1]; 2680 2622 $password = $args[2]; … … 2710 2652 * @return array 2711 2653 */ 2712 2654 function wp_getComment($args) { 2713 $this->escape($args);2714 2715 2655 $blog_id = (int) $args[0]; 2716 2656 $username = $args[1]; 2717 2657 $password = $args[2]; … … 2751 2691 * @return array. Contains a collection of comments. See {@link wp_xmlrpc_server::wp_getComment()} for a description of each item contents 2752 2692 */ 2753 2693 function wp_getComments($args) { 2754 $this->escape($args);2755 2756 2694 $blog_id = (int) $args[0]; 2757 2695 $username = $args[1]; 2758 2696 $password = $args[2]; … … 2811 2749 * @return mixed {@link wp_delete_comment()} 2812 2750 */ 2813 2751 function wp_deleteComment($args) { 2814 $this->escape($args);2815 2816 2752 $blog_id = (int) $args[0]; 2817 2753 $username = $args[1]; 2818 2754 $password = $args[2]; … … 2865 2801 * @return bool True, on success. 2866 2802 */ 2867 2803 function wp_editComment($args) { 2868 $this->escape($args);2869 2870 2804 $blog_id = (int) $args[0]; 2871 2805 $username = $args[1]; 2872 2806 $password = $args[2]; … … 2942 2876 function wp_newComment($args) { 2943 2877 global $wpdb; 2944 2878 2945 $this->escape($args);2946 2947 2879 $blog_id = (int) $args[0]; 2948 2880 $username = $args[1]; 2949 2881 $password = $args[2]; … … 2978 2910 $comment['comment_post_ID'] = $post_id; 2979 2911 2980 2912 if ( $logged_in ) { 2981 $comment['comment_author'] = $ wpdb->escape( $user->display_name );2982 $comment['comment_author_email'] = $ wpdb->escape( $user->user_email );2983 $comment['comment_author_url'] = $ wpdb->escape( $user->user_url );2913 $comment['comment_author'] = $user->display_name; 2914 $comment['comment_author_email'] = $user->user_email; 2915 $comment['comment_author_url'] = $user->user_url; 2984 2916 $comment['user_ID'] = $user->ID; 2985 2917 } else { 2986 2918 $comment['comment_author'] = ''; … … 3027 2959 * @return array 3028 2960 */ 3029 2961 function wp_getCommentStatusList($args) { 3030 $this->escape( $args );3031 3032 2962 $blog_id = (int) $args[0]; 3033 2963 $username = $args[1]; 3034 2964 $password = $args[2]; … … 3053 2983 * @return array 3054 2984 */ 3055 2985 function wp_getCommentCount( $args ) { 3056 $this->escape($args);3057 3058 2986 $blog_id = (int) $args[0]; 3059 2987 $username = $args[1]; 3060 2988 $password = $args[2]; … … 3086 3014 * @return array 3087 3015 */ 3088 3016 function wp_getPostStatusList( $args ) { 3089 $this->escape( $args );3090 3091 3017 $blog_id = (int) $args[0]; 3092 3018 $username = $args[1]; 3093 3019 $password = $args[2]; … … 3112 3038 * @return array 3113 3039 */ 3114 3040 function wp_getPageStatusList( $args ) { 3115 $this->escape( $args );3116 3117 3041 $blog_id = (int) $args[0]; 3118 3042 $username = $args[1]; 3119 3043 $password = $args[2]; … … 3138 3062 * @return array 3139 3063 */ 3140 3064 function wp_getPageTemplates( $args ) { 3141 $this->escape( $args );3142 3143 3065 $blog_id = (int) $args[0]; 3144 3066 $username = $args[1]; 3145 3067 $password = $args[2]; … … 3165 3087 * @return array 3166 3088 */ 3167 3089 function wp_getOptions( $args ) { 3168 $this->escape( $args );3169 3170 3090 $blog_id = (int) $args[0]; 3171 3091 $username = $args[1]; 3172 3092 $password = $args[2]; … … 3215 3135 * @return unknown 3216 3136 */ 3217 3137 function wp_setOptions( $args ) { 3218 $this->escape( $args );3219 3220 3138 $blog_id = (int) $args[0]; 3221 3139 $username = $args[1]; 3222 3140 $password = $args[2]; … … 3264 3182 * - 'metadata' 3265 3183 */ 3266 3184 function wp_getMediaItem($args) { 3267 $this->escape($args);3268 3269 3185 $blog_id = (int) $args[0]; 3270 3186 $username = $args[1]; 3271 3187 $password = $args[2]; … … 3309 3225 * @return array. Contains a collection of media items. See {@link wp_xmlrpc_server::wp_getMediaItem()} for a description of each item contents 3310 3226 */ 3311 3227 function wp_getMediaLibrary($args) { 3312 $this->escape($args);3313 3314 3228 $blog_id = (int) $args[0]; 3315 3229 $username = $args[1]; 3316 3230 $password = $args[2]; … … 3351 3265 * @return array 3352 3266 */ 3353 3267 function wp_getPostFormats( $args ) { 3354 $this->escape( $args );3355 3356 3268 $blog_id = (int) $args[0]; 3357 3269 $username = $args[1]; 3358 3270 $password = $args[2]; … … 3411 3323 if ( ! $this->minimum_args( $args, 4 ) ) 3412 3324 return $this->error; 3413 3325 3414 $this->escape( $args );3415 3416 3326 $blog_id = (int) $args[0]; 3417 3327 $username = $args[1]; 3418 3328 $password = $args[2]; … … 3457 3367 if ( ! $this->minimum_args( $args, 3 ) ) 3458 3368 return $this->error; 3459 3369 3460 $this->escape( $args );3461 3462 3370 $blog_id = (int) $args[0]; 3463 3371 $username = $args[1]; 3464 3372 $password = $args[2]; … … 3511 3419 if ( ! $this->minimum_args( $args, 4 ) ) 3512 3420 return $this->error; 3513 3421 3514 $this->escape( $args );3515 3516 3422 $blog_id = (int) $args[0]; 3517 3423 $username = $args[1]; 3518 3424 $password = $args[2]; … … 3577 3483 if ( ! $this->minimum_args( $args, 3 ) ) 3578 3484 return $this->error; 3579 3485 3580 $this->escape( $args );3581 3582 3486 $blog_id = (int) $args[0]; 3583 3487 $username = $args[1]; 3584 3488 $password = $args[2]; … … 3628 3532 if ( is_multisite() ) 3629 3533 return $this->_multisite_getUsersBlogs($args); 3630 3534 3631 $this->escape($args);3632 3633 3535 $username = $args[1]; 3634 3536 $password = $args[2]; 3635 3537 … … 3691 3593 * @return array 3692 3594 */ 3693 3595 function blogger_getUserInfo($args) { 3694 3695 $this->escape($args);3696 3697 3596 $username = $args[1]; 3698 3597 $password = $args[2]; 3699 3598 … … 3725 3624 * @return array 3726 3625 */ 3727 3626 function blogger_getPost($args) { 3728 3729 $this->escape($args);3730 3731 3627 $post_ID = (int) $args[1]; 3732 3628 $username = $args[2]; 3733 3629 $password = $args[3]; … … 3746 3642 3747 3643 $categories = implode(',', wp_get_post_categories($post_ID)); 3748 3644 3749 $content = '<title>'. stripslashes($post_data['post_title']).'</title>';3645 $content = '<title>'.$post_data['post_title'].'</title>'; 3750 3646 $content .= '<category>'.$categories.'</category>'; 3751 $content .= stripslashes($post_data['post_content']);3647 $content .= $post_data['post_content']; 3752 3648 3753 3649 $struct = array( 3754 3650 'userid' => (string) $post_data['post_author'], … … 3769 3665 * @return array 3770 3666 */ 3771 3667 function blogger_getRecentPosts($args) { 3772 3773 $this->escape($args);3774 3775 3668 // $args[0] = appkey - ignored 3776 3669 $blog_ID = (int) $args[1]; /* though we don't use it yet */ 3777 3670 $username = $args[2]; … … 3800 3693 $post_date = $this->_convert_date( $entry['post_date'] ); 3801 3694 $categories = implode(',', wp_get_post_categories($entry['ID'])); 3802 3695 3803 $content = '<title>'. stripslashes($entry['post_title']).'</title>';3696 $content = '<title>'.$entry['post_title'].'</title>'; 3804 3697 $content .= '<category>'.$categories.'</category>'; 3805 $content .= stripslashes($entry['post_content']);3698 $content .= $entry['post_content']; 3806 3699 3807 3700 $struct[] = array( 3808 3701 'userid' => (string) $entry['post_author'], … … 3850 3743 * @return int 3851 3744 */ 3852 3745 function blogger_newPost($args) { 3853 3854 $this->escape($args);3855 3856 3746 $blog_ID = (int) $args[1]; /* though we don't use it yet */ 3857 3747 $username = $args[2]; 3858 3748 $password = $args[3]; … … 3904 3794 * @return bool true when done. 3905 3795 */ 3906 3796 function blogger_editPost($args) { 3907 3908 $this->escape($args);3909 3910 3797 $post_ID = (int) $args[1]; 3911 3798 $username = $args[2]; 3912 3799 $password = $args[3]; … … 3923 3810 if ( !$actual_post || $actual_post['post_type'] != 'post' ) 3924 3811 return new IXR_Error(404, __('Sorry, no such post.')); 3925 3812 3926 $this->escape($actual_post);3927 3928 3813 if ( !current_user_can('edit_post', $post_ID) ) 3929 3814 return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.')); 3930 3815 … … 3960 3845 * @return bool True when post is deleted. 3961 3846 */ 3962 3847 function blogger_deletePost($args) { 3963 $this->escape($args);3964 3965 3848 $post_ID = (int) $args[1]; 3966 3849 $username = $args[2]; 3967 3850 $password = $args[3]; … … 4030 3913 * @return int 4031 3914 */ 4032 3915 function mw_newPost($args) { 4033 $this->escape($args); 4034 4035 $blog_ID = (int) $args[0]; 4036 $username = $args[1]; 4037 $password = $args[2]; 3916 $blog_ID = (int) $args[0]; 3917 $username = $args[1]; 3918 $password = $args[2]; 4038 3919 $content_struct = $args[3]; 4039 $publish = isset( $args[4] ) ? $args[4] : 0;3920 $publish = isset( $args[4] ) ? $args[4] : 0; 4040 3921 4041 3922 if ( !$user = $this->login($username, $password) ) 4042 3923 return $this->error; … … 4316 4197 } 4317 4198 } 4318 4199 if (!$found) 4319 add_post_meta( $post_ID, 'enclosure', $encstring );4200 wp_add_post_meta( $post_ID, 'enclosure', $encstring ); 4320 4201 } 4321 4202 } 4322 4203 … … 4350 4231 * @return bool True on success. 4351 4232 */ 4352 4233 function mw_editPost($args) { 4353 4354 $this->escape($args);4355 4356 4234 $post_ID = (int) $args[0]; 4357 4235 $username = $args[1]; 4358 4236 $password = $args[2]; … … 4391 4269 } 4392 4270 } 4393 4271 4394 $this->escape($postdata);4395 4272 extract($postdata, EXTR_SKIP); 4396 4273 4397 4274 // Let WordPress manage slug if none was provided. … … 4619 4496 * @return array 4620 4497 */ 4621 4498 function mw_getPost($args) { 4622 4623 $this->escape($args);4624 4625 4499 $post_ID = (int) $args[0]; 4626 4500 $username = $args[1]; 4627 4501 $password = $args[2]; … … 4743 4617 * @return array 4744 4618 */ 4745 4619 function mw_getRecentPosts($args) { 4746 4747 $this->escape($args);4748 4749 4620 $blog_ID = (int) $args[0]; 4750 4621 $username = $args[1]; 4751 4622 $password = $args[2]; … … 4858 4729 * @return array 4859 4730 */ 4860 4731 function mw_getCategories($args) { 4861 4862 $this->escape($args);4863 4864 4732 $blog_ID = (int) $args[0]; 4865 4733 $username = $args[1]; 4866 4734 $password = $args[2]; … … 4907 4775 function mw_newMediaObject($args) { 4908 4776 global $wpdb; 4909 4777 4910 $blog_ID 4911 $username = $ wpdb->escape($args[1]);4912 $password = $wpdb->escape($args[2]);4913 $data 4778 $blog_ID = (int) $args[0]; 4779 $username = $args[1]; 4780 $password = $args[2]; 4781 $data = $args[3]; 4914 4782 4915 4783 $name = sanitize_file_name( $data['name'] ); 4916 4784 $type = $data['type']; … … 4997 4865 * @return array 4998 4866 */ 4999 4867 function mt_getRecentPostTitles($args) { 5000 5001 $this->escape($args);5002 5003 4868 $blog_ID = (int) $args[0]; 5004 4869 $username = $args[1]; 5005 4870 $password = $args[2]; … … 5057 4922 * @return array 5058 4923 */ 5059 4924 function mt_getCategoryList($args) { 5060 5061 $this->escape($args);5062 5063 4925 $blog_ID = (int) $args[0]; 5064 4926 $username = $args[1]; 5065 4927 $password = $args[2]; … … 5095 4957 * @return array 5096 4958 */ 5097 4959 function mt_getPostCategories($args) { 5098 5099 $this->escape($args);5100 5101 4960 $post_ID = (int) $args[0]; 5102 4961 $username = $args[1]; 5103 4962 $password = $args[2]; … … 5138 4997 * @return bool True on success. 5139 4998 */ 5140 4999 function mt_setPostCategories($args) { 5141 5142 $this->escape($args);5143 5144 5000 $post_ID = (int) $args[0]; 5145 5001 $username = $args[1]; 5146 5002 $password = $args[2]; … … 5250 5106 * @return int 5251 5107 */ 5252 5108 function mt_publishPost($args) { 5253 5254 $this->escape($args);5255 5256 5109 $post_ID = (int) $args[0]; 5257 5110 $username = $args[1]; 5258 5111 $password = $args[2]; … … 5274 5127 // retain old cats 5275 5128 $cats = wp_get_post_categories($post_ID); 5276 5129 $postdata['post_category'] = $cats; 5277 $this->escape($postdata);5278 5130 5279 5131 $result = wp_update_post($postdata); 5280 5132 … … 5298 5150 5299 5151 do_action('xmlrpc_call', 'pingback.ping'); 5300 5152 5301 $this->escape($args);5302 5303 5153 $pagelinkedfrom = $args[0]; 5304 5154 $pagelinkedto = $args[1]; 5305 5155 … … 5435 5285 $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom); 5436 5286 5437 5287 $context = '[...] ' . esc_html( $excerpt ) . ' [...]'; 5438 $pagelinkedfrom = $ wpdb->escape( $pagelinkedfrom );5288 $pagelinkedfrom = $pagelinkedfrom; 5439 5289 5440 5290 $comment_post_ID = (int) $post_ID; 5441 5291 $comment_author = $title; 5442 5292 $comment_author_email = ''; 5443 $ this->escape($comment_author);5293 $comment_author; 5444 5294 $comment_author_url = $pagelinkedfrom; 5445 5295 $comment_content = $context; 5446 $ this->escape($comment_content);5296 $comment_content; 5447 5297 $comment_type = 'pingback'; 5448 5298 5449 5299 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type'); … … 5465 5315 * @return array 5466 5316 */ 5467 5317 function pingback_extensions_getPingbacks($args) { 5468 5469 5318 global $wpdb; 5470 5319 5471 5320 do_action('xmlrpc_call', 'pingback.extensions.getPingbacks'); 5472 5321 5473 $this->escape($args);5474 5475 5322 $url = $args; 5476 5323 5477 5324 $post_ID = url_to_postid($url); -
wp-includes/query.php
1733 1733 // Category stuff 1734 1734 if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && $this->query_vars_changed ) { 1735 1735 $q['cat'] = ''.urldecode($q['cat']).''; 1736 $q['cat'] = addslashes_gpc($q['cat']);1737 1736 $cat_array = preg_split('/[,\s]+/', $q['cat']); 1738 1737 $q['cat'] = ''; 1739 1738 $req_cats = array(); … … 2180 2179 2181 2180 // If a search pattern is specified, load the posts that match 2182 2181 if ( !empty($q['s']) ) { 2183 // added slashes screw with quote grouping when done early, so done later2184 $q['s'] = stripslashes($q['s']);2185 2182 if ( empty( $_GET['s'] ) && $this->is_main_query() ) 2186 2183 $q['s'] = urldecode($q['s']); 2187 2184 if ( !empty($q['sentence']) ) { … … 2290 2287 $whichauthor = ''; 2291 2288 } else { 2292 2289 $q['author'] = (string)urldecode($q['author']); 2293 $q['author'] = addslashes_gpc($q['author']);2294 2290 if ( strpos($q['author'], '-') !== false ) { 2295 2291 $eq = '!='; 2296 2292 $andor = 'AND'; … … 2352 2348 $allowed_keys[] = 'meta_value_num'; 2353 2349 } 2354 2350 $q['orderby'] = urldecode($q['orderby']); 2355 $q['orderby'] = addslashes_gpc($q['orderby']);2356 2351 2357 2352 $orderby_array = array(); 2358 2353 foreach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) { -
wp-includes/link-template.php
746 746 if ( empty($query) ) 747 747 $search = get_search_query( false ); 748 748 else 749 $search = stripslashes($query);749 $search = $query; 750 750 751 751 $permastruct = $wp_rewrite->get_search_permastruct(); 752 752 -
wp-includes/formatting.php
1716 1716 * @return string Converted content. 1717 1717 */ 1718 1718 function wp_rel_nofollow( $text ) { 1719 // This is a pre save filter, so text is already escaped.1720 $text = stripslashes($text);1721 1719 $text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text); 1722 $text = esc_sql($text);1723 1720 return $text; 1724 1721 } 1725 1722 … … 3342 3339 $urls_to_ping = implode( "\n", $urls_to_ping ); 3343 3340 return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping ); 3344 3341 } 3342 3343 /** 3344 * Conditionally add slashes to a string or array of strings. When GPCS 3345 * slashing is turned on, slashes are added. When GPCS slashing is turned off, 3346 * slashes are not added. 3347 * 3348 * This should be used when preparing data for core API that deal directly with GPCS data. 3349 * Outside of unit tests, this should be rare. At a future date GPCS will no longer 3350 * be slashed and this function will noop. Do not use it in situations where adding slashes 3351 * is always required regardless of whether GPCS is slashed. 3352 * 3353 * @since 3.6.0 3354 * 3355 * @param string|array $value String or array of strings to slash. 3356 * @return string|array Slashed $value 3357 */ 3358 function wp_slash( $value ) { 3359 if ( is_array( $value ) ) { 3360 foreach ( $value as $k => $v ) { 3361 if ( is_array( $v ) ) { 3362 $value[$k] = wp_slash( $v ); 3363 } else { 3364 $value[$k] = addslashes( $v ); 3365 } 3366 } 3367 } else { 3368 $value = addslashes( $value ); 3369 } 3370 3371 return $value; 3372 } 3373 3374 /** 3375 * Conditionally removes slashes from a string or array of strings. When GPCS 3376 * slashing is turned on, slashes are stripped. When GPCS slashing is turned off, 3377 * slashes are not stripped. 3378 * 3379 * This should be used for GPCS data before passing it along to core API. At a future 3380 * date GPCS will no longer be slashed and this function will noop. Do not use it 3381 * in situations where slash stripping is always required regardless of whether GPCS 3382 * is slashed. 3383 * 3384 * @since 3.6.0 3385 * 3386 * @param string|array $value String or array of strings to unslash. 3387 * @return string|array Unslashed $value 3388 */ 3389 function wp_unslash( $value ) { 3390 return stripslashes_deep( $value ); 3391 } -
wp-includes/class-wp.php
142 142 $this->did_permalink = true; 143 143 144 144 if ( isset($_SERVER['PATH_INFO']) ) 145 $pathinfo = $_SERVER['PATH_INFO'];145 $pathinfo = wp_unslash( $_SERVER['PATH_INFO'] ); 146 146 else 147 147 $pathinfo = ''; 148 148 $pathinfo_array = explode('?', $pathinfo); 149 149 $pathinfo = str_replace("%", "%25", $pathinfo_array[0]); 150 $req_uri = $_SERVER['REQUEST_URI'];150 $req_uri = wp_unslash( $_SERVER['REQUEST_URI'] ); 151 151 $req_uri_array = explode('?', $req_uri); 152 152 $req_uri = $req_uri_array[0]; 153 $self = $_SERVER['PHP_SELF'];153 $self = wp_unslash( $_SERVER['PHP_SELF'] ); 154 154 $home_path = parse_url(home_url()); 155 155 if ( isset($home_path['path']) ) 156 156 $home_path = $home_path['path']; … … 255 255 if ( isset( $this->extra_query_vars[$wpvar] ) ) 256 256 $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar]; 257 257 elseif ( isset( $_POST[$wpvar] ) ) 258 $this->query_vars[$wpvar] = $_POST[$wpvar];258 $this->query_vars[$wpvar] = wp_unslash( $_POST[$wpvar] ); 259 259 elseif ( isset( $_GET[$wpvar] ) ) 260 $this->query_vars[$wpvar] = $_GET[$wpvar];260 $this->query_vars[$wpvar] = wp_unslash( $_GET[$wpvar] ); 261 261 elseif ( isset( $perma_query_vars[$wpvar] ) ) 262 262 $this->query_vars[$wpvar] = $perma_query_vars[$wpvar]; 263 263 … … 356 356 357 357 // Support for Conditional GET 358 358 if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) 359 $client_etag = stripslashes( stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));359 $client_etag = stripslashes( wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] ) ); // Retain extra strip. See #2597 360 360 else $client_etag = false; 361 361 362 362 $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']); -
wp-includes/deprecated.php
2383 2383 2384 2384 /** @todo Might need fix because usermeta data is assumed to be already escaped */ 2385 2385 if ( is_string($meta_value) ) 2386 $meta_value = stripslashes($meta_value);2386 $meta_value = $meta_value; 2387 2387 $meta_value = maybe_serialize($meta_value); 2388 2388 2389 2389 if (empty($meta_value)) { -
wp-includes/cron.php
230 230 set_transient( 'doing_cron', $doing_wp_cron ); 231 231 232 232 ob_start(); 233 wp_redirect( add_query_arg( 'doing_wp_cron', $doing_wp_cron, stripslashes($_SERVER['REQUEST_URI'])) );233 wp_redirect( add_query_arg( 'doing_wp_cron', $doing_wp_cron, wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 234 234 echo ' '; 235 235 236 236 // flush any buffers and send the headers -
wp-includes/pluggable.php
782 782 // The cookie is no good so force login 783 783 nocache_headers(); 784 784 785 $redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);785 $redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . wp_unslash( $_SERVER['HTTP_HOST'] ) . wp_unslash( $_SERVER['REQUEST_URI'] ) ); 786 786 787 787 $login_url = wp_login_url($redirect, true); 788 788 … … 1197 1197 function wp_new_user_notification($user_id, $plaintext_pass = '') { 1198 1198 $user = get_userdata( $user_id ); 1199 1199 1200 $user_login = stripslashes($user->user_login);1201 $user_email = stripslashes($user->user_email);1200 $user_login = $user->user_login; 1201 $user_email = $user->user_email; 1202 1202 1203 1203 // The blogname option is escaped with esc_html on the way into the database in sanitize_option 1204 1204 // we want to reverse this for the plain text arena of emails. -
wp-includes/feed.php
488 488 */ 489 489 function self_link() { 490 490 $host = @parse_url(home_url()); 491 echo esc_url( set_url_scheme( 'http://' . $host['host'] . stripslashes($_SERVER['REQUEST_URI']) ) );491 echo esc_url( set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 492 492 } 493 493 494 494 /** -
wp-includes/kses.php
1326 1326 */ 1327 1327 function kses_init_filters() { 1328 1328 // Normal filtering 1329 add_filter('title_save_pre', 'wp_ filter_kses');1329 add_filter('title_save_pre', 'wp_kses_data'); 1330 1330 1331 1331 // Comment filtering 1332 1332 if ( current_user_can( 'unfiltered_html' ) ) 1333 add_filter( 'pre_comment_content', 'wp_ filter_post_kses' );1333 add_filter( 'pre_comment_content', 'wp_kses_post' ); 1334 1334 else 1335 add_filter( 'pre_comment_content', 'wp_ filter_kses' );1335 add_filter( 'pre_comment_content', 'wp_kses_data' ); 1336 1336 1337 1337 // Post filtering 1338 add_filter('content_save_pre', 'wp_ filter_post_kses');1339 add_filter('excerpt_save_pre', 'wp_ filter_post_kses');1340 add_filter('content_filtered_save_pre', 'wp_ filter_post_kses');1338 add_filter('content_save_pre', 'wp_kses_post'); 1339 add_filter('excerpt_save_pre', 'wp_kses_post'); 1340 add_filter('content_filtered_save_pre', 'wp_kses_post'); 1341 1341 } 1342 1342 1343 1343 /** … … 1354 1354 */ 1355 1355 function kses_remove_filters() { 1356 1356 // Normal filtering 1357 remove_filter('title_save_pre', 'wp_ filter_kses');1357 remove_filter('title_save_pre', 'wp_kses_data'); 1358 1358 1359 1359 // Comment filtering 1360 remove_filter( 'pre_comment_content', 'wp_ filter_post_kses' );1361 remove_filter( 'pre_comment_content', 'wp_ filter_kses' );1360 remove_filter( 'pre_comment_content', 'wp_kses_post' ); 1361 remove_filter( 'pre_comment_content', 'wp_kses_data' ); 1362 1362 1363 1363 // Post filtering 1364 remove_filter('content_save_pre', 'wp_ filter_post_kses');1365 remove_filter('excerpt_save_pre', 'wp_ filter_post_kses');1366 remove_filter('content_filtered_save_pre', 'wp_ filter_post_kses');1364 remove_filter('content_save_pre', 'wp_kses_post'); 1365 remove_filter('excerpt_save_pre', 'wp_kses_post'); 1366 remove_filter('content_filtered_save_pre', 'wp_kses_post'); 1367 1367 } 1368 1368 1369 1369 /** -
wp-includes/widgets.php
224 224 } 225 225 226 226 foreach ( $settings as $number => $new_instance ) { 227 $new_instance = stripslashes_deep($new_instance);227 $new_instance = wp_unslash($new_instance); 228 228 $this->_set($number); 229 229 230 230 $old_instance = isset($all_instances[$number]) ? $all_instances[$number] : array(); -
wp-includes/class-wp-customize-setting.php
144 144 * @return mixed Null if an input isn't valid, otherwise the sanitized value. 145 145 */ 146 146 public function sanitize( $value ) { 147 $value = stripslashes_deep( $value );147 $value = wp_unslash( $value ); 148 148 return apply_filters( "customize_sanitize_{$this->id}", $value, $this ); 149 149 } 150 150 -
wp-includes/ms-functions.php
279 279 * @return int The ID of the newly created blog 280 280 */ 281 281 function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) { 282 $domain = addslashes( $domain );283 $weblog_title = addslashes( $weblog_title );284 285 282 if ( empty($path) ) 286 283 $path = '/'; 287 284 … … 585 582 586 583 $blogname = apply_filters( 'newblogname', $blogname ); 587 584 588 $blog_title = stripslashes( $blog_title );585 $blog_title = $blog_title; 589 586 590 587 if ( empty( $blog_title ) ) 591 588 $errors->add('blog_title', __( 'Please enter a site title.' ) ); … … 638 635 global $wpdb; 639 636 640 637 $key = substr( md5( time() . rand() . $domain ), 0, 16 ); 641 $meta = serialize($meta); 642 $domain = $wpdb->escape($domain); 643 $path = $wpdb->escape($path); 644 $title = $wpdb->escape($title); 638 $meta = serialize( $meta ); 645 639 646 640 $wpdb->insert( $wpdb->signups, array( 647 641 'domain' => $domain, … … 654 648 'meta' => $meta 655 649 ) ); 656 650 657 wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta);651 wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ); 658 652 } 659 653 660 654 /** … … 844 838 } 845 839 846 840 $meta = maybe_unserialize($signup->meta); 847 $user_login = $ wpdb->escape($signup->user_login);848 $user_email = $ wpdb->escape($signup->user_email);841 $user_login = $signup->user_login; 842 $user_email = $signup->user_email; 849 843 $password = wp_generate_password( 12, false ); 850 844 851 845 $user_id = username_exists($user_login); … … 1162 1156 else 1163 1157 update_option( 'upload_path', get_blog_option( $current_site->blog_id, 'upload_path' ) ); 1164 1158 1165 update_option( 'blogname', stripslashes( $blog_title ));1159 update_option( 'blogname', $blog_title ); 1166 1160 update_option( 'admin_email', '' ); 1167 1161 1168 1162 // remove all perms … … 1219 1213 if ( !apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta) ) 1220 1214 return false; 1221 1215 1222 $welcome_email = stripslashes( get_site_option( 'welcome_email' ));1216 $welcome_email = get_site_option( 'welcome_email' ); 1223 1217 if ( $welcome_email == false ) 1224 $welcome_email = stripslashes(__( 'Dear User,1218 $welcome_email = __( 'Dear User, 1225 1219 1226 1220 Your new SITE_NAME site has been successfully set up at: 1227 1221 BLOG_URL … … 1233 1227 1234 1228 We hope you enjoy your new site. Thanks! 1235 1229 1236 --The Team @ SITE_NAME' ) );1230 --The Team @ SITE_NAME' ); 1237 1231 1238 1232 $url = get_blogaddress_by_id($blog_id); 1239 1233 $user = get_userdata( $user_id ); … … 1257 1251 if ( empty( $current_site->site_name ) ) 1258 1252 $current_site->site_name = 'WordPress'; 1259 1253 1260 $subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, stripslashes( $title )) );1254 $subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, $title ) ); 1261 1255 wp_mail($user->user_email, $subject, $message, $message_headers); 1262 1256 return true; 1263 1257 } … … 1512 1506 function wpmu_log_new_registrations( $blog_id, $user_id ) { 1513 1507 global $wpdb; 1514 1508 $user = get_userdata( (int) $user_id ); 1515 $wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR']), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );1509 $wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) ); 1516 1510 } 1517 1511 1518 1512 /** -
wp-includes/meta.php
42 42 43 43 $column = esc_sql($meta_type . '_id'); 44 44 45 // expected_slashed ($meta_key)46 $meta_key = stripslashes($meta_key);47 $meta_value = stripslashes_deep($meta_value);48 45 $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type ); 49 46 50 47 $check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique ); … … 113 110 $column = esc_sql($meta_type . '_id'); 114 111 $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id'; 115 112 116 // expected_slashed ($meta_key)117 $meta_key = stripslashes($meta_key);118 113 $passed_value = $meta_value; 119 $meta_value = stripslashes_deep($meta_value);120 114 $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type ); 121 115 122 116 $check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value ); … … 195 189 196 190 $type_column = esc_sql($meta_type . '_id'); 197 191 $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id'; 198 // expected_slashed ($meta_key)199 $meta_key = stripslashes($meta_key);200 $meta_value = stripslashes_deep($meta_value);201 192 202 193 $check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all ); 203 194 if ( null !== $check ) -
wp-includes/nav-menu.php
369 369 370 370 $menu_item_db_id = (int) $menu_item_db_id; 371 371 372 update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key($args['menu-item-type']) );373 update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', strval( (int) $args['menu-item-parent-id'] ) );374 update_post_meta( $menu_item_db_id, '_menu_item_object_id', strval( (int) $args['menu-item-object-id'] ) );375 update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object']) );376 update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key($args['menu-item-target']) );372 wp_update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key($args['menu-item-type']) ); 373 wp_update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', strval( (int) $args['menu-item-parent-id'] ) ); 374 wp_update_post_meta( $menu_item_db_id, '_menu_item_object_id', strval( (int) $args['menu-item-object-id'] ) ); 375 wp_update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object']) ); 376 wp_update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key($args['menu-item-target']) ); 377 377 378 378 $args['menu-item-classes'] = array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-classes'] ) ); 379 379 $args['menu-item-xfn'] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-xfn'] ) ) ); 380 update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] );381 update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] );382 update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw($args['menu-item-url']) );380 wp_update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] ); 381 wp_update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] ); 382 wp_update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw($args['menu-item-url']) ); 383 383 384 384 if ( 0 == $menu_id ) 385 update_post_meta( $menu_item_db_id, '_menu_item_orphaned', (string) time() );385 wp_update_post_meta( $menu_item_db_id, '_menu_item_orphaned', (string) time() ); 386 386 elseif ( get_post_meta( $menu_item_db_id, '_menu_item_orphaned' ) ) 387 387 delete_post_meta( $menu_item_db_id, '_menu_item_orphaned' ); 388 388 -
wp-mail.php
202 202 $post_category = array(get_option('default_email_category')); 203 203 204 204 $post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status'); 205 $post_data = add_magic_quotes($post_data);206 205 207 206 $post_ID = wp_insert_post($post_data); 208 207 if ( is_wp_error( $post_ID ) ) -
wp-trackback.php
45 45 $charset = isset($_POST['charset']) ? $_POST['charset'] : ''; 46 46 47 47 // These three are stripslashed here so that they can be properly escaped after mb_convert_encoding() 48 $title = isset($_POST['title']) ? stripslashes($_POST['title']) : '';49 $excerpt = isset($_POST['excerpt']) ? stripslashes($_POST['excerpt']) : '';50 $blog_name = isset($_POST['blog_name']) ? stripslashes($_POST['blog_name']) : '';48 $title = isset($_POST['title']) ? wp_unslash( $_POST['title'] ) : ''; 49 $excerpt = isset($_POST['excerpt']) ? wp_unslash( $_POST['excerpt'] ) : ''; 50 $blog_name = isset($_POST['blog_name']) ? wp_unslash( $_POST['blog_name'] ) : ''; 51 51 52 52 if ($charset) 53 53 $charset = str_replace( array(',', ' '), '', strtoupper( trim($charset) ) ); … … 64 64 $blog_name = mb_convert_encoding($blog_name, get_option('blog_charset'), $charset); 65 65 } 66 66 67 // Now that mb_convert_encoding() has been given a swing, we need to escape these three68 $title = $wpdb->escape($title);69 $excerpt = $wpdb->escape($excerpt);70 $blog_name = $wpdb->escape($blog_name);71 72 67 if ( is_single() || is_page() ) 73 68 $tb_id = $posts[0]->ID; 74 69 -
wp-admin/network.php
520 520 $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH ); 521 521 $subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false; 522 522 if ( ! network_domain_check() ) { 523 $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install );523 $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install ); 524 524 if ( is_wp_error( $result ) ) { 525 525 if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) 526 526 network_step2( $result ); -
wp-admin/users.php
64 64 ); 65 65 66 66 if ( empty($_REQUEST) ) { 67 $referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr( stripslashes($_SERVER['REQUEST_URI'])) . '" />';67 $referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />'; 68 68 } elseif ( isset($_REQUEST['wp_http_referer']) ) { 69 $redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), stripslashes($_REQUEST['wp_http_referer']));69 $redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash( $_REQUEST['wp_http_referer'] ) ); 70 70 $referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr($redirect) . '" />'; 71 71 } else { 72 72 $redirect = 'users.php'; … … 357 357 default: 358 358 359 359 if ( !empty($_GET['_wp_http_referer']) ) { 360 wp_redirect( remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));360 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 361 361 exit; 362 362 } 363 363 … … 381 381 case 'add': 382 382 if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) { 383 383 $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ), 384 esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ),384 esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 385 385 self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>'; 386 386 } else { 387 387 $messages[] = '<div id="message" class="updated"><p>' . __( 'New user created.' ) . '</p></div>'; -
wp-admin/edit-comments.php
20 20 check_admin_referer( 'bulk-comments' ); 21 21 22 22 if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) { 23 $comment_status = $ wpdb->escape( $_REQUEST['comment_status'] );24 $delete_time = $ wpdb->escape( $_REQUEST['pagegen_timestamp'] );25 $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt");23 $comment_status = $_REQUEST['comment_status']; 24 $delete_time = $_REQUEST['pagegen_timestamp']; 25 $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) ); 26 26 $doaction = 'delete'; 27 27 } elseif ( isset( $_REQUEST['delete_comments'] ) ) { 28 28 $comment_ids = $_REQUEST['delete_comments']; … … 95 95 wp_safe_redirect( $redirect_to ); 96 96 exit; 97 97 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { 98 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );98 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 99 99 exit; 100 100 } 101 101 … … 153 153 echo __('Comments'); 154 154 155 155 if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) 156 printf( '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?>156 printf( '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?> 157 157 </h2> 158 158 159 159 <?php -
wp-admin/includes/class-wp-ms-sites-list-table.php
29 29 30 30 $pagenum = $this->get_pagenum(); 31 31 32 $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : '';32 $s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST[ 's' ] ) ) : ''; 33 33 $wild = ''; 34 34 if ( false !== strpos($s, '*') ) { 35 35 $wild = '%'; -
wp-admin/includes/plugin-install.php
116 116 * @since 2.7.0 117 117 */ 118 118 function install_search_form( $type_selector = true ) { 119 $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : 'term';120 $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';119 $type = isset($_REQUEST['type']) ? wp_unslash( $_REQUEST['type'] ) : 'term'; 120 $term = isset($_REQUEST['s']) ? wp_unslash( $_REQUEST['s'] ) : ''; 121 121 122 122 ?><form id="search-plugins" method="get" action=""> 123 123 <input type="hidden" name="tab" value="search" /> … … 160 160 * 161 161 */ 162 162 function install_plugins_favorites_form() { 163 $user = ! empty( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );163 $user = ! empty( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); 164 164 ?> 165 165 <p class="install-help"><?php _e( 'If you have marked plugins as favorites on WordPress.org, you can browse them here.' ); ?></p> 166 166 <form method="get" action=""> … … 251 251 } 252 252 } 253 253 if ( isset($_GET['from']) ) 254 $url .= '&from=' . urlencode( stripslashes($_GET['from']));254 $url .= '&from=' . urlencode( wp_unslash( $_GET['from'] ) ); 255 255 256 256 return compact('status', 'url', 'version'); 257 257 } … … 264 264 function install_plugin_information() { 265 265 global $tab; 266 266 267 $api = plugins_api('plugin_information', array('slug' => stripslashes( $_REQUEST['plugin'] ) ));267 $api = plugins_api('plugin_information', array('slug' => wp_unslash( $_REQUEST['plugin'] ) )); 268 268 269 269 if ( is_wp_error($api) ) 270 270 wp_die($api); … … 295 295 $api->$key = wp_kses( $api->$key, $plugins_allowedtags ); 296 296 } 297 297 298 $section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.298 $section = isset($_REQUEST['section']) ? wp_unslash( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English. 299 299 if ( empty($section) || ! isset($api->sections[ $section ]) ) 300 300 $section = array_shift( $section_titles = array_keys((array)$api->sections) ); 301 301 -
wp-admin/includes/bookmark.php
39 39 40 40 if ( !empty( $link_id ) ) { 41 41 $_POST['link_id'] = $link_id; 42 return wp_update_link( $_POST);42 return wp_update_link( wp_unslash( $_POST ) ); 43 43 } else { 44 return wp_insert_link( $_POST);44 return wp_insert_link( wp_unslash( $_POST ) ); 45 45 } 46 46 } 47 47 … … 137 137 $linkdata = wp_parse_args( $linkdata, $defaults ); 138 138 $linkdata = sanitize_bookmark( $linkdata, 'db' ); 139 139 140 extract( stripslashes_deep( $linkdata ), EXTR_SKIP );140 extract( $linkdata, EXTR_SKIP ); 141 141 142 142 $update = false; 143 143 … … 250 250 251 251 $link = get_bookmark( $link_id, ARRAY_A ); 252 252 253 // Escape data pulled from DB.254 $link = add_magic_quotes( $link );255 256 253 // Passed link category list overwrites existing category list if not empty. 257 254 if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] ) 258 255 && 0 != count( $linkdata['link_category'] ) ) -
wp-admin/includes/taxonomy.php
157 157 // First, get all of the original fields 158 158 $category = get_category($cat_ID, ARRAY_A); 159 159 160 // Escape data pulled from DB.161 $category = add_magic_quotes($category);162 163 160 // Merge old and new fields with new fields overwriting old ones. 164 161 $catarr = array_merge($category, $catarr); 165 162 -
wp-admin/includes/file.php
901 901 $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => '')); 902 902 903 903 // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) 904 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? stripslashes($_POST['hostname']) : $credentials['hostname']);905 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? stripslashes($_POST['username']) : $credentials['username']);906 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? stripslashes($_POST['password']) : '');904 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? wp_unslash( $_POST['hostname'] ) : $credentials['hostname']); 905 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? wp_unslash( $_POST['username'] ) : $credentials['username']); 906 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? wp_unslash( $_POST['password'] ) : ''); 907 907 908 908 // Check to see if we are setting the public/private keys for ssh 909 $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? stripslashes($_POST['public_key']) : '');910 $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? stripslashes($_POST['private_key']) : '');909 $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? wp_unslash( $_POST['public_key'] ) : ''); 910 $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? wp_unslash( $_POST['private_key'] ) : ''); 911 911 912 912 //sanitize the hostname, Some people might pass in odd-data: 913 913 $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off … … 925 925 else if ( (defined('FTP_SSL') && FTP_SSL) && 'ftpext' == $type ) //Only the FTP Extension understands SSL 926 926 $credentials['connection_type'] = 'ftps'; 927 927 else if ( !empty($_POST['connection_type']) ) 928 $credentials['connection_type'] = stripslashes($_POST['connection_type']);928 $credentials['connection_type'] = wp_unslash( $_POST['connection_type'] ); 929 929 else if ( !isset($credentials['connection_type']) ) //All else fails (And it's not defaulted to something else saved), Default to FTP 930 930 $credentials['connection_type'] = 'ftp'; 931 931 … … 1050 1050 <?php 1051 1051 foreach ( (array) $extra_fields as $field ) { 1052 1052 if ( isset( $_POST[ $field ] ) ) 1053 echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( stripslashes( $_POST[ $field ] ) ) . '" />';1053 echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />'; 1054 1054 } 1055 1055 submit_button( __( 'Proceed' ), 'button', 'upgrade' ); 1056 1056 ?> -
wp-admin/includes/class-wp-terms-list-table.php
52 52 $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter 53 53 } 54 54 55 $search = !empty( $_REQUEST['s'] ) ? trim( stripslashes( $_REQUEST['s'] ) ) : '';55 $search = !empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : ''; 56 56 57 57 $args = array( 58 58 'search' => $search, … … 61 61 ); 62 62 63 63 if ( !empty( $_REQUEST['orderby'] ) ) 64 $args['orderby'] = trim( stripslashes( $_REQUEST['orderby'] ) );64 $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) ); 65 65 66 66 if ( !empty( $_REQUEST['order'] ) ) 67 $args['order'] = trim( stripslashes( $_REQUEST['order'] ) );67 $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) ); 68 68 69 69 $this->callback_args = $args; 70 70 -
wp-admin/includes/ajax-actions.php
59 59 wp_die( 0 ); 60 60 } 61 61 62 $s = stripslashes( $_GET['q'] );62 $s = wp_unslash( $_GET['q'] ); 63 63 64 64 $comma = _x( ',', 'tag delimiter' ); 65 65 if ( ',' !== $comma ) … … 279 279 */ 280 280 281 281 function _wp_ajax_add_hierarchical_term() { 282 $action = $_POST['action']; 282 $post_data = wp_unslash( $_POST ); 283 284 $action = $post_data['action']; 283 285 $taxonomy = get_taxonomy(substr($action, 4)); 284 286 check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name ); 285 287 if ( !current_user_can( $taxonomy->cap->edit_terms ) ) 286 288 wp_die( -1 ); 287 $names = explode(',', $ _POST['new'.$taxonomy->name]);288 $parent = isset($ _POST['new'.$taxonomy->name.'_parent']) ? (int) $_POST['new'.$taxonomy->name.'_parent'] : 0;289 $names = explode(',', $post_data['new'.$taxonomy->name]); 290 $parent = isset($post_data['new'.$taxonomy->name.'_parent']) ? (int) $post_data['new'.$taxonomy->name.'_parent'] : 0; 289 291 if ( 0 > $parent ) 290 292 $parent = 0; 291 293 if ( $taxonomy->name == 'category' ) 292 $post_category = isset( $_POST['post_category']) ? (array) $_POST['post_category'] : array();294 $post_category = isset( $post_data['post_category'] ) ? (array) $post_data['post_category'] : array(); 293 295 else 294 $post_category = ( isset( $_POST['tax_input']) && isset($_POST['tax_input'][$taxonomy->name]) ) ? (array) $_POST['tax_input'][$taxonomy->name] : array();296 $post_category = ( isset( $post_data['tax_input'] ) && isset( $post_data['tax_input'][$taxonomy->name] ) ) ? (array) $post_data['tax_input'][$taxonomy->name] : array(); 295 297 $checked_categories = array_map( 'absint', (array) $post_category ); 296 298 $popular_ids = wp_popular_terms_checklist($taxonomy->name, 0, 10, false); 297 299 … … 559 561 check_ajax_referer( $action ); 560 562 if ( !current_user_can( 'manage_categories' ) ) 561 563 wp_die( -1 ); 562 $names = explode( ',', $_POST['newcat']);564 $names = explode( ',', wp_unslash( $_POST['newcat'] ) ); 563 565 $x = new WP_Ajax_Response(); 564 566 foreach ( $names as $cat_name ) { 565 567 $cat_name = trim($cat_name); … … 572 574 continue; 573 575 else if ( is_array( $cat_id ) ) 574 576 $cat_id = $cat_id['term_id']; 575 $cat_name = esc_html( stripslashes($cat_name));577 $cat_name = esc_html( wp_unslash( $cat_name ) ); 576 578 $x->add( array( 577 579 'what' => 'link-category', 578 580 'id' => $cat_id, … … 586 588 function wp_ajax_add_tag() { 587 589 global $wp_list_table; 588 590 591 $post_data = wp_unslash( $_POST ); 592 589 593 check_ajax_referer( 'add-tag', '_wpnonce_add-tag' ); 590 $post_type = !empty($ _POST['post_type']) ? $_POST['post_type'] : 'post';591 $taxonomy = !empty($ _POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';594 $post_type = !empty($post_data['post_type']) ? $post_data['post_type'] : 'post'; 595 $taxonomy = !empty($post_data['taxonomy']) ? $post_data['taxonomy'] : 'post_tag'; 592 596 $tax = get_taxonomy($taxonomy); 593 597 594 598 if ( !current_user_can( $tax->cap->edit_terms ) ) … … 596 600 597 601 $x = new WP_Ajax_Response(); 598 602 599 $tag = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST);603 $tag = wp_insert_term( $post_data['tag-name'], $taxonomy, $post_data ); 600 604 601 605 if ( !$tag || is_wp_error($tag) || (!$tag = get_term( $tag['term_id'], $taxonomy )) ) { 602 606 $message = __('An error has occurred. Please reload the page and try again.'); … … 610 614 $x->send(); 611 615 } 612 616 613 $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $ _POST['screen'] ) );617 $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $post_data['screen'] ) ); 614 618 615 619 $level = 0; 616 620 if ( is_taxonomy_hierarchical($taxonomy) ) { … … 728 732 $user = wp_get_current_user(); 729 733 if ( $user->exists() ) { 730 734 $user_ID = $user->ID; 731 $comment_author = $ wpdb->escape($user->display_name);732 $comment_author_email = $ wpdb->escape($user->user_email);733 $comment_author_url = $ wpdb->escape($user->user_url);734 $comment_content = trim( $_POST['content']);735 $comment_author = $user->display_name; 736 $comment_author_email = $user->user_email; 737 $comment_author_url = $user->user_url; 738 $comment_content = trim( wp_unslash( $_POST['content'] ) ); 735 739 if ( current_user_can( 'unfiltered_html' ) ) { 736 740 if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) { 737 741 kses_remove_filters(); // start with a clean slate … … 957 961 ) ); 958 962 } else { // Update? 959 963 $mid = (int) key( $_POST['meta'] ); 960 $key = stripslashes( $_POST['meta'][$mid]['key'] );961 $value = stripslashes( $_POST['meta'][$mid]['value'] );964 $key = wp_unslash( $_POST['meta'][$mid]['key'] ); 965 $value = wp_unslash( $_POST['meta'][$mid]['value'] ); 962 966 if ( '' == trim($key) ) 963 967 wp_die( __( 'Please provide a custom field name.' ) ); 964 968 if ( '' == trim($value) ) … … 1227 1231 $args = array(); 1228 1232 1229 1233 if ( isset( $_POST['search'] ) ) 1230 $args['s'] = stripslashes( $_POST['search'] );1234 $args['s'] = wp_unslash( $_POST['search'] ); 1231 1235 $args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; 1232 1236 1233 1237 require(ABSPATH . WPINC . '/class-wp-editor.php'); … … 1328 1332 $data = &$_POST; 1329 1333 1330 1334 $post = get_post( $post_ID, ARRAY_A ); 1331 $post = add_magic_quotes($post); //since it is from db1332 1335 1333 1336 $data['content'] = $post['post_content']; 1334 1337 $data['excerpt'] = $post['post_excerpt']; … … 1376 1379 global $wp_list_table; 1377 1380 1378 1381 check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' ); 1382 1383 $post_data = wp_unslash( $_POST ); 1379 1384 1380 $taxonomy = sanitize_key( $ _POST['taxonomy'] );1385 $taxonomy = sanitize_key( $post_data['taxonomy'] ); 1381 1386 $tax = get_taxonomy( $taxonomy ); 1382 1387 if ( ! $tax ) 1383 1388 wp_die( 0 ); … … 1387 1392 1388 1393 $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) ); 1389 1394 1390 if ( ! isset($ _POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )1395 if ( ! isset($post_data['tax_ID']) || ! ( $id = (int) $post_data['tax_ID'] ) ) 1391 1396 wp_die( -1 ); 1392 1397 1393 1398 $tag = get_term( $id, $taxonomy ); 1394 $ _POST['description'] = $tag->description;1399 $post_data['description'] = $tag->description; 1395 1400 1396 $updated = wp_update_term($id, $taxonomy, $ _POST);1401 $updated = wp_update_term($id, $taxonomy, $post_data ); 1397 1402 if ( $updated && !is_wp_error($updated) ) { 1398 1403 $tag = get_term( $updated['term_id'], $taxonomy ); 1399 1404 if ( !$tag || is_wp_error( $tag ) ) { … … 1425 1430 $post_types = get_post_types( array( 'public' => true ), 'objects' ); 1426 1431 unset( $post_types['attachment'] ); 1427 1432 1428 $s = stripslashes( $_POST['ps'] );1433 $s = wp_unslash( $_POST['ps'] ); 1429 1434 $searchand = $search = ''; 1430 1435 $args = array( 1431 1436 'post_type' => array_keys( $post_types ), … … 1596 1601 $post_id = null; 1597 1602 } 1598 1603 1599 $post_data = isset( $_REQUEST['post_data'] ) ? $_REQUEST['post_data']: array();1604 $post_data = isset( $_REQUEST['post_data'] ) ? wp_unslash( $_REQUEST['post_data'] ) : array(); 1600 1605 1601 1606 // If the context is custom header or background, make sure the uploaded file is an image. 1602 1607 if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ) ) ) { … … 1630 1635 1631 1636 if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) { 1632 1637 if ( 'custom-background' === $post_data['context'] ) 1633 update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] );1638 wp_update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] ); 1634 1639 1635 1640 if ( 'custom-header' === $post_data['context'] ) 1636 update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] );1641 wp_update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] ); 1637 1642 } 1638 1643 1639 1644 if ( ! $attachment = wp_prepare_attachment_for_js( $attachment_id ) ) … … 1778 1783 wp_die( 0 ); 1779 1784 1780 1785 $new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 ) + 5 ) . ':' . $active_lock[1]; 1781 update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );1786 wp_update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) ); 1782 1787 wp_die( 1 ); 1783 1788 } 1784 1789 … … 1873 1878 if ( ! current_user_can( 'edit_post', $id ) ) 1874 1879 wp_send_json_error(); 1875 1880 1876 $changes = $_REQUEST['changes'];1881 $changes = wp_unslash( $_REQUEST['changes'] ); 1877 1882 $post = get_post( $id, ARRAY_A ); 1878 1883 1879 1884 if ( 'attachment' != $post['post_type'] ) … … 1890 1895 1891 1896 if ( isset( $changes['alt'] ) ) { 1892 1897 $alt = get_post_meta( $id, '_wp_attachment_image_alt', true ); 1893 $new_alt = stripslashes( $changes['alt'] );1898 $new_alt = $changes['alt']; 1894 1899 if ( $alt != $new_alt ) { 1895 1900 $new_alt = wp_strip_all_tags( $new_alt, true ); 1896 update_post_meta( $id, '_wp_attachment_image_alt', addslashes( $new_alt ));1901 wp_update_post_meta( $id, '_wp_attachment_image_alt', $new_alt ); 1897 1902 } 1898 1903 } 1899 1904 … … 1915 1920 1916 1921 if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) ) 1917 1922 wp_send_json_error(); 1918 $attachment_data = $_REQUEST['attachments'][ $id ];1923 $attachment_data = wp_unslash( $_REQUEST['attachments'][ $id ] ); 1919 1924 1920 1925 check_ajax_referer( 'update-post_' . $id, 'nonce' ); 1921 1926 … … 1959 1964 1960 1965 check_ajax_referer( 'update-post_' . $post_id, 'nonce' ); 1961 1966 1962 $attachments = $_REQUEST['attachments'];1967 $attachments = wp_unslash( $_REQUEST['attachments'] ); 1963 1968 1964 1969 if ( ! current_user_can( 'edit_post', $post_id ) ) 1965 1970 wp_send_json_error(); … … 1990 1995 function wp_ajax_send_attachment_to_editor() { 1991 1996 check_ajax_referer( 'media-send-to-editor', 'nonce' ); 1992 1997 1993 $attachment = stripslashes_deep( $_POST['attachment'] );1998 $attachment = wp_unslash( $_POST['attachment'] ); 1994 1999 1995 2000 $id = intval( $attachment['id'] ); 1996 2001 … … 2045 2050 function wp_ajax_send_link_to_editor() { 2046 2051 check_ajax_referer( 'media-send-to-editor', 'nonce' ); 2047 2052 2048 if ( ! $src = stripslashes( $_POST['src'] ) )2053 if ( ! $src = wp_unslash( $_POST['src'] ) ) 2049 2054 wp_send_json_error(); 2050 2055 2051 2056 if ( ! strpos( $src, '://' ) ) … … 2054 2059 if ( ! $src = esc_url_raw( $src ) ) 2055 2060 wp_send_json_error(); 2056 2061 2057 if ( ! $title = trim( stripslashes( $_POST['title'] ) ) )2062 if ( ! $title = trim( wp_unslash( $_POST['title'] ) ) ) 2058 2063 $title = wp_basename( $src ); 2059 2064 2060 2065 $html = ''; … … 2083 2088 $screen_id = 'site'; 2084 2089 2085 2090 if ( ! empty($_POST['data']) ) { 2086 $data = (array) $_POST['data'];2091 $data = wp_unslash( (array) $_POST['data'] ); 2087 2092 // todo: how much to sanitize and preset and what to leave to be accessed from $data or $_POST..? 2088 2093 $user = wp_get_current_user(); 2089 2094 $data['user_id'] = $user->exists() ? $user->ID : 0; -
wp-admin/includes/post.php
149 149 */ 150 150 function edit_post( $post_data = null ) { 151 151 152 if ( empty( $post_data) )153 $post_data = &$_POST;152 if ( empty( $post_data ) ) 153 $post_data = wp_unslash( $_POST ); 154 154 155 155 // Clear out any data in internal vars. 156 156 unset( $post_data['filter'] ); … … 228 228 if ( 'attachment' == $post_data['post_type'] ) { 229 229 if ( isset( $post_data[ '_wp_attachment_image_alt' ] ) ) { 230 230 $image_alt = get_post_meta( $post_ID, '_wp_attachment_image_alt', true ); 231 if ( $image_alt != stripslashes( $post_data['_wp_attachment_image_alt'] ) ) { 232 $image_alt = wp_strip_all_tags( stripslashes( $post_data['_wp_attachment_image_alt'] ), true ); 233 // update_meta expects slashed 234 update_post_meta( $post_ID, '_wp_attachment_image_alt', addslashes( $image_alt ) ); 231 if ( $image_alt != $post_data['_wp_attachment_image_alt'] ) { 232 $image_alt = wp_strip_all_tags( $post_data['_wp_attachment_image_alt'], true ); 233 wp_update_post_meta( $post_ID, '_wp_attachment_image_alt', $image_alt ); 235 234 } 236 235 } 237 236 … … 241 240 242 241 add_meta( $post_ID ); 243 242 244 update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );243 wp_update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); 245 244 246 245 wp_update_post( $post_data ); 247 246 … … 422 421 423 422 $post_title = ''; 424 423 if ( !empty( $_REQUEST['post_title'] ) ) 425 $post_title = esc_html( stripslashes( $_REQUEST['post_title'] ));424 $post_title = esc_html( wp_unslash( $_REQUEST['post_title'] )); 426 425 427 426 $post_content = ''; 428 427 if ( !empty( $_REQUEST['content'] ) ) 429 $post_content = esc_html( stripslashes( $_REQUEST['content'] ));428 $post_content = esc_html( wp_unslash( $_REQUEST['content'] )); 430 429 431 430 $post_excerpt = ''; 432 431 if ( !empty( $_REQUEST['excerpt'] ) ) 433 $post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] ));432 $post_excerpt = esc_html( wp_unslash( $_REQUEST['excerpt'] )); 434 433 435 434 if ( $create_in_db ) { 436 435 $post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) ); … … 479 478 function post_exists($title, $content = '', $date = '') { 480 479 global $wpdb; 481 480 482 $post_title = s tripslashes( sanitize_post_field( 'post_title', $title, 0, 'db' ));483 $post_content = s tripslashes( sanitize_post_field( 'post_content', $content, 0, 'db' ));484 $post_date = s tripslashes( sanitize_post_field( 'post_date', $date, 0, 'db' ));481 $post_title = sanitize_post_field( 'post_title', $title, 0, 'db' ); 482 $post_content = sanitize_post_field( 'post_content', $content, 0, 'db' ); 483 $post_date = sanitize_post_field( 'post_date', $date, 0, 'db' ); 485 484 486 485 $query = "SELECT ID FROM $wpdb->posts WHERE 1=1"; 487 486 $args = array(); … … 559 558 } 560 559 561 560 // Create the post. 562 $post_ID = wp_insert_post( $_POST);561 $post_ID = wp_insert_post( wp_unslash( $_POST ) ); 563 562 if ( is_wp_error( $post_ID ) ) 564 563 return $post_ID; 565 564 … … 568 567 569 568 add_meta( $post_ID ); 570 569 571 add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );570 wp_add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); 572 571 573 572 // Now that we have an ID we can fix any attachment anchor hrefs 574 573 _fix_attachment_links( $post_ID ); … … 612 611 global $wpdb; 613 612 $post_ID = (int) $post_ID; 614 613 615 $metakeyselect = isset($_POST['metakeyselect']) ? stripslashes( trim( $_POST['metakeyselect'] ) ) : '';616 $metakeyinput = isset($_POST['metakeyinput']) ? stripslashes( trim( $_POST['metakeyinput'] ) ) : '';617 $metavalue = isset($_POST['metavalue']) ? $_POST['metavalue']: '';614 $metakeyselect = isset($_POST['metakeyselect']) ? wp_unslash( trim( $_POST['metakeyselect'] ) ) : ''; 615 $metakeyinput = isset($_POST['metakeyinput']) ? wp_unslash( trim( $_POST['metakeyinput'] ) ) : ''; 616 $metavalue = isset($_POST['metavalue']) ? wp_unslash( trim( $_POST['metavalue'] ) ) : ''; 618 617 if ( is_string( $metavalue ) ) 619 618 $metavalue = trim( $metavalue ); 620 619 … … 631 630 if ( is_protected_meta( $metakey, 'post' ) || ! current_user_can( 'add_post_meta', $post_ID, $metakey ) ) 632 631 return false; 633 632 634 $metakey = esc_sql( $metakey ); 635 636 return add_post_meta( $post_ID, $metakey, $metavalue ); 633 return wp_add_post_meta( $post_ID, $metakey, $metavalue ); 637 634 } 638 635 639 636 return false; … … 706 703 * @since 1.2.0 707 704 * 708 705 * @param unknown_type $meta_id 709 * @param unknown_type $meta_key Expect Slashed710 * @param unknown_type $meta_value Expect Slashed706 * @param unknown_type $meta_key 707 * @param unknown_type $meta_value 711 708 * @return unknown 712 709 */ 713 710 function update_meta( $meta_id, $meta_key, $meta_value ) { 714 $meta_key = stripslashes( $meta_key );715 $meta_value = stripslashes_deep( $meta_value );716 717 711 return update_metadata_by_mid( 'post', $meta_id, $meta_value, $meta_key ); 718 712 } 719 713 … … 767 761 768 762 if ( $replace ) { 769 763 $post['post_content'] = $content; 770 // Escape data pulled from DB.771 $post = add_magic_quotes($post);772 764 773 765 return wp_update_post($post); 774 766 } … … 1179 1171 $now = time(); 1180 1172 $lock = "$now:$user_id"; 1181 1173 1182 update_post_meta( $post->ID, '_edit_lock', $lock );1174 wp_update_post_meta( $post->ID, '_edit_lock', $lock ); 1183 1175 return array( $now, $user_id ); 1184 1176 } 1185 1177 … … 1230 1222 1231 1223 // Only store one autosave. If there is already an autosave, overwrite it. 1232 1224 if ( $old_autosave = wp_get_post_autosave( $post_id ) ) { 1233 $new_autosave = _wp_post_revision_fields( $_POST, true );1225 $new_autosave = _wp_post_revision_fields( wp_unslash( $_POST ), true ); 1234 1226 $new_autosave['ID'] = $old_autosave->ID; 1235 1227 $new_autosave['post_author'] = get_current_user_id(); 1236 1228 return wp_update_post( $new_autosave ); 1237 1229 } 1238 1230 1239 1231 // _wp_put_post_revision() expects unescaped. 1240 $_POST = stripslashes_deep($_POST);1232 $_POST = wp_unslash( $_POST ); 1241 1233 1242 1234 // Otherwise create the new autosave as a special post revision 1243 1235 return _wp_put_post_revision( $_POST, true ); -
wp-admin/includes/class-wp-users-list-table.php
241 241 // Check if the user for this row is editable 242 242 if ( current_user_can( 'list_users' ) ) { 243 243 // Set up the user editing link 244 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );244 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) ); 245 245 246 246 // Set up the hover actions for this user 247 247 $actions = array(); -
wp-admin/includes/upgrade.php
132 132 $first_post = get_site_option( 'first_post' ); 133 133 134 134 if ( empty($first_post) ) 135 $first_post = stripslashes( __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ));135 $first_post = __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ); 136 136 137 137 $first_post = str_replace( "SITE_URL", esc_url( network_home_url() ), $first_post ); 138 138 $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post ); … … 636 636 $users = $wpdb->get_results("SELECT * FROM $wpdb->users"); 637 637 foreach ( $users as $user ) : 638 638 if ( !empty( $user->user_firstname ) ) 639 update_user_meta( $user->ID, 'first_name', $ wpdb->escape($user->user_firstname));639 update_user_meta( $user->ID, 'first_name', $user->user_firstname ); 640 640 if ( !empty( $user->user_lastname ) ) 641 update_user_meta( $user->ID, 'last_name', $ wpdb->escape($user->user_lastname));641 update_user_meta( $user->ID, 'last_name', $user->user_lastname ); 642 642 if ( !empty( $user->user_nickname ) ) 643 update_user_meta( $user->ID, 'nickname', $ wpdb->escape($user->user_nickname));643 update_user_meta( $user->ID, 'nickname', $user->user_nickname ); 644 644 if ( !empty( $user->user_level ) ) 645 645 update_user_meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level ); 646 646 if ( !empty( $user->user_icq ) ) 647 update_user_meta( $user->ID, 'icq', $ wpdb->escape($user->user_icq));647 update_user_meta( $user->ID, 'icq', $user->user_icq ); 648 648 if ( !empty( $user->user_aim ) ) 649 update_user_meta( $user->ID, 'aim', $ wpdb->escape($user->user_aim));649 update_user_meta( $user->ID, 'aim', $user->user_aim ); 650 650 if ( !empty( $user->user_msn ) ) 651 update_user_meta( $user->ID, 'msn', $ wpdb->escape($user->user_msn));651 update_user_meta( $user->ID, 'msn', $user->user_msn ); 652 652 if ( !empty( $user->user_yim ) ) 653 update_user_meta( $user->ID, 'yim', $ wpdb->escape($user->user_icq));653 update_user_meta( $user->ID, 'yim', $user->user_icq ); 654 654 if ( !empty( $user->user_description ) ) 655 update_user_meta( $user->ID, 'description', $ wpdb->escape($user->user_description));655 update_user_meta( $user->ID, 'description', $user->user_description ); 656 656 657 657 if ( isset( $user->user_idmode ) ): 658 658 $idmode = $user->user_idmode; … … 854 854 foreach ( $link_cats as $category) { 855 855 $cat_id = (int) $category->cat_id; 856 856 $term_id = 0; 857 $name = $ wpdb->escape($category->cat_name);857 $name = $category->cat_name; 858 858 $slug = sanitize_title($name); 859 859 $term_group = 0; 860 860 -
wp-admin/includes/class-wp-ms-themes-list-table.php
126 126 function _search_callback( $theme ) { 127 127 static $term; 128 128 if ( is_null( $term ) ) 129 $term = stripslashes( $_REQUEST['s'] );129 $term = wp_unslash( $_REQUEST['s'] ); 130 130 131 131 foreach ( array( 'Name', 'Description', 'Author', 'Author', 'AuthorURI' ) as $field ) { 132 132 // Don't mark up; Do translate. -
wp-admin/includes/class-wp-plugin-install-list-table.php
48 48 49 49 switch ( $tab ) { 50 50 case 'search': 51 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : 'term';52 $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';51 $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; 52 $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; 53 53 54 54 switch ( $type ) { 55 55 case 'tag': … … 73 73 break; 74 74 75 75 case 'favorites': 76 $user = isset( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );76 $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); 77 77 update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); 78 78 if ( $user ) 79 79 $args['user'] = $user; -
wp-admin/includes/dashboard.php
1093 1093 $widget_options[$widget_id]['number'] = $number; 1094 1094 1095 1095 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) { 1096 $_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] );1096 $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] ); 1097 1097 $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] ); 1098 1098 // title is optional. If black, fill it if possible 1099 1099 if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { -
wp-admin/includes/misc.php
220 220 * @return string 221 221 */ 222 222 function url_shorten( $url ) { 223 $short_url = str_replace( 'http://', '', stripslashes( $url ));223 $short_url = str_replace( 'http://', '', wp_unslash( $url )); 224 224 $short_url = str_replace( 'www.', '', $short_url ); 225 225 $short_url = untrailingslashit( $short_url ); 226 226 if ( strlen( $short_url ) > 35 ) … … 323 323 324 324 if ( !$user = wp_get_current_user() ) 325 325 return; 326 $option = $_POST['wp_screen_options']['option'];327 $value = $_POST['wp_screen_options']['value'];326 $option = wp_unslash( $_POST['wp_screen_options']['option'] ); 327 $value = wp_unslash( $_POST['wp_screen_options']['value'] ); 328 328 329 329 if ( $option != sanitize_key( $option ) ) 330 330 return; -
wp-admin/includes/class-wp-theme-install-list-table.php
24 24 $search_terms = array(); 25 25 $search_string = ''; 26 26 if ( ! empty( $_REQUEST['s'] ) ){ 27 $search_string = strtolower( stripslashes( $_REQUEST['s'] ) );27 $search_string = strtolower( wp_unslash( $_REQUEST['s'] ) ); 28 28 $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); 29 29 } 30 30 … … 59 59 60 60 switch ( $tab ) { 61 61 case 'search': 62 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : 'term';62 $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; 63 63 switch ( $type ) { 64 64 case 'tag': 65 65 $args['tag'] = array_map( 'sanitize_key', $search_terms ); -
wp-admin/includes/deprecated.php
472 472 function WP_User_Search ($search_term = '', $page = '', $role = '') { 473 473 _deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' ); 474 474 475 $this->search_term = stripslashes( $search_term );475 $this->search_term = $search_term; 476 476 $this->raw_page = ( '' == $page ) ? false : (int) $page; 477 477 $this->page = (int) ( '' == $page ) ? 1 : $page; 478 478 $this->role = $role; … … 551 551 * @access public 552 552 */ 553 553 function prepare_vars_for_template_usage() { 554 $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone554 $this->search_term = $this->search_term; // done with DB, from now on we want slashes gone 555 555 } 556 556 557 557 /** -
wp-admin/includes/class-wp-upgrader.php
1427 1427 1428 1428 $install_actions = array(); 1429 1429 1430 $from = isset($_GET['from']) ? stripslashes($_GET['from']) : 'plugins';1430 $from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins'; 1431 1431 1432 1432 if ( 'import' == $from ) 1433 1433 $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&from=import&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin & Run Importer') . '</a>'; -
wp-admin/includes/schema.php
505 505 else 506 506 $autoload = 'yes'; 507 507 508 $option = $wpdb->escape($option);509 508 if ( is_array($value) ) 510 509 $value = serialize($value); 511 $value = $wpdb->escape($value);512 510 if ( !empty($insert) ) 513 511 $insert .= ', '; 514 $insert .= "('$option', '$value', '$autoload')";512 $insert .= $wpdb->prepare( "(%s, %s, %s)", $option, $value, $autoload ); 515 513 } 516 514 517 515 if ( !empty($insert) ) … … 921 919 922 920 $insert = ''; 923 921 foreach ( $sitemeta as $meta_key => $meta_value ) { 924 $meta_key = $wpdb->escape( $meta_key );925 922 if ( is_array( $meta_value ) ) 926 923 $meta_value = serialize( $meta_value ); 927 $meta_value = $wpdb->escape( $meta_value );928 924 if ( !empty( $insert ) ) 929 925 $insert .= ', '; 930 $insert .= "( $network_id, '$meta_key', '$meta_value')";926 $insert .= $wpdb->prepare( "( %d, %s, %s)", $network_id, $meta_key, $meta_value ); 931 927 } 932 928 $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); 933 929 -
wp-admin/includes/comment.php
19 19 function comment_exists($comment_author, $comment_date) { 20 20 global $wpdb; 21 21 22 $comment_author = stripslashes($comment_author);23 $comment_date = stripslashes($comment_date);24 25 22 return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments 26 23 WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) ); 27 24 } … … 33 30 */ 34 31 function edit_comment() { 35 32 36 if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) ) 33 $post_data = wp_unslash( $_POST ); 34 35 if ( ! current_user_can( 'edit_comment', (int) $post_data['comment_ID'] ) ) 37 36 wp_die ( __( 'You are not allowed to edit comments on this post.' ) ); 38 37 39 $ _POST['comment_author'] = $_POST['newcomment_author'];40 $ _POST['comment_author_email'] = $_POST['newcomment_author_email'];41 $ _POST['comment_author_url'] = $_POST['newcomment_author_url'];42 $ _POST['comment_approved'] = $_POST['comment_status'];43 $ _POST['comment_content'] = $_POST['content'];44 $ _POST['comment_ID'] = (int) $_POST['comment_ID'];38 $post_data['comment_author'] = $post_data['newcomment_author']; 39 $post_data['comment_author_email'] = $post_data['newcomment_author_email']; 40 $post_data['comment_author_url'] = $post_data['newcomment_author_url']; 41 $post_data['comment_approved'] = $post_data['comment_status']; 42 $post_data['comment_content'] = $post_data['content']; 43 $post_data['comment_ID'] = (int) $post_data['comment_ID']; 45 44 46 45 foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) { 47 if ( !empty( $ _POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {46 if ( !empty( $post_data['hidden_' . $timeunit] ) && $post_data['hidden_' . $timeunit] != $post_data[$timeunit] ) { 48 47 $_POST['edit_date'] = '1'; 49 48 break; 50 49 } 51 50 } 52 51 53 if ( !empty ( $ _POST['edit_date'] ) ) {54 $aa = $ _POST['aa'];55 $mm = $ _POST['mm'];56 $jj = $ _POST['jj'];57 $hh = $ _POST['hh'];58 $mn = $ _POST['mn'];59 $ss = $ _POST['ss'];52 if ( !empty ( $post_data['edit_date'] ) ) { 53 $aa = $post_data['aa']; 54 $mm = $post_data['mm']; 55 $jj = $post_data['jj']; 56 $hh = $post_data['hh']; 57 $mn = $post_data['mn']; 58 $ss = $post_data['ss']; 60 59 $jj = ($jj > 31 ) ? 31 : $jj; 61 60 $hh = ($hh > 23 ) ? $hh -24 : $hh; 62 61 $mn = ($mn > 59 ) ? $mn -60 : $mn; 63 62 $ss = ($ss > 59 ) ? $ss -60 : $ss; 64 $ _POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";63 $post_data['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss"; 65 64 } 66 65 67 wp_update_comment( $ _POST);66 wp_update_comment( $post_data ); 68 67 } 69 68 70 69 /** -
wp-admin/includes/class-wp-ms-users-list-table.php
173 173 174 174 case 'username': 175 175 $avatar = get_avatar( $user->user_email, 32 ); 176 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );176 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 177 177 178 178 echo "<td $attributes>"; ?> 179 <?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php179 <?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php 180 180 if ( in_array( $user->user_login, $super_admins ) ) 181 181 echo ' - ' . __( 'Super Admin' ); 182 182 ?></strong> … … 186 186 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 187 187 188 188 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 189 $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';189 $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 190 190 } 191 191 192 192 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); -
wp-admin/includes/image-edit.php
454 454 if ( is_wp_error( $img ) ) 455 455 return false; 456 456 457 $changes = !empty($_REQUEST['history']) ? json_decode( stripslashes($_REQUEST['history']) ) : null;457 $changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash( $_REQUEST['history'] ) ) : null; 458 458 if ( $changes ) 459 459 $img = image_edit_apply_changes( $img, $changes ); 460 460 … … 533 533 } 534 534 } 535 535 536 if ( !wp_update_attachment_metadata($post_id, $meta) || ! update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes) ) {536 if ( !wp_update_attachment_metadata($post_id, $meta) || !wp_update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes) ) { 537 537 $msg->error = __('Cannot save image metadata.'); 538 538 return $msg; 539 539 } … … 587 587 return $return; 588 588 } 589 589 } elseif ( !empty($_REQUEST['history']) ) { 590 $changes = json_decode( stripslashes($_REQUEST['history']) );590 $changes = json_decode( wp_unslash( $_REQUEST['history'] ) ); 591 591 if ( $changes ) 592 592 $img = image_edit_apply_changes($img, $changes); 593 593 } else { … … 699 699 700 700 if ( $success ) { 701 701 wp_update_attachment_metadata( $post_id, $meta ); 702 update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes);702 wp_update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes); 703 703 704 704 if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) { 705 705 // Check if it's an image edit from attachment edit screen -
wp-admin/includes/class-wp-plugins-list-table.php
22 22 $status = $_REQUEST['plugin_status']; 23 23 24 24 if ( isset($_REQUEST['s']) ) 25 $_SERVER['REQUEST_URI'] = add_query_arg('s', stripslashes($_REQUEST['s']) );25 $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); 26 26 27 27 $page = $this->get_pagenum(); 28 28 } … … 140 140 function _search_callback( $plugin ) { 141 141 static $term; 142 142 if ( is_null( $term ) ) 143 $term = stripslashes( $_REQUEST['s'] );143 $term = wp_unslash( $_REQUEST['s'] ); 144 144 145 145 foreach ( $plugin as $value ) 146 146 if ( stripos( $value, $term ) !== false ) -
wp-admin/includes/theme-install.php
50 50 * @since 2.8.0 51 51 */ 52 52 function install_theme_search_form( $type_selector = true ) { 53 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : 'term';54 $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';53 $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; 54 $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; 55 55 if ( ! $type_selector ) 56 56 echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>'; 57 57 ?> … … 179 179 function install_theme_information() { 180 180 global $tab, $themes_allowedtags, $wp_list_table; 181 181 182 $theme = themes_api( 'theme_information', array( 'slug' => stripslashes( $_REQUEST['theme'] ) ) );182 $theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) ); 183 183 184 184 if ( is_wp_error( $theme ) ) 185 185 wp_die( $theme ); -
wp-admin/includes/class-wp-themes-list-table.php
28 28 $themes = wp_get_themes( array( 'allowed' => true ) ); 29 29 30 30 if ( ! empty( $_REQUEST['s'] ) ) 31 $this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( stripslashes( $_REQUEST['s'] ) ) ) ) ) );31 $this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) ); 32 32 33 33 if ( ! empty( $_REQUEST['features'] ) ) 34 34 $this->features = $_REQUEST['features']; … … 235 235 * @uses _pagination_args['total_pages'] 236 236 */ 237 237 function _js_vars( $extra_args = array() ) { 238 $search_string = isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( $_REQUEST['s'] ) ) : '';238 $search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : ''; 239 239 240 240 $args = array( 241 241 'search' => $search_string, -
wp-admin/includes/class-wp-comments-list-table.php
170 170 /* 171 171 // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark 172 172 if ( !empty( $_REQUEST['s'] ) ) 173 $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );173 $link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link ); 174 174 */ 175 175 $status_links[$status] = "<a href='$link'$class>" . sprintf( 176 176 translate_nooped_plural( $label, $num_comments->$status ), -
wp-admin/includes/template.php
1331 1331 * 1332 1332 */ 1333 1333 function _admin_search_query() { 1334 echo isset($_REQUEST['s']) ? esc_attr( stripslashes( $_REQUEST['s'] ) ) : '';1334 echo isset($_REQUEST['s']) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : ''; 1335 1335 } 1336 1336 1337 1337 /** -
wp-admin/includes/user.php
34 34 $update = true; 35 35 $user->ID = (int) $user_id; 36 36 $userdata = get_userdata( $user_id ); 37 $user->user_login = $ wpdb->escape( $userdata->user_login );37 $user->user_login = $userdata->user_login; 38 38 } else { 39 39 $update = false; 40 40 } 41 41 42 if ( !$update && isset( $_POST['user_login'] ) )43 $user->user_login = sanitize_user($_POST['user_login'], true);42 // get clean data before we get started. 43 $post_data = wp_unslash( $_POST ); 44 44 45 if ( !$update && isset( $post_data['user_login'] ) ) 46 $user->user_login = sanitize_user($post_data['user_login'], true); 47 45 48 $pass1 = $pass2 = ''; 46 if ( isset( $ _POST['pass1'] ))47 $pass1 = $ _POST['pass1'];48 if ( isset( $ _POST['pass2'] ))49 $pass2 = $ _POST['pass2'];49 if ( isset( $post_data['pass1'] )) 50 $pass1 = $post_data['pass1']; 51 if ( isset( $post_data['pass2'] )) 52 $pass2 = $post_data['pass2']; 50 53 51 if ( isset( $ _POST['role'] ) && current_user_can( 'edit_users' ) ) {52 $new_role = sanitize_text_field( $ _POST['role'] );54 if ( isset( $post_data['role'] ) && current_user_can( 'edit_users' ) ) { 55 $new_role = sanitize_text_field( $post_data['role'] ); 53 56 $potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false; 54 57 // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. 55 58 // Multisite super admins can freely edit their blog roles -- they possess all caps. … … 62 65 wp_die(__('You can’t give users that role.')); 63 66 } 64 67 65 if ( isset( $ _POST['email'] ))66 $user->user_email = sanitize_text_field( $ _POST['email'] );67 if ( isset( $ _POST['url'] ) ) {68 if ( empty ( $ _POST['url'] ) || $_POST['url'] == 'http://' ) {68 if ( isset( $post_data['email'] )) 69 $user->user_email = sanitize_text_field( $post_data['email'] ); 70 if ( isset( $post_data['url'] ) ) { 71 if ( empty ( $post_data['url'] ) || $post_data['url'] == 'http://' ) { 69 72 $user->user_url = ''; 70 73 } else { 71 $user->user_url = esc_url_raw( $ _POST['url'] );74 $user->user_url = esc_url_raw( $post_data['url'] ); 72 75 $protocols = implode( '|', array_map( 'preg_quote', wp_allowed_protocols() ) ); 73 76 $user->user_url = preg_match('/^(' . $protocols . '):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url; 74 77 } 75 78 } 76 if ( isset( $ _POST['first_name'] ) )77 $user->first_name = sanitize_text_field( $ _POST['first_name'] );78 if ( isset( $ _POST['last_name'] ) )79 $user->last_name = sanitize_text_field( $ _POST['last_name'] );80 if ( isset( $ _POST['nickname'] ) )81 $user->nickname = sanitize_text_field( $ _POST['nickname'] );82 if ( isset( $ _POST['display_name'] ) )83 $user->display_name = sanitize_text_field( $ _POST['display_name'] );79 if ( isset( $post_data['first_name'] ) ) 80 $user->first_name = sanitize_text_field( $post_data['first_name'] ); 81 if ( isset( $post_data['last_name'] ) ) 82 $user->last_name = sanitize_text_field( $post_data['last_name'] ); 83 if ( isset( $post_data['nickname'] ) ) 84 $user->nickname = sanitize_text_field( $post_data['nickname'] ); 85 if ( isset( $post_data['display_name'] ) ) 86 $user->display_name = sanitize_text_field( $post_data['display_name'] ); 84 87 85 if ( isset( $ _POST['description'] ) )86 $user->description = trim( $ _POST['description'] );88 if ( isset( $post_data['description'] ) ) 89 $user->description = trim( $post_data['description'] ); 87 90 88 91 foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) { 89 if ( isset( $ _POST[$method] ))90 $user->$method = sanitize_text_field( $ _POST[$method] );92 if ( isset( $post_data[$method] )) 93 $user->$method = sanitize_text_field( $post_data[$method] ); 91 94 } 92 95 93 96 if ( $update ) { 94 $user->rich_editing = isset( $ _POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true';95 $user->admin_color = isset( $ _POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh';96 $user->show_admin_bar_front = isset( $ _POST['admin_bar_front'] ) ? 'true' : 'false';97 $user->rich_editing = isset( $post_data['rich_editing'] ) && 'false' == $post_data['rich_editing'] ? 'false' : 'true'; 98 $user->admin_color = isset( $post_data['admin_color'] ) ? sanitize_text_field( $post_data['admin_color'] ) : 'fresh'; 99 $user->show_admin_bar_front = isset( $post_data['admin_bar_front'] ) ? 'true' : 'false'; 97 100 } 98 101 99 $user->comment_shortcuts = isset( $ _POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : '';102 $user->comment_shortcuts = isset( $post_data['comment_shortcuts'] ) && 'true' == $post_data['comment_shortcuts'] ? 'true' : ''; 100 103 101 104 $user->use_ssl = 0; 102 if ( !empty($ _POST['use_ssl']) )105 if ( !empty($post_data['use_ssl']) ) 103 106 $user->use_ssl = 1; 104 107 105 108 $errors = new WP_Error(); … … 124 127 } 125 128 126 129 /* Check for "\" in password */ 127 if ( false !== strpos( stripslashes($pass1), "\\" ) )130 if ( false !== strpos( $pass1, "\\" ) ) 128 131 $errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); 129 132 130 133 /* checking the password has been typed twice the same */ … … 134 137 if ( !empty( $pass1 ) ) 135 138 $user->user_pass = $pass1; 136 139 137 if ( !$update && isset( $ _POST['user_login'] ) && !validate_username( $_POST['user_login'] ) )140 if ( !$update && isset( $post_data['user_login'] ) && !validate_username( $post_data['user_login'] ) ) 138 141 $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' )); 139 142 140 143 if ( !$update && username_exists( $user->user_login ) ) … … 159 162 $user_id = wp_update_user( $user ); 160 163 } else { 161 164 $user_id = wp_insert_user( $user ); 162 wp_new_user_notification( $user_id, isset($ _POST['send_password']) ? $pass1 : '' );165 wp_new_user_notification( $user_id, isset($post_data['send_password']) ? $pass1 : '' ); 163 166 } 164 167 return $user_id; 165 168 } -
wp-admin/includes/media.php
444 444 } 445 445 446 446 if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 447 $attachment = wp_unslash( $attachment ); 448 447 449 $post = $_post = get_post($attachment_id, ARRAY_A); 448 450 $post_type_object = get_post_type_object( $post[ 'post_type' ] ); 449 451 … … 468 470 469 471 if ( isset($attachment['image_alt']) ) { 470 472 $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); 471 if ( $image_alt != stripslashes($attachment['image_alt']) ) { 472 $image_alt = wp_strip_all_tags( stripslashes($attachment['image_alt']), true ); 473 // update_meta expects slashed 474 update_post_meta( $attachment_id, '_wp_attachment_image_alt', addslashes($image_alt) ); 473 if ( $image_alt != $attachment['image_alt'] ) { 474 $image_alt = wp_strip_all_tags( $attachment['image_alt'], true ); 475 wp_update_post_meta( $attachment_id, '_wp_attachment_image_alt', $image_alt ); 475 476 } 476 477 } 477 478 … … 501 502 } 502 503 503 504 if ( isset($send_id) ) { 504 $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );505 $attachment = wp_unslash( $_POST['attachments'][$send_id] ); 505 506 506 507 $html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : ''; 507 508 if ( !empty($attachment['url']) ) { … … 546 547 $src = "http://$src"; 547 548 548 549 if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) { 549 $title = esc_html( stripslashes( $_POST['title'] ) );550 $title = esc_html( wp_unslash( $_POST['title'] ) ); 550 551 if ( empty( $title ) ) 551 552 $title = esc_html( basename( $src ) ); 552 553 … … 561 562 $html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title ); 562 563 } else { 563 564 $align = ''; 564 $alt = esc_attr( stripslashes( $_POST['alt'] ) );565 $alt = esc_attr( wp_unslash( $_POST['alt'] ) ); 565 566 if ( isset($_POST['align']) ) { 566 $align = esc_attr( stripslashes( $_POST['align'] ) );567 $align = esc_attr( wp_unslash( $_POST['align'] ) ); 567 568 $class = " class='align$align'"; 568 569 } 569 570 if ( !empty($src) ) -
wp-admin/edit-tags.php
47 47 if ( !current_user_can( $tax->cap->edit_terms ) ) 48 48 wp_die( __( 'Cheatin’ uh?' ) ); 49 49 50 $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); 50 $post_data = wp_unslash( $_POST ); 51 52 $ret = wp_insert_term( $post_data['tag-name'], $taxonomy, $post_data ); 51 53 $location = 'edit-tags.php?taxonomy=' . $taxonomy; 52 54 if ( 'post' != $post_type ) 53 55 $location .= '&post_type=' . $post_type; … … 132 134 break; 133 135 134 136 case 'editedtag': 135 $tag_ID = (int) $_POST['tag_ID']; 137 138 $post_data = wp_unslash( $_POST ); 139 140 $tag_ID = (int) $post_data['tag_ID']; 136 141 check_admin_referer( 'update-tag_' . $tag_ID ); 137 142 138 143 if ( !current_user_can( $tax->cap->edit_terms ) ) … … 142 147 if ( ! $tag ) 143 148 wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); 144 149 145 $ret = wp_update_term( $tag_ID, $taxonomy, $ _POST);150 $ret = wp_update_term( $tag_ID, $taxonomy, $post_data ); 146 151 147 152 $location = 'edit-tags.php?taxonomy=' . $taxonomy; 148 153 if ( 'post' != $post_type ) … … 164 169 165 170 default: 166 171 if ( ! empty($_REQUEST['_wp_http_referer']) ) { 167 $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) );172 $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ); 168 173 169 174 if ( ! empty( $_REQUEST['paged'] ) ) 170 175 $location = add_query_arg( 'paged', (int) $_REQUEST['paged'] ); … … 264 269 <div class="wrap nosubsub"> 265 270 <?php screen_icon(); ?> 266 271 <h2><?php echo esc_html( $title ); 267 if ( ! empty($_REQUEST['s']) )268 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?>272 if ( ! empty($_REQUEST['s']) ) 273 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) ); ?> 269 274 </h2> 270 275 271 276 <?php if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) ) : ?> -
wp-admin/update.php
26 26 check_admin_referer( 'bulk-update-plugins' ); 27 27 28 28 if ( isset( $_GET['plugins'] ) ) 29 $plugins = explode( ',', stripslashes($_GET['plugins']) );29 $plugins = explode( ',', wp_unslash($_GET['plugins']) ); 30 30 elseif ( isset( $_POST['checked'] ) ) 31 31 $plugins = (array) $_POST['checked']; 32 32 else … … 109 109 $nonce = 'install-plugin_' . $plugin; 110 110 $url = 'update.php?action=install-plugin&plugin=' . $plugin; 111 111 if ( isset($_GET['from']) ) 112 $url .= '&from=' . urlencode( stripslashes($_GET['from']));112 $url .= '&from=' . urlencode( wp_unslash( $_GET['from'] ) ); 113 113 114 114 $type = 'web'; //Install plugin type, From Web or an Upload. 115 115 … … 173 173 check_admin_referer( 'bulk-update-themes' ); 174 174 175 175 if ( isset( $_GET['themes'] ) ) 176 $themes = explode( ',', stripslashes($_GET['themes']) );176 $themes = explode( ',', wp_unslash( $_GET['themes'] ) ); 177 177 elseif ( isset( $_POST['checked'] ) ) 178 178 $themes = (array) $_POST['checked']; 179 179 else -
wp-admin/theme-editor.php
68 68 $relative_file = 'style.css'; 69 69 $file = $allowed_files['style.css']; 70 70 } else { 71 $relative_file = stripslashes( $file );71 $relative_file = wp_unslash( $file ); 72 72 $file = $theme->get_stylesheet_directory() . '/' . $relative_file; 73 73 } 74 74 … … 78 78 switch( $action ) { 79 79 case 'update': 80 80 check_admin_referer( 'edit-theme_' . $file . $stylesheet ); 81 $newcontent = stripslashes( $_POST['newcontent'] );81 $newcontent = wp_unslash( $_POST['newcontent'] ); 82 82 $location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto; 83 83 if ( is_writeable( $file ) ) { 84 84 //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable -
wp-admin/admin.php
43 43 do_action('after_db_upgrade'); 44 44 } elseif ( get_option('db_version') != $wp_db_version && empty($_POST) ) { 45 45 if ( !is_multisite() ) { 46 wp_redirect( admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));46 wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ); 47 47 exit; 48 48 } elseif ( apply_filters( 'do_mu_upgrade', true ) ) { 49 49 /** … … 84 84 $editing = false; 85 85 86 86 if ( isset($_GET['page']) ) { 87 $plugin_page = stripslashes($_GET['page']);87 $plugin_page = wp_unslash( $_GET['page'] ); 88 88 $plugin_page = plugin_basename($plugin_page); 89 89 } 90 90 -
wp-admin/custom-header.php
948 948 'width' => $choice['width'], 949 949 ); 950 950 951 update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() );951 wp_update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() ); 952 952 set_theme_mod( 'header_image', $choice['url'] ); 953 953 set_theme_mod( 'header_image_data', $header_image_data ); 954 954 return; -
wp-admin/user-new.php
112 112 } 113 113 } else { 114 114 // Adding a new user to this blog 115 $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ]);115 $user_details = wpmu_validate_user_signup( wp_unslash( $_REQUEST[ 'user_login' ] ), wp_unslash( $_REQUEST[ 'email' ] ) ); 116 116 unset( $user_details[ 'errors' ]->errors[ 'user_email_used' ] ); 117 117 if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) { 118 118 $add_user_errors = $user_details[ 'errors' ]; 119 119 } else { 120 $new_user_login = apply_filters('pre_user_login', sanitize_user( stripslashes($_REQUEST['user_login']), true));120 $new_user_login = apply_filters('pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) ); 121 121 if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { 122 122 add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email 123 123 } 124 wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) );124 wpmu_signup_user( $new_user_login, wp_unslash( $_REQUEST[ 'email' ] ), array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) ); 125 125 if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { 126 126 $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) ); 127 127 wpmu_activate_signup( $key ); … … 310 310 $var = "new_user_$var"; 311 311 if( isset( $_POST['createuser'] ) ) { 312 312 if ( ! isset($$var) ) 313 $$var = isset( $_POST[$post_field] ) ? stripslashes( $_POST[$post_field] ) : '';313 $$var = isset( $_POST[$post_field] ) ? wp_unslash( $_POST[$post_field] ) : ''; 314 314 } else { 315 315 $$var = false; 316 316 } -
wp-admin/media.php
32 32 } 33 33 if ( false !== strpos($location, 'upload.php') ) { 34 34 $location = remove_query_arg('message', $location); 35 $location = add_query_arg('posted', 35 $location = add_query_arg('posted', $attachment_id, $location); 36 36 } elseif ( false !== strpos($location, 'media.php') ) { 37 37 $location = add_query_arg('message', 'updated', $location); 38 38 } -
wp-admin/upload.php
132 132 wp_redirect( $location ); 133 133 exit; 134 134 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { 135 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );135 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 136 136 exit; 137 137 } 138 138 -
wp-admin/edit-form-comment.php
132 132 133 133 <input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID) ?>" /> 134 134 <input type="hidden" name="p" value="<?php echo esc_attr($comment->comment_post_ID) ?>" /> 135 <input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url( stripslashes(wp_get_referer())); ?>" />135 <input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url( wp_get_referer() ); ?>" /> 136 136 <?php wp_original_referer_field(true, 'previous'); ?> 137 137 <input type="hidden" name="noredir" value="1" /> 138 138 -
wp-admin/edit-form-advanced.php
304 304 <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> 305 305 <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" /> 306 306 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" /> 307 <input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url( stripslashes(wp_get_referer())); ?>" />307 <input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url( wp_get_referer() ); ?>" /> 308 308 <?php if ( ! empty( $active_post_lock ) ) { ?> 309 309 <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" /> 310 310 <?php -
wp-admin/network/site-new.php
38 38 39 39 if ( ! is_array( $_POST['blog'] ) ) 40 40 wp_die( __( 'Can’t create an empty site.' ) ); 41 $blog = $_POST['blog'];41 $blog = wp_unslash( $_POST['blog'] ); 42 42 $domain = ''; 43 43 if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) 44 44 $domain = strtolower( $blog['domain'] ); … … 88 88 $content_mail = sprintf( __( 'New site created by %1$s 89 89 90 90 Address: %2$s 91 Name: %3$s' ), $current_user->user_login , get_site_url( $id ), stripslashes( $title ));91 Name: %3$s' ), $current_user->user_login , get_site_url( $id ), $title ); 92 92 wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' ); 93 93 wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); 94 94 wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) ); -
wp-admin/network/site-info.php
62 62 delete_option( 'rewrite_rules' ); 63 63 64 64 // update blogs table 65 $blog_data = stripslashes_deep( $_POST['blog'] );65 $blog_data = wp_unslash( $_POST['blog'] ); 66 66 $existing_details = get_blog_details( $id, false ); 67 67 $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); 68 68 foreach ( $blog_data_checkboxes as $c ) { -
wp-admin/network/settings.php
61 61 foreach ( $options as $option_name ) { 62 62 if ( ! isset($_POST[$option_name]) ) 63 63 continue; 64 $value = stripslashes_deep( $_POST[$option_name] );64 $value = wp_unslash( $_POST[$option_name] ); 65 65 update_site_option( $option_name, $value ); 66 66 } 67 67 … … 181 181 <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th> 182 182 <td> 183 183 <textarea name="welcome_email" id="welcome_email" rows="5" cols="45" class="large-text"> 184 <?php echo esc_textarea( stripslashes( get_site_option( 'welcome_email' )) ) ?></textarea>184 <?php echo esc_textarea( get_site_option( 'welcome_email' ) ) ?></textarea> 185 185 <br /> 186 186 <?php _e( 'The welcome email sent to new site owners.' ) ?> 187 187 </td> … … 190 190 <th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th> 191 191 <td> 192 192 <textarea name="welcome_user_email" id="welcome_user_email" rows="5" cols="45" class="large-text"> 193 <?php echo esc_textarea( stripslashes( get_site_option( 'welcome_user_email' )) ) ?></textarea>193 <?php echo esc_textarea( get_site_option( 'welcome_user_email' ) ) ?></textarea> 194 194 <br /> 195 195 <?php _e( 'The welcome email sent to new users.' ) ?> 196 196 </td> … … 199 199 <th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th> 200 200 <td> 201 201 <textarea name="first_post" id="first_post" rows="5" cols="45" class="large-text"> 202 <?php echo esc_textarea( stripslashes( get_site_option( 'first_post' )) ) ?></textarea>202 <?php echo esc_textarea( get_site_option( 'first_post' ) ) ?></textarea> 203 203 <br /> 204 204 <?php _e( 'The first post on a new site.' ) ?> 205 205 </td> … … 208 208 <th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th> 209 209 <td> 210 210 <textarea name="first_page" id="first_page" rows="5" cols="45" class="large-text"> 211 <?php echo esc_textarea( stripslashes( get_site_option('first_page')) ) ?></textarea>211 <?php echo esc_textarea( get_site_option( 'first_page' ) ) ?></textarea> 212 212 <br /> 213 213 <?php _e( 'The first page on a new site.' ) ?> 214 214 </td> … … 217 217 <th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th> 218 218 <td> 219 219 <textarea name="first_comment" id="first_comment" rows="5" cols="45" class="large-text"> 220 <?php echo esc_textarea( stripslashes( get_site_option('first_comment')) ) ?></textarea>220 <?php echo esc_textarea( get_site_option( 'first_comment' ) ) ?></textarea> 221 221 <br /> 222 222 <?php _e( 'The first comment on a new site.' ) ?> 223 223 </td> -
wp-admin/network/site-settings.php
53 53 $count = count( $_POST['option'] ); 54 54 $skip_options = array( 'allowedthemes' ); // Don't update these options since they are handled elsewhere in the form. 55 55 foreach ( (array) $_POST['option'] as $key => $val ) { 56 $key = wp_unslash( $key ); 57 $val = wp_unslash( $val ); 56 58 if ( $key === 0 || is_array( $val ) || in_array($key, $skip_options) ) 57 59 continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options 58 60 if ( $c == $count ) 59 update_option( $key, stripslashes( $val ));61 update_option( $key, $val ); 60 62 else 61 update_option( $key, stripslashes( $val ), false ); // no need to refresh blog details yet63 update_option( $key, $val, false ); // no need to refresh blog details yet 62 64 $c++; 63 65 } 64 66 -
wp-admin/network/sites.php
79 79 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> 80 80 <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" /> 81 81 <?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?> 82 <p><?php echo esc_html( stripslashes( $_GET['msg'] ) ); ?></p>82 <p><?php echo esc_html( wp_unslash( $_GET['msg'] ) ); ?></p> 83 83 <?php submit_button( __('Confirm'), 'button' ); ?> 84 84 </form> 85 85 </body> -
wp-admin/nav-menus.php
93 93 if ( ! is_wp_error( $parent_object ) ) { 94 94 $parent_data = (array) $parent_object; 95 95 $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent']; 96 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );96 wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); 97 97 98 98 } 99 99 … … 103 103 $menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1; 104 104 105 105 $menu_item_data['menu_item_parent'] = $next_item_data['ID']; 106 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );106 wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); 107 107 108 108 wp_update_post($menu_item_data); 109 109 wp_update_post($next_item_data); … … 115 115 in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) 116 116 ) { 117 117 $menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true); 118 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );118 wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); 119 119 } 120 120 } 121 121 } … … 190 190 $menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1; 191 191 192 192 // save changes 193 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );193 wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); 194 194 wp_update_post($menu_item_data); 195 195 wp_update_post($parent_data); 196 196 } … … 205 205 ) { 206 206 // just make it a child of the previous; keep the order 207 207 $menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1]; 208 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );208 wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); 209 209 wp_update_post($menu_item_data); 210 210 } 211 211 } -
wp-admin/edit.php
138 138 wp_redirect($sendback); 139 139 exit(); 140 140 } elseif ( ! empty($_REQUEST['_wp_http_referer']) ) { 141 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );141 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 142 142 exit; 143 143 } 144 144 -
wp-admin/upgrade.php
77 77 <?php else : 78 78 switch ( $step ) : 79 79 case 0: 80 $goback = stripslashes( wp_get_referer());80 $goback = wp_get_referer(); 81 81 $goback = esc_url_raw( $goback ); 82 82 $goback = urlencode( $goback ); 83 83 ?> … … 90 90 case 1: 91 91 wp_upgrade(); 92 92 93 $backto = !empty($_GET['backto']) ? stripslashes( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/';93 $backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/'; 94 94 $backto = esc_url( $backto ); 95 95 $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/'); 96 96 ?> -
wp-admin/options.php
120 120 if ( 'options' == $option_page ) { 121 121 if ( is_multisite() && ! is_super_admin() ) 122 122 wp_die( __( 'You do not have sufficient permissions to modify unregistered settings for this site.' ) ); 123 $options = explode( ',', stripslashes( $_POST[ 'page_options' ] ) );123 $options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) ); 124 124 } else { 125 125 $options = $whitelist_options[ $option_page ]; 126 126 } 127 127 128 128 // Handle custom date/time formats 129 129 if ( 'general' == $option_page ) { 130 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) )130 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) 131 131 $_POST['date_format'] = $_POST['date_format_custom']; 132 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) )132 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) 133 133 $_POST['time_format'] = $_POST['time_format_custom']; 134 134 // Map UTC+- timezones to gmt_offsets and set timezone_string to empty. 135 135 if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) { … … 150 150 $value = $_POST[ $option ]; 151 151 if ( ! is_array( $value ) ) 152 152 $value = trim( $value ); 153 $value = stripslashes_deep( $value );153 $value = wp_unslash( $value ); 154 154 } 155 155 update_option( $option, $value ); 156 156 } -
wp-admin/press-this.php
91 91 } 92 92 93 93 // Set Variables 94 $title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( stripslashes( $_GET['t'] ) , ENT_QUOTES) ) ) : '';94 $title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( wp_unslash( $_GET['t'] ) , ENT_QUOTES) ) ) : ''; 95 95 96 96 $selection = ''; 97 97 if ( !empty($_GET['s']) ) { 98 $selection = str_replace(''', "'", stripslashes($_GET['s']));98 $selection = str_replace(''', "'", wp_unslash($_GET['s'])); 99 99 $selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) ); 100 100 } 101 101 -
wp-admin/user-edit.php
54 54 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 55 55 ); 56 56 57 $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));57 $wp_http_referer = remove_query_arg(array('update', 'delete_count'), wp_unslash( $wp_http_referer ) ); 58 58 59 59 $user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); 60 60 -
wp-admin/setup-config.php
164 164 165 165 case 2: 166 166 foreach ( array( 'dbname', 'uname', 'pwd', 'dbhost', 'prefix' ) as $key ) 167 $$key = trim( stripslashes( $_POST[ $key ] ) );167 $$key = trim( wp_unslash( $_POST[ $key ] ) ); 168 168 169 169 $tryagain_link = '</p><p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>'; 170 170 -
wp-admin/link-manager.php
31 31 exit; 32 32 } 33 33 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { 34 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );34 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 35 35 exit; 36 36 } 37 37 … … 72 72 <?php screen_icon(); ?> 73 73 <h2><?php echo esc_html( $title ); ?> <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php 74 74 if ( !empty($_REQUEST['s']) ) 75 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?>75 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?> 76 76 </h2> 77 77 78 78 <?php -
wp-admin/install.php
84 84 if ( ! empty( $_POST ) ) 85 85 $blog_public = isset( $_POST['blog_public'] ); 86 86 87 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';88 $user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin';89 $admin_password = isset($_POST['admin_password']) ? trim( stripslashes( $_POST['admin_password'] ) ) : '';90 $admin_email = isset( $_POST['admin_email'] ) ? trim( stripslashes( $_POST['admin_email'] ) ) : '';87 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; 88 $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : 'admin'; 89 $admin_password = isset($_POST['admin_password']) ? trim( wp_unslash( $_POST['admin_password'] ) ) : ''; 90 $admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; 91 91 92 92 if ( ! is_null( $error ) ) { 93 93 ?> … … 189 189 190 190 display_header(); 191 191 // Fill in the data we gathered 192 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';193 $user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin';194 $admin_password = isset($_POST['admin_password']) ? $_POST['admin_password']: '';195 $admin_password_check = isset($_POST['admin_password2']) ? $_POST['admin_password2']: '';196 $admin_email = isset( $_POST['admin_email'] ) ?trim( stripslashes( $_POST['admin_email'] ) ) : '';192 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; 193 $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : 'admin'; 194 $admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : ''; 195 $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : ''; 196 $admin_email = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : ''; 197 197 $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 0; 198 198 // check e-mail address 199 199 $error = false; -
wp-admin/plugin-editor.php
28 28 wp_die( __('There are no plugins installed on this site.') ); 29 29 30 30 if ( isset($_REQUEST['file']) ) 31 $plugin = stripslashes($_REQUEST['file']);31 $plugin = wp_unslash($_REQUEST['file']); 32 32 33 33 if ( empty($plugin) ) { 34 34 $plugin = array_keys($plugins); … … 40 40 if ( empty($file) ) 41 41 $file = $plugin_files[0]; 42 42 else 43 $file = stripslashes($file);43 $file = wp_unslash($file); 44 44 45 45 $file = validate_file_to_edit($file, $plugin_files); 46 46 $real_file = WP_PLUGIN_DIR . '/' . $file; … … 52 52 53 53 check_admin_referer('edit-plugin_' . $file); 54 54 55 $newcontent = stripslashes($_POST['newcontent']);55 $newcontent = wp_unslash( $_POST['newcontent'] ); 56 56 if ( is_writeable($real_file) ) { 57 57 $f = fopen($real_file, 'w+'); 58 58 fwrite($f, $newcontent); -
wp-admin/custom-background.php
378 378 379 379 // Add the meta-data 380 380 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 381 update_post_meta( $id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );381 wp_update_post_meta( $id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) ); 382 382 383 383 set_theme_mod('background_image', esc_url_raw($url)); 384 384 … … 415 415 if ( in_array( $_POST['size'], $sizes ) ) 416 416 $size = esc_attr( $_POST['size'] ); 417 417 418 update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );418 wp_update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) ); 419 419 $url = wp_get_attachment_image_src( $attachment_id, $size ); 420 420 $thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); 421 421 set_theme_mod( 'background_image', esc_url_raw( $url[0] ) );