]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/async-upload.php
Wordpress 2.9
[autoinstalls/wordpress.git] / wp-admin / async-upload.php
index 8ee85fc1f838924581e9fe78efcba146389d5145..a384453a283ccc7e9df6e163f62459279fb38c22 100644 (file)
@@ -6,6 +6,8 @@
  * @subpackage Administration
  */
 
+define('WP_ADMIN', true);
+
 if ( defined('ABSPATH') )
        require_once(ABSPATH . 'wp-load.php');
 else
@@ -16,6 +18,8 @@ if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_c
        $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
 elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
        $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
+if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
+       $_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
 unset($current_user);
 require_once('admin.php');
 
@@ -28,8 +32,9 @@ if ( !current_user_can('upload_files') )
 if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
        if ( 2 == $_REQUEST['fetch'] ) {
                add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
-               echo get_media_item($id, array( 'send' => false, 'delete' => false ));
+               echo get_media_item($id, array( 'send' => false, 'delete' => true ));
        } else {
+               add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
                echo get_media_item($id);
        }
        exit;
@@ -39,7 +44,7 @@ check_admin_referer('media-form');
 
 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
 if (is_wp_error($id)) {
-       echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
+       echo '<div id="media-upload-error">'.esc_html($id->get_error_message()).'</div>';
        exit;
 }
 
@@ -53,4 +58,4 @@ else {
        echo apply_filters("async_upload_{$type}", $id);
 }
 
-?>
\ No newline at end of file
+?>