X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/38ca813a0e312e2768e5b9519f0415cd0aa84781..6c8f14c09105d0afa4c1574215c59b5021040e76:/wp-admin/media-new.php diff --git a/wp-admin/media-new.php b/wp-admin/media-new.php index d4e3cabf..c6a7ae14 100644 --- a/wp-admin/media-new.php +++ b/wp-admin/media-new.php @@ -1,14 +1,85 @@ \ No newline at end of file +if (!current_user_can('upload_files')) + wp_die(__('You do not have permission to upload files.')); + +wp_enqueue_script('plupload-handlers'); + +$post_id = 0; +if ( isset( $_REQUEST['post_id'] ) ) { + $post_id = absint( $_REQUEST['post_id'] ); + if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) + $post_id = 0; +} + +if ( $_POST ) { + $location = 'upload.php'; + if ( isset($_POST['html-upload']) && !empty($_FILES) ) { + check_admin_referer('media-form'); + // Upload File button was clicked + $id = media_handle_upload( 'async-upload', $post_id ); + if ( is_wp_error( $id ) ) + $location .= '?message=3'; + } + wp_redirect( admin_url( $location ) ); + exit; +} + +$title = __('Upload New Media'); +$parent_file = 'upload.php'; + +get_current_screen()->add_help_tab( array( +'id' => 'overview', +'title' => __('Overview'), +'content' => + '

' . __('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:') . '

' . + '' +) ); +get_current_screen()->set_help_sidebar( + '

' . __('For more information:') . '

' . + '

' . __('Documentation on Uploading Media Files') . '

' . + '

' . __('Support Forums') . '

' +); + +require_once( ABSPATH . 'wp-admin/admin-header.php' ); + +$form_class = 'media-upload-form type-form validate'; + +if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) ) + $form_class .= ' html-uploader'; +?> +
+ +

+ +
+ + + + + + +
+
+
+ +