X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/baca9ce86a38dc54c4574890ee2d352fd81f78b2..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-admin/includes/image-edit.php diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php index 01bce7bd..9d717d7e 100644 --- a/wp-admin/includes/image-edit.php +++ b/wp-admin/includes/image-edit.php @@ -13,7 +13,7 @@ function wp_image_editor($post_id, $msg = false) { $sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']); $note = ''; - if ( is_array($meta) && isset($meta['width']) ) + if ( isset( $meta['width'], $meta['height'] ) ) $big = max( $meta['width'], $meta['height'] ); else die( __('Image data does not exist. Please re-upload the image.') ); @@ -21,8 +21,9 @@ function wp_image_editor($post_id, $msg = false) { $sizer = $big > 400 ? 400 / $big : 1; $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); - $can_restore = !empty($backup_sizes) && isset($backup_sizes['full-orig']) - && $backup_sizes['full-orig']['file'] != basename($meta['file']); + $can_restore = false; + if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) + $can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] ); if ( $msg ) { if ( isset($msg->error) ) @@ -63,8 +64,8 @@ function wp_image_editor($post_id, $msg = false) { - - + +
@@ -81,10 +82,12 @@ function wp_image_editor($post_id, $msg = false) {
-

+

+

+
- × + × ! , 'scale')" class="button-primary" value="" />
@@ -454,7 +457,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 ); @@ -499,7 +502,7 @@ function wp_restore_image($post_id) { $delpath = apply_filters('wp_delete_file', $file); @unlink($delpath); } - } else { + } elseif ( isset( $meta['width'], $meta['height'] ) ) { $backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']); } } @@ -587,7 +590,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 {