Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 21766)
+++ wp-includes/link-template.php	(working copy)
@@ -106,7 +106,7 @@
 	if ( $post->post_type == 'page' )
 		return get_page_link($post->ID, $leavename, $sample);
 	elseif ( $post->post_type == 'attachment' )
-		return get_attachment_link($post->ID);
+		return get_attachment_link( $post->ID, $leavename );
 	elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
 		return get_post_permalink($post->ID, $leavename, $sample);
 
@@ -292,9 +292,10 @@
  * @since 2.0.0
  *
  * @param mixed $post Optional. Post ID or object.
+ * @param bool $leavename Optional. Leave name.
  * @return string
  */
-function get_attachment_link( $post = null ) {
+function get_attachment_link( $post = null, $leavename = false ) {
 	global $wp_rewrite;
 
 	$link = false;
@@ -314,7 +315,10 @@
 			$name = $post->post_name;
 
 		if ( strpos($parentlink, '?') === false )
-			$link = user_trailingslashit( trailingslashit($parentlink) . $name );
+			$link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
+
+		if ( ! $leavename )
+			$link = str_replace( '%postname%', $name, $link );
 	}
 
 	if ( ! $link )
Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 21766)
+++ wp-includes/post.php	(working copy)
@@ -53,12 +53,23 @@
 	register_post_type( 'attachment', array(
 		'labels' => array(
 			'name' => __( 'Media' ),
+			'name' => _x('Media', 'post type general name'),
+ 			'singular_name' => _x( 'Media Item', 'post type singular name' ),
+ 			'add_new' => _x( 'Add New', 'media item'),
+ 			'add_new_item' => __( 'Add New Media' ),
 			'edit_item' => __( 'Edit Media' ),
+			'new_item' => __( 'New Media Item' ),
+ 			'view_item' => __( 'View Attachment Page' ),
+ 			'search_items' => __( 'Search Media' ),
+ 			'not_found' => __( 'No media found.' ),
+ 			'not_found_in_trash' => __('No media found in Trash.'),
+ 			'parent_item_colon' => __('Parent:'),
+ 			'all_items' => __( 'All Media' ),
 		),
 		'public' => true,
-		'show_ui' => false,
+		'show_ui' => true,
 		'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
-		'_edit_link' => 'media.php?attachment_id=%d', /* internal use only. don't use this when registering your own post type. */
+		'_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */
 		'capability_type' => 'post',
 		'map_meta_cap' => true,
 		'hierarchical' => false,
@@ -66,7 +77,8 @@
 		'query_var' => false,
 		'show_in_nav_menus' => false,
 		'delete_with_user' => true,
-		'supports' => array( 'comments', 'author' ),
+		'supports' => array( 'title', 'editor', 'author', 'comments', 'image_editor' ),
+		'disables' => array( 'save', 'preview', 'post_status', 'visibility' )
 	) );
 
 	register_post_type( 'revision', array(
@@ -1099,7 +1111,7 @@
 		'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => null,
 		'_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false,
 		'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true,
-		'supports' => array(), 'register_meta_box_cb' => null,
+		'supports' => array(), 'disables' => array(), 'register_meta_box_cb' => null,
 		'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null,
 		'can_export' => true,
 		'show_in_nav_menus' => null, 'show_in_menu' => null, 'show_in_admin_bar' => null,
@@ -1159,6 +1171,11 @@
 		add_post_type_support($post_type, array('title', 'editor'));
 	}
 
+	if ( ! empty($args->disables) ) {
+		disable_for_post_type($post_type, $args->disables);
+		unset($args->disables);
+	}
+
 	if ( false !== $args->query_var && !empty($wp) ) {
 		if ( true === $args->query_var )
 			$args->query_var = $post_type;
@@ -1516,6 +1533,66 @@
 }
 
 /**
+ * Disable long-existing features for a post type
+ *
+ * Can't later add post type support for certain things
+ *
+ * @since 3.5.0
+ * @param string $post_type The post type for which to remove the feature
+ * @param string|array $feature the feature being removed, can be an array of feature strings or a single string
+ */
+function disable_for_post_type( $post_type, $feature ) {
+	global $_wp_post_type_disabled;
+
+	$features = (array) $feature;
+	foreach ($features as $feature) {
+		if ( func_num_args() == 2 )
+			$_wp_post_type_disabled[$post_type][$feature] = true;
+		else
+			$_wp_post_type_disabled[$post_type][$feature] = array_slice( func_get_args(), 2 );
+	}
+}
+
+/**
+ * Get all the disabled post type features
+ *
+ * @since 3.5.0
+ * @param string $post_type The post type
+ * @return array
+ */
+
+function get_all_disabled_for_post_type( $post_type ) {
+	global $_wp_post_type_disabled;
+
+	if ( isset( $_wp_post_type_disabled[$post_type] ) )
+		return $_wp_post_type_disabled[$post_type];
+
+	return array();
+}
+
+/**
+ * Checks whether a post type disables a given feature
+ *
+ * @since 3.5.0
+ * @param string $post_type The post type being checked
+ * @param string $feature the feature being checked
+ * @return boolean
+ */
+
+function post_type_disables( $post_type, $feature ) {
+	global $_wp_post_type_disabled;
+
+	if ( !isset( $_wp_post_type_disabled[$post_type][$feature] ) )
+		return false;
+
+	// If no args passed then no extra checks need be performed
+	if ( func_num_args() <= 2 )
+		return true;
+
+	return true;
+}
+
+/**
  * Updates the post type for the post ID.
  *
  * The page or post cache will be cleaned for the post ID.
Index: wp-admin/includes/post.php
===================================================================
--- wp-admin/includes/post.php	(revision 21766)
+++ wp-admin/includes/post.php	(working copy)
@@ -1065,7 +1065,7 @@
 
 	list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
 
-	if ( 'publish' == $post->post_status ) {
+	if ( 'publish' == get_post_status( $post ) ) {
 		$ptype = get_post_type_object($post->post_type);
 		$view_post = $ptype->labels->view_item;
 		$title = __('Click to edit this part of the permalink');
@@ -1099,7 +1099,7 @@
 		}
 	}
 
-	$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
+	$post_name_html = '<span id="editable-post-name" title="' . __('Click to edit this part of the permalink') . '">' . $post_name_abridged . '</span>';
 	$display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
 	$view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
 	$return =  '<strong>' . __('Permalink:') . "</strong>\n";
Index: wp-admin/includes/screen.php
===================================================================
--- wp-admin/includes/screen.php	(revision 21766)
+++ wp-admin/includes/screen.php	(working copy)
@@ -98,6 +98,8 @@
 		if ( 'post' == $screen->base ) {
 			if ( 'post' == $screen->post_type || 'page' == $screen->post_type )
 				$hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
+			elseif ( 'attachment' == $screen->post_type )
+				$hidden = array( 'slugdiv', 'trackbacksdiv', 'postcustom', 'authordiv', 'revisionsdiv' );
 			else
 				$hidden = array( 'slugdiv' );
 		}
Index: wp-admin/includes/media.php
===================================================================
--- wp-admin/includes/media.php	(revision 21766)
+++ wp-admin/includes/media.php	(working copy)
@@ -858,9 +858,9 @@
 
 /**
  * Filters input from media_upload_form_handler() and assigns a default
- * post_title from the file name if none supplied. 
+ * post_title from the file name if none supplied.
  *
- * Illustrates the use of the attachment_fields_to_save filter 
+ * Illustrates the use of the attachment_fields_to_save filter
  * which can be used to add default values to any field before saving to DB.
  *
  * @since 2.5.0
@@ -2095,6 +2095,63 @@
 	echo '<p>' . sprintf( __( 'Sorry, you have used all of your storage quota of %s MB.' ), get_space_allowed() ) . '</p>';
 }
 
+/**
+ * Displays the image and editor in the post editor
+ *
+ * @since 3.5.0
+ */
+function edit_form_image_editor() {
+	$post = get_post();
+
+	if ( ( $attachment_id = intval( $post->ID ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) )
+		$thumb_url = $thumb_url[0];
+	else
+		$thumb_url = false;
+
+	$filename = esc_html( basename( $post->guid ) );
+	$title = esc_attr( $post->post_title );
+
+
+	$post_mime_types = get_post_mime_types();
+	$keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
+	$type = array_shift( $keys );
+	$type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
+
+
+	$media_dims = '';
+	$meta = wp_get_attachment_metadata( $post->ID );
+	if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) )
+		$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
+	$media_dims = apply_filters( 'media_meta', $media_dims, $post );
+
+	$image_edit_button = '';
+	if ( gd_edit_image_support( $post->post_mime_type ) ) {
+		$nonce = wp_create_nonce( "image_editor-$post->ID" );
+		$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <img src='" . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . "' class='imgedit-wait-spin' alt='' />";
+	}
+
+ 	?>
+	<div class="wp_attachment_holder">
+		<div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
+
+		<div class="wp_attachment_image" id="media-head-<?php echo $attachment_id; ?>">
+			<p><img class="thumbnail" src="<?php echo $thumb_url; ?>" alt="" /></p>
+			<p><?php echo $image_edit_button; ?></p>
+		</div>
+		<div style="display:none" class="image-editor" id="image-editor-<?php echo $attachment_id; ?>"></div>
+
+		<div class="wp_attachment_details">
+			<p><strong><?php _e( 'File name:' ); ?></strong> <?php echo $filename; ?></p>
+			<p><strong><?php _e( 'File type:' ); ?></strong> <?php echo $post->post_mime_type; ?></p>
+			<?php
+				if ( !empty( $media_dims ) )
+					echo '<p><strong>' . __( 'Dimensions:' ) . "</strong> $media_dims</p>";
+			?>
+		</div>
+	</div>
+	<?php
+}
+
 add_filter( 'async_upload_image', 'get_media_item', 10, 2 );
 add_filter( 'async_upload_audio', 'get_media_item', 10, 2 );
 add_filter( 'async_upload_video', 'get_media_item', 10, 2 );
Index: wp-admin/includes/meta-boxes.php
===================================================================
--- wp-admin/includes/meta-boxes.php	(revision 21766)
+++ wp-admin/includes/meta-boxes.php	(working copy)
@@ -26,6 +26,7 @@
 </div>
 
 <div id="minor-publishing-actions">
+<?php if ( ! post_type_disables( $post->post_type, 'save' ) ) : ?>
 <div id="save-action">
 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
 <input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button button-highlighted" />
@@ -34,7 +35,8 @@
 <?php } ?>
 <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading" id="draft-ajax-loading" alt="" />
 </div>
-<?php if ( $post_type_object->public ) : ?>
+<?php endif; // doesn't disable save button ?>
+<?php if ( ! post_type_disables( $post->post_type, 'preview' ) && $post_type_object->public ) : ?>
 <div id="preview-action">
 <?php
 if ( 'publish' == $post->post_status ) {
@@ -55,7 +57,9 @@
 
 <div id="misc-publishing-actions">
 
+<?php if ( ! post_type_disables( $post->post_type, 'post_status' ) ) : ?>
 <div class="misc-pub-section"><label for="post_status"><?php _e('Status:') ?></label>
+
 <span id="post-status-display">
 <?php
 switch ( $post->post_status ) {
@@ -104,7 +108,9 @@
 
 <?php } ?>
 </div><?php // /misc-pub-section ?>
+<?php endif; // doesn't disable post_status ?>
 
+<?php if ( ! post_type_disables( $post->post_type, 'visibility' ) ) : ?>
 <div class="misc-pub-section" id="visibility">
 <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
 
@@ -149,14 +155,17 @@
 <?php } ?>
 
 </div><?php // /misc-pub-section ?>
+<?php endif; // doesn't disable visibility ?>
 
 <?php
 // translators: Publish box date format, see http://php.net/date
 $datef = __( 'M j, Y @ G:i' );
 if ( 0 != $post->ID ) {
-	if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
+	if ( 'attachment' == get_post_type() ) { // attachments are uploaded on a date
+		$stamp = __('Uploaded on: <b>%1$s</b>');
+	} else if ( 'future' == get_post_status() ) { // scheduled for publishing at a future date
 		$stamp = __('Scheduled for: <b>%1$s</b>');
-	} else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
+	} else if ( 'publish' == get_post_status() || 'private' == get_post_status() ) { // already published
 		$stamp = __('Published on: <b>%1$s</b>');
 	} else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
 		$stamp = __('Publish <b>immediately</b>');
@@ -171,7 +180,7 @@
 	$date = date_i18n( $datef, strtotime( current_time('mysql') ) );
 }
 
-if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
+if ( $can_publish && ! post_type_disables( $post->post_type, 'change_publish_date' ) ) : // Contributors don't get to choose the date of publish ?>
 <div class="misc-pub-section curtime">
 	<span id="timestamp">
 	<?php printf($stamp, $date); ?></span>
@@ -202,7 +211,7 @@
 <div id="publishing-action">
 <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading" id="ajax-loading" alt="" />
 <?php
-if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
+if ( !in_array( $post->post_status, array('publish', 'future', 'private', 'inherit') ) || 0 == $post->ID ) {
 	if ( $can_publish ) :
 		if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
@@ -914,3 +923,31 @@
 	$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
 	echo _wp_post_thumbnail_html( $thumbnail_id );
 }
+
+/**
+ * Display attachment/media-specific information
+ *
+ * @since 3.5.0
+ *
+ * @param object $post
+ */
+function attachment_data_meta_box( $post ) {
+	$att_url = wp_get_attachment_url( $post->ID );
+	$alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
+?>
+	<label for="_wp_attachment_image_alt"><strong>Alternative text</strong></label><br />
+	<input type="text" class="widefat" name="_wp_attachment_image_alt" value="<?php echo esc_attr( $alt_text ); ?>" />
+</p>
+
+<p>
+	<label for="excerpt"><strong>Excerpt</strong></label><br />
+	<textarea class="widefat" name="excerpt"><?php echo $post->post_excerpt; ?></textarea>
+</p>
+
+<p>
+	<label for="attachment_url"><strong>File URL</strong></label><br />
+	<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php echo esc_attr($att_url); ?>" /><br />
+	<em><?php _e( 'Location of the uploaded file.' ); ?></em>
+</p>
+<?php
+}
Index: wp-admin/css/wp-admin.css
===================================================================
--- wp-admin/css/wp-admin.css	(revision 21766)
+++ wp-admin/css/wp-admin.css	(working copy)
@@ -3894,7 +3894,8 @@
 	margin: 8px 0;
 }
 
-.describe .imgedit-wrap table td {
+.describe .imgedit-wrap table td,
+.wp_attachment_holder .imgedit-wrap table td {
 	vertical-align: top;
 	padding-top: 0;
 }
Index: wp-admin/post.php
===================================================================
--- wp-admin/post.php	(revision 21766)
+++ wp-admin/post.php	(working copy)
@@ -31,6 +31,7 @@
 if ( $post ) {
 	$post_type = $post->post_type;
 	$post_type_object = get_post_type_object( $post_type );
+	$parent_file = 'upload.php';
 }
 
 /**
@@ -148,6 +149,10 @@
 		$parent_file = "edit.php";
 		$submenu_file = "edit.php";
 		$post_new_file = "post-new.php";
+	} elseif ( 'attachment' === $post_type ) {
+ 		$parent_file = 'upload.php';
+ 		$submenu_file = 'upload.php';
+ 		$post_new_file = 'media-new.php';
 	} else {
 		if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
 			$parent_file = $post_type_object->show_in_menu;
Index: wp-admin/edit-form-advanced.php
===================================================================
--- wp-admin/edit-form-advanced.php	(revision 21766)
+++ wp-admin/edit-form-advanced.php	(working copy)
@@ -23,6 +23,10 @@
 	wp_plupload_default_settings();
 	add_action( 'admin_footer', 'wp_print_media_templates' );
 }
+if ( post_type_supports( $post_type, 'image_editor' ) ) {
+	wp_enqueue_script('image-edit');
+	wp_enqueue_style( 'imgareaselect' );
+}
 
 /**
  * Post ID global
@@ -77,7 +81,7 @@
 
 $notice = false;
 $form_extra = '';
-if ( 'auto-draft' == $post->post_status ) {
+if ( 'auto-draft' == get_post_status( $post ) ) {
 	if ( 'edit' == $action )
 		$post->post_title = '';
 	$autosave = false;
@@ -131,6 +135,9 @@
 if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) )
 		add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
 
+if ( 'attachment' == $post_type )
+	add_meta_box( 'attachmentdata', __('Attachment Data'), 'attachment_data_meta_box', null, 'normal', 'core' );
+
 if ( post_type_supports($post_type, 'excerpt') )
 	add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
 
@@ -144,10 +151,10 @@
 if ( post_type_supports($post_type, 'comments') )
 	add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
 
-if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') )
+if ( ('publish' == get_post_status( $post ) || 'private' == get_post_status( $post )) && post_type_supports($post_type, 'comments') )
 	add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
 
-if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) )
+if ( !( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) )
 	add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
 
 if ( post_type_supports($post_type, 'author') ) {
@@ -158,6 +165,9 @@
 if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
 	add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
 
+if ( post_type_supports( $post_type, 'image_editor' ) )
+	add_action( 'edit_form_advanced_before', 'edit_form_image_editor' );
+
 do_action('add_meta_boxes', $post_type, $post);
 do_action('add_meta_boxes_' . $post_type, $post);
 
@@ -263,13 +273,13 @@
 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" />
 <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
 <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" />
-<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" />
+<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ) ?>" />
 <input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
 <?php if ( ! empty( $active_post_lock ) ) { ?>
 <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
 <?php
 }
-if ( 'draft' != $post->post_status )
+if ( 'draft' != get_post_status( $post ) )
 	wp_original_referer_field(true, 'previous');
 
 echo $form_extra;
@@ -283,7 +293,11 @@
 
 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
 <div id="post-body-content">
-<?php if ( post_type_supports($post_type, 'title') ) { ?>
+<?php
+do_action( 'edit_form_advanced_before');
+
+if ( post_type_supports($post_type, 'title') ) {
+?>
 <div id="titlediv">
 <div id="titlewrap">
 	<label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
@@ -296,10 +310,10 @@
 if ( !empty($shortlink) )
     $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
 
-if ( $post_type_object->public && ! ( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?>
+if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?>
 	<div id="edit-slug-box">
 	<?php
-		if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status )
+		if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != get_post_status( $post ) )
 			echo $sample_permalink_html;
 	?>
 	</div>
@@ -311,8 +325,12 @@
 wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
 ?>
 </div>
-<?php } ?>
 
+<?php
+	do_action( 'edit_form_after_title');
+}
+?>
+
 <?php if ( post_type_supports($post_type, 'editor') ) { ?>
 <div id="postdivrich" class="postarea">
 
@@ -323,7 +341,7 @@
 	<td class="autosave-info">
 	<span class="autosave-message">&nbsp;</span>
 <?php
-	if ( 'auto-draft' != $post->post_status ) {
+	if ( 'auto-draft' != get_post_status( $post ) ) {
 		echo '<span id="last-edit">';
 		if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
 			$last_user = get_userdata($last_id);
@@ -337,7 +355,10 @@
 </tr></tbody></table>
 
 </div>
-<?php } ?>
+<?php
+	do_action( 'edit_form_after_editor');
+}
+?>
 </div><!-- /post-body-content -->
 
 <div id="postbox-container-1" class="postbox-container">
