+ require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+
+if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['action'] ) ) {
+ // Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
+ if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
+ $_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( ABSPATH . 'wp-admin/admin.php' );
+
+header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
+
+if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
+ include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+ send_nosniff_header();
+ nocache_headers();