diff --git a/wp-admin/admin.php b/wp-admin/admin.php
index 4e739c3c8d..1b58b4bafe 100644
--- a/wp-admin/admin.php
+++ b/wp-admin/admin.php
@@ -43,7 +43,7 @@ if ( get_option('db_upgraded') ) {
do_action('after_db_upgrade');
} elseif ( get_option('db_version') != $wp_db_version && empty($_POST) ) {
if ( !is_multisite() ) {
- wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
+ wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
exit;
} elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
/**
@@ -82,7 +82,7 @@ wp_enqueue_script( 'common' );
$editing = false;
if ( isset($_GET['page']) ) {
- $plugin_page = wp_unslash( $_GET['page'] );
+ $plugin_page = stripslashes($_GET['page']);
$plugin_page = plugin_basename($plugin_page);
}
diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php
index 85a684b792..a924ecaf79 100644
--- a/wp-admin/custom-background.php
+++ b/wp-admin/custom-background.php
@@ -378,7 +378,7 @@ if ( current_theme_supports( 'custom-background', 'default-color' ) )
// Add the meta-data
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
- wp_update_post_meta( $id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
+ update_post_meta( $id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
set_theme_mod('background_image', esc_url_raw($url));
@@ -415,7 +415,7 @@ if ( current_theme_supports( 'custom-background', 'default-color' ) )
if ( in_array( $_POST['size'], $sizes ) )
$size = esc_attr( $_POST['size'] );
- wp_update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
+ update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
$url = wp_get_attachment_image_src( $attachment_id, $size );
$thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' );
set_theme_mod( 'background_image', esc_url_raw( $url[0] ) );
diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php
index 10c81a31eb..7629af3d3a 100644
--- a/wp-admin/custom-header.php
+++ b/wp-admin/custom-header.php
@@ -948,7 +948,7 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
'width' => $choice['width'],
);
- wp_update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() );
+ update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() );
set_theme_mod( 'header_image', $choice['url'] );
set_theme_mod( 'header_image_data', $header_image_data );
return;
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index f6dd19c0b3..174cd9af11 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -20,9 +20,9 @@ if ( $doaction ) {
check_admin_referer( 'bulk-comments' );
if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
- $comment_status = $_REQUEST['comment_status'];
- $delete_time = $_REQUEST['pagegen_timestamp'];
- $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 ) );
+ $comment_status = $wpdb->escape( $_REQUEST['comment_status'] );
+ $delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] );
+ $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" );
$doaction = 'delete';
} elseif ( isset( $_REQUEST['delete_comments'] ) ) {
$comment_ids = $_REQUEST['delete_comments'];
@@ -95,7 +95,7 @@ if ( $doaction ) {
wp_safe_redirect( $redirect_to );
exit;
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
- wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
+ wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
exit;
}
@@ -153,7 +153,7 @@ else
echo __('Comments');
if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
- printf( '' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50 ) ) . '' ); ?>
+ printf( '' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ) . '' ); ?>
cap->create
-
+
comment_ID) ?>" />
-
+
diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php
index 0aca6e7bc1..6d81ec0144 100644
--- a/wp-admin/edit-link-form.php
+++ b/wp-admin/edit-link-form.php
@@ -126,6 +126,7 @@ do_meta_boxes(null, 'advanced', $link);
if ( $link_id ) : ?>
+
diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php
index 8d3a02abd8..7250a66984 100644
--- a/wp-admin/edit-tags.php
+++ b/wp-admin/edit-tags.php
@@ -47,9 +47,7 @@ case 'add-tag':
if ( !current_user_can( $tax->cap->edit_terms ) )
wp_die( __( 'Cheatin’ uh?' ) );
- $post_data = wp_unslash( $_POST );
-
- $ret = wp_insert_term( $post_data['tag-name'], $taxonomy, $post_data );
+ $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
if ( 'post' != $post_type )
$location .= '&post_type=' . $post_type;
@@ -134,10 +132,7 @@ case 'edit':
break;
case 'editedtag':
-
- $post_data = wp_unslash( $_POST );
-
- $tag_ID = (int) $post_data['tag_ID'];
+ $tag_ID = (int) $_POST['tag_ID'];
check_admin_referer( 'update-tag_' . $tag_ID );
if ( !current_user_can( $tax->cap->edit_terms ) )
@@ -147,7 +142,7 @@ case 'editedtag':
if ( ! $tag )
wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );
- $ret = wp_update_term( $tag_ID, $taxonomy, $post_data );
+ $ret = wp_update_term( $tag_ID, $taxonomy, $_POST );
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
if ( 'post' != $post_type )
@@ -169,7 +164,7 @@ break;
default:
if ( ! empty($_REQUEST['_wp_http_referer']) ) {
- $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) );
+ $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) );
if ( ! empty( $_REQUEST['paged'] ) )
$location = add_query_arg( 'paged', (int) $_REQUEST['paged'] );
@@ -269,8 +264,8 @@ $messages[6] = __('Items deleted.');
' . __('Search results for “%s”') . '', esc_html( wp_unslash( $_REQUEST['s'] ) ) ); ?>
+if ( !empty($_REQUEST['s']) )
+ printf( '' . __('Search results for “%s”') . '', esc_html( stripslashes($_REQUEST['s']) ) ); ?>
diff --git a/wp-admin/edit.php b/wp-admin/edit.php
index 0fe509ee6d..507c76554d 100644
--- a/wp-admin/edit.php
+++ b/wp-admin/edit.php
@@ -138,7 +138,7 @@ if ( $doaction ) {
wp_redirect($sendback);
exit();
} elseif ( ! empty($_REQUEST['_wp_http_referer']) ) {
- wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
+ wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
exit;
}
diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
index 2cab400a6a..04d7312c1a 100644
--- a/wp-admin/includes/ajax-actions.php
+++ b/wp-admin/includes/ajax-actions.php
@@ -59,7 +59,7 @@ function wp_ajax_ajax_tag_search() {
wp_die( 0 );
}
- $s = wp_unslash( $_GET['q'] );
+ $s = stripslashes( $_GET['q'] );
$comma = _x( ',', 'tag delimiter' );
if ( ',' !== $comma )
@@ -279,21 +279,19 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
*/
function _wp_ajax_add_hierarchical_term() {
- $post_data = wp_unslash( $_POST );
-
- $action = $post_data['action'];
+ $action = $_POST['action'];
$taxonomy = get_taxonomy(substr($action, 4));
check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name );
if ( !current_user_can( $taxonomy->cap->edit_terms ) )
wp_die( -1 );
- $names = explode(',', $post_data['new'.$taxonomy->name]);
- $parent = isset($post_data['new'.$taxonomy->name.'_parent']) ? (int) $post_data['new'.$taxonomy->name.'_parent'] : 0;
+ $names = explode(',', $_POST['new'.$taxonomy->name]);
+ $parent = isset($_POST['new'.$taxonomy->name.'_parent']) ? (int) $_POST['new'.$taxonomy->name.'_parent'] : 0;
if ( 0 > $parent )
$parent = 0;
if ( $taxonomy->name == 'category' )
- $post_category = isset( $post_data['post_category'] ) ? (array) $post_data['post_category'] : array();
+ $post_category = isset($_POST['post_category']) ? (array) $_POST['post_category'] : array();
else
- $post_category = ( isset( $post_data['tax_input'] ) && isset( $post_data['tax_input'][$taxonomy->name] ) ) ? (array) $post_data['tax_input'][$taxonomy->name] : array();
+ $post_category = ( isset($_POST['tax_input']) && isset($_POST['tax_input'][$taxonomy->name]) ) ? (array) $_POST['tax_input'][$taxonomy->name] : array();
$checked_categories = array_map( 'absint', (array) $post_category );
$popular_ids = wp_popular_terms_checklist($taxonomy->name, 0, 10, false);
@@ -561,7 +559,7 @@ function wp_ajax_add_link_category( $action ) {
check_ajax_referer( $action );
if ( !current_user_can( 'manage_categories' ) )
wp_die( -1 );
- $names = explode( ',', wp_unslash( $_POST['newcat'] ) );
+ $names = explode(',', $_POST['newcat']);
$x = new WP_Ajax_Response();
foreach ( $names as $cat_name ) {
$cat_name = trim($cat_name);
@@ -574,7 +572,7 @@ function wp_ajax_add_link_category( $action ) {
continue;
else if ( is_array( $cat_id ) )
$cat_id = $cat_id['term_id'];
- $cat_name = esc_html( wp_unslash( $cat_name ) );
+ $cat_name = esc_html(stripslashes($cat_name));
$x->add( array(
'what' => 'link-category',
'id' => $cat_id,
@@ -588,11 +586,9 @@ function wp_ajax_add_link_category( $action ) {
function wp_ajax_add_tag() {
global $wp_list_table;
- $post_data = wp_unslash( $_POST );
-
check_ajax_referer( 'add-tag', '_wpnonce_add-tag' );
- $post_type = !empty($post_data['post_type']) ? $post_data['post_type'] : 'post';
- $taxonomy = !empty($post_data['taxonomy']) ? $post_data['taxonomy'] : 'post_tag';
+ $post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post';
+ $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
$tax = get_taxonomy($taxonomy);
if ( !current_user_can( $tax->cap->edit_terms ) )
@@ -600,7 +596,7 @@ function wp_ajax_add_tag() {
$x = new WP_Ajax_Response();
- $tag = wp_insert_term( $post_data['tag-name'], $taxonomy, $post_data );
+ $tag = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST );
if ( !$tag || is_wp_error($tag) || (!$tag = get_term( $tag['term_id'], $taxonomy )) ) {
$message = __('An error has occurred. Please reload the page and try again.');
@@ -614,7 +610,7 @@ function wp_ajax_add_tag() {
$x->send();
}
- $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $post_data['screen'] ) );
+ $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $_POST['screen'] ) );
$level = 0;
if ( is_taxonomy_hierarchical($taxonomy) ) {
@@ -732,10 +728,10 @@ function wp_ajax_replyto_comment( $action ) {
$user = wp_get_current_user();
if ( $user->exists() ) {
$user_ID = $user->ID;
- $comment_author = $user->display_name;
- $comment_author_email = $user->user_email;
- $comment_author_url = $user->user_url;
- $comment_content = trim( wp_unslash( $_POST['content'] ) );
+ $comment_author = $wpdb->escape($user->display_name);
+ $comment_author_email = $wpdb->escape($user->user_email);
+ $comment_author_url = $wpdb->escape($user->user_url);
+ $comment_content = trim($_POST['content']);
if ( current_user_can( 'unfiltered_html' ) ) {
if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
kses_remove_filters(); // start with a clean slate
@@ -961,8 +957,8 @@ function wp_ajax_add_meta() {
) );
} else { // Update?
$mid = (int) key( $_POST['meta'] );
- $key = wp_unslash( $_POST['meta'][$mid]['key'] );
- $value = wp_unslash( $_POST['meta'][$mid]['value'] );
+ $key = stripslashes( $_POST['meta'][$mid]['key'] );
+ $value = stripslashes( $_POST['meta'][$mid]['value'] );
if ( '' == trim($key) )
wp_die( __( 'Please provide a custom field name.' ) );
if ( '' == trim($value) )
@@ -1231,7 +1227,7 @@ function wp_ajax_wp_link_ajax() {
$args = array();
if ( isset( $_POST['search'] ) )
- $args['s'] = wp_unslash( $_POST['search'] );
+ $args['s'] = stripslashes( $_POST['search'] );
$args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
require(ABSPATH . WPINC . '/class-wp-editor.php');
@@ -1332,6 +1328,7 @@ function wp_ajax_inline_save() {
$data = &$_POST;
$post = get_post( $post_ID, ARRAY_A );
+ $post = add_magic_quotes($post); //since it is from db
$data['content'] = $post['post_content'];
$data['excerpt'] = $post['post_excerpt'];
@@ -1380,9 +1377,7 @@ function wp_ajax_inline_save_tax() {
check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
- $post_data = wp_unslash( $_POST );
-
- $taxonomy = sanitize_key( $post_data['taxonomy'] );
+ $taxonomy = sanitize_key( $_POST['taxonomy'] );
$tax = get_taxonomy( $taxonomy );
if ( ! $tax )
wp_die( 0 );
@@ -1392,13 +1387,13 @@ function wp_ajax_inline_save_tax() {
$wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) );
- if ( ! isset($post_data['tax_ID']) || ! ( $id = (int) $post_data['tax_ID'] ) )
+ if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
wp_die( -1 );
$tag = get_term( $id, $taxonomy );
- $post_data['description'] = $tag->description;
+ $_POST['description'] = $tag->description;
- $updated = wp_update_term($id, $taxonomy, $post_data );
+ $updated = wp_update_term($id, $taxonomy, $_POST);
if ( $updated && !is_wp_error($updated) ) {
$tag = get_term( $updated['term_id'], $taxonomy );
if ( !$tag || is_wp_error( $tag ) ) {
@@ -1430,7 +1425,7 @@ function wp_ajax_find_posts() {
$post_types = get_post_types( array( 'public' => true ), 'objects' );
unset( $post_types['attachment'] );
- $s = wp_unslash( $_POST['ps'] );
+ $s = stripslashes( $_POST['ps'] );
$searchand = $search = '';
$args = array(
'post_type' => array_keys( $post_types ),
@@ -1601,7 +1596,7 @@ function wp_ajax_upload_attachment() {
$post_id = null;
}
- $post_data = isset( $_REQUEST['post_data'] ) ? wp_unslash( $_REQUEST['post_data'] ) : array();
+ $post_data = isset( $_REQUEST['post_data'] ) ? $_REQUEST['post_data'] : array();
// If the context is custom header or background, make sure the uploaded file is an image.
if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ) ) ) {
@@ -1635,10 +1630,10 @@ function wp_ajax_upload_attachment() {
if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) {
if ( 'custom-background' === $post_data['context'] )
- wp_update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] );
+ update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] );
if ( 'custom-header' === $post_data['context'] )
- wp_update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] );
+ update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] );
}
if ( ! $attachment = wp_prepare_attachment_for_js( $attachment_id ) )
@@ -1783,7 +1778,7 @@ function wp_ajax_wp_remove_post_lock() {
wp_die( 0 );
$new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 ) + 5 ) . ':' . $active_lock[1];
- wp_update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
+ update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
wp_die( 1 );
}
@@ -1878,7 +1873,7 @@ function wp_ajax_save_attachment() {
if ( ! current_user_can( 'edit_post', $id ) )
wp_send_json_error();
- $changes = wp_unslash( $_REQUEST['changes'] );
+ $changes = $_REQUEST['changes'];
$post = get_post( $id, ARRAY_A );
if ( 'attachment' != $post['post_type'] )
@@ -1895,10 +1890,10 @@ function wp_ajax_save_attachment() {
if ( isset( $changes['alt'] ) ) {
$alt = get_post_meta( $id, '_wp_attachment_image_alt', true );
- $new_alt = $changes['alt'];
+ $new_alt = stripslashes( $changes['alt'] );
if ( $alt != $new_alt ) {
$new_alt = wp_strip_all_tags( $new_alt, true );
- wp_update_post_meta( $id, '_wp_attachment_image_alt', $new_alt );
+ update_post_meta( $id, '_wp_attachment_image_alt', addslashes( $new_alt ) );
}
}
@@ -1920,7 +1915,7 @@ function wp_ajax_save_attachment_compat() {
if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) )
wp_send_json_error();
- $attachment_data = wp_unslash( $_REQUEST['attachments'][ $id ] );
+ $attachment_data = $_REQUEST['attachments'][ $id ];
check_ajax_referer( 'update-post_' . $id, 'nonce' );
@@ -1964,7 +1959,7 @@ function wp_ajax_save_attachment_order() {
check_ajax_referer( 'update-post_' . $post_id, 'nonce' );
- $attachments = wp_unslash( $_REQUEST['attachments'] );
+ $attachments = $_REQUEST['attachments'];
if ( ! current_user_can( 'edit_post', $post_id ) )
wp_send_json_error();
@@ -1995,7 +1990,7 @@ function wp_ajax_save_attachment_order() {
function wp_ajax_send_attachment_to_editor() {
check_ajax_referer( 'media-send-to-editor', 'nonce' );
- $attachment = wp_unslash( $_POST['attachment'] );
+ $attachment = stripslashes_deep( $_POST['attachment'] );
$id = intval( $attachment['id'] );
@@ -2050,7 +2045,7 @@ function wp_ajax_send_attachment_to_editor() {
function wp_ajax_send_link_to_editor() {
check_ajax_referer( 'media-send-to-editor', 'nonce' );
- if ( ! $src = wp_unslash( $_POST['src'] ) )
+ if ( ! $src = stripslashes( $_POST['src'] ) )
wp_send_json_error();
if ( ! strpos( $src, '://' ) )
@@ -2059,7 +2054,7 @@ function wp_ajax_send_link_to_editor() {
if ( ! $src = esc_url_raw( $src ) )
wp_send_json_error();
- if ( ! $title = trim( wp_unslash( $_POST['title'] ) ) )
+ if ( ! $title = trim( stripslashes( $_POST['title'] ) ) )
$title = wp_basename( $src );
$html = '';
@@ -2088,7 +2083,7 @@ function wp_ajax_heartbeat() {
$screen_id = 'site';
if ( ! empty($_POST['data']) ) {
- $data = wp_unslash( (array) $_POST['data'] );
+ $data = (array) $_POST['data'];
// todo: how much to sanitize and preset and what to leave to be accessed from $data or $_POST..?
$user = wp_get_current_user();
$data['user_id'] = $user->exists() ? $user->ID : 0;
@@ -2119,7 +2114,7 @@ function wp_ajax_nopriv_heartbeat() {
$screen_id = 'site';
if ( ! empty($_POST['data']) ) {
- $data = wp_unslash( (array) $_POST['data'] );
+ $data = stripslashes_deep( (array) $_POST['data'] );
$response = apply_filters( 'heartbeat_nopriv_received', $response, $data, $screen_id );
}
diff --git a/wp-admin/includes/bookmark.php b/wp-admin/includes/bookmark.php
index 14cb20dac2..4d240b775c 100644
--- a/wp-admin/includes/bookmark.php
+++ b/wp-admin/includes/bookmark.php
@@ -39,9 +39,9 @@ function edit_link( $link_id = 0 ) {
if ( !empty( $link_id ) ) {
$_POST['link_id'] = $link_id;
- return wp_update_link( wp_unslash( $_POST ) );
+ return wp_update_link( $_POST );
} else {
- return wp_insert_link( wp_unslash( $_POST ) );
+ return wp_insert_link( $_POST );
}
}
@@ -55,12 +55,12 @@ function edit_link( $link_id = 0 ) {
function get_default_link_to_edit() {
$link = new stdClass;
if ( isset( $_GET['linkurl'] ) )
- $link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) );
+ $link->link_url = esc_url( $_GET['linkurl'] );
else
$link->link_url = '';
if ( isset( $_GET['name'] ) )
- $link->link_name = esc_attr( wp_unslash( $_GET['name'] ) );
+ $link->link_name = esc_attr( $_GET['name'] );
else
$link->link_name = '';
@@ -137,7 +137,7 @@ function wp_insert_link( $linkdata, $wp_error = false ) {
$linkdata = wp_parse_args( $linkdata, $defaults );
$linkdata = sanitize_bookmark( $linkdata, 'db' );
- extract( $linkdata, EXTR_SKIP );
+ extract( stripslashes_deep( $linkdata ), EXTR_SKIP );
$update = false;
@@ -250,6 +250,9 @@ function wp_update_link( $linkdata ) {
$link = get_bookmark( $link_id, ARRAY_A );
+ // Escape data pulled from DB.
+ $link = add_magic_quotes( $link );
+
// Passed link category list overwrites existing category list if not empty.
if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )
&& 0 != count( $linkdata['link_category'] ) )
diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php
index bd04f09be1..cf0ab88a82 100644
--- a/wp-admin/includes/class-wp-comments-list-table.php
+++ b/wp-admin/includes/class-wp-comments-list-table.php
@@ -170,7 +170,7 @@ class WP_Comments_List_Table extends WP_List_Table {
/*
// I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
if ( !empty( $_REQUEST['s'] ) )
- $link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link );
+ $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );
*/
$status_links[$status] = "
" . sprintf(
translate_nooped_plural( $label, $num_comments->$status ),
diff --git a/wp-admin/includes/class-wp-ms-sites-list-table.php b/wp-admin/includes/class-wp-ms-sites-list-table.php
index b9d68a1f35..371901a638 100644
--- a/wp-admin/includes/class-wp-ms-sites-list-table.php
+++ b/wp-admin/includes/class-wp-ms-sites-list-table.php
@@ -29,7 +29,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
$pagenum = $this->get_pagenum();
- $s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST[ 's' ] ) ) : '';
+ $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : '';
$wild = '';
if ( false !== strpos($s, '*') ) {
$wild = '%';
diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php
index df9db5e892..d4190249bf 100644
--- a/wp-admin/includes/class-wp-ms-themes-list-table.php
+++ b/wp-admin/includes/class-wp-ms-themes-list-table.php
@@ -126,7 +126,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
function _search_callback( $theme ) {
static $term;
if ( is_null( $term ) )
- $term = wp_unslash( $_REQUEST['s'] );
+ $term = stripslashes( $_REQUEST['s'] );
foreach ( array( 'Name', 'Description', 'Author', 'Author', 'AuthorURI' ) as $field ) {
// Don't mark up; Do translate.
diff --git a/wp-admin/includes/class-wp-ms-users-list-table.php b/wp-admin/includes/class-wp-ms-users-list-table.php
index ab1ee3620e..6a4268f6ae 100644
--- a/wp-admin/includes/class-wp-ms-users-list-table.php
+++ b/wp-admin/includes/class-wp-ms-users-list-table.php
@@ -173,10 +173,10 @@ class WP_MS_Users_List_Table extends WP_List_Table {
case 'username':
$avatar = get_avatar( $user->user_email, 32 );
- $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
+ $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
echo ""; ?>
- user_login; ?>user_login ); ?>user_login, $super_admins ) )
echo ' - ' . __( 'Super Admin' );
?>
@@ -186,7 +186,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$actions['edit'] = '' . __( 'Edit' ) . '';
if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
- $actions['delete'] = '' . __( 'Delete' ) . '';
+ $actions['delete'] = '' . __( 'Delete' ) . '';
}
$actions = apply_filters( 'ms_user_row_actions', $actions, $user );
diff --git a/wp-admin/includes/class-wp-plugin-install-list-table.php b/wp-admin/includes/class-wp-plugin-install-list-table.php
index 76ef2ce2c1..aa7cffe4c9 100644
--- a/wp-admin/includes/class-wp-plugin-install-list-table.php
+++ b/wp-admin/includes/class-wp-plugin-install-list-table.php
@@ -48,8 +48,8 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
switch ( $tab ) {
case 'search':
- $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
- $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
+ $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : 'term';
+ $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
switch ( $type ) {
case 'tag':
@@ -73,7 +73,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
break;
case 'favorites':
- $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
+ $user = isset( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
if ( $user )
$args['user'] = $user;
diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php
index 64086d8d49..ec60afdfe6 100644
--- a/wp-admin/includes/class-wp-plugins-list-table.php
+++ b/wp-admin/includes/class-wp-plugins-list-table.php
@@ -22,7 +22,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
$status = $_REQUEST['plugin_status'];
if ( isset($_REQUEST['s']) )
- $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) );
+ $_SERVER['REQUEST_URI'] = add_query_arg('s', stripslashes($_REQUEST['s']) );
$page = $this->get_pagenum();
}
@@ -140,7 +140,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
function _search_callback( $plugin ) {
static $term;
if ( is_null( $term ) )
- $term = wp_unslash( $_REQUEST['s'] );
+ $term = stripslashes( $_REQUEST['s'] );
foreach ( $plugin as $value )
if ( stripos( $value, $term ) !== false )
diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php
index de8d8d32c1..85010105cd 100644
--- a/wp-admin/includes/class-wp-terms-list-table.php
+++ b/wp-admin/includes/class-wp-terms-list-table.php
@@ -52,7 +52,7 @@ class WP_Terms_List_Table extends WP_List_Table {
$tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter
}
- $search = !empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : '';
+ $search = !empty( $_REQUEST['s'] ) ? trim( stripslashes( $_REQUEST['s'] ) ) : '';
$args = array(
'search' => $search,
@@ -61,10 +61,10 @@ class WP_Terms_List_Table extends WP_List_Table {
);
if ( !empty( $_REQUEST['orderby'] ) )
- $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
+ $args['orderby'] = trim( stripslashes( $_REQUEST['orderby'] ) );
if ( !empty( $_REQUEST['order'] ) )
- $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
+ $args['order'] = trim( stripslashes( $_REQUEST['order'] ) );
$this->callback_args = $args;
diff --git a/wp-admin/includes/class-wp-theme-install-list-table.php b/wp-admin/includes/class-wp-theme-install-list-table.php
index 5bc80502f6..8aa892929d 100644
--- a/wp-admin/includes/class-wp-theme-install-list-table.php
+++ b/wp-admin/includes/class-wp-theme-install-list-table.php
@@ -24,7 +24,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
$search_terms = array();
$search_string = '';
if ( ! empty( $_REQUEST['s'] ) ){
- $search_string = strtolower( wp_unslash( $_REQUEST['s'] ) );
+ $search_string = strtolower( stripslashes( $_REQUEST['s'] ) );
$search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) );
}
@@ -59,7 +59,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
switch ( $tab ) {
case 'search':
- $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
+ $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : 'term';
switch ( $type ) {
case 'tag':
$args['tag'] = array_map( 'sanitize_key', $search_terms );
diff --git a/wp-admin/includes/class-wp-themes-list-table.php b/wp-admin/includes/class-wp-themes-list-table.php
index 684bd8be00..420495efe3 100644
--- a/wp-admin/includes/class-wp-themes-list-table.php
+++ b/wp-admin/includes/class-wp-themes-list-table.php
@@ -28,7 +28,7 @@ class WP_Themes_List_Table extends WP_List_Table {
$themes = wp_get_themes( array( 'allowed' => true ) );
if ( ! empty( $_REQUEST['s'] ) )
- $this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) );
+ $this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( stripslashes( $_REQUEST['s'] ) ) ) ) ) );
if ( ! empty( $_REQUEST['features'] ) )
$this->features = $_REQUEST['features'];
@@ -235,7 +235,7 @@ class WP_Themes_List_Table extends WP_List_Table {
* @uses _pagination_args['total_pages']
*/
function _js_vars( $extra_args = array() ) {
- $search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
+ $search_string = isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( $_REQUEST['s'] ) ) : '';
$args = array(
'search' => $search_string,
diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php
index a42ab3fdfd..c9bfec3dc4 100644
--- a/wp-admin/includes/class-wp-upgrader.php
+++ b/wp-admin/includes/class-wp-upgrader.php
@@ -1427,7 +1427,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$install_actions = array();
- $from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
+ $from = isset($_GET['from']) ? stripslashes($_GET['from']) : 'plugins';
if ( 'import' == $from )
$install_actions['activate_plugin'] = '' . __('Activate Plugin & Run Importer') . '';
diff --git a/wp-admin/includes/class-wp-users-list-table.php b/wp-admin/includes/class-wp-users-list-table.php
index 3071fa97af..10802c110c 100644
--- a/wp-admin/includes/class-wp-users-list-table.php
+++ b/wp-admin/includes/class-wp-users-list-table.php
@@ -241,7 +241,7 @@ class WP_Users_List_Table extends WP_List_Table {
// Check if the user for this row is editable
if ( current_user_can( 'list_users' ) ) {
// Set up the user editing link
- $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
+ $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
// Set up the hover actions for this user
$actions = array();
diff --git a/wp-admin/includes/comment.php b/wp-admin/includes/comment.php
index 311f669b54..1620755b68 100644
--- a/wp-admin/includes/comment.php
+++ b/wp-admin/includes/comment.php
@@ -19,6 +19,9 @@
function comment_exists($comment_author, $comment_date) {
global $wpdb;
+ $comment_author = stripslashes($comment_author);
+ $comment_date = stripslashes($comment_date);
+
return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments
WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
}
@@ -30,40 +33,38 @@ function comment_exists($comment_author, $comment_date) {
*/
function edit_comment() {
- $post_data = wp_unslash( $_POST );
-
- if ( ! current_user_can( 'edit_comment', (int) $post_data['comment_ID'] ) )
+ if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) )
wp_die ( __( 'You are not allowed to edit comments on this post.' ) );
- $post_data['comment_author'] = $post_data['newcomment_author'];
- $post_data['comment_author_email'] = $post_data['newcomment_author_email'];
- $post_data['comment_author_url'] = $post_data['newcomment_author_url'];
- $post_data['comment_approved'] = $post_data['comment_status'];
- $post_data['comment_content'] = $post_data['content'];
- $post_data['comment_ID'] = (int) $post_data['comment_ID'];
+ $_POST['comment_author'] = $_POST['newcomment_author'];
+ $_POST['comment_author_email'] = $_POST['newcomment_author_email'];
+ $_POST['comment_author_url'] = $_POST['newcomment_author_url'];
+ $_POST['comment_approved'] = $_POST['comment_status'];
+ $_POST['comment_content'] = $_POST['content'];
+ $_POST['comment_ID'] = (int) $_POST['comment_ID'];
foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
- if ( !empty( $post_data['hidden_' . $timeunit] ) && $post_data['hidden_' . $timeunit] != $post_data[$timeunit] ) {
+ if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
$_POST['edit_date'] = '1';
break;
}
}
- if ( !empty ( $post_data['edit_date'] ) ) {
- $aa = $post_data['aa'];
- $mm = $post_data['mm'];
- $jj = $post_data['jj'];
- $hh = $post_data['hh'];
- $mn = $post_data['mn'];
- $ss = $post_data['ss'];
+ if ( !empty ( $_POST['edit_date'] ) ) {
+ $aa = $_POST['aa'];
+ $mm = $_POST['mm'];
+ $jj = $_POST['jj'];
+ $hh = $_POST['hh'];
+ $mn = $_POST['mn'];
+ $ss = $_POST['ss'];
$jj = ($jj > 31 ) ? 31 : $jj;
$hh = ($hh > 23 ) ? $hh -24 : $hh;
$mn = ($mn > 59 ) ? $mn -60 : $mn;
$ss = ($ss > 59 ) ? $ss -60 : $ss;
- $post_data['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
+ $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
}
- wp_update_comment( $post_data );
+ wp_update_comment( $_POST );
}
/**
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index 5576d510b0..ee41d53e7b 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -1093,7 +1093,7 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
$widget_options[$widget_id]['number'] = $number;
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) {
- $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] );
+ $_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] );
$widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
// title is optional. If black, fill it if possible
if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php
index e6353eaf30..8513cada32 100644
--- a/wp-admin/includes/deprecated.php
+++ b/wp-admin/includes/deprecated.php
@@ -472,13 +472,14 @@ class WP_User_Search {
function WP_User_Search ($search_term = '', $page = '', $role = '') {
_deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' );
- $this->search_term = $search_term;
+ $this->search_term = stripslashes( $search_term );
$this->raw_page = ( '' == $page ) ? false : (int) $page;
$this->page = (int) ( '' == $page ) ? 1 : $page;
$this->role = $role;
$this->prepare_query();
$this->query();
+ $this->prepare_vars_for_template_usage();
$this->do_paging();
}
@@ -549,7 +550,9 @@ class WP_User_Search {
* @since 2.1.0
* @access public
*/
- function prepare_vars_for_template_usage() {}
+ function prepare_vars_for_template_usage() {
+ $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
+ }
/**
* {@internal Missing Short Description}}
diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index eac8ab53a5..05eaf82527 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php
@@ -901,13 +901,13 @@ function request_filesystem_credentials($form_post, $type = '', $error = false,
$credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => ''));
// 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)
- $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? wp_unslash( $_POST['hostname'] ) : $credentials['hostname']);
- $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? wp_unslash( $_POST['username'] ) : $credentials['username']);
- $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? wp_unslash( $_POST['password'] ) : '');
+ $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? stripslashes($_POST['hostname']) : $credentials['hostname']);
+ $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? stripslashes($_POST['username']) : $credentials['username']);
+ $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? stripslashes($_POST['password']) : '');
// Check to see if we are setting the public/private keys for ssh
- $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? wp_unslash( $_POST['public_key'] ) : '');
- $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? wp_unslash( $_POST['private_key'] ) : '');
+ $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? stripslashes($_POST['public_key']) : '');
+ $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? stripslashes($_POST['private_key']) : '');
//sanitize the hostname, Some people might pass in odd-data:
$credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off
@@ -925,7 +925,7 @@ function request_filesystem_credentials($form_post, $type = '', $error = false,
else if ( (defined('FTP_SSL') && FTP_SSL) && 'ftpext' == $type ) //Only the FTP Extension understands SSL
$credentials['connection_type'] = 'ftps';
else if ( !empty($_POST['connection_type']) )
- $credentials['connection_type'] = wp_unslash( $_POST['connection_type'] );
+ $credentials['connection_type'] = stripslashes($_POST['connection_type']);
else if ( !isset($credentials['connection_type']) ) //All else fails (And it's not defaulted to something else saved), Default to FTP
$credentials['connection_type'] = 'ftp';
@@ -1050,7 +1050,7 @@ jQuery(function($){
';
+ echo '';
}
submit_button( __( 'Proceed' ), 'button', 'upgrade' );
?>
diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php
index f0ded2f73d..01bce7bd97 100644
--- a/wp-admin/includes/image-edit.php
+++ b/wp-admin/includes/image-edit.php
@@ -454,7 +454,7 @@ function stream_preview_image( $post_id ) {
if ( is_wp_error( $img ) )
return false;
- $changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash( $_REQUEST['history'] ) ) : null;
+ $changes = !empty($_REQUEST['history']) ? json_decode( stripslashes($_REQUEST['history']) ) : null;
if ( $changes )
$img = image_edit_apply_changes( $img, $changes );
@@ -533,7 +533,7 @@ function wp_restore_image($post_id) {
}
}
- if ( !wp_update_attachment_metadata($post_id, $meta) || !wp_update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes) ) {
+ if ( !wp_update_attachment_metadata($post_id, $meta) || !update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes) ) {
$msg->error = __('Cannot save image metadata.');
return $msg;
}
@@ -587,7 +587,7 @@ function wp_save_image( $post_id ) {
return $return;
}
} elseif ( !empty($_REQUEST['history']) ) {
- $changes = json_decode( wp_unslash( $_REQUEST['history'] ) );
+ $changes = json_decode( stripslashes($_REQUEST['history']) );
if ( $changes )
$img = image_edit_apply_changes($img, $changes);
} else {
@@ -699,7 +699,7 @@ function wp_save_image( $post_id ) {
if ( $success ) {
wp_update_attachment_metadata( $post_id, $meta );
- wp_update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes);
+ update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes);
if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) {
// Check if it's an image edit from attachment edit screen
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 5e9912be68..814cae9f9e 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -444,8 +444,6 @@ function media_upload_form_handler() {
}
if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
- $attachment = wp_unslash( $attachment );
-
$post = $_post = get_post($attachment_id, ARRAY_A);
$post_type_object = get_post_type_object( $post[ 'post_type' ] );
@@ -470,9 +468,10 @@ function media_upload_form_handler() {
if ( isset($attachment['image_alt']) ) {
$image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
- if ( $image_alt != $attachment['image_alt'] ) {
- $image_alt = wp_strip_all_tags( $attachment['image_alt'], true );
- wp_update_post_meta( $attachment_id, '_wp_attachment_image_alt', $image_alt );
+ if ( $image_alt != stripslashes($attachment['image_alt']) ) {
+ $image_alt = wp_strip_all_tags( stripslashes($attachment['image_alt']), true );
+ // update_meta expects slashed
+ update_post_meta( $attachment_id, '_wp_attachment_image_alt', addslashes($image_alt) );
}
}
@@ -502,7 +501,7 @@ function media_upload_form_handler() {
}
if ( isset($send_id) ) {
- $attachment = wp_unslash( $_POST['attachments'][$send_id] );
+ $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
if ( !empty($attachment['url']) ) {
@@ -547,7 +546,7 @@ function wp_media_upload_handler() {
$src = "http://$src";
if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
- $title = esc_html( wp_unslash( $_POST['title'] ) );
+ $title = esc_html( stripslashes( $_POST['title'] ) );
if ( empty( $title ) )
$title = esc_html( basename( $src ) );
@@ -562,9 +561,9 @@ function wp_media_upload_handler() {
$html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
} else {
$align = '';
- $alt = esc_attr( wp_unslash( $_POST['alt'] ) );
+ $alt = esc_attr( stripslashes( $_POST['alt'] ) );
if ( isset($_POST['align']) ) {
- $align = esc_attr( wp_unslash( $_POST['align'] ) );
+ $align = esc_attr( stripslashes( $_POST['align'] ) );
$class = " class='align$align'";
}
if ( !empty($src) )
diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php
index d0f2ed7d16..b450e2c3ff 100644
--- a/wp-admin/includes/misc.php
+++ b/wp-admin/includes/misc.php
@@ -220,7 +220,7 @@ add_action( 'update_option_page_on_front', 'update_home_siteurl', 10, 2 );
* @return string
*/
function url_shorten( $url ) {
- $short_url = str_replace( 'http://', '', $url );
+ $short_url = str_replace( 'http://', '', stripslashes( $url ));
$short_url = str_replace( 'www.', '', $short_url );
$short_url = untrailingslashit( $short_url );
if ( strlen( $short_url ) > 35 )
@@ -248,9 +248,9 @@ function wp_reset_vars( $vars ) {
if ( empty( $_GET[$var] ) )
$$var = '';
else
- $$var = wp_unslash( $_GET[$var] );
+ $$var = $_GET[$var];
} else {
- $$var = wp_unslash( $_POST[$var] );
+ $$var = $_POST[$var];
}
}
}
@@ -323,8 +323,8 @@ function set_screen_options() {
if ( !$user = wp_get_current_user() )
return;
- $option = wp_unslash( $_POST['wp_screen_options']['option'] );
- $value = wp_unslash( $_POST['wp_screen_options']['value'] );
+ $option = $_POST['wp_screen_options']['option'];
+ $value = $_POST['wp_screen_options']['value'];
if ( $option != sanitize_key( $option ) )
return;
diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php
index 32b4c676cb..63a5f711f2 100644
--- a/wp-admin/includes/plugin-install.php
+++ b/wp-admin/includes/plugin-install.php
@@ -116,8 +116,8 @@ add_action('install_plugins_dashboard', 'install_dashboard');
* @since 2.7.0
*/
function install_search_form( $type_selector = true ) {
- $type = isset($_REQUEST['type']) ? wp_unslash( $_REQUEST['type'] ) : 'term';
- $term = isset($_REQUEST['s']) ? wp_unslash( $_REQUEST['s'] ) : '';
+ $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : 'term';
+ $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
?>
|