-
+ C7E80BDDAF2DDE406CE67FF8846A6B0BDA2E7D73D161542DAD9E8BDE705F1F24DD9FA9ABEA88C619CB78CB4F8B6099741545A8D7DF913019B9C4B1A131E91A04
mp-wp/wp-admin/media-upload.php
(0 . 0)(1 . 111)
52603 <?php
52604 /**
52605 * Manage media uploaded file.
52606 *
52607 * There are many filters in here for media. Plugins can extend functionality
52608 * by hooking into the filters.
52609 *
52610 * @package WordPress
52611 * @subpackage Administration
52612 */
52613
52614 /** Load WordPress Administration Bootstrap */
52615 require_once('admin.php');
52616
52617 if (!current_user_can('upload_files'))
52618 wp_die(__('You do not have permission to upload files.'));
52619
52620 wp_enqueue_script('swfupload');
52621 wp_enqueue_script('swfupload-swfobject');
52622 wp_enqueue_script('swfupload-queue');
52623 wp_enqueue_script('swfupload-handlers');
52624
52625 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
52626
52627 // IDs should be integers
52628 $ID = isset($ID) ? (int) $ID : 0;
52629 $post_id = isset($post_id)? (int) $post_id : 0;
52630
52631 // Require an ID for the edit screen
52632 if ( isset($action) && $action == 'edit' && !$ID )
52633 wp_die(__("You are not allowed to be here"));
52634
52635 if ( isset($_GET['inline']) ) {
52636
52637 if ( isset($_GET['upload-page-form']) ) {
52638 $errors = media_upload_form_handler();
52639
52640 $location = 'upload.php';
52641 if ( $errors )
52642 $location .= '?message=3';
52643
52644 wp_redirect( admin_url($location) );
52645 }
52646
52647 if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
52648 // Upload File button was clicked
52649 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
52650 unset($_FILES);
52651 if ( is_wp_error($id) ) {
52652 $errors['upload_error'] = $id;
52653 $id = false;
52654 }
52655 }
52656
52657 $title = __('Upload New Media');
52658 $parent_file = 'upload.php';
52659 require_once('admin-header.php'); ?>
52660 <div class="wrap">
52661 <?php screen_icon(); ?>
52662 <h2><?php echo wp_specialchars( $title ); ?></h2>
52663
52664 <form enctype="multipart/form-data" method="post" action="media-upload.php?inline=&upload-page-form=" class="media-upload-form type-form validate" id="file-form">
52665
52666 <?php media_upload_form(); ?>
52667
52668 <script type="text/javascript">
52669 jQuery(function($){
52670 var preloaded = $(".media-item.preloaded");
52671 if ( preloaded.length > 0 ) {
52672 preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
52673 }
52674 updateMediaForm();
52675 post_id = 0;
52676 shortform = 1;
52677 });
52678 </script>
52679 <input type="hidden" name="post_id" id="post_id" value="0" />
52680 <?php wp_nonce_field('media-form'); ?>
52681 <div id="media-items"> </div>
52682 <p>
52683 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
52684 </p>
52685 </form>
52686 </div>
52687
52688 <?php
52689 include('admin-footer.php');
52690
52691 } else {
52692
52693 // upload type: image, video, file, ..?
52694 if ( isset($_GET['type']) )
52695 $type = strval($_GET['type']);
52696 else
52697 $type = apply_filters('media_upload_default_type', 'file');
52698
52699 // tab: gallery, library, or type-specific
52700 if ( isset($_GET['tab']) )
52701 $tab = strval($_GET['tab']);
52702 else
52703 $tab = apply_filters('media_upload_default_tab', 'type');
52704
52705 $body_id = 'media-upload';
52706
52707 // let the action code decide how to handle the request
52708 if ( $tab == 'type' || $tab == 'type_url' )
52709 do_action("media_upload_$type");
52710 else
52711 do_action("media_upload_$tab");
52712 }
52713 ?>