Changeset 16798
- Timestamp:
- 12/08/2010 03:31:17 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-xmlrpc-server.php
r16769 r16798 2081 2081 $password = $args[2]; 2082 2082 $content_struct = $args[3]; 2083 $publish = $args[4];2083 $publish = isset( $args[4] ) ? $args[4] : 0; 2084 2084 2085 2085 if ( !$user = $this->login($username, $password) ) … … 2087 2087 2088 2088 do_action('xmlrpc_call', 'metaWeblog.newPost'); 2089 2090 $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; 2091 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2092 $post_type = 'post'; 2089 2093 2090 $page_template = ''; 2094 2091 if ( !empty( $content_struct['post_type'] ) ) { 2095 2092 if ( $content_struct['post_type'] == 'page' ) { 2096 $cap = ( $publish ) ? 'publish_pages' : 'edit_pages'; 2093 if ( $publish ) 2094 $cap = 'publish_pages'; 2095 elseif ('publish' == $content_struct['page_status']) 2096 $cap = 'publish_pages'; 2097 else 2098 $cap = 'edit_pages'; 2097 2099 $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' ); 2098 2100 $post_type = 'page'; … … 2100 2102 $page_template = $content_struct['wp_page_template']; 2101 2103 } elseif ( $content_struct['post_type'] == 'post' ) { 2102 // This is the default, no changes needed 2104 if ( $publish ) 2105 $cap = 'publish_posts'; 2106 elseif ('publish' == $content_struct['post_status']) 2107 $cap = 'publish_posts'; 2108 else 2109 $cap = 'edit_posts'; 2110 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2111 $post_type = 'post'; 2103 2112 } else { 2104 2113 // No other post_type values are allowed here 2105 2114 return new IXR_Error( 401, __( 'Invalid post type.' ) ); 2106 2115 } 2116 } else { 2117 if ( $publish ) 2118 $cap = 'publish_posts'; 2119 elseif ('publish' == $content_struct['post_status']) 2120 $cap = 'publish_posts'; 2121 else 2122 $cap = 'edit_posts'; 2123 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2124 $post_type = 'post'; 2107 2125 } 2108 2126 … … 2382 2400 if ( !empty( $content_struct['post_type'] ) ) { 2383 2401 if ( $content_struct['post_type'] == 'page' ) { 2384 $cap = ( $publish ) ? 'publish_pages' : 'edit_pages'; 2402 if ( $publish ) 2403 $cap = 'publish_pages'; 2404 elseif ('publish' == $content_struct['page_status']) 2405 $cap = 'publish_pages'; 2406 else 2407 $cap = 'edit_pages'; 2385 2408 $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' ); 2386 2409 $post_type = 'page'; … … 2388 2411 $page_template = $content_struct['wp_page_template']; 2389 2412 } elseif ( $content_struct['post_type'] == 'post' ) { 2390 // This is the default, no changes needed 2413 if ( $publish ) 2414 $cap = 'publish_posts'; 2415 elseif ('publish' == $content_struct['post_status']) 2416 $cap = 'publish_posts'; 2417 else 2418 $cap = 'edit_posts'; 2419 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2420 $post_type = 'post'; 2391 2421 } else { 2392 2422 // No other post_type values are allowed here 2393 2423 return new IXR_Error( 401, __( 'Invalid post type.' ) ); 2394 2424 } 2425 } else { 2426 if ( $publish ) 2427 $cap = 'publish_posts'; 2428 elseif ('publish' == $content_struct['post_status']) 2429 $cap = 'publish_posts'; 2430 else 2431 $cap = 'edit_posts'; 2432 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2433 $post_type = 'post'; 2395 2434 } 2396 2435
Note: See TracChangeset
for help on using the changeset viewer.