-
+ BCDEC73F5EE71615523F0EB88243CB2484822E6600B9D7DA01882A75D16C25E287FEA3D11E4CB194AB2EC40FC681588F26163B7CC93324277A8831027C39447D
mp-wp/wp-admin/media.php
(0 . 0)(1 . 120)
52718 <?php
52719 /**
52720 * Media management action handler.
52721 *
52722 * @package WordPress
52723 * @subpackage Administration
52724 */
52725
52726 /** Load WordPress Administration Bootstrap */
52727 require_once('admin.php');
52728
52729 $parent_file = 'upload.php';
52730 $submenu_file = 'upload.php';
52731
52732 wp_reset_vars(array('action'));
52733
52734 switch( $action ) :
52735 case 'editattachment' :
52736 $attachment_id = (int) $_POST['attachment_id'];
52737 check_admin_referer('media-form');
52738
52739 if ( !current_user_can('edit_post', $attachment_id) )
52740 wp_die ( __('You are not allowed to edit this attachment.') );
52741
52742 $errors = media_upload_form_handler();
52743
52744 if ( empty($errors) ) {
52745 $location = 'media.php';
52746 if ( $referer = wp_get_original_referer() ) {
52747 if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) )
52748 $location = $referer;
52749 }
52750 if ( false !== strpos($location, 'upload.php') ) {
52751 $location = remove_query_arg('message', $location);
52752 $location = add_query_arg('posted', $attachment_id, $location);
52753 } elseif ( false !== strpos($location, 'media.php') ) {
52754 $location = add_query_arg('message', 'updated', $location);
52755 }
52756 wp_redirect($location);
52757 exit;
52758 }
52759
52760 // no break
52761 case 'edit' :
52762 $title = __('Edit Media');
52763
52764 if ( empty($errors) )
52765 $errors = null;
52766
52767 if ( empty( $_GET['attachment_id'] ) ) {
52768 wp_redirect('upload.php');
52769 exit();
52770 }
52771 $att_id = (int) $_GET['attachment_id'];
52772
52773 if ( !current_user_can('edit_post', $att_id) )
52774 wp_die ( __('You are not allowed to edit this attachment.') );
52775
52776 $att = get_post($att_id);
52777
52778 add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
52779
52780 wp_enqueue_script( 'wp-ajax-response' );
52781 // wp_admin_css( 'media' );
52782
52783 require( 'admin-header.php' );
52784
52785 $parent_file = 'upload.php';
52786 $message = '';
52787 $class = '';
52788 if ( isset($_GET['message']) ) {
52789 switch ( $_GET['message'] ) :
52790 case 'updated' :
52791 $message = __('Media attachment updated.');
52792 $class = 'updated fade';
52793 break;
52794 endswitch;
52795 }
52796 if ( $message )
52797 echo "<div id='message' class='$class'><p>$message</p></div>\n";
52798
52799 ?>
52800
52801 <div class="wrap">
52802 <?php screen_icon(); ?>
52803 <h2><?php _e( 'Edit Media' ); ?></h2>
52804
52805 <form method="post" action="<?php echo clean_url( remove_query_arg( 'message' ) ); ?>" class="media-upload-form" id="media-single-form">
52806 <div class="media-single">
52807 <div id='media-item-<?php echo $att_id; ?>' class='media-item'>
52808 <?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => $errors ) ); ?>
52809 </div>
52810 </div>
52811
52812 <p class="submit">
52813 <input type="submit" class="button-primary" name="save" value="<?php _e('Update Media'); ?>" />
52814 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
52815 <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $att_id; ?>" />
52816 <input type="hidden" name="action" value="editattachment" />
52817 <?php wp_original_referer_field(true, 'previous'); ?>
52818 <?php wp_nonce_field('media-form'); ?>
52819 </p>
52820 </form>
52821
52822 </div>
52823
52824 <?php
52825
52826 require( 'admin-footer.php' );
52827
52828 exit;
52829
52830 default:
52831 wp_redirect( 'upload.php' );
52832 exit;
52833
52834 endswitch;
52835
52836
52837 ?>