<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12708] trunk: Merge page.php into post.php.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12708">12708</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-12 16:50:37 +0000 (Tue, 12 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge page.php into post.php. see <a href="http://trac.wordpress.org/ticket/9674">#9674</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmineditformadvancedphp">trunk/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunkwpadminpostphp">trunk/wp-admin/post.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkwpadminpagephp">trunk/wp-admin/page.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-advanced.php (12707 => 12708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-advanced.php        2010-01-12 15:41:10 UTC (rev 12707)
+++ trunk/wp-admin/edit-form-advanced.php        2010-01-12 16:50:37 UTC (rev 12708)
</span><span class="lines">@@ -40,8 +40,9 @@
</span><span class="cx">         sprintf( __('Page updated. &lt;a href=&quot;%s&quot;&gt;View page&lt;/a&gt;'), get_permalink($post_ID) ),
</span><span class="cx">         __('Custom field updated.'),
</span><span class="cx">         __('Custom field deleted.'),
</span><ins>+        __('Page updated.'),
+        isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
</ins><span class="cx">         sprintf( __('Page published. &lt;a href=&quot;%s&quot;&gt;View page&lt;/a&gt;'), get_permalink($post_ID) ),
</span><del>-        isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
</del><span class="cx">         sprintf( __('Page submitted. &lt;a target=&quot;_blank&quot; href=&quot;%s&quot;&gt;Preview page&lt;/a&gt;'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ),
</span><span class="cx">         // translators: Publish box date format, see http://php.net/date - Same as in meta-boxes.php
</span><span class="cx">         sprintf( __('Page scheduled for: &lt;b&gt;%1$s&lt;/b&gt;. &lt;a target=&quot;_blank&quot; href=&quot;%2$s&quot;&gt;Preview page&lt;/a&gt;'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post-&gt;post_date ) ), get_permalink($post_ID) ),
</span></span></pre></div>
<a id="trunkwpadminpagephp"></a>
<div class="delfile"><h4>Deleted: trunk/wp-admin/page.php (12707 => 12708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/page.php        2010-01-12 15:41:10 UTC (rev 12707)
+++ trunk/wp-admin/page.php        2010-01-12 16:50:37 UTC (rev 12708)
</span><span class="lines">@@ -1,222 +0,0 @@
</span><del>-&lt;?php
-/**
- * Edit page administration panel.
- *
- * Manage edit page: post, edit, delete, etc.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-/** WordPress Administration Bootstrap */
-require_once('admin.php');
-
-$parent_file = 'edit-pages.php';
-$submenu_file = 'edit-pages.php';
-
-wp_reset_vars(array('action'));
-
-/**
- * Redirect to previous page.
- *
- * @param int $page_ID Page ID.
- */
-function redirect_page($page_ID) {
-        global $action;
-
-        $referredby = '';
-        if ( !empty($_POST['referredby']) ) {
-                $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
-                $referredby = remove_query_arg('_wp_original_http_referer', $referredby);
-        }
-        $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
-
-        if ( 'post' == $_POST['originalaction'] &amp;&amp; !empty($_POST['mode']) &amp;&amp; 'sidebar' == $_POST['mode'] ) {
-                $location = 'sidebar.php?a=b';
-        } elseif ( isset($_POST['save']) || isset($_POST['publish']) ) {
-                $status = get_post_status( $page_ID );
-
-                if ( isset( $_POST['publish'] ) ) {
-                        switch ( $status ) {
-                                case 'pending':
-                                        $message = 6;
-                                        break;
-                                case 'future':
-                                        $message = 7;
-                                        break;
-                                default:
-                                        $message = 4;
-                        }
-                } else {
-                                $message = 'draft' == $status ? 8 : 1;
-                }
-
-                $location = add_query_arg( 'message', $message, get_edit_post_link( $page_ID, 'url' ) );
-        } elseif ( isset($_POST['addmeta']) ) {
-                $location = add_query_arg( 'message', 2, wp_get_referer() );
-                $location = explode('#', $location);
-                $location = $location[0] . '#postcustom';
-        } elseif ( isset($_POST['deletemeta']) ) {
-                $location = add_query_arg( 'message', 3, wp_get_referer() );
-                $location = explode('#', $location);
-                $location = $location[0] . '#postcustom';
-        } else {
-                $location = add_query_arg( 'message', 1, get_edit_post_link( $page_ID, 'url' ) );
-        }
-
-        wp_redirect( apply_filters( 'redirect_page_location', $location, $page_ID ) );
-}
-
-if (isset($_POST['deletepost']))
-        $action = &quot;delete&quot;;
-elseif ( isset($_POST['wp-preview']) &amp;&amp; 'dopreview' == $_POST['wp-preview'] )
-        $action = 'preview';
-
-$sendback = wp_get_referer();
-if ( strpos($sendback, 'page.php') !== false || strpos($sendback, 'post-new.php') !== false )
-        $sendback = admin_url('edit-pages.php');
-else
-        $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
-
-switch($action) {
-case 'post':
-        check_admin_referer('add-page');
-        $page_ID = write_post();
-
-        redirect_page($page_ID);
-
-        exit();
-        break;
-
-case 'edit':
-        $title = __('Edit Page');
-        $editing = true;
-        $page_ID = $post_ID = $p = (int) $_GET['post'];
-        $post = get_post_to_edit($page_ID);
-
-        if ( empty($post-&gt;ID) )
-                wp_die( __('You attempted to edit a page that doesn&amp;#8217;t exist. Perhaps it was deleted?') );
-
-        if ( !current_user_can('edit_page', $page_ID) )
-                wp_die( __('You are not allowed to edit this page.') );
-
-        if ( 'trash' == $post-&gt;post_status )
-                wp_die( __('You can&amp;#8217;t edit this page because it is in the Trash. Please move it out of the Trash and try again.') );
-
-        if ( 'page' != $post-&gt;post_type ) {
-                wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
-                exit();
-        }
-
-        wp_enqueue_script('post');
-        if ( user_can_richedit() )
-                wp_enqueue_script('editor');
-        add_thickbox();
-        wp_enqueue_script('media-upload');
-        wp_enqueue_script('word-count');
-
-        if ( $last = wp_check_post_lock( $post-&gt;ID ) ) {
-                add_action('admin_notices', '_admin_notice_post_locked' );
-        } else {
-                wp_set_post_lock( $post-&gt;ID );
-                wp_enqueue_script('autosave');
-        }
-
-        $post_type = $post-&gt;post_type;
-        include('edit-form-advanced.php');
-        break;
-
-case 'editattachment':
-        $page_id = $post_ID = (int) $_POST['post_ID'];
-        check_admin_referer('update-attachment_' . $page_id);
-
-        // Don't let these be changed
-        unset($_POST['guid']);
-        $_POST['post_type'] = 'attachment';
-
-        // Update the thumbnail filename
-        $newmeta = wp_get_attachment_metadata( $page_id, true );
-        $newmeta['thumb'] = $_POST['thumb'];
-
-        wp_update_attachment_metadata( $newmeta );
-
-case 'editpost':
-        $page_ID = (int) $_POST['post_ID'];
-        check_admin_referer('update-page_' . $page_ID);
-
-        $page_ID = edit_post();
-
-        redirect_page($page_ID);
-
-        exit();
-        break;
-
-case 'trash':
-        $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
-        check_admin_referer('trash-page_' . $post_id);
-
-        $post = &amp; get_post($post_id);
-
-        if ( !current_user_can('delete_page', $post_id) )
-                wp_die( __('You are not allowed to move this page to the trash.') );
-
-        if ( !wp_trash_post($post_id) )
-                wp_die( __('Error in moving to trash...') );
-
-        wp_redirect( add_query_arg( array('trashed' =&gt; 1, 'ids' =&gt; $post_id), $sendback ) );
-        exit();
-        break;
-
-case 'untrash':
-        $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
-        check_admin_referer('untrash-page_' . $post_id);
-
-        $post = &amp; get_post($post_id);
-
-        if ( !current_user_can('delete_page', $post_id) )
-                wp_die( __('You are not allowed to move this page out of the trash.') );
-
-        if ( !wp_untrash_post($post_id) )
-                wp_die( __('Error in restoring from trash...') );
-
-        wp_redirect( add_query_arg('untrashed', 1, $sendback) );
-        exit();
-        break;
-
-case 'delete':
-        $page_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
-        check_admin_referer('delete-page_' .  $page_id);
-
-        $page = &amp; get_post($page_id);
-
-        if ( !current_user_can('delete_page', $page_id) )
-                wp_die( __('You are not allowed to delete this page.') );
-
-        if ( $page-&gt;post_type == 'attachment' ) {
-                if ( ! wp_delete_attachment($page_id) )
-                        wp_die( __('Error in deleting...') );
-        } else {
-                if ( !wp_delete_post($page_id) )
-                        wp_die( __('Error in deleting...') );
-        }
-
-        wp_redirect( add_query_arg('deleted', 1, $sendback) );
-        exit();
-        break;
-
-case 'preview':
-        check_admin_referer( 'autosave', 'autosavenonce' );
-
-        $url = post_preview();
-
-        wp_redirect($url);
-        exit();
-        break;
-
-default:
-        wp_redirect('edit-pages.php');
-        exit();
-        break;
-} // end switch
-include('admin-footer.php');
-?&gt;
</del></span></pre></div>
<a id="trunkwpadminpostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post.php (12707 => 12708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post.php        2010-01-12 15:41:10 UTC (rev 12707)
+++ trunk/wp-admin/post.php        2010-01-12 16:50:37 UTC (rev 12708)
</span><span class="lines">@@ -16,12 +16,32 @@
</span><span class="cx"> 
</span><span class="cx"> wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder'));
</span><span class="cx"> 
</span><ins>+if ( isset($_GET['post']) )
+        $post_id = (int) $_GET['post'];
+elseif ( isset($_POST['post_ID']) )
+        $post_id = (int) $_POST['post_ID'];
+else
+        $post_id = 0;
+$post_ID = $post_id;
+
+$post = null;
+$post_type_object = null;
+$post_type_cap = null;
+if ( $post_id ) {
+        $post = get_post($post_id);
+        if ( $post ) {
+                $post_type_object = get_post_type_object($post-&gt;post_type);
+                if ( $post_type_object )
+                        $post_type_cap = $post_type_object-&gt;capability_type;
+        }
+}
+
</ins><span class="cx"> /**
</span><span class="cx">  * Redirect to previous page.
</span><span class="cx">  *
</span><del>- * @param int $post_ID Optional. Post ID.
</del><ins>+ * @param int $post_id Optional. Post ID.
</ins><span class="cx">  */
</span><del>-function redirect_post($post_ID = '') {
</del><ins>+function redirect_post($post_id = '') {
</ins><span class="cx">         global $action;
</span><span class="cx"> 
</span><span class="cx">         $referredby = '';
</span><span class="lines">@@ -37,7 +57,7 @@
</span><span class="cx">                 elseif ( isset($_POST['publish']) )
</span><span class="cx">                         $location = 'sidebar.php?a=b';
</span><span class="cx">         } elseif ( isset($_POST['save']) || isset($_POST['publish']) ) {
</span><del>-                $status = get_post_status( $post_ID );
</del><ins>+                $status = get_post_status( $post_id );
</ins><span class="cx"> 
</span><span class="cx">                 if ( isset( $_POST['publish'] ) ) {
</span><span class="cx">                         switch ( $status ) {
</span><span class="lines">@@ -54,7 +74,7 @@
</span><span class="cx">                                 $message = 'draft' == $status ? 10 : 1;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $location = add_query_arg( 'message', $message, get_edit_post_link( $post_ID, 'url' ) );
</del><ins>+                $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
</ins><span class="cx">         } elseif ( isset($_POST['addmeta']) &amp;&amp; $_POST['addmeta'] ) {
</span><span class="cx">                 $location = add_query_arg( 'message', 2, wp_get_referer() );
</span><span class="cx">                 $location = explode('#', $location);
</span><span class="lines">@@ -64,12 +84,12 @@
</span><span class="cx">                 $location = explode('#', $location);
</span><span class="cx">                 $location = $location[0] . '#postcustom';
</span><span class="cx">         } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) {
</span><del>-                $location = &quot;post.php?action=edit&amp;post=$post_ID&amp;message=7&quot;;
</del><ins>+                $location = &quot;post.php?action=edit&amp;post=$post_id&amp;message=7&quot;;
</ins><span class="cx">         } else {
</span><del>-                $location = add_query_arg( 'message', 4, get_edit_post_link( $post_ID, 'url' ) );
</del><ins>+                $location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        wp_redirect( apply_filters( 'redirect_post_location', $location, $post_ID ) );
</del><ins>+        wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if ( isset( $_POST['deletepost'] ) )
</span><span class="lines">@@ -100,55 +120,60 @@
</span><span class="cx"> 
</span><span class="cx">         if ( !empty( $_POST['quickpress_post_ID'] ) ) {
</span><span class="cx">                 $_POST['post_ID'] = (int) $_POST['quickpress_post_ID'];
</span><del>-                $post_ID = edit_post();
</del><ins>+                $post_id = edit_post();
</ins><span class="cx">         } else {
</span><del>-                $post_ID = 'postajaxpost' == $action ? edit_post() : write_post();
</del><ins>+                $post_id = 'postajaxpost' == $action ? edit_post() : write_post();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( 0 === strpos( $action, 'post-quickpress' ) ) {
</span><del>-                $_POST['post_ID'] = $post_ID;
</del><ins>+                $_POST['post_ID'] = $post_id;
</ins><span class="cx">                 // output the quickpress dashboard widget
</span><span class="cx">                 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
</span><span class="cx">                 wp_dashboard_quick_press();
</span><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        redirect_post($post_ID);
</del><ins>+        redirect_post($post_id);
</ins><span class="cx">         exit();
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx"> case 'edit':
</span><span class="cx">         $editing = true;
</span><span class="cx"> 
</span><del>-        if ( empty( $_GET['post'] ) ) {
</del><ins>+        if ( empty( $post_id ) ) {
</ins><span class="cx">                 wp_redirect(&quot;post.php&quot;);
</span><span class="cx">                 exit();
</span><span class="cx">         }
</span><del>-        $post_ID = $p = (int) $_GET['post'];
-        $post = get_post($post_ID);
-        $post_type_object = get_post_type_object($post-&gt;post_type);
</del><span class="cx"> 
</span><ins>+        $p = $post_id;
+
</ins><span class="cx">         if ( empty($post-&gt;ID) )
</span><del>-                wp_die( __('You attempted to edit a post that doesn&amp;#8217;t exist. Perhaps it was deleted?') );
</del><ins>+                wp_die( __('You attempted to edit an item that doesn&amp;#8217;t exist. Perhaps it was deleted?') );
</ins><span class="cx"> 
</span><del>-        if ( !current_user_can('edit_post', $post_ID) )
-                wp_die( __('You are not allowed to edit this post.') );
</del><ins>+        if ( !current_user_can($post_type_object-&gt;edit_cap, $post_id) )
+                wp_die( __('You are not allowed to edit this item.') );
</ins><span class="cx"> 
</span><span class="cx">         if ( 'trash' == $post-&gt;post_status )
</span><del>-                wp_die( __('You can&amp;#8217;t edit this post because it is in the Trash. Please restore it and try again.') );
</del><ins>+                wp_die( __('You can&amp;#8217;t edit this item because it is in the Trash. Please restore it and try again.') );
</ins><span class="cx"> 
</span><span class="cx">         if ( null == $post_type_object )
</span><span class="cx">                 wp_die( __('Unknown post type.') );
</span><span class="cx"> 
</span><del>-        if ( 'post' != $post-&gt;post_type &amp;&amp; $post_type_object-&gt;_builtin ) {
-                wp_redirect( get_edit_post_link( $post-&gt;ID, 'url' ) );
-                exit();
-        }
-
</del><span class="cx">         $post_type = $post-&gt;post_type;
</span><del>-        if ( 'post' != $post_type ) {
-                $parent_file = &quot;edit.php?post_type=$post_type&quot;;
-                $submenu_file = &quot;edit.php?post_type=$post_type&quot;;
</del><ins>+        if ( 'post' == $post_type ) {
+                $parent_file = &quot;edit.php&quot;;
+                $submenu_file = &quot;edit.php&quot;;
+        } elseif ( 'page' == $post_type ) {
+                $parent_file = &quot;edit-pages.php&quot;;
+                $submenu_file = &quot;edit-pages.php&quot;;
+        } else {
+                if ( $post_type_object-&gt;hierarchical ) {
+                        $parent_file = &quot;edit-pages.php?post_type=$post_type&quot;;
+                        $submenu_file = &quot;edit-pages.php?post_type=$post_type&quot;;
+                } else {
+                        $parent_file = &quot;edit.php?post_type=$post_type&quot;;
+                        $submenu_file = &quot;edit.php?post_type=$post_type&quot;;
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         wp_enqueue_script('post');
</span><span class="lines">@@ -168,15 +193,13 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $title = sprintf(__('Edit %s'), $post_type_object-&gt;label);
</span><del>-        $post = get_post_to_edit($post_ID);
</del><ins>+        $post = get_post_to_edit($post_id);
</ins><span class="cx"> 
</span><span class="cx">         include('edit-form-advanced.php');
</span><span class="cx"> 
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx"> case 'editattachment':
</span><del>-        $post_id = (int) $_POST['post_ID'];
-
</del><span class="cx">         check_admin_referer('update-attachment_' . $post_id);
</span><span class="cx"> 
</span><span class="cx">         // Don't let these be changed
</span><span class="lines">@@ -190,24 +213,22 @@
</span><span class="cx">         wp_update_attachment_metadata( $post_id, $newmeta );
</span><span class="cx"> 
</span><span class="cx"> case 'editpost':
</span><del>-        $post_ID = (int) $_POST['post_ID'];
-        check_admin_referer('update-post_' . $post_ID);
</del><ins>+        check_admin_referer('update-' . $post-&gt;post_type . '_' . $post_id);
</ins><span class="cx"> 
</span><del>-        $post_ID = edit_post();
</del><ins>+        $post_id = edit_post();
</ins><span class="cx"> 
</span><del>-        redirect_post($post_ID); // Send user on their way while we keep working
</del><ins>+        redirect_post($post_id); // Send user on their way while we keep working
</ins><span class="cx"> 
</span><span class="cx">         exit();
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx"> case 'trash':
</span><del>-        $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
</del><span class="cx">         check_admin_referer('trash-post_' . $post_id);
</span><span class="cx"> 
</span><span class="cx">         $post = &amp; get_post($post_id);
</span><span class="cx"> 
</span><del>-        if ( !current_user_can('delete_post', $post_id) )
-                wp_die( __('You are not allowed to move this post to the trash.') );
</del><ins>+        if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
+                wp_die( __('You are not allowed to move this item to the trash.') );
</ins><span class="cx"> 
</span><span class="cx">         if ( ! wp_trash_post($post_id) )
</span><span class="cx">                 wp_die( __('Error in moving to trash...') );
</span><span class="lines">@@ -217,14 +238,11 @@
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx"> case 'untrash':
</span><del>-        $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']);
</del><span class="cx">         check_admin_referer('untrash-post_' . $post_id);
</span><span class="cx"> 
</span><del>-        $post = &amp; get_post($post_id);
</del><ins>+        if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
+                wp_die( __('You are not allowed to move this item out of the trash.') );
</ins><span class="cx"> 
</span><del>-        if ( !current_user_can('delete_post', $post_id) )
-                wp_die( __('You are not allowed to move this post out of the trash.') );
-
</del><span class="cx">         if ( ! wp_untrash_post($post_id) )
</span><span class="cx">                 wp_die( __('Error in restoring from trash...') );
</span><span class="cx"> 
</span><span class="lines">@@ -233,14 +251,11 @@
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx"> case 'delete':
</span><del>-        $post_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']);
</del><span class="cx">         check_admin_referer('delete-post_' . $post_id);
</span><span class="cx"> 
</span><del>-        $post = &amp; get_post($post_id);
</del><ins>+        if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
+                wp_die( __('You are not allowed to delete this item.') );
</ins><span class="cx"> 
</span><del>-        if ( !current_user_can('delete_post', $post_id) )
-                wp_die( __('You are not allowed to delete this post.') );
-
</del><span class="cx">         $force = !EMPTY_TRASH_DAYS;
</span><span class="cx">         if ( $post-&gt;post_type == 'attachment' ) {
</span><span class="cx">                 $force = ( $force || !MEDIA_TRASH );
</span><span class="lines">@@ -265,7 +280,10 @@
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx"> default:
</span><del>-        wp_redirect('edit.php');
</del><ins>+        if ( $post_type_object-&gt;hierarchical )
+                wp_redirect('edit-pages.php');
+        else
+                wp_redirect('edit.php');
</ins><span class="cx">         exit();
</span><span class="cx">         break;
</span><span class="cx"> } // end switch
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (12707 => 12708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2010-01-12 15:41:10 UTC (rev 12707)
+++ trunk/wp-includes/post.php        2010-01-12 16:50:37 UTC (rev 12708)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx">  */
</span><span class="cx"> function create_initial_post_types() {
</span><span class="cx">         register_post_type( 'post', array('label' =&gt; __('Posts'), 'exclude_from_search' =&gt; false, '_builtin' =&gt; true, '_edit_link' =&gt; 'post.php?post=%d', 'capability_type' =&gt; 'post', 'hierarchical' =&gt; false) );
</span><del>-        register_post_type( 'page', array('label' =&gt; __('Pages'),'exclude_from_search' =&gt; false, '_builtin' =&gt; true, '_edit_link' =&gt; 'page.php?post=%d', 'capability_type' =&gt; 'page', 'hierarchical' =&gt; true) );
</del><ins>+        register_post_type( 'page', array('label' =&gt; __('Pages'),'exclude_from_search' =&gt; false, '_builtin' =&gt; true, '_edit_link' =&gt; 'post.php?post=%d', 'capability_type' =&gt; 'page', 'hierarchical' =&gt; true) );
</ins><span class="cx">         register_post_type( 'attachment', array('label' =&gt; __('Media'), 'exclude_from_search' =&gt; false, '_builtin' =&gt; true, '_edit_link' =&gt; 'media.php?attachment_id=%d', 'capability_type' =&gt; 'post', 'hierarchical' =&gt; false) );
</span><span class="cx">         register_post_type( 'revision', array('label' =&gt; __('Revisions'),'exclude_from_search' =&gt; true, '_builtin' =&gt; true, '_edit_link' =&gt; 'revision.php?revision=%d', 'capability_type' =&gt; 'post', 'hierarchical' =&gt; false) );
</span><span class="cx">         add_post_type_support('post', array('post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments') );
</span></span></pre>
</div>
</div>

</body>
</html>