Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/wp-admin/async-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
}

if ( ! current_user_can( 'upload_files' ) ) {
wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
wp_die( __( 'Sorry, you are not allowed to upload files.' ), 403 );
}

// Just fetch the detail form for that attachment.
if ( isset( $_REQUEST['attachment_id'] ) && (int) $_REQUEST['attachment_id'] && $_REQUEST['fetch'] ) {
$id = (int) $_REQUEST['attachment_id'];
$post = get_post( $id );
if ( 'attachment' !== $post->post_type ) {
wp_die( __( 'Invalid post type.' ) );
wp_die( __( 'Invalid post type.' ), 400 );
}

switch ( $_REQUEST['fetch'] ) {
Expand Down
10 changes: 5 additions & 5 deletions src/wp-admin/includes/class-file-upload-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class File_Upload_Upgrader {
public function __construct( $form, $urlholder ) {

if ( empty( $_FILES[ $form ]['name'] ) && empty( $_GET[ $urlholder ] ) ) {
wp_die( __( 'Please select a file' ) );
wp_die( __( 'Please select a file' ), 400 );
}

// Handle a newly uploaded file. Else, assume it's already been uploaded.
Expand All @@ -79,7 +79,7 @@ public function __construct( $form, $urlholder ) {
self_admin_url( 'plugin-install.php' ),
__( 'Return to the Plugin Installer' )
);
wp_die( __( 'Incompatible Archive.' ) . '<br />' . $plugins_page );
wp_die( __( 'Incompatible Archive.' ) . '<br />' . $plugins_page, 415 );
}

if ( 'themezip' === $form ) {
Expand All @@ -88,7 +88,7 @@ public function __construct( $form, $urlholder ) {
self_admin_url( 'theme-install.php' ),
__( 'Return to the Theme Installer' )
);
wp_die( __( 'Incompatible Archive.' ) . '<br />' . $themes_page );
wp_die( __( 'Incompatible Archive.' ) . '<br />' . $themes_page, 415 );
}
}
}
Expand Down Expand Up @@ -117,7 +117,7 @@ public function __construct( $form, $urlholder ) {
$this->id = (int) $_GET[ $urlholder ];
$attachment = get_post( $this->id );
if ( empty( $attachment ) ) {
wp_die( __( 'Please select a file' ) );
wp_die( __( 'Please select a file' ), 400 );
}

$this->filename = $attachment->post_title;
Expand All @@ -126,7 +126,7 @@ public function __construct( $form, $urlholder ) {
// Else, It's set to something, Back compat for plugins using the old (pre-3.3) File_Uploader handler.
$uploads = wp_upload_dir();
if ( ! ( $uploads && false === $uploads['error'] ) ) {
wp_die( $uploads['error'] );
wp_die( $uploads['error'], 400 );
}

$this->filename = sanitize_file_name( $_GET[ $urlholder ] );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/media-new.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'upload_files' ) ) {
wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
wp_die( __( 'Sorry, you are not allowed to upload files.' ), 403 );
}

wp_enqueue_script( 'plupload-handlers' );
Expand Down
8 changes: 4 additions & 4 deletions src/wp-admin/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'upload_files' ) ) {
wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
wp_die( __( 'Sorry, you are not allowed to upload files.' ), 403 );
}

$message = '';
Expand Down Expand Up @@ -293,7 +293,7 @@ function () {
}
foreach ( $post_ids as $post_id ) {
if ( ! current_user_can( 'delete_post', $post_id ) ) {
wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ), 403 );
}

if ( ! wp_trash_post( $post_id ) ) {
Expand All @@ -314,7 +314,7 @@ function () {
}
foreach ( $post_ids as $post_id ) {
if ( ! current_user_can( 'delete_post', $post_id ) ) {
wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ), 403 );
}

if ( ! wp_untrash_post( $post_id ) ) {
Expand All @@ -329,7 +329,7 @@ function () {
}
foreach ( $post_ids as $post_id_del ) {
if ( ! current_user_can( 'delete_post', $post_id_del ) ) {
wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
wp_die( __( 'Sorry, you are not allowed to delete this item.' ), 403 );
}

if ( ! wp_delete_attachment( $post_id_del ) ) {
Expand Down
Loading