Ticket #3601: 3601.diff
File 3601.diff, 5.1 KB (added by , 18 years ago) |
---|
-
wp-includes/js/autosave-js.php
85 85 form.submit ? form.submit.disabled = 'disabled' : null; 86 86 form.publish ? form.publish.disabled = 'disabled' : null; 87 87 form.deletepost ? form.deletepost.disabled = 'disabled' : null; 88 setTimeout('autosave_enable_buttons();', 1000); // Re-enable 1 sec later. Just gives autosave a head start to avoid collisions. 88 89 } 89 90 90 91 function autosave_enable_buttons() { -
wp-includes/script-loader.php
19 19 $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); 20 20 $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20061113' ); 21 21 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0'); 22 $this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), ' 4508');22 $this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), '20070116'); 23 23 $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4459'); 24 24 $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4583'); 25 25 $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.6.1'); -
wp-admin/admin-ajax.php
220 220 ) ); 221 221 $x->send(); 222 222 break; 223 case 'autosave' : 223 case 'autosave' : // The name of this action is hardcoded in edit_post() 224 224 $_POST['post_content'] = $_POST['content']; 225 225 $_POST['post_excerpt'] = $_POST['excerpt']; 226 226 $_POST['post_status'] = 'draft'; -
wp-admin/admin-functions.php
20 20 return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) ); 21 21 } 22 22 23 24 // Check for autosave collisions 25 if ( isset($_POST['temp_ID']) ) { 26 $temp_id = (int) $_POST['temp_ID']; 27 if ( !$draft_ids = get_option( 'autosave_draft_ids' ) ) 28 $draft_ids = array(); 29 foreach ( $draft_ids as $temp => $real ) 30 if ( time() + $temp > 86400 ) // 1 day: $temp is equal to -1 * time( then ) 31 unset($draft_ids[$temp]); 32 33 if ( isset($draft_ids[$temp_id]) ) { // Edit, don't write 34 $_POST['post_ID'] = $draft_ids[$temp_id]; 35 unset($_POST['temp_ID']); 36 relocate_children( $temp_id, $_POST['post_ID'] ); 37 update_option( 'autosave_draft_ids', $draft_ids ); 38 return edit_post(); 39 } 40 } 41 23 42 // Rename. 24 43 $_POST['post_content'] = $_POST['content']; 25 44 $_POST['post_excerpt'] = $_POST['excerpt']; … … 88 107 } 89 108 90 109 // Create the post. 91 $post_ID = wp_insert_post( $_POST); 110 $post_ID = wp_insert_post( $_POST ); 111 92 112 add_meta( $post_ID ); 93 113 94 114 // Reunite any orphaned attachments with their parent 95 if ( $_POST['temp_ID'] ) 115 // Update autosave collision detection 116 if ( $_POST['temp_ID'] ) { 96 117 relocate_children( $_POST['temp_ID'], $post_ID ); 118 $draft_ids[$temp_id] = $post_ID; 119 update_option( 'autosave_draft_ids', $draft_ids ); 120 } 97 121 98 122 // Now that we have an ID we can fix any attachment anchor hrefs 99 123 fix_attachment_links( $post_ID ); … … 165 189 wp_die( __('You are not allowed to edit this post.' )); 166 190 } 167 191 192 // Autosave shouldn't save too soon after a real save 193 if ( 'autosave' == $_POST['action'] ) { 194 $post =& get_post( $post_ID ); 195 $now = time(); 196 $then = strtotime($post->post_date_gmt . ' +0000'); 197 $delta = apply_filters( 'autosave_interval', 120 ) / 2; 198 if ( $now - $then < $delta ) 199 return $post_ID; 200 } 201 168 202 // Rename. 169 203 $_POST['ID'] = (int) $_POST['post_ID']; 170 204 $_POST['post_content'] = $_POST['content']; -
wp-admin/edit-page-form.php
5 5 if (0 == $post_ID) { 6 6 $form_action = 'post'; 7 7 $nonce_action = 'add-page'; 8 $temp_ID = -1 * time(); 8 $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post() 9 9 $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />"; 10 10 } else { 11 11 $form_action = 'editpost'; -
wp-admin/edit-form-advanced.php
17 17 18 18 if (0 == $post_ID) { 19 19 $form_action = 'post'; 20 $temp_ID = -1 * time(); 20 $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post() 21 21 $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />"; 22 22 wp_nonce_field('add-post'); 23 23 } else {