| 1 | Index: wp-admin/media-new.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/media-new.php (revision 22833) |
|---|
| 4 | +++ wp-admin/media-new.php (working copy) |
|---|
| 5 | @@ -17,14 +17,19 @@ |
|---|
| 6 | |
|---|
| 7 | wp_enqueue_script('plupload-handlers'); |
|---|
| 8 | |
|---|
| 9 | -unset( $_REQUEST['post_id'] ); |
|---|
| 10 | +$post_id = 0; |
|---|
| 11 | +if ( isset( $_REQUEST['post_id'] ) ) { |
|---|
| 12 | + $post_id = absint( $_REQUEST['post_id'] ); |
|---|
| 13 | + if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) |
|---|
| 14 | + $post_id = 0; |
|---|
| 15 | +} |
|---|
| 16 | |
|---|
| 17 | if ( $_POST ) { |
|---|
| 18 | $location = 'upload.php'; |
|---|
| 19 | if ( isset($_POST['html-upload']) && !empty($_FILES) ) { |
|---|
| 20 | check_admin_referer('media-form'); |
|---|
| 21 | // Upload File button was clicked |
|---|
| 22 | - $id = media_handle_upload('async-upload', $_REQUEST['post_id']); |
|---|
| 23 | + $id = media_handle_upload( 'async-upload', $post_id ); |
|---|
| 24 | if ( is_wp_error( $id ) ) |
|---|
| 25 | $location .= '?message=3'; |
|---|
| 26 | } |
|---|
| 27 | @@ -68,9 +73,9 @@ |
|---|
| 28 | <?php media_upload_form(); ?> |
|---|
| 29 | |
|---|
| 30 | <script type="text/javascript"> |
|---|
| 31 | - var post_id = 0, shortform = 3; |
|---|
| 32 | + var post_id = <?php echo $post_id; ?>, shortform = 3; |
|---|
| 33 | </script> |
|---|
| 34 | - <input type="hidden" name="post_id" id="post_id" value="0" /> |
|---|
| 35 | + <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> |
|---|
| 36 | <?php wp_nonce_field('media-form'); ?> |
|---|
| 37 | <div id="media-items" class="hide-if-no-js"></div> |
|---|
| 38 | </form> |
|---|
| 39 | Index: wp-admin/includes/media.php |
|---|
| 40 | =================================================================== |
|---|
| 41 | --- wp-admin/includes/media.php (revision 22833) |
|---|
| 42 | +++ wp-admin/includes/media.php (working copy) |
|---|
| 43 | @@ -2166,9 +2166,16 @@ |
|---|
| 44 | * @since 2.6.0 |
|---|
| 45 | */ |
|---|
| 46 | function media_upload_flash_bypass() { |
|---|
| 47 | + $browser_uploader = admin_url( 'media-new.php?browser-uploader' ); |
|---|
| 48 | + |
|---|
| 49 | + if ( $post = get_post() ) |
|---|
| 50 | + $browser_uploader .= '&post_id=' . intval( $post->ID ); |
|---|
| 51 | + elseif ( ! empty( $GLOBALS['post_ID'] ) ) |
|---|
| 52 | + $browser_uploader .= '&post_id=' . intval( $GLOBALS['post_ID'] ); |
|---|
| 53 | + |
|---|
| 54 | ?> |
|---|
| 55 | <p class="upload-flash-bypass"> |
|---|
| 56 | - <?php printf( __( 'You are using the multi-file uploader. Problems? Try the <a href="%1$s" target="%2$s">browser uploader</a> instead.' ), admin_url( 'media-new.php?browser-uploader' ), '_blank' ); ?> |
|---|
| 57 | + <?php printf( __( 'You are using the multi-file uploader. Problems? Try the <a href="%1$s" target="%2$s">browser uploader</a> instead.' ), $browser_uploader, '_blank' ); ?> |
|---|
| 58 | </p> |
|---|
| 59 | <?php |
|---|
| 60 | } |
|---|