Ticket #22572: 22572.3.patch
| File 22572.3.patch, 2.4 KB (added by ocean90, 6 months ago) |
|---|
-
wp-admin/includes/media.php
2166 2166 * @since 2.6.0 2167 2167 */ 2168 2168 function media_upload_flash_bypass() { 2169 $browser_uploader = admin_url( 'media-new.php?browser-uploader' ); 2170 2171 $post = get_post(); 2172 if ( ! empty( $post ) ) 2173 $browser_uploader = add_query_arg( 'post_id', $post->ID, $browser_uploader ); 2174 2169 2175 ?> 2170 2176 <p class="upload-flash-bypass"> 2171 <?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' ); ?>2177 <?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' ); ?> 2172 2178 </p> 2173 2179 <?php 2174 2180 } -
wp-admin/media-new.php
17 17 18 18 wp_enqueue_script('plupload-handlers'); 19 19 20 unset( $_REQUEST['post_id'] );20 $post_id = ! empty( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; 21 21 22 22 if ( $_POST ) { 23 if ( ! empty( $post_id ) && ! current_user_can( 'edit_post' , $post_id ) ) 24 wp_die( __( 'Cheatin’ uh?' ) ); 25 23 26 $location = 'upload.php'; 24 27 if ( isset($_POST['html-upload']) && !empty($_FILES) ) { 25 28 check_admin_referer('media-form'); 26 29 // Upload File button was clicked 27 $id = media_handle_upload('async-upload', $ _REQUEST['post_id']);30 $id = media_handle_upload('async-upload', $post_id); 28 31 if ( is_wp_error( $id ) ) 29 32 $location .= '?message=3'; 30 33 } 31 34 wp_redirect( admin_url( $location ) ); 32 35 exit; 36 } else if ( ! empty( $post_id ) ) { 37 // post_id is only allowed for browser upload 38 wp_die( __( 'Cheatin’ uh?' ) ); 33 39 } 34 40 35 41 $title = __('Upload New Media'); … … 68 74 <?php media_upload_form(); ?> 69 75 70 76 <script type="text/javascript"> 71 var post_id = 0, shortform = 3;77 var post_id = <?php echo $post_id; ?>, shortform = 3; 72 78 </script> 73 <input type="hidden" name="post_id" id="post_id" value=" 0" />79 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> 74 80 <?php wp_nonce_field('media-form'); ?> 75 81 <div id="media-items" class="hide-if-no-js"></div> 76 82 </form>
