Changeset 4082
- Timestamp:
- 08/11/2006 03:54:45 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r4042 r4082 217 217 die($r); 218 218 break; 219 case 'autosave' : 220 $_POST['post_content'] = $_POST['content']; 221 $_POST['post_excerpt'] = $_POST['excerpt']; 222 $_POST['post_status'] = 'draft'; 223 $_POST['post_category'] = explode(",", $_POST['catslist']); 224 if($_POST['post_type'] == 'page' || empty($_POST['post_category'])) 225 unset($_POST['post_category']); 226 227 if($_POST['post_ID'] < 0) { 228 $_POST['temp_ID'] = $_POST['post_ID']; 229 $id = wp_write_post(); 230 if(is_wp_error($id)) 231 die($id->get_error_message()); 232 else 233 die("$id"); 234 } else { 235 $post_ID = (int) $_POST['post_ID']; 236 $_POST['ID'] = $post_ID; 237 $post = get_post($post_ID); 238 if ( 'page' == $post->post_type ) { 239 if ( !current_user_can('edit_page', $post_ID) ) 240 die(__('You are not allowed to edit this page.')); 241 } else { 242 if ( !current_user_can('edit_post', $post_ID) ) 243 die(__('You are not allowed to edit this post.')); 244 } 245 wp_update_post($_POST); 246 } 247 die('0'); 248 break; 219 249 default : 220 250 do_action( 'wp_ajax_' . $_POST['action'] ); -
trunk/wp-admin/admin-functions.php
r4049 r4082 1 1 <?php 2 2 3 function write_post() { 4 $result = wp_write_post(); 5 if( is_wp_error($result) ) 6 wp_die( $result->get_error_message() ); 7 else 8 return $result; 9 } 10 3 11 // Creates a new post from the "Write Post" form using $_POST information. 4 function w rite_post() {12 function wp_write_post() { 5 13 global $user_ID; 6 14 7 15 if ( 'page' == $_POST['post_type'] ) { 8 16 if ( !current_user_can('edit_pages') ) 9 wp_die(__('You are not allowed to create pages on this blog.'));17 return new WP_Error('edit_pages', __('You are not allowed to create pages on this blog.')); 10 18 } else { 11 19 if ( !current_user_can('edit_posts') ) 12 wp_die(__('You are not allowed to create posts or drafts on this blog.'));20 return new WP_Error('edit_posts', __('You are not allowed to create posts or drafts on this blog.')); 13 21 } 14 22 … … 33 41 if ( 'page' == $_POST['post_type'] ) { 34 42 if ( !current_user_can('edit_others_pages') ) 35 wp_die(__('You cannot create pages as this user.'));43 return new WP_Error('edit_others_pages', __('You cannot create pages as this user.')); 36 44 } else { 37 45 if ( !current_user_can('edit_others_posts') ) 38 wp_die(__('You cannot post as this user.'));46 return new WP_Error('edit_others_posts', __('You cannot post as this user.')); 39 47 40 48 } -
trunk/wp-admin/page-new.php
r3726 r4082 4 4 $parent_file = 'post-new.php'; 5 5 $editing = true; 6 wp_enqueue_script('prototype'); 7 wp_enqueue_script('autosave'); 6 8 require_once('admin-header.php'); 7 9 ?> -
trunk/wp-admin/page.php
r3985 r4082 43 43 $title = __('Edit'); 44 44 $editing = true; 45 $page_ID = $post_ID = $p = (int) $_GET['post']; 46 $post = get_post_to_edit($page_ID); 47 if($post->post_status == 'draft') { 48 wp_enqueue_script('prototype'); 49 wp_enqueue_script('autosave'); 50 } 45 51 require_once('admin-header.php'); 46 47 $page_ID = $post_ID = $p = (int) $_GET['post'];48 52 49 53 if ( !current_user_can('edit_page', $page_ID) ) 50 54 die ( __('You are not allowed to edit this page.') ); 51 52 $post = get_post_to_edit($page_ID);53 55 54 56 include('edit-page-form.php'); -
trunk/wp-admin/post-new.php
r3685 r4082 4 4 $parent_file = 'post-new.php'; 5 5 $editing = true; 6 wp_enqueue_script('prototype'); 7 wp_enqueue_script('autosave'); 6 8 require_once ('./admin-header.php'); 7 9 -
trunk/wp-admin/post.php
r4059 r4082 46 46 $title = __('Edit'); 47 47 $editing = true; 48 $post_ID = $p = (int) $_GET['post']; 49 $post = get_post($post_ID); 50 if($post->post_status == 'draft') { 51 wp_enqueue_script('prototype'); 52 wp_enqueue_script('autosave'); 53 } 48 54 require_once('admin-header.php'); 49 55 50 $post_ID = $p = (int) $_GET['post'];51 52 $post = get_post($post_ID);53 56 if ( !current_user_can('edit_post', $post_ID) ) 54 57 die ( __('You are not allowed to edit this post.') ); -
trunk/wp-includes/script-loader.php
r4042 r4082 18 18 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '04162006' ); 19 19 $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '04162006' ); 20 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0'); 21 $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4080'); 20 22 if ( is_admin() ) { 21 23 $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' );
Note: See TracChangeset
for help on using the changeset viewer.