mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Properly check, initialize, or cast a number of variables. props ChenHui. see #14642.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e2be537941
commit
478186859b
@ -13,12 +13,13 @@ $wp_list_table = get_list_table('WP_Posts_List_Table');
|
|||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
// Back-compat for viewing comments of an entry
|
// Back-compat for viewing comments of an entry
|
||||||
if ( $_redirect = intval( max( @$_REQUEST['p'], @$_REQUEST['attachment_id'], @$_REQUEST['page_id'] ) ) ) {
|
foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
|
||||||
wp_redirect( admin_url('edit-comments.php?p=' . $_redirect ) );
|
if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
|
||||||
exit;
|
wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
|
||||||
} else {
|
exit;
|
||||||
unset( $_redirect );
|
}
|
||||||
}
|
}
|
||||||
|
unset( $_redirect );
|
||||||
|
|
||||||
// Handle bulk actions
|
// Handle bulk actions
|
||||||
$doaction = $wp_list_table->current_action();
|
$doaction = $wp_list_table->current_action();
|
||||||
|
@ -422,7 +422,7 @@ function wp_restore_image($post_id) {
|
|||||||
$file = get_attached_file($post_id);
|
$file = get_attached_file($post_id);
|
||||||
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
|
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
|
||||||
$restored = false;
|
$restored = false;
|
||||||
$msg = '';
|
$msg = new stdClass;
|
||||||
|
|
||||||
if ( !is_array($backup_sizes) ) {
|
if ( !is_array($backup_sizes) ) {
|
||||||
$msg->error = __('Cannot load image metadata.');
|
$msg->error = __('Cannot load image metadata.');
|
||||||
@ -493,7 +493,7 @@ function wp_restore_image($post_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function wp_save_image($post_id) {
|
function wp_save_image($post_id) {
|
||||||
$return = '';
|
$return = new stdClass;
|
||||||
$success = $delete = $scaled = $nocrop = false;
|
$success = $delete = $scaled = $nocrop = false;
|
||||||
$post = get_post($post_id);
|
$post = get_post($post_id);
|
||||||
@ini_set('memory_limit', '256M');
|
@ini_set('memory_limit', '256M');
|
||||||
|
@ -55,14 +55,14 @@ function add_user() {
|
|||||||
*/
|
*/
|
||||||
function edit_user( $user_id = 0 ) {
|
function edit_user( $user_id = 0 ) {
|
||||||
global $wp_roles, $wpdb;
|
global $wp_roles, $wpdb;
|
||||||
if ( $user_id != 0 ) {
|
$user = new WP_User( $user_id );
|
||||||
|
if ( $user_id ) {
|
||||||
$update = true;
|
$update = true;
|
||||||
$user->ID = (int) $user_id;
|
$user->ID = (int) $user_id;
|
||||||
$userdata = get_userdata( $user_id );
|
$userdata = get_userdata( $user_id );
|
||||||
$user->user_login = $wpdb->escape( $userdata->user_login );
|
$user->user_login = $wpdb->escape( $userdata->user_login );
|
||||||
} else {
|
} else {
|
||||||
$update = false;
|
$update = false;
|
||||||
$user = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$update && isset( $_POST['user_login'] ) )
|
if ( !$update && isset( $_POST['user_login'] ) )
|
||||||
|
@ -4232,7 +4232,7 @@ function get_file_data( $file, $default_headers, $context = '' ) {
|
|||||||
foreach( $extra_headers as $key=>$value ) {
|
foreach( $extra_headers as $key=>$value ) {
|
||||||
$extra_headers[$key] = $key;
|
$extra_headers[$key] = $key;
|
||||||
}
|
}
|
||||||
$all_headers = array_merge($extra_headers, $default_headers);
|
$all_headers = array_merge( $extra_headers, (array) $default_headers );
|
||||||
} else {
|
} else {
|
||||||
$all_headers = $default_headers;
|
$all_headers = $default_headers;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user