wp/wp-admin/media-upload.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
--- a/wp/wp-admin/media-upload.php	Tue Jun 09 11:14:17 2015 +0000
+++ b/wp/wp-admin/media-upload.php	Mon Oct 14 17:39:30 2019 +0200
@@ -15,8 +15,9 @@
 /** Load WordPress Administration Bootstrap */
 require_once( dirname( __FILE__ ) . '/admin.php' );
 
-if (!current_user_can('upload_files'))
-	wp_die(__('You do not have permission to upload files.'));
+if ( ! current_user_can( 'upload_files' ) ) {
+	wp_die( __( 'Sorry, you are not allowed to upload files.' ), 403 );
+}
 
 wp_enqueue_script('plupload-handlers');
 wp_enqueue_script('image-edit');
@@ -31,12 +32,20 @@
 $post_id = isset($post_id)? (int) $post_id : 0;
 
 // Require an ID for the edit screen.
-if ( isset($action) && $action == 'edit' && !$ID ) {
-	wp_die( __( 'Cheatin’ uh?' ), 403 );
+if ( isset( $action ) && $action == 'edit' && !$ID ) {
+	wp_die(
+		'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
+		'<p>' . __( 'Invalid item ID.' ) . '</p>',
+		403
+	);
 }
 
 if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) ) {
-	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+	wp_die(
+		'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
+		'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
+		403
+	);
 }
 
 // Upload type: image, video, file, ..?
@@ -44,7 +53,7 @@
 	$type = strval($_GET['type']);
 } else {
 	/**
-	 * Filter the default media upload type in the legacy (pre-3.5.0) media popup.
+	 * Filters the default media upload type in the legacy (pre-3.5.0) media popup.
 	 *
 	 * @since 2.5.0
 	 *
@@ -59,7 +68,7 @@
 	$tab = strval($_GET['tab']);
 } else {
 	/**
-	 * Filter the default tab in the legacy (pre-3.5.0) media popup.
+	 * Filters the default tab in the legacy (pre-3.5.0) media popup.
 	 *
 	 * @since 2.5.0
 	 *
@@ -86,7 +95,7 @@
 	 *
 	 * @since 2.5.0
 	 */
-	do_action( "media_upload_$type" );
+	do_action( "media_upload_{$type}" );
 } else {
 	/**
 	 * Fires inside limited and specific upload-tab views in the legacy
@@ -98,6 +107,6 @@
 	 *
 	 * @since 2.5.0
 	 */
-	do_action( "media_upload_$tab" );
+	do_action( "media_upload_{$tab}" );
 }