Changeset 11807 for trunk/wp-admin/post.php
- Timestamp:
- 08/12/2009 10:57:15 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/post.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/post.php
r11749 r11807 56 56 $location = explode('#', $location); 57 57 $location = $location[0] . '#postcustom'; 58 } elseif ($action == 'editattachment') {59 $location = 'attachments.php';60 58 } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) { 61 59 $location = "post.php?action=edit&post=$post_ID&message=7"; … … 116 114 $post = get_post($post_ID); 117 115 118 if ( empty($post->ID) ) wp_die( __('You attempted to edit a post that doesn’t exist. Perhaps it was deleted?') ); 119 if ( $post->post_status == 'trash' ) wp_die( __('You can’t edit this post because it is in the Trash. Please move it out of the Trash and try again.') ); 116 if ( empty($post->ID) ) 117 wp_die( __('You attempted to edit a post that doesn’t exist. Perhaps it was deleted?') ); 118 119 if ( !current_user_can('edit_post', $post_ID) ) 120 wp_die( __('You are not allowed to edit this post.') ); 121 122 if ( 'trash' == $post->post_status ) 123 wp_die( __('You can’t edit this post because it is in the Trash. Please restore it and try again.') ); 120 124 121 125 if ( 'post' != $post->post_type ) { … … 133 137 enqueue_comment_hotkeys_js(); 134 138 135 if ( current_user_can('edit_post', $post_ID) ) { 136 if ( $last = wp_check_post_lock( $post->ID ) ) { 137 $last_user = get_userdata( $last ); 138 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); 139 $message = sprintf( __( 'Warning: %s is currently editing this post' ), esc_html( $last_user_name ) ); 140 $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" ); 141 add_action('admin_notices', create_function( '', "echo '$message';" ) ); 142 } else { 143 wp_set_post_lock( $post->ID ); 144 wp_enqueue_script('autosave'); 145 } 139 if ( $last = wp_check_post_lock( $post->ID ) ) { 140 $last_user = get_userdata( $last ); 141 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); 142 $message = sprintf( __( 'Warning: %s is currently editing this post' ), esc_html( $last_user_name ) ); 143 $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" ); 144 add_action('admin_notices', create_function( '', "echo '$message';" ) ); 145 } else { 146 wp_set_post_lock( $post->ID ); 147 wp_enqueue_script('autosave'); 146 148 } 147 149 148 150 $title = __('Edit Post'); 149 150 if ( !current_user_can('edit_post', $post_ID) )151 die ( __('You are not allowed to edit this post.') );152 153 151 $post = get_post_to_edit($post_ID); 154 152 … … 184 182 185 183 case 'trash': 186 $post_id = (isset($_GET['post']))? intval($_GET['post']) : intval($_POST['post_ID']);184 $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']); 187 185 check_admin_referer('trash-post_' . $post_id); 188 186 … … 196 194 197 195 $sendback = wp_get_referer(); 198 if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?trashed=1'); 199 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 200 else $sendback = add_query_arg('trashed', 1, $sendback); 196 if ( strpos($sendback, 'post.php') !== false ) 197 $sendback = admin_url('edit.php?trashed=1'); 198 else 199 $sendback = add_query_arg('trashed', 1, $sendback); 200 201 201 wp_redirect($sendback); 202 202 exit(); … … 204 204 205 205 case 'untrash': 206 $post_id = (isset($_GET['post']))? intval($_GET['post']) : intval($_POST['post_ID']);206 $post_id = isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post_ID']); 207 207 check_admin_referer('untrash-post_' . $post_id); 208 208 … … 210 210 211 211 if ( !current_user_can('delete_post', $post_id) ) 212 wp_die( __('You are not allowed to remove this post fromthe trash.') );212 wp_die( __('You are not allowed to move this post out of the trash.') ); 213 213 214 214 if ( ! wp_untrash_post($post_id) ) 215 wp_die( __('Error in re moving from trash...') );215 wp_die( __('Error in restoring from trash...') ); 216 216 217 217 $sendback = wp_get_referer(); 218 if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?untrashed=1'); 219 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 220 else $sendback = add_query_arg('untrashed', 1, $sendback); 218 if ( strpos($sendback, 'post.php') !== false ) 219 $sendback = admin_url('edit.php?untrashed=1'); 220 else 221 $sendback = add_query_arg('untrashed', 1, $sendback); 222 221 223 wp_redirect($sendback); 222 224 exit(); … … 241 243 242 244 $sendback = wp_get_referer(); 243 if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?deleted=1'); 244 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 245 else $sendback = add_query_arg('deleted', 1, $sendback); 245 if ( strpos($sendback, 'post.php') !== false ) 246 $sendback = admin_url('edit.php?deleted=1'); 247 else 248 $sendback = add_query_arg('deleted', 1, $sendback); 249 246 250 wp_redirect($sendback); 247 251 exit();
Note: See TracChangeset
for help on using the changeset viewer.