Ticket #6098: xmlrpc.php.diff
File xmlrpc.php.diff, 5.0 KB (added by , 17 years ago) |
---|
-
xmlrpc.php
84 84 'wp.getCommentCount' => 'this:wp_getCommentCount', 85 85 'wp.getPostStatusList' => 'this:wp_getPostStatusList', 86 86 'wp.getPageStatusList' => 'this:wp_getPageStatusList', 87 'wp.getPageTemplates' => 'this:wp_getPageTemplates', 87 88 88 89 // Blogger API 89 90 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', … … 267 268 // Get the author info. 268 269 $author = get_userdata($page->post_author); 269 270 271 $page_template = get_post_meta( $page->ID, '_wp_page_template', true ); 272 if( empty( $page_template ) ) 273 $page_template = 'default'; 274 270 275 $page_struct = array( 271 276 "dateCreated" => new IXR_Date($page_date), 272 277 "userid" => $page->post_author, … … 290 295 "wp_author_id" => $author->ID, 291 296 "wp_author_display_name" => $author->display_name, 292 297 "date_created_gmt" => new IXR_Date($page_date_gmt), 293 "custom_fields" => $this->get_custom_fields($page_id) 298 "custom_fields" => $this->get_custom_fields($page_id), 299 "wp_page_template" => $page_template 294 300 ); 295 301 296 302 return($page_struct); … … 739 745 return get_page_statuses( ); 740 746 } 741 747 748 function wp_getPageTemplates( $args ) { 749 $this->escape( $args ); 742 750 751 $blog_id = (int) $args[0]; 752 $username = $args[1]; 753 $password = $args[2]; 754 755 if( !$this->login_pass_ok( $username, $password ) ) { 756 return new IXR_Error( 403, __( 'Bad login/pass combination.' ) ); 757 } 758 759 set_current_user( 0, $username ); 760 if( !current_user_can( 'edit_pages' ) ) { 761 return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) ); 762 } 763 764 $templates = get_page_templates( ); 765 $templates['Default'] = 'default'; 766 767 return $templates; 768 } 769 770 743 771 /* Blogger API functions 744 772 * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/ 745 773 */ … … 1130 1158 $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; 1131 1159 $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' ); 1132 1160 $post_type = 'post'; 1161 $page_template = ''; 1133 1162 if( !empty( $content_struct['post_type'] ) ) { 1134 1163 if( $content_struct['post_type'] == 'page' ) { 1135 1164 $cap = ( $publish ) ? 'publish_pages' : 'edit_pages'; 1136 1165 $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' ); 1137 1166 $post_type = 'page'; 1167 if( !empty( $content_struct['wp_page_template'] ) ) 1168 $page_template = $content_struct['wp_page_template']; 1138 1169 } 1139 1170 elseif( $content_struct['post_type'] == 'post' ) { 1140 1171 // This is the default, no changes needed … … 1323 1354 } 1324 1355 1325 1356 // We've got all the data -- post it: 1326 $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input' );1357 $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template'); 1327 1358 1328 $post_ID = wp_insert_post($postdata );1359 $post_ID = wp_insert_post($postdata, true); 1329 1360 if ( is_wp_error( $post_ID ) ) 1330 1361 return new IXR_Error(500, $post_ID->get_error_message()); 1331 1362 … … 1385 1416 $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; 1386 1417 $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' ); 1387 1418 $post_type = 'post'; 1419 $page_template = ''; 1388 1420 if( !empty( $content_struct['post_type'] ) ) { 1389 1421 if( $content_struct['post_type'] == 'page' ) { 1390 1422 $cap = ( $publish ) ? 'publish_pages' : 'edit_pages'; 1391 1423 $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' ); 1392 1424 $post_type = 'page'; 1425 if( !empty( $content_struct['wp_page_template'] ) ) 1426 $page_template = $content_struct['wp_page_template']; 1393 1427 } 1394 1428 elseif( $content_struct['post_type'] == 'post' ) { 1395 1429 // This is the default, no changes needed … … 1588 1622 } 1589 1623 1590 1624 // We've got all the data -- post it: 1591 $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input' );1625 $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template'); 1592 1626 1593 $result = wp_update_post($newpost); 1627 $result = wp_update_post($newpost, true); 1628 if ( is_wp_error( $result ) ) 1629 return new IXR_Error(500, $result->get_error_message()); 1630 1594 1631 if (!$result) { 1595 1632 return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.')); 1596 1633 }