mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Change all core API to expect unslashed rather than slashed arguments.
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now. Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet. Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed. Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary. Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core. Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests. Plugins should use wp_unslash() on data being passed to core API. Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer. Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data. Remove many no longer necessary calls to $wpdb->escape() and esc_sql(). In wp_get_referer() and wp_get_original_referer(), return unslashed data. Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget. Switch several queries over to prepare(). Expect something to break. Props alexkingorg see #21767 git-svn-id: https://develop.svn.wordpress.org/trunk@23416 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+2
-2
@@ -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(stripslashes($_SERVER['REQUEST_URI']))));
|
||||
wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
|
||||
exit;
|
||||
} elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ wp_enqueue_script( 'common' );
|
||||
$editing = false;
|
||||
|
||||
if ( isset($_GET['page']) ) {
|
||||
$plugin_page = stripslashes($_GET['page']);
|
||||
$plugin_page = wp_unslash( $_GET['page'] );
|
||||
$plugin_page = plugin_basename($plugin_page);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ) );
|
||||
update_post_meta( $id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
|
||||
wp_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'] );
|
||||
|
||||
update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
|
||||
wp_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] ) );
|
||||
|
||||
@@ -948,7 +948,7 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
|
||||
'width' => $choice['width'],
|
||||
);
|
||||
|
||||
update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() );
|
||||
wp_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;
|
||||
|
||||
@@ -20,9 +20,9 @@ if ( $doaction ) {
|
||||
check_admin_referer( 'bulk-comments' );
|
||||
|
||||
if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
|
||||
$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" );
|
||||
$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 ) );
|
||||
$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' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
|
||||
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ else
|
||||
echo __('Comments');
|
||||
|
||||
if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
|
||||
printf( '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?>
|
||||
printf( '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?>
|
||||
</h2>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -304,7 +304,7 @@ if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create
|
||||
<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
|
||||
<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" />
|
||||
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" />
|
||||
<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
|
||||
<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url( wp_get_referer() ); ?>" />
|
||||
<?php if ( ! empty( $active_post_lock ) ) { ?>
|
||||
<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
|
||||
<?php
|
||||
|
||||
@@ -132,7 +132,7 @@ do_meta_boxes(null, 'normal', $comment);
|
||||
|
||||
<input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID) ?>" />
|
||||
<input type="hidden" name="p" value="<?php echo esc_attr($comment->comment_post_ID) ?>" />
|
||||
<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
|
||||
<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url( wp_get_referer() ); ?>" />
|
||||
<?php wp_original_referer_field(true, 'previous'); ?>
|
||||
<input type="hidden" name="noredir" value="1" />
|
||||
|
||||
|
||||
+11
-6
@@ -47,7 +47,9 @@ case 'add-tag':
|
||||
if ( !current_user_can( $tax->cap->edit_terms ) )
|
||||
wp_die( __( 'Cheatin’ uh?' ) );
|
||||
|
||||
$ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
|
||||
$post_data = wp_unslash( $_POST );
|
||||
|
||||
$ret = wp_insert_term( $post_data['tag-name'], $taxonomy, $post_data );
|
||||
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
|
||||
if ( 'post' != $post_type )
|
||||
$location .= '&post_type=' . $post_type;
|
||||
@@ -132,7 +134,10 @@ case 'edit':
|
||||
break;
|
||||
|
||||
case 'editedtag':
|
||||
$tag_ID = (int) $_POST['tag_ID'];
|
||||
|
||||
$post_data = wp_unslash( $_POST );
|
||||
|
||||
$tag_ID = (int) $post_data['tag_ID'];
|
||||
check_admin_referer( 'update-tag_' . $tag_ID );
|
||||
|
||||
if ( !current_user_can( $tax->cap->edit_terms ) )
|
||||
@@ -142,7 +147,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 );
|
||||
$ret = wp_update_term( $tag_ID, $taxonomy, $post_data );
|
||||
|
||||
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
|
||||
if ( 'post' != $post_type )
|
||||
@@ -164,7 +169,7 @@ break;
|
||||
|
||||
default:
|
||||
if ( ! empty($_REQUEST['_wp_http_referer']) ) {
|
||||
$location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) );
|
||||
$location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) );
|
||||
|
||||
if ( ! empty( $_REQUEST['paged'] ) )
|
||||
$location = add_query_arg( 'paged', (int) $_REQUEST['paged'] );
|
||||
@@ -264,8 +269,8 @@ $messages[6] = __('Items deleted.');
|
||||
<div class="wrap nosubsub">
|
||||
<?php screen_icon(); ?>
|
||||
<h2><?php echo esc_html( $title );
|
||||
if ( !empty($_REQUEST['s']) )
|
||||
printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?>
|
||||
if ( ! empty($_REQUEST['s']) )
|
||||
printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) ); ?>
|
||||
</h2>
|
||||
|
||||
<?php if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) ) : ?>
|
||||
|
||||
+1
-1
@@ -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'), stripslashes($_SERVER['REQUEST_URI']) ) );
|
||||
wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ function wp_ajax_ajax_tag_search() {
|
||||
wp_die( 0 );
|
||||
}
|
||||
|
||||
$s = stripslashes( $_GET['q'] );
|
||||
$s = wp_unslash( $_GET['q'] );
|
||||
|
||||
$comma = _x( ',', 'tag delimiter' );
|
||||
if ( ',' !== $comma )
|
||||
@@ -279,19 +279,21 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
|
||||
*/
|
||||
|
||||
function _wp_ajax_add_hierarchical_term() {
|
||||
$action = $_POST['action'];
|
||||
$post_data = wp_unslash( $_POST );
|
||||
|
||||
$action = $post_data['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['new'.$taxonomy->name]);
|
||||
$parent = isset($_POST['new'.$taxonomy->name.'_parent']) ? (int) $_POST['new'.$taxonomy->name.'_parent'] : 0;
|
||||
$names = explode(',', $post_data['new'.$taxonomy->name]);
|
||||
$parent = isset($post_data['new'.$taxonomy->name.'_parent']) ? (int) $post_data['new'.$taxonomy->name.'_parent'] : 0;
|
||||
if ( 0 > $parent )
|
||||
$parent = 0;
|
||||
if ( $taxonomy->name == 'category' )
|
||||
$post_category = isset($_POST['post_category']) ? (array) $_POST['post_category'] : array();
|
||||
$post_category = isset( $post_data['post_category'] ) ? (array) $post_data['post_category'] : array();
|
||||
else
|
||||
$post_category = ( isset($_POST['tax_input']) && isset($_POST['tax_input'][$taxonomy->name]) ) ? (array) $_POST['tax_input'][$taxonomy->name] : array();
|
||||
$post_category = ( isset( $post_data['tax_input'] ) && isset( $post_data['tax_input'][$taxonomy->name] ) ) ? (array) $post_data['tax_input'][$taxonomy->name] : array();
|
||||
$checked_categories = array_map( 'absint', (array) $post_category );
|
||||
$popular_ids = wp_popular_terms_checklist($taxonomy->name, 0, 10, false);
|
||||
|
||||
@@ -559,7 +561,7 @@ function wp_ajax_add_link_category( $action ) {
|
||||
check_ajax_referer( $action );
|
||||
if ( !current_user_can( 'manage_categories' ) )
|
||||
wp_die( -1 );
|
||||
$names = explode(',', $_POST['newcat']);
|
||||
$names = explode( ',', wp_unslash( $_POST['newcat'] ) );
|
||||
$x = new WP_Ajax_Response();
|
||||
foreach ( $names as $cat_name ) {
|
||||
$cat_name = trim($cat_name);
|
||||
@@ -572,7 +574,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(stripslashes($cat_name));
|
||||
$cat_name = esc_html( wp_unslash( $cat_name ) );
|
||||
$x->add( array(
|
||||
'what' => 'link-category',
|
||||
'id' => $cat_id,
|
||||
@@ -586,9 +588,11 @@ 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['post_type']) ? $_POST['post_type'] : 'post';
|
||||
$taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
|
||||
$post_type = !empty($post_data['post_type']) ? $post_data['post_type'] : 'post';
|
||||
$taxonomy = !empty($post_data['taxonomy']) ? $post_data['taxonomy'] : 'post_tag';
|
||||
$tax = get_taxonomy($taxonomy);
|
||||
|
||||
if ( !current_user_can( $tax->cap->edit_terms ) )
|
||||
@@ -596,7 +600,7 @@ function wp_ajax_add_tag() {
|
||||
|
||||
$x = new WP_Ajax_Response();
|
||||
|
||||
$tag = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST );
|
||||
$tag = wp_insert_term( $post_data['tag-name'], $taxonomy, $post_data );
|
||||
|
||||
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.');
|
||||
@@ -610,7 +614,7 @@ function wp_ajax_add_tag() {
|
||||
$x->send();
|
||||
}
|
||||
|
||||
$wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $_POST['screen'] ) );
|
||||
$wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $post_data['screen'] ) );
|
||||
|
||||
$level = 0;
|
||||
if ( is_taxonomy_hierarchical($taxonomy) ) {
|
||||
@@ -728,10 +732,10 @@ function wp_ajax_replyto_comment( $action ) {
|
||||
$user = wp_get_current_user();
|
||||
if ( $user->exists() ) {
|
||||
$user_ID = $user->ID;
|
||||
$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']);
|
||||
$comment_author = $user->display_name;
|
||||
$comment_author_email = $user->user_email;
|
||||
$comment_author_url = $user->user_url;
|
||||
$comment_content = trim( wp_unslash( $_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
|
||||
@@ -957,8 +961,8 @@ function wp_ajax_add_meta() {
|
||||
) );
|
||||
} else { // Update?
|
||||
$mid = (int) key( $_POST['meta'] );
|
||||
$key = stripslashes( $_POST['meta'][$mid]['key'] );
|
||||
$value = stripslashes( $_POST['meta'][$mid]['value'] );
|
||||
$key = wp_unslash( $_POST['meta'][$mid]['key'] );
|
||||
$value = wp_unslash( $_POST['meta'][$mid]['value'] );
|
||||
if ( '' == trim($key) )
|
||||
wp_die( __( 'Please provide a custom field name.' ) );
|
||||
if ( '' == trim($value) )
|
||||
@@ -1227,7 +1231,7 @@ function wp_ajax_wp_link_ajax() {
|
||||
$args = array();
|
||||
|
||||
if ( isset( $_POST['search'] ) )
|
||||
$args['s'] = stripslashes( $_POST['search'] );
|
||||
$args['s'] = wp_unslash( $_POST['search'] );
|
||||
$args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
|
||||
|
||||
require(ABSPATH . WPINC . '/class-wp-editor.php');
|
||||
@@ -1328,7 +1332,6 @@ 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'];
|
||||
@@ -1376,8 +1379,10 @@ function wp_ajax_inline_save_tax() {
|
||||
global $wp_list_table;
|
||||
|
||||
check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
|
||||
|
||||
$post_data = wp_unslash( $_POST );
|
||||
|
||||
$taxonomy = sanitize_key( $_POST['taxonomy'] );
|
||||
$taxonomy = sanitize_key( $post_data['taxonomy'] );
|
||||
$tax = get_taxonomy( $taxonomy );
|
||||
if ( ! $tax )
|
||||
wp_die( 0 );
|
||||
@@ -1387,13 +1392,13 @@ function wp_ajax_inline_save_tax() {
|
||||
|
||||
$wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) );
|
||||
|
||||
if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
|
||||
if ( ! isset($post_data['tax_ID']) || ! ( $id = (int) $post_data['tax_ID'] ) )
|
||||
wp_die( -1 );
|
||||
|
||||
$tag = get_term( $id, $taxonomy );
|
||||
$_POST['description'] = $tag->description;
|
||||
$post_data['description'] = $tag->description;
|
||||
|
||||
$updated = wp_update_term($id, $taxonomy, $_POST);
|
||||
$updated = wp_update_term($id, $taxonomy, $post_data );
|
||||
if ( $updated && !is_wp_error($updated) ) {
|
||||
$tag = get_term( $updated['term_id'], $taxonomy );
|
||||
if ( !$tag || is_wp_error( $tag ) ) {
|
||||
@@ -1425,7 +1430,7 @@ function wp_ajax_find_posts() {
|
||||
$post_types = get_post_types( array( 'public' => true ), 'objects' );
|
||||
unset( $post_types['attachment'] );
|
||||
|
||||
$s = stripslashes( $_POST['ps'] );
|
||||
$s = wp_unslash( $_POST['ps'] );
|
||||
$searchand = $search = '';
|
||||
$args = array(
|
||||
'post_type' => array_keys( $post_types ),
|
||||
@@ -1596,7 +1601,7 @@ function wp_ajax_upload_attachment() {
|
||||
$post_id = null;
|
||||
}
|
||||
|
||||
$post_data = isset( $_REQUEST['post_data'] ) ? $_REQUEST['post_data'] : array();
|
||||
$post_data = isset( $_REQUEST['post_data'] ) ? wp_unslash( $_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' ) ) ) {
|
||||
@@ -1630,10 +1635,10 @@ function wp_ajax_upload_attachment() {
|
||||
|
||||
if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) {
|
||||
if ( 'custom-background' === $post_data['context'] )
|
||||
update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] );
|
||||
wp_update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] );
|
||||
|
||||
if ( 'custom-header' === $post_data['context'] )
|
||||
update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] );
|
||||
wp_update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] );
|
||||
}
|
||||
|
||||
if ( ! $attachment = wp_prepare_attachment_for_js( $attachment_id ) )
|
||||
@@ -1778,7 +1783,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];
|
||||
update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
|
||||
wp_update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
|
||||
wp_die( 1 );
|
||||
}
|
||||
|
||||
@@ -1873,7 +1878,7 @@ function wp_ajax_save_attachment() {
|
||||
if ( ! current_user_can( 'edit_post', $id ) )
|
||||
wp_send_json_error();
|
||||
|
||||
$changes = $_REQUEST['changes'];
|
||||
$changes = wp_unslash( $_REQUEST['changes'] );
|
||||
$post = get_post( $id, ARRAY_A );
|
||||
|
||||
if ( 'attachment' != $post['post_type'] )
|
||||
@@ -1890,10 +1895,10 @@ function wp_ajax_save_attachment() {
|
||||
|
||||
if ( isset( $changes['alt'] ) ) {
|
||||
$alt = get_post_meta( $id, '_wp_attachment_image_alt', true );
|
||||
$new_alt = stripslashes( $changes['alt'] );
|
||||
$new_alt = $changes['alt'];
|
||||
if ( $alt != $new_alt ) {
|
||||
$new_alt = wp_strip_all_tags( $new_alt, true );
|
||||
update_post_meta( $id, '_wp_attachment_image_alt', addslashes( $new_alt ) );
|
||||
wp_update_post_meta( $id, '_wp_attachment_image_alt', $new_alt );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1915,7 +1920,7 @@ function wp_ajax_save_attachment_compat() {
|
||||
|
||||
if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) )
|
||||
wp_send_json_error();
|
||||
$attachment_data = $_REQUEST['attachments'][ $id ];
|
||||
$attachment_data = wp_unslash( $_REQUEST['attachments'][ $id ] );
|
||||
|
||||
check_ajax_referer( 'update-post_' . $id, 'nonce' );
|
||||
|
||||
@@ -1959,7 +1964,7 @@ function wp_ajax_save_attachment_order() {
|
||||
|
||||
check_ajax_referer( 'update-post_' . $post_id, 'nonce' );
|
||||
|
||||
$attachments = $_REQUEST['attachments'];
|
||||
$attachments = wp_unslash( $_REQUEST['attachments'] );
|
||||
|
||||
if ( ! current_user_can( 'edit_post', $post_id ) )
|
||||
wp_send_json_error();
|
||||
@@ -1990,7 +1995,7 @@ function wp_ajax_save_attachment_order() {
|
||||
function wp_ajax_send_attachment_to_editor() {
|
||||
check_ajax_referer( 'media-send-to-editor', 'nonce' );
|
||||
|
||||
$attachment = stripslashes_deep( $_POST['attachment'] );
|
||||
$attachment = wp_unslash( $_POST['attachment'] );
|
||||
|
||||
$id = intval( $attachment['id'] );
|
||||
|
||||
@@ -2045,7 +2050,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 = stripslashes( $_POST['src'] ) )
|
||||
if ( ! $src = wp_unslash( $_POST['src'] ) )
|
||||
wp_send_json_error();
|
||||
|
||||
if ( ! strpos( $src, '://' ) )
|
||||
@@ -2054,7 +2059,7 @@ function wp_ajax_send_link_to_editor() {
|
||||
if ( ! $src = esc_url_raw( $src ) )
|
||||
wp_send_json_error();
|
||||
|
||||
if ( ! $title = trim( stripslashes( $_POST['title'] ) ) )
|
||||
if ( ! $title = trim( wp_unslash( $_POST['title'] ) ) )
|
||||
$title = wp_basename( $src );
|
||||
|
||||
$html = '';
|
||||
@@ -2083,7 +2088,7 @@ function wp_ajax_heartbeat() {
|
||||
$screen_id = 'site';
|
||||
|
||||
if ( ! empty($_POST['data']) ) {
|
||||
$data = (array) $_POST['data'];
|
||||
$data = wp_unslash( (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;
|
||||
|
||||
@@ -39,9 +39,9 @@ function edit_link( $link_id = 0 ) {
|
||||
|
||||
if ( !empty( $link_id ) ) {
|
||||
$_POST['link_id'] = $link_id;
|
||||
return wp_update_link( $_POST );
|
||||
return wp_update_link( wp_unslash( $_POST ) );
|
||||
} else {
|
||||
return wp_insert_link( $_POST );
|
||||
return wp_insert_link( wp_unslash( $_POST ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ function wp_insert_link( $linkdata, $wp_error = false ) {
|
||||
$linkdata = wp_parse_args( $linkdata, $defaults );
|
||||
$linkdata = sanitize_bookmark( $linkdata, 'db' );
|
||||
|
||||
extract( stripslashes_deep( $linkdata ), EXTR_SKIP );
|
||||
extract( $linkdata, EXTR_SKIP );
|
||||
|
||||
$update = false;
|
||||
|
||||
@@ -250,9 +250,6 @@ 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'] ) )
|
||||
|
||||
@@ -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( stripslashes( $_REQUEST['s'] ) ), $link );
|
||||
$link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link );
|
||||
*/
|
||||
$status_links[$status] = "<a href='$link'$class>" . sprintf(
|
||||
translate_nooped_plural( $label, $num_comments->$status ),
|
||||
|
||||
@@ -29,7 +29,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||
|
||||
$pagenum = $this->get_pagenum();
|
||||
|
||||
$s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : '';
|
||||
$s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST[ 's' ] ) ) : '';
|
||||
$wild = '';
|
||||
if ( false !== strpos($s, '*') ) {
|
||||
$wild = '%';
|
||||
|
||||
@@ -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 = stripslashes( $_REQUEST['s'] );
|
||||
$term = wp_unslash( $_REQUEST['s'] );
|
||||
|
||||
foreach ( array( 'Name', 'Description', 'Author', 'Author', 'AuthorURI' ) as $field ) {
|
||||
// Don't mark up; Do translate.
|
||||
|
||||
@@ -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( stripslashes( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
|
||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
|
||||
|
||||
echo "<td $attributes>"; ?>
|
||||
<?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php
|
||||
<?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php
|
||||
if ( in_array( $user->user_login, $super_admins ) )
|
||||
echo ' - ' . __( 'Super Admin' );
|
||||
?></strong>
|
||||
@@ -186,7 +186,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||
$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
|
||||
|
||||
if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
|
||||
$actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
|
||||
$actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
|
||||
}
|
||||
|
||||
$actions = apply_filters( 'ms_user_row_actions', $actions, $user );
|
||||
|
||||
@@ -48,8 +48,8 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
|
||||
switch ( $tab ) {
|
||||
case 'search':
|
||||
$type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : 'term';
|
||||
$term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
|
||||
$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
|
||||
$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_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'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
|
||||
$user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
|
||||
update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
|
||||
if ( $user )
|
||||
$args['user'] = $user;
|
||||
|
||||
@@ -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', stripslashes($_REQUEST['s']) );
|
||||
$_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_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 = stripslashes( $_REQUEST['s'] );
|
||||
$term = wp_unslash( $_REQUEST['s'] );
|
||||
|
||||
foreach ( $plugin as $value )
|
||||
if ( stripos( $value, $term ) !== false )
|
||||
|
||||
@@ -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( stripslashes( $_REQUEST['s'] ) ) : '';
|
||||
$search = !empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_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( stripslashes( $_REQUEST['orderby'] ) );
|
||||
$args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
|
||||
|
||||
if ( !empty( $_REQUEST['order'] ) )
|
||||
$args['order'] = trim( stripslashes( $_REQUEST['order'] ) );
|
||||
$args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
|
||||
|
||||
$this->callback_args = $args;
|
||||
|
||||
|
||||
@@ -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( stripslashes( $_REQUEST['s'] ) );
|
||||
$search_string = strtolower( wp_unslash( $_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'] ) ? stripslashes( $_REQUEST['type'] ) : 'term';
|
||||
$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
|
||||
switch ( $type ) {
|
||||
case 'tag':
|
||||
$args['tag'] = array_map( 'sanitize_key', $search_terms );
|
||||
|
||||
@@ -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( stripslashes( $_REQUEST['s'] ) ) ) ) ) );
|
||||
$this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_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( stripslashes( $_REQUEST['s'] ) ) : '';
|
||||
$search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
|
||||
|
||||
$args = array(
|
||||
'search' => $search_string,
|
||||
|
||||
@@ -1427,7 +1427,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
|
||||
|
||||
$install_actions = array();
|
||||
|
||||
$from = isset($_GET['from']) ? stripslashes($_GET['from']) : 'plugins';
|
||||
$from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
|
||||
|
||||
if ( 'import' == $from )
|
||||
$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&from=import&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin & Run Importer') . '</a>';
|
||||
|
||||
@@ -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( stripslashes( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
|
||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
|
||||
|
||||
// Set up the hover actions for this user
|
||||
$actions = array();
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
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) );
|
||||
}
|
||||
@@ -33,38 +30,40 @@ function comment_exists($comment_author, $comment_date) {
|
||||
*/
|
||||
function edit_comment() {
|
||||
|
||||
if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) )
|
||||
$post_data = wp_unslash( $_POST );
|
||||
|
||||
if ( ! current_user_can( 'edit_comment', (int) $post_data['comment_ID'] ) )
|
||||
wp_die ( __( 'You are not allowed to edit comments on this post.' ) );
|
||||
|
||||
$_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'];
|
||||
$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'];
|
||||
|
||||
foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
|
||||
if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
|
||||
if ( !empty( $post_data['hidden_' . $timeunit] ) && $post_data['hidden_' . $timeunit] != $post_data[$timeunit] ) {
|
||||
$_POST['edit_date'] = '1';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !empty ( $_POST['edit_date'] ) ) {
|
||||
$aa = $_POST['aa'];
|
||||
$mm = $_POST['mm'];
|
||||
$jj = $_POST['jj'];
|
||||
$hh = $_POST['hh'];
|
||||
$mn = $_POST['mn'];
|
||||
$ss = $_POST['ss'];
|
||||
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'];
|
||||
$jj = ($jj > 31 ) ? 31 : $jj;
|
||||
$hh = ($hh > 23 ) ? $hh -24 : $hh;
|
||||
$mn = ($mn > 59 ) ? $mn -60 : $mn;
|
||||
$ss = ($ss > 59 ) ? $ss -60 : $ss;
|
||||
$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
|
||||
$post_data['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
|
||||
}
|
||||
|
||||
wp_update_comment( $_POST );
|
||||
wp_update_comment( $post_data );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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] = stripslashes_deep( $_POST['widget-rss'][$number] );
|
||||
$_POST['widget-rss'][$number] = wp_unslash( $_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']) ) {
|
||||
|
||||
@@ -472,14 +472,13 @@ class WP_User_Search {
|
||||
function WP_User_Search ($search_term = '', $page = '', $role = '') {
|
||||
_deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' );
|
||||
|
||||
$this->search_term = stripslashes( $search_term );
|
||||
$this->search_term = $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();
|
||||
}
|
||||
|
||||
@@ -550,9 +549,7 @@ class WP_User_Search {
|
||||
* @since 2.1.0
|
||||
* @access public
|
||||
*/
|
||||
function prepare_vars_for_template_usage() {
|
||||
$this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
|
||||
}
|
||||
function prepare_vars_for_template_usage() {}
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
|
||||
@@ -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']) ? 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']) : '');
|
||||
$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'] ) : '');
|
||||
|
||||
// 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']) ? stripslashes($_POST['public_key']) : '');
|
||||
$credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? stripslashes($_POST['private_key']) : '');
|
||||
$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'] ) : '');
|
||||
|
||||
//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'] = stripslashes($_POST['connection_type']);
|
||||
$credentials['connection_type'] = wp_unslash( $_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($){
|
||||
<?php
|
||||
foreach ( (array) $extra_fields as $field ) {
|
||||
if ( isset( $_POST[ $field ] ) )
|
||||
echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( stripslashes( $_POST[ $field ] ) ) . '" />';
|
||||
echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />';
|
||||
}
|
||||
submit_button( __( 'Proceed' ), 'button', 'upgrade' );
|
||||
?>
|
||||
|
||||
@@ -454,7 +454,7 @@ function stream_preview_image( $post_id ) {
|
||||
if ( is_wp_error( $img ) )
|
||||
return false;
|
||||
|
||||
$changes = !empty($_REQUEST['history']) ? json_decode( stripslashes($_REQUEST['history']) ) : null;
|
||||
$changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash( $_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) || !update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes) ) {
|
||||
if ( !wp_update_attachment_metadata($post_id, $meta) || !wp_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( stripslashes($_REQUEST['history']) );
|
||||
$changes = json_decode( wp_unslash( $_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 );
|
||||
update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes);
|
||||
wp_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
|
||||
|
||||
@@ -444,6 +444,8 @@ 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' ] );
|
||||
|
||||
@@ -468,10 +470,9 @@ 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 != 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) );
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,7 +502,7 @@ function media_upload_form_handler() {
|
||||
}
|
||||
|
||||
if ( isset($send_id) ) {
|
||||
$attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
|
||||
$attachment = wp_unslash( $_POST['attachments'][$send_id] );
|
||||
|
||||
$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
|
||||
if ( !empty($attachment['url']) ) {
|
||||
@@ -546,7 +547,7 @@ function wp_media_upload_handler() {
|
||||
$src = "http://$src";
|
||||
|
||||
if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
|
||||
$title = esc_html( stripslashes( $_POST['title'] ) );
|
||||
$title = esc_html( wp_unslash( $_POST['title'] ) );
|
||||
if ( empty( $title ) )
|
||||
$title = esc_html( basename( $src ) );
|
||||
|
||||
@@ -561,9 +562,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( stripslashes( $_POST['alt'] ) );
|
||||
$alt = esc_attr( wp_unslash( $_POST['alt'] ) );
|
||||
if ( isset($_POST['align']) ) {
|
||||
$align = esc_attr( stripslashes( $_POST['align'] ) );
|
||||
$align = esc_attr( wp_unslash( $_POST['align'] ) );
|
||||
$class = " class='align$align'";
|
||||
}
|
||||
if ( !empty($src) )
|
||||
|
||||
@@ -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://', '', stripslashes( $url ));
|
||||
$short_url = str_replace( 'http://', '', $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 = $_GET[$var];
|
||||
$$var = wp_unslash( $_GET[$var] );
|
||||
} else {
|
||||
$$var = $_POST[$var];
|
||||
$$var = wp_unslash( $_POST[$var] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,8 +323,8 @@ function set_screen_options() {
|
||||
|
||||
if ( !$user = wp_get_current_user() )
|
||||
return;
|
||||
$option = $_POST['wp_screen_options']['option'];
|
||||
$value = $_POST['wp_screen_options']['value'];
|
||||
$option = wp_unslash( $_POST['wp_screen_options']['option'] );
|
||||
$value = wp_unslash( $_POST['wp_screen_options']['value'] );
|
||||
|
||||
if ( $option != sanitize_key( $option ) )
|
||||
return;
|
||||
|
||||
@@ -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']) ? stripslashes( $_REQUEST['type'] ) : 'term';
|
||||
$term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
|
||||
$type = isset($_REQUEST['type']) ? wp_unslash( $_REQUEST['type'] ) : 'term';
|
||||
$term = isset($_REQUEST['s']) ? wp_unslash( $_REQUEST['s'] ) : '';
|
||||
|
||||
?><form id="search-plugins" method="get" action="">
|
||||
<input type="hidden" name="tab" value="search" />
|
||||
@@ -160,7 +160,7 @@ add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
|
||||
*
|
||||
*/
|
||||
function install_plugins_favorites_form() {
|
||||
$user = ! empty( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
|
||||
$user = ! empty( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
|
||||
?>
|
||||
<p class="install-help"><?php _e( 'If you have marked plugins as favorites on WordPress.org, you can browse them here.' ); ?></p>
|
||||
<form method="get" action="">
|
||||
@@ -251,7 +251,7 @@ function install_plugin_install_status($api, $loop = false) {
|
||||
}
|
||||
}
|
||||
if ( isset($_GET['from']) )
|
||||
$url .= '&from=' . urlencode(stripslashes($_GET['from']));
|
||||
$url .= '&from=' . urlencode( wp_unslash( $_GET['from'] ) );
|
||||
|
||||
return compact('status', 'url', 'version');
|
||||
}
|
||||
@@ -264,7 +264,7 @@ function install_plugin_install_status($api, $loop = false) {
|
||||
function install_plugin_information() {
|
||||
global $tab;
|
||||
|
||||
$api = plugins_api('plugin_information', array('slug' => stripslashes( $_REQUEST['plugin'] ) ));
|
||||
$api = plugins_api('plugin_information', array('slug' => wp_unslash( $_REQUEST['plugin'] ) ));
|
||||
|
||||
if ( is_wp_error($api) )
|
||||
wp_die($api);
|
||||
@@ -295,7 +295,7 @@ function install_plugin_information() {
|
||||
$api->$key = wp_kses( $api->$key, $plugins_allowedtags );
|
||||
}
|
||||
|
||||
$section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
|
||||
$section = isset($_REQUEST['section']) ? wp_unslash( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
|
||||
if ( empty($section) || ! isset($api->sections[ $section ]) )
|
||||
$section = array_shift( $section_titles = array_keys((array)$api->sections) );
|
||||
|
||||
|
||||
+23
-31
@@ -149,8 +149,8 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||
*/
|
||||
function edit_post( $post_data = null ) {
|
||||
|
||||
if ( empty($post_data) )
|
||||
$post_data = &$_POST;
|
||||
if ( empty( $post_data ) )
|
||||
$post_data = wp_unslash( $_POST );
|
||||
|
||||
// Clear out any data in internal vars.
|
||||
unset( $post_data['filter'] );
|
||||
@@ -228,10 +228,9 @@ function edit_post( $post_data = null ) {
|
||||
if ( 'attachment' == $post_data['post_type'] ) {
|
||||
if ( isset( $post_data[ '_wp_attachment_image_alt' ] ) ) {
|
||||
$image_alt = get_post_meta( $post_ID, '_wp_attachment_image_alt', true );
|
||||
if ( $image_alt != stripslashes( $post_data['_wp_attachment_image_alt'] ) ) {
|
||||
$image_alt = wp_strip_all_tags( stripslashes( $post_data['_wp_attachment_image_alt'] ), true );
|
||||
// update_meta expects slashed
|
||||
update_post_meta( $post_ID, '_wp_attachment_image_alt', addslashes( $image_alt ) );
|
||||
if ( $image_alt != $post_data['_wp_attachment_image_alt'] ) {
|
||||
$image_alt = wp_strip_all_tags( $post_data['_wp_attachment_image_alt'], true );
|
||||
wp_update_post_meta( $post_ID, '_wp_attachment_image_alt', $image_alt );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +240,7 @@ function edit_post( $post_data = null ) {
|
||||
|
||||
add_meta( $post_ID );
|
||||
|
||||
update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );
|
||||
wp_update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );
|
||||
|
||||
wp_update_post( $post_data );
|
||||
|
||||
@@ -422,15 +421,15 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
|
||||
|
||||
$post_title = '';
|
||||
if ( !empty( $_REQUEST['post_title'] ) )
|
||||
$post_title = esc_html( stripslashes( $_REQUEST['post_title'] ));
|
||||
$post_title = esc_html( wp_unslash( $_REQUEST['post_title'] ));
|
||||
|
||||
$post_content = '';
|
||||
if ( !empty( $_REQUEST['content'] ) )
|
||||
$post_content = esc_html( stripslashes( $_REQUEST['content'] ));
|
||||
$post_content = esc_html( wp_unslash( $_REQUEST['content'] ));
|
||||
|
||||
$post_excerpt = '';
|
||||
if ( !empty( $_REQUEST['excerpt'] ) )
|
||||
$post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] ));
|
||||
$post_excerpt = esc_html( wp_unslash( $_REQUEST['excerpt'] ));
|
||||
|
||||
if ( $create_in_db ) {
|
||||
$post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) );
|
||||
@@ -479,9 +478,9 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
|
||||
function post_exists($title, $content = '', $date = '') {
|
||||
global $wpdb;
|
||||
|
||||
$post_title = stripslashes( sanitize_post_field( 'post_title', $title, 0, 'db' ) );
|
||||
$post_content = stripslashes( sanitize_post_field( 'post_content', $content, 0, 'db' ) );
|
||||
$post_date = stripslashes( sanitize_post_field( 'post_date', $date, 0, 'db' ) );
|
||||
$post_title = sanitize_post_field( 'post_title', $title, 0, 'db' );
|
||||
$post_content = sanitize_post_field( 'post_content', $content, 0, 'db' );
|
||||
$post_date = sanitize_post_field( 'post_date', $date, 0, 'db' );
|
||||
|
||||
$query = "SELECT ID FROM $wpdb->posts WHERE 1=1";
|
||||
$args = array();
|
||||
@@ -559,7 +558,7 @@ function wp_write_post() {
|
||||
}
|
||||
|
||||
// Create the post.
|
||||
$post_ID = wp_insert_post( $_POST );
|
||||
$post_ID = wp_insert_post( wp_unslash( $_POST ) );
|
||||
if ( is_wp_error( $post_ID ) )
|
||||
return $post_ID;
|
||||
|
||||
@@ -568,7 +567,7 @@ function wp_write_post() {
|
||||
|
||||
add_meta( $post_ID );
|
||||
|
||||
add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );
|
||||
wp_add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );
|
||||
|
||||
// Now that we have an ID we can fix any attachment anchor hrefs
|
||||
_fix_attachment_links( $post_ID );
|
||||
@@ -612,9 +611,9 @@ function add_meta( $post_ID ) {
|
||||
global $wpdb;
|
||||
$post_ID = (int) $post_ID;
|
||||
|
||||
$metakeyselect = isset($_POST['metakeyselect']) ? stripslashes( trim( $_POST['metakeyselect'] ) ) : '';
|
||||
$metakeyinput = isset($_POST['metakeyinput']) ? stripslashes( trim( $_POST['metakeyinput'] ) ) : '';
|
||||
$metavalue = isset($_POST['metavalue']) ? $_POST['metavalue'] : '';
|
||||
$metakeyselect = isset($_POST['metakeyselect']) ? wp_unslash( trim( $_POST['metakeyselect'] ) ) : '';
|
||||
$metakeyinput = isset($_POST['metakeyinput']) ? wp_unslash( trim( $_POST['metakeyinput'] ) ) : '';
|
||||
$metavalue = isset($_POST['metavalue']) ? wp_unslash( trim( $_POST['metavalue'] ) ) : '';
|
||||
if ( is_string( $metavalue ) )
|
||||
$metavalue = trim( $metavalue );
|
||||
|
||||
@@ -631,9 +630,7 @@ function add_meta( $post_ID ) {
|
||||
if ( is_protected_meta( $metakey, 'post' ) || ! current_user_can( 'add_post_meta', $post_ID, $metakey ) )
|
||||
return false;
|
||||
|
||||
$metakey = esc_sql( $metakey );
|
||||
|
||||
return add_post_meta( $post_ID, $metakey, $metavalue );
|
||||
return wp_add_post_meta( $post_ID, $metakey, $metavalue );
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -706,14 +703,11 @@ function has_meta( $postid ) {
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param unknown_type $meta_id
|
||||
* @param unknown_type $meta_key Expect Slashed
|
||||
* @param unknown_type $meta_value Expect Slashed
|
||||
* @param unknown_type $meta_key
|
||||
* @param unknown_type $meta_value
|
||||
* @return unknown
|
||||
*/
|
||||
function update_meta( $meta_id, $meta_key, $meta_value ) {
|
||||
$meta_key = stripslashes( $meta_key );
|
||||
$meta_value = stripslashes_deep( $meta_value );
|
||||
|
||||
return update_metadata_by_mid( 'post', $meta_id, $meta_value, $meta_key );
|
||||
}
|
||||
|
||||
@@ -767,8 +761,6 @@ function _fix_attachment_links( $post_ID ) {
|
||||
|
||||
if ( $replace ) {
|
||||
$post['post_content'] = $content;
|
||||
// Escape data pulled from DB.
|
||||
$post = add_magic_quotes($post);
|
||||
|
||||
return wp_update_post($post);
|
||||
}
|
||||
@@ -1179,7 +1171,7 @@ function wp_set_post_lock( $post_id ) {
|
||||
$now = time();
|
||||
$lock = "$now:$user_id";
|
||||
|
||||
update_post_meta( $post->ID, '_edit_lock', $lock );
|
||||
wp_update_post_meta( $post->ID, '_edit_lock', $lock );
|
||||
return array( $now, $user_id );
|
||||
}
|
||||
|
||||
@@ -1230,14 +1222,14 @@ function wp_create_post_autosave( $post_id ) {
|
||||
|
||||
// Only store one autosave. If there is already an autosave, overwrite it.
|
||||
if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {
|
||||
$new_autosave = _wp_post_revision_fields( $_POST, true );
|
||||
$new_autosave = _wp_post_revision_fields( wp_unslash( $_POST ), true );
|
||||
$new_autosave['ID'] = $old_autosave->ID;
|
||||
$new_autosave['post_author'] = get_current_user_id();
|
||||
return wp_update_post( $new_autosave );
|
||||
}
|
||||
|
||||
// _wp_put_post_revision() expects unescaped.
|
||||
$_POST = stripslashes_deep($_POST);
|
||||
$_POST = wp_unslash( $_POST );
|
||||
|
||||
// Otherwise create the new autosave as a special post revision
|
||||
return _wp_put_post_revision( $_POST, true );
|
||||
|
||||
@@ -505,13 +505,11 @@ function populate_options() {
|
||||
else
|
||||
$autoload = 'yes';
|
||||
|
||||
$option = $wpdb->escape($option);
|
||||
if ( is_array($value) )
|
||||
$value = serialize($value);
|
||||
$value = $wpdb->escape($value);
|
||||
if ( !empty($insert) )
|
||||
$insert .= ', ';
|
||||
$insert .= "('$option', '$value', '$autoload')";
|
||||
$insert .= $wpdb->prepare( "(%s, %s, %s)", $option, $value, $autoload );
|
||||
}
|
||||
|
||||
if ( !empty($insert) )
|
||||
@@ -921,13 +919,11 @@ We hope you enjoy your new site. Thanks!
|
||||
|
||||
$insert = '';
|
||||
foreach ( $sitemeta as $meta_key => $meta_value ) {
|
||||
$meta_key = $wpdb->escape( $meta_key );
|
||||
if ( is_array( $meta_value ) )
|
||||
$meta_value = serialize( $meta_value );
|
||||
$meta_value = $wpdb->escape( $meta_value );
|
||||
if ( !empty( $insert ) )
|
||||
$insert .= ', ';
|
||||
$insert .= "( $network_id, '$meta_key', '$meta_value')";
|
||||
$insert .= $wpdb->prepare( "( %d, %s, %s)", $network_id, $meta_key, $meta_value );
|
||||
}
|
||||
$wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert );
|
||||
|
||||
|
||||
@@ -157,9 +157,6 @@ function wp_update_category($catarr) {
|
||||
// First, get all of the original fields
|
||||
$category = get_category($cat_ID, ARRAY_A);
|
||||
|
||||
// Escape data pulled from DB.
|
||||
$category = add_magic_quotes($category);
|
||||
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$catarr = array_merge($category, $catarr);
|
||||
|
||||
|
||||
@@ -1331,7 +1331,7 @@ function _draft_or_post_title( $post = 0 ) {
|
||||
*
|
||||
*/
|
||||
function _admin_search_query() {
|
||||
echo isset($_REQUEST['s']) ? esc_attr( stripslashes( $_REQUEST['s'] ) ) : '';
|
||||
echo isset($_REQUEST['s']) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,8 +50,8 @@ function install_themes_feature_list() {
|
||||
* @since 2.8.0
|
||||
*/
|
||||
function install_theme_search_form( $type_selector = true ) {
|
||||
$type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : 'term';
|
||||
$term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
|
||||
$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
|
||||
$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
|
||||
if ( ! $type_selector )
|
||||
echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>';
|
||||
?>
|
||||
@@ -179,7 +179,7 @@ add_action('install_themes_updated', 'display_themes');
|
||||
function install_theme_information() {
|
||||
global $tab, $themes_allowedtags, $wp_list_table;
|
||||
|
||||
$theme = themes_api( 'theme_information', array( 'slug' => stripslashes( $_REQUEST['theme'] ) ) );
|
||||
$theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) );
|
||||
|
||||
if ( is_wp_error( $theme ) )
|
||||
wp_die( $theme );
|
||||
|
||||
@@ -132,7 +132,7 @@ function wp_install_defaults($user_id) {
|
||||
$first_post = get_site_option( 'first_post' );
|
||||
|
||||
if ( empty($first_post) )
|
||||
$first_post = stripslashes( __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ) );
|
||||
$first_post = __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' );
|
||||
|
||||
$first_post = str_replace( "SITE_URL", esc_url( network_home_url() ), $first_post );
|
||||
$first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post );
|
||||
@@ -636,23 +636,23 @@ function upgrade_160() {
|
||||
$users = $wpdb->get_results("SELECT * FROM $wpdb->users");
|
||||
foreach ( $users as $user ) :
|
||||
if ( !empty( $user->user_firstname ) )
|
||||
update_user_meta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) );
|
||||
update_user_meta( $user->ID, 'first_name', $user->user_firstname );
|
||||
if ( !empty( $user->user_lastname ) )
|
||||
update_user_meta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) );
|
||||
update_user_meta( $user->ID, 'last_name', $user->user_lastname );
|
||||
if ( !empty( $user->user_nickname ) )
|
||||
update_user_meta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
|
||||
update_user_meta( $user->ID, 'nickname', $user->user_nickname );
|
||||
if ( !empty( $user->user_level ) )
|
||||
update_user_meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );
|
||||
if ( !empty( $user->user_icq ) )
|
||||
update_user_meta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
|
||||
update_user_meta( $user->ID, 'icq', $user->user_icq );
|
||||
if ( !empty( $user->user_aim ) )
|
||||
update_user_meta( $user->ID, 'aim', $wpdb->escape($user->user_aim) );
|
||||
update_user_meta( $user->ID, 'aim', $user->user_aim );
|
||||
if ( !empty( $user->user_msn ) )
|
||||
update_user_meta( $user->ID, 'msn', $wpdb->escape($user->user_msn) );
|
||||
update_user_meta( $user->ID, 'msn', $user->user_msn );
|
||||
if ( !empty( $user->user_yim ) )
|
||||
update_user_meta( $user->ID, 'yim', $wpdb->escape($user->user_icq) );
|
||||
update_user_meta( $user->ID, 'yim', $user->user_icq );
|
||||
if ( !empty( $user->user_description ) )
|
||||
update_user_meta( $user->ID, 'description', $wpdb->escape($user->user_description) );
|
||||
update_user_meta( $user->ID, 'description', $user->user_description );
|
||||
|
||||
if ( isset( $user->user_idmode ) ):
|
||||
$idmode = $user->user_idmode;
|
||||
@@ -854,7 +854,7 @@ function upgrade_230() {
|
||||
foreach ( $link_cats as $category) {
|
||||
$cat_id = (int) $category->cat_id;
|
||||
$term_id = 0;
|
||||
$name = $wpdb->escape($category->cat_name);
|
||||
$name = $category->cat_name;
|
||||
$slug = sanitize_title($name);
|
||||
$term_group = 0;
|
||||
|
||||
|
||||
+37
-34
@@ -34,22 +34,25 @@ function edit_user( $user_id = 0 ) {
|
||||
$update = true;
|
||||
$user->ID = (int) $user_id;
|
||||
$userdata = get_userdata( $user_id );
|
||||
$user->user_login = $wpdb->escape( $userdata->user_login );
|
||||
$user->user_login = $userdata->user_login;
|
||||
} else {
|
||||
$update = false;
|
||||
}
|
||||
|
||||
if ( !$update && isset( $_POST['user_login'] ) )
|
||||
$user->user_login = sanitize_user($_POST['user_login'], true);
|
||||
// get clean data before we get started.
|
||||
$post_data = wp_unslash( $_POST );
|
||||
|
||||
if ( !$update && isset( $post_data['user_login'] ) )
|
||||
$user->user_login = sanitize_user($post_data['user_login'], true);
|
||||
|
||||
$pass1 = $pass2 = '';
|
||||
if ( isset( $_POST['pass1'] ))
|
||||
$pass1 = $_POST['pass1'];
|
||||
if ( isset( $_POST['pass2'] ))
|
||||
$pass2 = $_POST['pass2'];
|
||||
if ( isset( $post_data['pass1'] ))
|
||||
$pass1 = $post_data['pass1'];
|
||||
if ( isset( $post_data['pass2'] ))
|
||||
$pass2 = $post_data['pass2'];
|
||||
|
||||
if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
|
||||
$new_role = sanitize_text_field( $_POST['role'] );
|
||||
if ( isset( $post_data['role'] ) && current_user_can( 'edit_users' ) ) {
|
||||
$new_role = sanitize_text_field( $post_data['role'] );
|
||||
$potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false;
|
||||
// Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
|
||||
// Multisite super admins can freely edit their blog roles -- they possess all caps.
|
||||
@@ -62,44 +65,44 @@ function edit_user( $user_id = 0 ) {
|
||||
wp_die(__('You can’t give users that role.'));
|
||||
}
|
||||
|
||||
if ( isset( $_POST['email'] ))
|
||||
$user->user_email = sanitize_text_field( $_POST['email'] );
|
||||
if ( isset( $_POST['url'] ) ) {
|
||||
if ( empty ( $_POST['url'] ) || $_POST['url'] == 'http://' ) {
|
||||
if ( isset( $post_data['email'] ))
|
||||
$user->user_email = sanitize_text_field( $post_data['email'] );
|
||||
if ( isset( $post_data['url'] ) ) {
|
||||
if ( empty ( $post_data['url'] ) || $post_data['url'] == 'http://' ) {
|
||||
$user->user_url = '';
|
||||
} else {
|
||||
$user->user_url = esc_url_raw( $_POST['url'] );
|
||||
$user->user_url = esc_url_raw( $post_data['url'] );
|
||||
$protocols = implode( '|', array_map( 'preg_quote', wp_allowed_protocols() ) );
|
||||
$user->user_url = preg_match('/^(' . $protocols . '):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
|
||||
}
|
||||
}
|
||||
if ( isset( $_POST['first_name'] ) )
|
||||
$user->first_name = sanitize_text_field( $_POST['first_name'] );
|
||||
if ( isset( $_POST['last_name'] ) )
|
||||
$user->last_name = sanitize_text_field( $_POST['last_name'] );
|
||||
if ( isset( $_POST['nickname'] ) )
|
||||
$user->nickname = sanitize_text_field( $_POST['nickname'] );
|
||||
if ( isset( $_POST['display_name'] ) )
|
||||
$user->display_name = sanitize_text_field( $_POST['display_name'] );
|
||||
if ( isset( $post_data['first_name'] ) )
|
||||
$user->first_name = sanitize_text_field( $post_data['first_name'] );
|
||||
if ( isset( $post_data['last_name'] ) )
|
||||
$user->last_name = sanitize_text_field( $post_data['last_name'] );
|
||||
if ( isset( $post_data['nickname'] ) )
|
||||
$user->nickname = sanitize_text_field( $post_data['nickname'] );
|
||||
if ( isset( $post_data['display_name'] ) )
|
||||
$user->display_name = sanitize_text_field( $post_data['display_name'] );
|
||||
|
||||
if ( isset( $_POST['description'] ) )
|
||||
$user->description = trim( $_POST['description'] );
|
||||
if ( isset( $post_data['description'] ) )
|
||||
$user->description = trim( $post_data['description'] );
|
||||
|
||||
foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
|
||||
if ( isset( $_POST[$method] ))
|
||||
$user->$method = sanitize_text_field( $_POST[$method] );
|
||||
if ( isset( $post_data[$method] ))
|
||||
$user->$method = sanitize_text_field( $post_data[$method] );
|
||||
}
|
||||
|
||||
if ( $update ) {
|
||||
$user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true';
|
||||
$user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh';
|
||||
$user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false';
|
||||
$user->rich_editing = isset( $post_data['rich_editing'] ) && 'false' == $post_data['rich_editing'] ? 'false' : 'true';
|
||||
$user->admin_color = isset( $post_data['admin_color'] ) ? sanitize_text_field( $post_data['admin_color'] ) : 'fresh';
|
||||
$user->show_admin_bar_front = isset( $post_data['admin_bar_front'] ) ? 'true' : 'false';
|
||||
}
|
||||
|
||||
$user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : '';
|
||||
$user->comment_shortcuts = isset( $post_data['comment_shortcuts'] ) && 'true' == $post_data['comment_shortcuts'] ? 'true' : '';
|
||||
|
||||
$user->use_ssl = 0;
|
||||
if ( !empty($_POST['use_ssl']) )
|
||||
if ( !empty($post_data['use_ssl']) )
|
||||
$user->use_ssl = 1;
|
||||
|
||||
$errors = new WP_Error();
|
||||
@@ -124,7 +127,7 @@ function edit_user( $user_id = 0 ) {
|
||||
}
|
||||
|
||||
/* Check for "\" in password */
|
||||
if ( false !== strpos( stripslashes($pass1), "\\" ) )
|
||||
if ( false !== strpos( $pass1, "\\" ) )
|
||||
$errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) );
|
||||
|
||||
/* checking the password has been typed twice the same */
|
||||
@@ -134,7 +137,7 @@ function edit_user( $user_id = 0 ) {
|
||||
if ( !empty( $pass1 ) )
|
||||
$user->user_pass = $pass1;
|
||||
|
||||
if ( !$update && isset( $_POST['user_login'] ) && !validate_username( $_POST['user_login'] ) )
|
||||
if ( !$update && isset( $post_data['user_login'] ) && !validate_username( $post_data['user_login'] ) )
|
||||
$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ));
|
||||
|
||||
if ( !$update && username_exists( $user->user_login ) )
|
||||
@@ -159,7 +162,7 @@ function edit_user( $user_id = 0 ) {
|
||||
$user_id = wp_update_user( $user );
|
||||
} else {
|
||||
$user_id = wp_insert_user( $user );
|
||||
wp_new_user_notification( $user_id, isset($_POST['send_password']) ? $pass1 : '' );
|
||||
wp_new_user_notification( $user_id, isset($post_data['send_password']) ? $pass1 : '' );
|
||||
}
|
||||
return $user_id;
|
||||
}
|
||||
|
||||
@@ -84,10 +84,10 @@ function display_setup_form( $error = null ) {
|
||||
if ( ! empty( $_POST ) )
|
||||
$blog_public = isset( $_POST['blog_public'] );
|
||||
|
||||
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';
|
||||
$user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin';
|
||||
$admin_password = isset($_POST['admin_password']) ? trim( stripslashes( $_POST['admin_password'] ) ) : '';
|
||||
$admin_email = isset( $_POST['admin_email'] ) ? trim( stripslashes( $_POST['admin_email'] ) ) : '';
|
||||
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
|
||||
$user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : 'admin';
|
||||
$admin_password = isset($_POST['admin_password']) ? trim( wp_unslash( $_POST['admin_password'] ) ) : '';
|
||||
$admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : '';
|
||||
|
||||
if ( ! is_null( $error ) ) {
|
||||
?>
|
||||
@@ -189,11 +189,11 @@ switch($step) {
|
||||
|
||||
display_header();
|
||||
// Fill in the data we gathered
|
||||
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : '';
|
||||
$user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin';
|
||||
$admin_password = isset($_POST['admin_password']) ? $_POST['admin_password'] : '';
|
||||
$admin_password_check = isset($_POST['admin_password2']) ? $_POST['admin_password2'] : '';
|
||||
$admin_email = isset( $_POST['admin_email'] ) ?trim( stripslashes( $_POST['admin_email'] ) ) : '';
|
||||
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
|
||||
$user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : 'admin';
|
||||
$admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : '';
|
||||
$admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : '';
|
||||
$admin_email = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : '';
|
||||
$public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 0;
|
||||
// check e-mail address
|
||||
$error = false;
|
||||
|
||||
@@ -31,7 +31,7 @@ if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
|
||||
exit;
|
||||
}
|
||||
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
|
||||
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
|
||||
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ if ( ! current_user_can('manage_links') )
|
||||
<?php screen_icon(); ?>
|
||||
<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
|
||||
if ( !empty($_REQUEST['s']) )
|
||||
printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?>
|
||||
printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
|
||||
</h2>
|
||||
|
||||
<?php
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ case 'editattachment' :
|
||||
}
|
||||
if ( false !== strpos($location, 'upload.php') ) {
|
||||
$location = remove_query_arg('message', $location);
|
||||
$location = add_query_arg('posted', $attachment_id, $location);
|
||||
$location = add_query_arg('posted', $attachment_id, $location);
|
||||
} elseif ( false !== strpos($location, 'media.php') ) {
|
||||
$location = add_query_arg('message', 'updated', $location);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ switch ( $action ) {
|
||||
if ( ! is_wp_error( $parent_object ) ) {
|
||||
$parent_data = (array) $parent_object;
|
||||
$menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];
|
||||
update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ switch ( $action ) {
|
||||
$menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1;
|
||||
|
||||
$menu_item_data['menu_item_parent'] = $next_item_data['ID'];
|
||||
update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
|
||||
wp_update_post($menu_item_data);
|
||||
wp_update_post($next_item_data);
|
||||
@@ -115,7 +115,7 @@ switch ( $action ) {
|
||||
in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids )
|
||||
) {
|
||||
$menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true);
|
||||
update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ switch ( $action ) {
|
||||
$menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1;
|
||||
|
||||
// save changes
|
||||
update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
wp_update_post($menu_item_data);
|
||||
wp_update_post($parent_data);
|
||||
}
|
||||
@@ -205,7 +205,7 @@ switch ( $action ) {
|
||||
) {
|
||||
// just make it a child of the previous; keep the order
|
||||
$menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1];
|
||||
update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
wp_update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
|
||||
wp_update_post($menu_item_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ if ( $_POST ) {
|
||||
$base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
|
||||
$subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false;
|
||||
if ( ! network_domain_check() ) {
|
||||
$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install );
|
||||
$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() )
|
||||
network_step2( $result );
|
||||
|
||||
@@ -61,7 +61,7 @@ if ( $_POST ) {
|
||||
foreach ( $options as $option_name ) {
|
||||
if ( ! isset($_POST[$option_name]) )
|
||||
continue;
|
||||
$value = stripslashes_deep( $_POST[$option_name] );
|
||||
$value = wp_unslash( $_POST[$option_name] );
|
||||
update_site_option( $option_name, $value );
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
<th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th>
|
||||
<td>
|
||||
<textarea name="welcome_email" id="welcome_email" rows="5" cols="45" class="large-text">
|
||||
<?php echo esc_textarea( stripslashes( get_site_option( 'welcome_email' ) ) ) ?></textarea>
|
||||
<?php echo esc_textarea( get_site_option( 'welcome_email' ) ) ?></textarea>
|
||||
<br />
|
||||
<?php _e( 'The welcome email sent to new site owners.' ) ?>
|
||||
</td>
|
||||
@@ -190,7 +190,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
<th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th>
|
||||
<td>
|
||||
<textarea name="welcome_user_email" id="welcome_user_email" rows="5" cols="45" class="large-text">
|
||||
<?php echo esc_textarea( stripslashes( get_site_option( 'welcome_user_email' ) ) ) ?></textarea>
|
||||
<?php echo esc_textarea( get_site_option( 'welcome_user_email' ) ) ?></textarea>
|
||||
<br />
|
||||
<?php _e( 'The welcome email sent to new users.' ) ?>
|
||||
</td>
|
||||
@@ -199,7 +199,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
<th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th>
|
||||
<td>
|
||||
<textarea name="first_post" id="first_post" rows="5" cols="45" class="large-text">
|
||||
<?php echo esc_textarea( stripslashes( get_site_option( 'first_post' ) ) ) ?></textarea>
|
||||
<?php echo esc_textarea( get_site_option( 'first_post' ) ) ?></textarea>
|
||||
<br />
|
||||
<?php _e( 'The first post on a new site.' ) ?>
|
||||
</td>
|
||||
@@ -208,7 +208,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
<th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th>
|
||||
<td>
|
||||
<textarea name="first_page" id="first_page" rows="5" cols="45" class="large-text">
|
||||
<?php echo esc_textarea( stripslashes( get_site_option('first_page') ) ) ?></textarea>
|
||||
<?php echo esc_textarea( get_site_option( 'first_page' ) ) ?></textarea>
|
||||
<br />
|
||||
<?php _e( 'The first page on a new site.' ) ?>
|
||||
</td>
|
||||
@@ -217,7 +217,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
<th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th>
|
||||
<td>
|
||||
<textarea name="first_comment" id="first_comment" rows="5" cols="45" class="large-text">
|
||||
<?php echo esc_textarea( stripslashes( get_site_option('first_comment') ) ) ?></textarea>
|
||||
<?php echo esc_textarea( get_site_option( 'first_comment' ) ) ?></textarea>
|
||||
<br />
|
||||
<?php _e( 'The first comment on a new site.' ) ?>
|
||||
</td>
|
||||
|
||||
@@ -62,7 +62,7 @@ if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) {
|
||||
delete_option( 'rewrite_rules' );
|
||||
|
||||
// update blogs table
|
||||
$blog_data = stripslashes_deep( $_POST['blog'] );
|
||||
$blog_data = wp_unslash( $_POST['blog'] );
|
||||
$existing_details = get_blog_details( $id, false );
|
||||
$blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
|
||||
foreach ( $blog_data_checkboxes as $c ) {
|
||||
|
||||
@@ -38,7 +38,7 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
|
||||
|
||||
if ( ! is_array( $_POST['blog'] ) )
|
||||
wp_die( __( 'Can’t create an empty site.' ) );
|
||||
$blog = $_POST['blog'];
|
||||
$blog = wp_unslash( $_POST['blog'] );
|
||||
$domain = '';
|
||||
if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) )
|
||||
$domain = strtolower( $blog['domain'] );
|
||||
@@ -88,7 +88,7 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
|
||||
$content_mail = sprintf( __( 'New site created by %1$s
|
||||
|
||||
Address: %2$s
|
||||
Name: %3$s' ), $current_user->user_login , get_site_url( $id ), stripslashes( $title ) );
|
||||
Name: %3$s' ), $current_user->user_login , get_site_url( $id ), $title );
|
||||
wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
|
||||
wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
|
||||
wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) );
|
||||
|
||||
@@ -53,12 +53,14 @@ if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] && is_ar
|
||||
$count = count( $_POST['option'] );
|
||||
$skip_options = array( 'allowedthemes' ); // Don't update these options since they are handled elsewhere in the form.
|
||||
foreach ( (array) $_POST['option'] as $key => $val ) {
|
||||
$key = wp_unslash( $key );
|
||||
$val = wp_unslash( $val );
|
||||
if ( $key === 0 || is_array( $val ) || in_array($key, $skip_options) )
|
||||
continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options
|
||||
if ( $c == $count )
|
||||
update_option( $key, stripslashes( $val ) );
|
||||
update_option( $key, $val );
|
||||
else
|
||||
update_option( $key, stripslashes( $val ), false ); // no need to refresh blog details yet
|
||||
update_option( $key, $val, false ); // no need to refresh blog details yet
|
||||
$c++;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
|
||||
<input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
|
||||
<?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?>
|
||||
<p><?php echo esc_html( stripslashes( $_GET['msg'] ) ); ?></p>
|
||||
<p><?php echo esc_html( wp_unslash( $_GET['msg'] ) ); ?></p>
|
||||
<?php submit_button( __('Confirm'), 'button' ); ?>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
@@ -120,16 +120,16 @@ if ( 'update' == $action ) {
|
||||
if ( 'options' == $option_page ) {
|
||||
if ( is_multisite() && ! is_super_admin() )
|
||||
wp_die( __( 'You do not have sufficient permissions to modify unregistered settings for this site.' ) );
|
||||
$options = explode( ',', stripslashes( $_POST[ 'page_options' ] ) );
|
||||
$options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) );
|
||||
} else {
|
||||
$options = $whitelist_options[ $option_page ];
|
||||
}
|
||||
|
||||
// Handle custom date/time formats
|
||||
if ( 'general' == $option_page ) {
|
||||
if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) )
|
||||
if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) )
|
||||
$_POST['date_format'] = $_POST['date_format_custom'];
|
||||
if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) )
|
||||
if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) )
|
||||
$_POST['time_format'] = $_POST['time_format_custom'];
|
||||
// Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
|
||||
if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) {
|
||||
@@ -150,7 +150,7 @@ if ( 'update' == $action ) {
|
||||
$value = $_POST[ $option ];
|
||||
if ( ! is_array( $value ) )
|
||||
$value = trim( $value );
|
||||
$value = stripslashes_deep( $value );
|
||||
$value = wp_unslash( $value );
|
||||
}
|
||||
update_option( $option, $value );
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ if ( empty($plugins) )
|
||||
wp_die( __('There are no plugins installed on this site.') );
|
||||
|
||||
if ( isset($_REQUEST['file']) )
|
||||
$plugin = stripslashes($_REQUEST['file']);
|
||||
$plugin = wp_unslash($_REQUEST['file']);
|
||||
|
||||
if ( empty($plugin) ) {
|
||||
$plugin = array_keys($plugins);
|
||||
@@ -40,7 +40,7 @@ $plugin_files = get_plugin_files($plugin);
|
||||
if ( empty($file) )
|
||||
$file = $plugin_files[0];
|
||||
else
|
||||
$file = stripslashes($file);
|
||||
$file = wp_unslash($file);
|
||||
|
||||
$file = validate_file_to_edit($file, $plugin_files);
|
||||
$real_file = WP_PLUGIN_DIR . '/' . $file;
|
||||
@@ -52,7 +52,7 @@ case 'update':
|
||||
|
||||
check_admin_referer('edit-plugin_' . $file);
|
||||
|
||||
$newcontent = stripslashes($_POST['newcontent']);
|
||||
$newcontent = wp_unslash( $_POST['newcontent'] );
|
||||
if ( is_writeable($real_file) ) {
|
||||
$f = fopen($real_file, 'w+');
|
||||
fwrite($f, $newcontent);
|
||||
|
||||
@@ -91,11 +91,11 @@ if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) {
|
||||
}
|
||||
|
||||
// Set Variables
|
||||
$title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( stripslashes( $_GET['t'] ) , ENT_QUOTES) ) ) : '';
|
||||
$title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( wp_unslash( $_GET['t'] ) , ENT_QUOTES) ) ) : '';
|
||||
|
||||
$selection = '';
|
||||
if ( !empty($_GET['s']) ) {
|
||||
$selection = str_replace(''', "'", stripslashes($_GET['s']));
|
||||
$selection = str_replace(''', "'", wp_unslash($_GET['s']));
|
||||
$selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ switch($step) {
|
||||
|
||||
case 2:
|
||||
foreach ( array( 'dbname', 'uname', 'pwd', 'dbhost', 'prefix' ) as $key )
|
||||
$$key = trim( stripslashes( $_POST[ $key ] ) );
|
||||
$$key = trim( wp_unslash( $_POST[ $key ] ) );
|
||||
|
||||
$tryagain_link = '</p><p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ if ( empty( $file ) ) {
|
||||
$relative_file = 'style.css';
|
||||
$file = $allowed_files['style.css'];
|
||||
} else {
|
||||
$relative_file = stripslashes( $file );
|
||||
$relative_file = wp_unslash( $file );
|
||||
$file = $theme->get_stylesheet_directory() . '/' . $relative_file;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ $scrollto = isset( $_REQUEST['scrollto'] ) ? (int) $_REQUEST['scrollto'] : 0;
|
||||
switch( $action ) {
|
||||
case 'update':
|
||||
check_admin_referer( 'edit-theme_' . $file . $stylesheet );
|
||||
$newcontent = stripslashes( $_POST['newcontent'] );
|
||||
$newcontent = wp_unslash( $_POST['newcontent'] );
|
||||
$location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto;
|
||||
if ( is_writeable( $file ) ) {
|
||||
//is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@ if ( isset($_GET['action']) ) {
|
||||
check_admin_referer( 'bulk-update-plugins' );
|
||||
|
||||
if ( isset( $_GET['plugins'] ) )
|
||||
$plugins = explode( ',', stripslashes($_GET['plugins']) );
|
||||
$plugins = explode( ',', wp_unslash($_GET['plugins']) );
|
||||
elseif ( isset( $_POST['checked'] ) )
|
||||
$plugins = (array) $_POST['checked'];
|
||||
else
|
||||
@@ -109,7 +109,7 @@ if ( isset($_GET['action']) ) {
|
||||
$nonce = 'install-plugin_' . $plugin;
|
||||
$url = 'update.php?action=install-plugin&plugin=' . $plugin;
|
||||
if ( isset($_GET['from']) )
|
||||
$url .= '&from=' . urlencode(stripslashes($_GET['from']));
|
||||
$url .= '&from=' . urlencode( wp_unslash( $_GET['from'] ) );
|
||||
|
||||
$type = 'web'; //Install plugin type, From Web or an Upload.
|
||||
|
||||
@@ -173,7 +173,7 @@ if ( isset($_GET['action']) ) {
|
||||
check_admin_referer( 'bulk-update-themes' );
|
||||
|
||||
if ( isset( $_GET['themes'] ) )
|
||||
$themes = explode( ',', stripslashes($_GET['themes']) );
|
||||
$themes = explode( ',', wp_unslash( $_GET['themes'] ) );
|
||||
elseif ( isset( $_POST['checked'] ) )
|
||||
$themes = (array) $_POST['checked'];
|
||||
else
|
||||
|
||||
@@ -77,7 +77,7 @@ else
|
||||
<?php else :
|
||||
switch ( $step ) :
|
||||
case 0:
|
||||
$goback = stripslashes( wp_get_referer() );
|
||||
$goback = wp_get_referer();
|
||||
$goback = esc_url_raw( $goback );
|
||||
$goback = urlencode( $goback );
|
||||
?>
|
||||
@@ -90,7 +90,7 @@ switch ( $step ) :
|
||||
case 1:
|
||||
wp_upgrade();
|
||||
|
||||
$backto = !empty($_GET['backto']) ? stripslashes( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/';
|
||||
$backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/';
|
||||
$backto = esc_url( $backto );
|
||||
$backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
|
||||
?>
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ if ( $doaction ) {
|
||||
wp_redirect( $location );
|
||||
exit;
|
||||
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
|
||||
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
|
||||
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ get_current_screen()->set_help_sidebar(
|
||||
'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
|
||||
);
|
||||
|
||||
$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
|
||||
$wp_http_referer = remove_query_arg(array('update', 'delete_count'), wp_unslash( $wp_http_referer ) );
|
||||
|
||||
$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
|
||||
|
||||
|
||||
@@ -112,15 +112,15 @@ Please click the following link to confirm the invite:
|
||||
}
|
||||
} else {
|
||||
// Adding a new user to this blog
|
||||
$user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] );
|
||||
$user_details = wpmu_validate_user_signup( wp_unslash( $_REQUEST[ 'user_login' ] ), wp_unslash( $_REQUEST[ 'email' ] ) );
|
||||
if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) {
|
||||
$add_user_errors = $user_details[ 'errors' ];
|
||||
} else {
|
||||
$new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
|
||||
$new_user_login = apply_filters('pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) );
|
||||
if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
|
||||
add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
|
||||
}
|
||||
wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) );
|
||||
wpmu_signup_user( $new_user_login, wp_unslash( $_REQUEST[ 'email' ] ), array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) );
|
||||
if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
|
||||
$key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) );
|
||||
wpmu_activate_signup( $key );
|
||||
@@ -309,7 +309,7 @@ foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_nam
|
||||
$var = "new_user_$var";
|
||||
if( isset( $_POST['createuser'] ) ) {
|
||||
if ( ! isset($$var) )
|
||||
$$var = isset( $_POST[$post_field] ) ? stripslashes( $_POST[$post_field] ) : '';
|
||||
$$var = isset( $_POST[$post_field] ) ? wp_unslash( $_POST[$post_field] ) : '';
|
||||
} else {
|
||||
$$var = false;
|
||||
}
|
||||
|
||||
+4
-4
@@ -64,9 +64,9 @@ get_current_screen()->set_help_sidebar(
|
||||
);
|
||||
|
||||
if ( empty($_REQUEST) ) {
|
||||
$referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr(stripslashes($_SERVER['REQUEST_URI'])) . '" />';
|
||||
$referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
|
||||
} elseif ( isset($_REQUEST['wp_http_referer']) ) {
|
||||
$redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), stripslashes($_REQUEST['wp_http_referer']));
|
||||
$redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash( $_REQUEST['wp_http_referer'] ) );
|
||||
$referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr($redirect) . '" />';
|
||||
} else {
|
||||
$redirect = 'users.php';
|
||||
@@ -357,7 +357,7 @@ break;
|
||||
default:
|
||||
|
||||
if ( !empty($_GET['_wp_http_referer']) ) {
|
||||
wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
|
||||
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ default:
|
||||
case 'add':
|
||||
if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
|
||||
$messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
|
||||
esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ),
|
||||
esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
|
||||
self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
|
||||
} else {
|
||||
$messages[] = '<div id="message" class="updated"><p>' . __( 'New user created.' ) . '</p></div>';
|
||||
|
||||
Reference in New Issue
Block a user