Make WordPress Core

Ticket #18322: 18322.diff

File 18322.diff, 45.2 KB (added by ryan, 14 years ago)

Incomplete patch showing the gist

  • wp-includes/post.php

     
    25532553        // expected_slashed (everything!)
    25542554        $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' ) );
    25552555        $data = apply_filters('wp_insert_post_data', $data, $postarr);
    2556         $data = stripslashes_deep( $data );
     2556        $data = wp_unslash( $data );
    25572557        $where = array( 'ID' => $post_ID );
    25582558
    25592559        if ( $update ) {
     
    36853685
    36863686        // expected_slashed (everything!)
    36873687        $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' ) );
    3688         $data = stripslashes_deep( $data );
     3688        $data = wp_unslash( $data );
    36893689
    36903690        if ( $update ) {
    36913691                $wpdb->update( $wpdb->posts, $data, array( 'ID' => $post_ID ) );
  • wp-includes/comment.php

     
    12141214 */
    12151215function wp_insert_comment($commentdata) {
    12161216        global $wpdb;
    1217         extract(stripslashes_deep($commentdata), EXTR_SKIP);
     1217        extract(wp_unslash($commentdata), EXTR_SKIP);
    12181218
    12191219        if ( ! isset($comment_author_IP) )
    12201220                $comment_author_IP = '';
     
    14551455        $commentarr = wp_filter_comment( $commentarr );
    14561456
    14571457        // Now extract the merged array.
    1458         extract(stripslashes_deep($commentarr), EXTR_SKIP);
     1458        extract(wp_unslash($commentarr), EXTR_SKIP);
    14591459
    14601460        $comment_content = apply_filters('comment_save_pre', $comment_content);
    14611461
  • wp-includes/user.php

     
    14781478        }
    14791479
    14801480        $data = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' );
    1481         $data = stripslashes_deep( $data );
     1481        $data = wp_unslash( $data );
    14821482
    14831483        if ( $update ) {
    14841484                $wpdb->update( $wpdb->users, $data, compact( 'ID' ) );
  • wp-includes/load.php

     
    527527 * @since 3.0.0
    528528 */
    529529function wp_magic_quotes() {
     530        global $wp_magic_quotes;
     531
     532        if ( ! isset( $wp_magic_quotes ) )
     533                $wp_magic_quotes = true;
     534
    530535        // If already slashed, strip.
    531536        if ( get_magic_quotes_gpc() ) {
    532537                $_GET    = stripslashes_deep( $_GET    );
     
    535540        }
    536541
    537542        // Escape with wpdb.
    538         $_GET    = add_magic_quotes( $_GET    );
    539         $_POST   = add_magic_quotes( $_POST   );
    540         $_COOKIE = add_magic_quotes( $_COOKIE );
    541         $_SERVER = add_magic_quotes( $_SERVER );
     543        if ( $wp_magic_quotes ) {
     544                $_GET    = add_magic_quotes( $_GET    );
     545                $_POST   = add_magic_quotes( $_POST   );
     546                $_COOKIE = add_magic_quotes( $_COOKIE );
     547                $_SERVER = add_magic_quotes( $_SERVER );
     548        }
    542549
    543550        // Force REQUEST to be GET + POST.
    544551        $_REQUEST = array_merge( $_GET, $_POST );
  • wp-includes/class-wp-xmlrpc-server.php

     
    262262                        if ( isset($meta['id']) ) {
    263263                                $meta['id'] = (int) $meta['id'];
    264264                                $pmeta = get_metadata_by_mid( 'post', $meta['id'] );
    265                                 $meta['value'] = stripslashes_deep( $meta['value'] );
     265                                $meta['value'] = wp_unslash( $meta['value'] );
    266266                                if ( isset($meta['key']) ) {
    267267                                        $meta['key'] = stripslashes( $meta['key'] );
    268268                                        if ( $meta['key'] != $pmeta->meta_key )
  • wp-includes/formatting.php

     
    24832483
    24842484                case 'blogdescription':
    24852485                case 'blogname':
    2486                         $value = addslashes($value);
    2487                         $value = wp_filter_post_kses( $value ); // calls stripslashes then addslashes
    2488                         $value = stripslashes($value);
     2486                        $value = wp_slash( $value );
     2487                        $value = wp_filter_post_kses( $value );
     2488                        $value = wp_unslash( $value );
    24892489                        $value = esc_html( $value );
    24902490                        break;
    24912491
     
    25012501                case 'ping_sites':
    25022502                case 'upload_path':
    25032503                        $value = strip_tags($value);
    2504                         $value = addslashes($value);
    2505                         $value = wp_filter_kses($value); // calls stripslashes then addslashes
    2506                         $value = stripslashes($value);
     2504                        $value = wp_slash( $value );
     2505                        $value = wp_filter_kses( $value );
     2506                        $value = wp_unslash( $value );
    25072507                        break;
    25082508
    25092509                case 'gmt_offset':
     
    29252925        return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
    29262926}
    29272927
     2928function wp_slash( $value ) {
     2929        global $wp_magic_quotes;
     2930
     2931        if ( ! $wp_magic_quotes )
     2932                return $value;
     2933
     2934        if ( is_array( $value ) ) {
     2935                $value = array_map( 'wp_slash', $value);
     2936        } elseif ( is_object( $value ) ) {
     2937                $vars = get_object_vars( $value );
     2938                foreach ( $vars as $key => $data ) {
     2939                        $value->{$key} = wp_slash( $data );
     2940                }
     2941        } else {
     2942                $value = addslashes( $value );
     2943        }
     2944
     2945        return $value;
     2946}
     2947
     2948function wp_unslash( $value ) {
     2949        global $wp_magic_quotes;
     2950
     2951        if ( ! $wp_magic_quotes )
     2952                return $value;
     2953
     2954        return stripslashes_deep( $value );
     2955}
     2956
    29282957?>
  • wp-includes/kses.php

     
    12561256 */
    12571257function wp_filter_post_kses($data) {
    12581258        global $allowedposttags;
    1259         return addslashes ( wp_kses(stripslashes( $data ), $allowedposttags) );
     1259        return wp_slash ( wp_kses( wp_unslash( $data ), $allowedposttags) );
    12601260}
    12611261
    12621262/**
     
    12851285 * @return string Filtered content without any HTML
    12861286 */
    12871287function wp_filter_nohtml_kses($data) {
    1288         return addslashes ( wp_kses(stripslashes( $data ), array()) );
     1288        return wp_slash ( wp_kses( wp_unslash( $data ), array() ) );
    12891289}
    12901290
    12911291/**
  • wp-includes/widgets.php

     
    224224                        }
    225225
    226226                        foreach ( $settings as $number => $new_instance ) {
    227                                 $new_instance = stripslashes_deep($new_instance);
     227                                $new_instance = wp_unslash($new_instance);
    228228                                $this->_set($number);
    229229
    230230                                $old_instance = isset($all_instances[$number]) ? $all_instances[$number] : array();
  • wp-includes/meta.php

     
    4444
    4545        // expected_slashed ($meta_key)
    4646        $meta_key = stripslashes($meta_key);
    47         $meta_value = stripslashes_deep($meta_value);
     47        $meta_value = wp_unslash($meta_value);
    4848        $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
    4949
    5050        $check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
     
    118118
    119119        // expected_slashed ($meta_key)
    120120        $meta_key = stripslashes($meta_key);
    121         $meta_value = stripslashes_deep($meta_value);
     121        $meta_value = wp_unslash($meta_value);
    122122        $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
    123123
    124124        $check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value );
     
    202202        $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
    203203        // expected_slashed ($meta_key)
    204204        $meta_key = stripslashes($meta_key);
    205         $meta_value = stripslashes_deep($meta_value);
     205        $meta_value = wp_unslash($meta_value);
    206206
    207207        $check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all );
    208208        if ( null !== $check )
  • wp-admin/network.php

     
    308308        $hostname = get_clean_basedomain();
    309309
    310310        if ( ! isset( $base ) )
    311                 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
     311                $base = trailingslashit( wp_unslash( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
    312312
    313313        // Wildcard DNS message.
    314314        if ( is_wp_error( $errors ) )
     
    515515
    516516if ( $_POST ) {
    517517
    518         $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
     518        $base = trailingslashit( wp_unslash( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
    519519
    520520        check_admin_referer( 'install-network-1' );
    521521
     
    525525        $hostname = get_clean_basedomain();
    526526        $subdomain_install = !allow_subdomain_install() ? false : (bool) $_POST['subdomain_install'];
    527527        if ( ! network_domain_check() ) {
    528                 $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install );
     528                $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
    529529                if ( is_wp_error( $result ) ) {
    530530                        if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() )
    531531                                network_step2( $result );
  • wp-admin/users.php

     
    3131);
    3232
    3333if ( empty($_REQUEST) ) {
    34         $referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr(stripslashes($_SERVER['REQUEST_URI'])) . '" />';
     34        $referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr(wp_unslash($_SERVER['REQUEST_URI'])) . '" />';
    3535} elseif ( isset($_REQUEST['wp_http_referer']) ) {
    36         $redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), stripslashes($_REQUEST['wp_http_referer']));
     36        $redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash($_REQUEST['wp_http_referer']));
    3737        $referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr($redirect) . '" />';
    3838} else {
    3939        $redirect = 'users.php';
     
    294294default:
    295295
    296296        if ( !empty($_GET['_wp_http_referer']) ) {
    297                 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
     297                wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
    298298                exit;
    299299        }
    300300
  • wp-admin/edit-comments.php

     
    9595        wp_redirect( $redirect_to );
    9696        exit;
    9797} 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'] ) ) );
    9999         exit;
    100100}
    101101
     
    140140        echo __('Comments');
    141141
    142142if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
    143         printf( '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?>
     143        printf( '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?>
    144144</h2>
    145145
    146146<?php
  • wp-admin/admin-ajax.php

     
    8686                die('0');
    8787        }
    8888
    89         $s = stripslashes( $_GET['q'] );
     89        $s = wp_unslash( $_GET['q'] );
    9090
    9191        if ( false !== strpos( $s, ',' ) ) {
    9292                $s = explode( ',', $s );
     
    497497                        $cat_id = wp_insert_term( $cat_name, 'link_category' );
    498498                }
    499499                $cat_id = $cat_id['term_id'];
    500                 $cat_name = esc_html(stripslashes($cat_name));
     500                $cat_name = esc_html(wp_unslash($cat_name));
    501501                $x->add( array(
    502502                        'what' => 'link-category',
    503503                        'id' => $cat_id,
     
    861861                ) );
    862862        } else { // Update?
    863863                $mid = (int) array_pop( array_keys($_POST['meta']) );
    864                 $key = stripslashes( $_POST['meta'][$mid]['key'] );
    865                 $value = stripslashes( $_POST['meta'][$mid]['value'] );
     864                $key = wp_unslash( $_POST['meta'][$mid]['key'] );
     865                $value = wp_unslash( $_POST['meta'][$mid]['value'] );
    866866                if ( '' == trim($key) )
    867867                        die(__('Please provide a custom field name.'));
    868868                if ( '' == trim($value) )
     
    11131113        $args = array();
    11141114
    11151115        if ( isset( $_POST['search'] ) )
    1116                 $args['s'] = stripslashes( $_POST['search'] );
     1116                $args['s'] = wp_unslash( $_POST['search'] );
    11171117        $args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
    11181118
    11191119        require(ABSPATH . WPINC . '/class-wp-editor.php');
     
    12761276        else
    12771277                $what = 'post';
    12781278
    1279         $s = stripslashes($_POST['ps']);
     1279        $s = wp_unslash($_POST['ps']);
    12801280        preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
    12811281        $search_terms = array_map('_search_terms_tidy', $matches[0]);
    12821282
  • wp-admin/includes/class-wp-ms-sites-list-table.php

     
    2828
    2929                $pagenum = $this->get_pagenum();
    3030
    31                 $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : '';
     31                $s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST[ 's' ] ) ) : '';
    3232                $wild = '';
    3333                if ( false !== strpos($s, '*') ) {
    3434                        $wild = '%';
  • wp-admin/includes/bookmark.php

     
    136136        $linkdata = wp_parse_args( $linkdata, $defaults );
    137137        $linkdata = sanitize_bookmark( $linkdata, 'db' );
    138138
    139         extract( stripslashes_deep( $linkdata ), EXTR_SKIP );
     139        extract( wp_unslash( $linkdata ), EXTR_SKIP );
    140140
    141141        $update = false;
    142142
  • wp-admin/includes/file.php

     
    916916        $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => ''));
    917917
    918918        // 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)
    919         $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? stripslashes($_POST['hostname']) : $credentials['hostname']);
    920         $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? stripslashes($_POST['username']) : $credentials['username']);
    921         $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? stripslashes($_POST['password']) : '');
     919        $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? wp_unslash($_POST['hostname']) : $credentials['hostname']);
     920        $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? wp_unslash($_POST['username']) : $credentials['username']);
     921        $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? wp_unslash($_POST['password']) : '');
    922922
    923923        // Check to see if we are setting the public/private keys for ssh
    924         $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? stripslashes($_POST['public_key']) : '');
    925         $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? stripslashes($_POST['private_key']) : '');
     924        $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? wp_unslash($_POST['public_key']) : '');
     925        $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? wp_unslash($_POST['private_key']) : '');
    926926
    927927        //sanitize the hostname, Some people might pass in odd-data:
    928928        $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off
  • wp-admin/includes/class-wp-terms-list-table.php

     
    5151                        $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter
    5252                }
    5353
    54                 $search = !empty( $_REQUEST['s'] ) ? trim( stripslashes( $_REQUEST['s'] ) ) : '';
     54                $search = !empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : '';
    5555
    5656                $args = array(
    5757                        'search' => $search,
     
    6060                );
    6161
    6262                if ( !empty( $_REQUEST['orderby'] ) )
    63                         $args['orderby'] = trim( stripslashes( $_REQUEST['orderby'] ) );
     63                        $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
    6464
    6565                if ( !empty( $_REQUEST['order'] ) )
    66                         $args['order'] = trim( stripslashes( $_REQUEST['order'] ) );
     66                        $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
    6767
    6868                $this->callback_args = $args;
    6969
  • wp-admin/includes/post.php

     
    764764 * @return unknown
    765765 */
    766766function update_meta( $meta_id, $meta_key, $meta_value ) {
    767         $meta_key = stripslashes( $meta_key );
    768         $meta_value = stripslashes_deep( $meta_value );
     767        $meta_key = wp_unslash( $meta_key );
     768        $meta_value = wp_unslash( $meta_value );
    769769
    770770        return update_metadata_by_mid( 'post', $meta_id, $meta_value, $meta_key );
    771771}
     
    13031303        }
    13041304
    13051305        // _wp_put_post_revision() expects unescaped.
    1306         $_POST = stripslashes_deep($_POST);
     1306        $_POST = wp_unslash($_POST);
    13071307
    13081308        // Otherwise create the new autosave as a special post revision
    13091309        return _wp_put_post_revision( $_POST, true );
  • wp-admin/includes/class-wp-users-list-table.php

     
    235235                        if ( get_current_user_id() == $user_object->ID ) {
    236236                                $edit_link = 'profile.php';
    237237                        } else {
    238                                 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), "user-edit.php?user_id=$user_object->ID" ) );
     238                                $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), "user-edit.php?user_id=$user_object->ID" ) );
    239239                        }
    240240
    241241                        // Set up the hover actions for this user
  • wp-admin/includes/dashboard.php

     
    11091109        $widget_options[$widget_id]['number'] = $number;
    11101110
    11111111        if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) {
    1112                 $_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] );
     1112                $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] );
    11131113                $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
    11141114                // title is optional.  If black, fill it if possible
    11151115                if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
  • wp-admin/includes/class-wp-plugin-install-list-table.php

     
    4848
    4949                switch ( $tab ) {
    5050                        case 'search':
    51                                 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
    52                                 $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
     51                                $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : '';
     52                                $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
    5353
    5454                                switch ( $type ) {
    5555                                        case 'tag':
  • wp-admin/includes/class-wp-ms-themes-list-table.php

     
    138138        function _search_callback( $theme ) {
    139139                static $term;
    140140                if ( is_null( $term ) )
    141                         $term = stripslashes( $_REQUEST['s'] );
     141                        $term = wp_unslash( $_REQUEST['s'] );
    142142
    143143                $search_fields = array( 'Name', 'Title', 'Description', 'Author', 'Author Name', 'Author URI', 'Template', 'Stylesheet' );
    144144                foreach ( $search_fields as $field )
  • wp-admin/includes/class-wp-theme-install-list-table.php

     
    4848
    4949                switch ( $tab ) {
    5050                        case 'search':
    51                                 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
    52                                 $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
     51                                $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : '';
     52                                $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
    5353
    5454                                switch ( $type ) {
    5555                                        case 'tag':
  • wp-admin/includes/deprecated.php

     
    454454        function WP_User_Search ($search_term = '', $page = '', $role = '') {
    455455                _deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' );
    456456
    457                 $this->search_term = stripslashes( $search_term );
     457                $this->search_term = wp_unslash( $search_term );
    458458                $this->raw_page = ( '' == $page ) ? false : (int) $page;
    459459                $this->page = (int) ( '' == $page ) ? 1 : $page;
    460460                $this->role = $role;
     
    533533         * @access public
    534534         */
    535535        function prepare_vars_for_template_usage() {
    536                 $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
     536                $this->search_term = wp_unslash($this->search_term); // done with DB, from now on we want slashes gone
    537537        }
    538538
    539539        /**
  • wp-admin/includes/class-wp-upgrader.php

     
    12741274
    12751275                $install_actions = array();
    12761276
    1277                 $from = isset($_GET['from']) ? stripslashes($_GET['from']) : 'plugins';
     1277                $from = isset($_GET['from']) ? wp_unslash($_GET['from']) : 'plugins';
    12781278
    12791279                if ( 'import' == $from )
    12801280                        $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;from=import&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin &amp; Run Importer') . '</a>';
  • wp-admin/includes/comment.php

     
    1919function comment_exists($comment_author, $comment_date) {
    2020        global $wpdb;
    2121
    22         $comment_author = stripslashes($comment_author);
    23         $comment_date = stripslashes($comment_date);
     22        $comment_author = wp_unslash($comment_author);
     23        $comment_date = wp_unslash($comment_date);
    2424
    2525        return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments
    2626                        WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
  • wp-admin/includes/class-wp-ms-users-list-table.php

     
    175175                                                if ( get_current_user_id() == $user->ID ) {
    176176                                                        $edit_link = esc_url( network_admin_url( 'profile.php' ) );
    177177                                                } else {
    178                                                         $edit_link = esc_url( network_admin_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), 'user-edit.php?user_id=' . $user->ID ) ) );
     178                                                        $edit_link = esc_url( network_admin_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'user-edit.php?user_id=' . $user->ID ) ) );
    179179                                                }
    180180
    181181                                                echo "<td $attributes>"; ?>
     
    189189                                                                $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
    190190
    191191                                                                if ( current_user_can( 'delete_user', $user->ID) && ! in_array( $user->user_login, $super_admins ) ) {
    192                                                                         $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'edit.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
     192                                                                        $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( 'edit.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
    193193                                                                }
    194194
    195195                                                                $actions = apply_filters( 'ms_user_row_actions', $actions, $user );
  • wp-admin/includes/class-wp-plugins-list-table.php

     
    2323
    2424
    2525                if ( isset($_REQUEST['s']) )
    26                         $_SERVER['REQUEST_URI'] = add_query_arg('s', stripslashes($_REQUEST['s']) );
     26                        $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) );
    2727
    2828                $page = $this->get_pagenum();
    2929
     
    152152        function _search_callback( $plugin ) {
    153153                static $term;
    154154                if ( is_null( $term ) )
    155                         $term = stripslashes( $_REQUEST['s'] );
     155                        $term = wp_unslash( $_REQUEST['s'] );
    156156
    157157                foreach ( $plugin as $value )
    158158                        if ( stripos( $value, $term ) !== false )
  • wp-admin/includes/class-wp-themes-list-table.php

     
    2525                $themes = get_allowed_themes();
    2626
    2727                if ( ! empty( $_REQUEST['s'] ) ) {
    28                         $search = strtolower( stripslashes( $_REQUEST['s'] ) );
     28                        $search = strtolower( wp_unslash( $_REQUEST['s'] ) );
    2929                        $this->search = array_merge( $this->search, array_filter( array_map( 'trim', explode( ',', $search ) ) ) );
    3030                        $this->search = array_unique( $this->search );
    3131                }
  • wp-admin/includes/class-wp-comments-list-table.php

     
    168168                        /*
    169169                        // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
    170170                        if ( !empty( $_REQUEST['s'] ) )
    171                                 $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );
     171                                $link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link );
    172172                        */
    173173                        $status_links[$status] = "<a href='$link'$class>" . sprintf(
    174174                                translate_nooped_plural( $label, $num_comments->$status ),
  • wp-admin/includes/media.php

     
    487487        }
    488488
    489489        if ( isset($send_id) ) {
    490                 $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
     490                $attachment = wp_unslash( $_POST['attachments'][$send_id] );
    491491
    492492                $html = $attachment['post_title'];
    493493                if ( !empty($attachment['url']) ) {
  • wp-admin/edit-tags.php

     
    150150
    151151default:
    152152if ( ! empty($_REQUEST['_wp_http_referer']) ) {
    153         $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) );
     153        $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) );
    154154
    155155        if ( ! empty( $_REQUEST['paged'] ) )
    156156                $location = add_query_arg( 'paged', (int) $_REQUEST['paged'] );
     
    239239<?php screen_icon(); ?>
    240240<h2><?php echo esc_html( $title );
    241241if ( !empty($_REQUEST['s']) )
    242         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?>
     242        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
    243243</h2>
    244244
    245245<?php if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) ) : ?>
  • wp-admin/update.php

     
    2626                check_admin_referer( 'bulk-update-plugins' );
    2727
    2828                if ( isset( $_GET['plugins'] ) )
    29                         $plugins = explode( ',', stripslashes($_GET['plugins']) );
     29                        $plugins = explode( ',', wp_unslash($_GET['plugins']) );
    3030                elseif ( isset( $_POST['checked'] ) )
    3131                        $plugins = (array) $_POST['checked'];
    3232                else
     
    109109                $nonce = 'install-plugin_' . $plugin;
    110110                $url = 'update.php?action=install-plugin&plugin=' . $plugin;
    111111                if ( isset($_GET['from']) )
    112                         $url .= '&from=' . urlencode(stripslashes($_GET['from']));
     112                        $url .= '&from=' . urlencode(wp_unslash($_GET['from']));
    113113
    114114                $type = 'web'; //Install plugin type, From Web or an Upload.
    115115
     
    170170                check_admin_referer( 'bulk-update-themes' );
    171171
    172172                if ( isset( $_GET['themes'] ) )
    173                         $themes = explode( ',', stripslashes($_GET['themes']) );
     173                        $themes = explode( ',', wp_unslash($_GET['themes']) );
    174174                elseif ( isset( $_POST['checked'] ) )
    175175                        $themes = (array) $_POST['checked'];
    176176                else
  • wp-admin/theme-editor.php

     
    4545if (empty($theme)) {
    4646        $theme = get_current_theme();
    4747} else {
    48         $theme = stripslashes($theme);
     48        $theme = wp_unslash($theme);
    4949}
    5050
    5151if ( ! isset($themes[$theme]) )
     
    5959        else
    6060                $file = $allowed_files[0];
    6161} else {
    62         $file = stripslashes($file);
     62        $file = wp_unslash($file);
    6363        if ( 'theme' == $dir ) {
    6464                $file = dirname(dirname($themes[$theme]['Template Dir'])) . $file ;
    6565        } else if ( 'style' == $dir) {
     
    7777
    7878        check_admin_referer('edit-theme_' . $file . $theme);
    7979
    80         $newcontent = stripslashes($_POST['newcontent']);
     80        $newcontent = wp_unslash($_POST['newcontent']);
    8181        $theme = urlencode($theme);
    8282        if (is_writeable($file)) {
    8383                //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
  • wp-admin/admin.php

     
    4141        do_action('after_db_upgrade');
    4242} elseif ( get_option('db_version') != $wp_db_version ) {
    4343        if ( !is_multisite() ) {
    44                 wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
     44                wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(wp_unslash($_SERVER['REQUEST_URI']))));
    4545                exit;
    4646        } elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
    4747                /**
     
    8484$editing = false;
    8585
    8686if ( isset($_GET['page']) ) {
    87         $plugin_page = stripslashes($_GET['page']);
     87        $plugin_page = wp_unslash($_GET['page']);
    8888        $plugin_page = plugin_basename($plugin_page);
    8989}
    9090
  • wp-admin/user-new.php

     
    9292                        $add_user_errors = $user_id;
    9393                } else {
    9494                        if ( current_user_can('edit_users') ) {
    95                                 $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
     95                                $new_user_login = apply_filters('pre_user_login', sanitize_user(wp_unslash($_REQUEST['user_login']), true));
    9696                                $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add' . '#user-' . $user_id;
    9797                        } else {
    9898                                $redirect = add_query_arg( 'update', 'add', 'user-new.php' );
     
    107107                if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) {
    108108                        $add_user_errors = $user_details[ 'errors' ];
    109109                } else {
    110                         $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
     110                        $new_user_login = apply_filters('pre_user_login', sanitize_user(wp_unslash($_REQUEST['user_login']), true));
    111111                        if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
    112112                                add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
    113113                        }
     
    275275        $var = "new_user_$var";
    276276        if( isset( $_POST['createuser'] ) ) {
    277277                if ( ! isset($$var) )
    278                         $$var = isset( $_POST[$post_field] ) ? stripslashes( $_POST[$post_field] ) : '';
     278                        $$var = isset( $_POST[$post_field] ) ? wp_unslash( $_POST[$post_field] ) : '';
    279279        } else {
    280280                $$var = false;
    281281        }
  • wp-admin/upload.php

     
    124124        wp_redirect( $location );
    125125        exit;
    126126} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
    127          wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
     127         wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
    128128         exit;
    129129}
    130130
  • wp-admin/edit-form-comment.php

     
    134134?>
    135135<input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID) ?>" />
    136136<input type="hidden" name="p" value="<?php echo esc_attr($comment->comment_post_ID) ?>" />
    137 <input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
     137<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(wp_unslash(wp_get_referer())); ?>" />
    138138<?php wp_original_referer_field(true, 'previous'); ?>
    139139<input type="hidden" name="noredir" value="1" />
    140140
  • wp-admin/edit-form-advanced.php

     
    210210<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
    211211<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" />
    212212<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" />
    213 <input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
     213<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(wp_unslash(wp_get_referer())); ?>" />
    214214<?php
    215215if ( 'draft' != $post->post_status )
    216216        wp_original_referer_field(true, 'previous');
  • wp-admin/network/site-info.php

     
    5656        delete_option( 'rewrite_rules' );
    5757
    5858        // update blogs table
    59         $blog_data = stripslashes_deep( $_POST['blog'] );
     59        $blog_data = wp_unslash( $_POST['blog'] );
    6060        $existing_details = get_blog_details( $id, false );
    6161        $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
    6262        foreach ( $blog_data_checkboxes as $c ) {
  • wp-admin/network/edit.php

     
    154154                foreach ( $options as $option_name ) {
    155155                        if ( ! isset($_POST[$option_name]) )
    156156                                continue;
    157                         $value = stripslashes_deep( $_POST[$option_name] );
     157                        $value = wp_unslash( $_POST[$option_name] );
    158158                        update_site_option( $option_name, $value );
    159159                }
    160160
  • wp-admin/edit.php

     
    138138        wp_redirect($sendback);
    139139        exit();
    140140} 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']) ) );
    142142         exit;
    143143}
    144144
  • wp-admin/upgrade.php

     
    7272<?php else :
    7373switch ( $step ) :
    7474        case 0:
    75                 $goback = stripslashes( wp_get_referer() );
     75                $goback = wp_unslash( wp_get_referer() );
    7676                $goback = esc_url_raw( $goback );
    7777                $goback = urlencode( $goback );
    7878?>
     
    8585        case 1:
    8686                wp_upgrade();
    8787
    88                         $backto = !empty($_GET['backto']) ? stripslashes( urldecode( $_GET['backto'] ) ) :  __get_option( 'home' ) . '/';
     88                        $backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) :  __get_option( 'home' ) . '/';
    8989                        $backto = esc_url( $backto );
    9090                        $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
    9191?>
  • wp-admin/options.php

     
    115115        if ( 'options' == $option_page ) {
    116116                if ( is_multisite() && ! is_super_admin() )
    117117                        wp_die( __( 'You do not have sufficient permissions to modify unregistered settings for this site.' ) );
    118                 $options = explode( ',', stripslashes( $_POST[ 'page_options' ] ) );
     118                $options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) );
    119119        } else {
    120120                $options = $whitelist_options[ $option_page ];
    121121        }
    122122
    123123        // Handle custom date/time formats
    124124        if ( 'general' == $option_page ) {
    125                 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) )
     125                if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) )
    126126                        $_POST['date_format'] = $_POST['date_format_custom'];
    127                 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) )
     127                if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) )
    128128                        $_POST['time_format'] = $_POST['time_format_custom'];
    129129                // Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
    130130                if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) {
     
    145145                                $value = $_POST[$option];
    146146                        if ( !is_array($value) )
    147147                                $value = trim($value);
    148                         $value = stripslashes_deep($value);
     148                        $value = wp_unslash($value);
    149149                        update_option($option, $value);
    150150                }
    151151        }
  • wp-admin/user-edit.php

     
    4949);
    5050
    5151
    52 $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
     52$wp_http_referer = remove_query_arg(array('update', 'delete_count'), wp_unslash($wp_http_referer));
    5353
    5454$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
    5555
  • wp-admin/press-this.php

     
    9696}
    9797
    9898// Set Variables
    99 $title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( stripslashes( $_GET['t'] ) , ENT_QUOTES) ) ) : '';
     99$title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( wp_unslash( $_GET['t'] ) , ENT_QUOTES) ) ) : '';
    100100
    101101$selection = '';
    102102if ( !empty($_GET['s']) ) {
    103         $selection = str_replace('&apos;', "'", stripslashes($_GET['s']));
     103        $selection = str_replace('&apos;', "'", wp_unslash($_GET['s']));
    104104        $selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) );
    105105}
    106106
  • wp-admin/link-manager.php

     
    3131                exit;
    3232        }
    3333} 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'] ) ) );
    3535         exit;
    3636}
    3737
     
    6161<?php screen_icon(); ?>
    6262<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
    6363if ( !empty($_REQUEST['s']) )
    64         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?>
     64        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
    6565</h2>
    6666
    6767<?php
  • wp-admin/install.php

     
    8282        if ( ! empty( $_POST ) )
    8383                $blog_public = isset( $_POST['blog_public'] );
    8484
    85         $weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';
    86         $user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin';
    87         $admin_password = isset($_POST['admin_password']) ? trim( stripslashes( $_POST['admin_password'] ) ) : '';
    88         $admin_email  = isset( $_POST['admin_email']  ) ? trim( stripslashes( $_POST['admin_email'] ) ) : '';
     85        $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
     86        $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : 'admin';
     87        $admin_password = isset($_POST['admin_password']) ? trim( wp_unslash( $_POST['admin_password'] ) ) : '';
     88        $admin_email  = isset( $_POST['admin_email']  ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : '';
    8989
    9090        if ( ! is_null( $error ) ) {
    9191?>
     
    181181
    182182                display_header();
    183183                // Fill in the data we gathered
    184                 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';
    185                 $user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin';
     184                $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
     185                $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : 'admin';
    186186                $admin_password = isset($_POST['admin_password']) ? $_POST['admin_password'] : '';
    187187                $admin_password_check = isset($_POST['admin_password2']) ? $_POST['admin_password2'] : '';
    188                 $admin_email  = isset( $_POST['admin_email']  ) ?trim( stripslashes( $_POST['admin_email'] ) ) : '';
     188                $admin_email  = isset( $_POST['admin_email']  ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : '';
    189189                $public       = isset( $_POST['blog_public']  ) ? (int) $_POST['blog_public'] : 0;
    190190                // check e-mail address
    191191                $error = false;
  • wp-admin/plugin-editor.php

     
    3030        wp_die( __('There are no plugins installed on this site.') );
    3131
    3232if ( isset($_REQUEST['file']) )
    33         $plugin = stripslashes($_REQUEST['file']);
     33        $plugin = wp_unslash($_REQUEST['file']);
    3434
    3535if ( empty($plugin) ) {
    3636        $plugin = array_keys($plugins);
     
    4242if ( empty($file) )
    4343        $file = $plugin_files[0];
    4444else
    45         $file = stripslashes($file);
     45        $file = wp_unslash($file);
    4646
    4747$file = validate_file_to_edit($file, $plugin_files);
    4848$real_file = WP_PLUGIN_DIR . '/' . $file;
     
    5454
    5555        check_admin_referer('edit-plugin_' . $file);
    5656
    57         $newcontent = stripslashes($_POST['newcontent']);
     57        $newcontent = wp_unslash($_POST['newcontent']);
    5858        if ( is_writeable($real_file) ) {
    5959                $f = fopen($real_file, 'w+');
    6060                fwrite($f, $newcontent);