-
+ E5128DD12C00925AB20DD786768C465010A73BA574A4307177381FE386B4ECA7638D551DD7BB652D78B24D0A1E1F2C830DB8467FB1F354D0C2AD422F1FD98A6Dmp-wp/wp-admin/async-upload.php(0 . 0)(1 . 56)
1619 <?php
1620 /**
1621 * Accepts file uploads from swfupload or other asynchronous upload methods.
1622 *
1623 * @package WordPress
1624 * @subpackage Administration
1625 */
1626
1627 if ( defined('ABSPATH') )
1628 require_once(ABSPATH . 'wp-load.php');
1629 else
1630 require_once('../wp-load.php');
1631
1632 // Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
1633 if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
1634 $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
1635 elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
1636 $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
1637 unset($current_user);
1638 require_once('admin.php');
1639
1640 header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
1641
1642 if ( !current_user_can('upload_files') )
1643 wp_die(__('You do not have permission to upload files.'));
1644
1645 // just fetch the detail form for that attachment
1646 if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
1647 if ( 2 == $_REQUEST['fetch'] ) {
1648 add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
1649 echo get_media_item($id, array( 'send' => false, 'delete' => false ));
1650 } else {
1651 echo get_media_item($id);
1652 }
1653 exit;
1654 }
1655
1656 check_admin_referer('media-form');
1657
1658 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
1659 if (is_wp_error($id)) {
1660 echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
1661 exit;
1662 }
1663
1664 if ( $_REQUEST['short'] ) {
1665 // short form response - attachment ID only
1666 echo $id;
1667 }
1668 else {
1669 // long form response - big chunk o html
1670 $type = $_REQUEST['type'];
1671 echo apply_filters("async_upload_{$type}", $id);
1672 }
1673
1674 ?>