Changeset 7913
- Timestamp:
- 05/09/2008 03:59:17 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-page-form.php
r7883 r7913 6 6 $messages[3] = __('Custom field deleted.'); 7 7 $messages[4] = __('Page updated.'); 8 ?> 9 <?php if (isset($_GET['message'])) : ?> 10 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div> 11 <?php endif; 8 9 $notice = false; 10 $notices[1] = __( 'There is an autosave of this page that is more recent than the version below. <a href="%s">View the autosave</a>.' ); 12 11 13 12 if (!isset($post_ID) || 0 == $post_ID) { … … 21 20 $nonce_action = 'update-page_' . $post_ID; 22 21 $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />"; 22 $autosave = wp_get_autosave( $post_id ); 23 if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) 24 $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) ); 23 25 } 24 26 … … 31 33 $sendto = 'redo'; 32 34 ?> 35 36 <?php if ( $notice ) : ?> 37 <div id="notice" class="error"><p><?php echo $notice ?></p></div> 38 <?php endif; ?> 39 <?php if (isset($_GET['message'])) : ?> 40 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div> 41 <?php endif; ?> 33 42 34 43 <form name="post" action="page.php" method="post" id="post"> … … 45 54 <input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' /> 46 55 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" /> 56 <input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" /> 47 57 <?php echo $form_extra ?> 48 58 <input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" /> … … 283 293 <?php endif; ?> 284 294 295 <?php if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) : ?> 296 <div id="revisionsdiv" class="postbox <?php echo postbox_classes('revisionsdiv', 'page'); ?>"> 297 <h3><?php _e('Page Revisions'); ?></h3> 298 <div class="inside"> 299 <?php wp_list_post_revisions(); ?> 300 </div> 301 </div> 302 <?php endif; ?> 303 304 285 305 <?php do_meta_boxes('page', 'advanced', $post); ?> 286 306 -
trunk/wp-admin/revision.php
r7907 r7913 2 2 3 3 require_once('admin.php'); 4 5 if ( !constant('WP_POST_REVISIONS') ) { 6 wp_redirect( 'edit.php' ); 7 exit; 8 } 4 9 5 10 wp_reset_vars(array('revision', 'left', 'right', 'action')); … … 9 14 $right = absint($right); 10 15 11 12 16 $parent_file = $redirect = 'edit.php'; 13 $submenu_file = 'edit.php';14 $title = __( 'Post Revision' );15 16 17 17 18 switch ( $action ) : … … 39 40 break; 40 41 41 if ( !current_user_can( ' edit_post', $left_revision->ID ) || !current_user_can( 'edit_post', $right_revision->ID ) )42 if ( !current_user_can( 'read_post', $left_revision->ID ) || !current_user_can( 'read_post', $right_revision->ID ) ) 42 43 break; 43 44 … … 81 82 break; 82 83 83 if ( !current_user_can( ' edit_post', $revision->ID ) || !current_user_can( 'edit_post', $post->ID ) )84 if ( !current_user_can( 'read_post', $revision->ID ) || !current_user_can( 'read_post', $post->ID ) ) 84 85 break; 85 86 … … 96 97 endswitch; 97 98 99 if ( !$redirect && !in_array( $post->post_type, array( 'post', 'page' ) ) ) 100 $redirect = 'edit.php'; 101 98 102 if ( $redirect ) { 99 103 wp_redirect( $redirect ); 100 104 exit; 105 } 106 107 if ( 'page' == $post->post_type ) { 108 $submenu_file = 'edit-pages.php'; 109 $title = __( 'Page Revisions' ); 110 } else { 111 $submenu_file = 'edit.php'; 112 $title = __( 'Post Revisions' ); 101 113 } 102 114 … … 164 176 <br class="clear" /> 165 177 166 <h2><?php _e( 'Post Revisions' ); ?></h2>178 <h2><?php echo $title; ?></h2> 167 179 168 180 <?php -
trunk/wp-includes/js/autosave.js
r7907 r7913 181 181 if ( jQuery("#ping_status").attr("checked") ) 182 182 post_data["ping_status"] = 'open'; 183 if ( jQuery("#excerpt") )183 if ( jQuery("#excerpt").size() ) 184 184 post_data["excerpt"] = jQuery("#excerpt").val(); 185 if ( jQuery("#post_author") )185 if ( jQuery("#post_author").size() ) 186 186 post_data["post_author"] = jQuery("#post_author").val(); 187 187 -
trunk/wp-includes/post-template.php
r7907 r7913 642 642 $rows = ''; 643 643 $class = false; 644 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 644 645 foreach ( $revisions as $revision ) { 646 if ( !current_user_can( 'read_post', $revision->ID ) ) 647 continue; 648 645 649 $date = wp_post_revision_title( $revision ); 646 650 $name = get_author_name( $revision->post_author ); … … 655 659 $class = $class ? '' : " class='alternate'"; 656 660 657 if ( $post->ID != $revision->ID && current_user_can( 'edit_post', $post->ID ))661 if ( $post->ID != $revision->ID && $can_edit_post ) 658 662 $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'diff' => false, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>'; 659 663 else -
trunk/wp-includes/post.php
r7907 r7913 957 957 $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'page' ) ); 958 958 } 959 960 // Do raw query. wp_get_post_revisions() is filtered 961 $revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) ); 962 // Use wp_delete_post (via wp_delete_revision) again. Ensures any meta/misplaced data gets cleaned up. 963 foreach ( $revision_ids as $revision_id ) 964 wp_delete_revision( $revision_id ); 959 965 960 966 // Point all attachments to this post up one level … … 3023 3029 return; 3024 3030 3031 if ( !constant('WP_POST_REVISIONS') ) 3032 return; 3033 3025 3034 if ( !$post = get_post( $post_id, ARRAY_A ) ) 3026 3035 return; … … 3228 3237 */ 3229 3238 function wp_get_post_revisions( $post_id = 0 ) { 3239 if ( !constant('WP_POST_REVISIONS') ) 3240 return array(); 3230 3241 if ( ( !$post = get_post( $post_id ) ) || empty( $post->ID ) ) 3231 3242 return array(); -
trunk/wp-includes/script-loader.php
r7907 r7913 48 48 ) ); 49 49 50 $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '2008050 7' );50 $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080508' ); 51 51 52 52 $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); -
trunk/wp-settings.php
r7757 r7913 377 377 do_action('plugins_loaded'); 378 378 379 $default_constants = array( 'WP_POST_REVISIONS' => true ); 380 foreach ( $default_constants as $c => $v ) 381 @define( $c, $v ); // will fail if the constant is already defined 382 unset($default_constants, $c, $v); 383 379 384 // If already slashed, strip. 380 385 if ( get_magic_quotes_gpc() ) {
Note: See TracChangeset
for help on using the changeset viewer.