Changeset 7901
- Timestamp:
- 05/06/2008 04:49:42 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc.php
r7847 r7901 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 … … 267 268 // Get the author info. 268 269 $author = get_userdata($page->post_author); 270 271 $page_template = get_post_meta( $page->ID, '_wp_page_template', true ); 272 if( empty( $page_template ) ) 273 $page_template = 'default'; 269 274 270 275 $page_struct = array( … … 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 … … 740 746 } 741 747 748 function wp_getPageTemplates( $args ) { 749 $this->escape( $args ); 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 742 770 743 771 /* Blogger API functions … … 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' ) { … … 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' ) { … … 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' );1327 1328 $post_ID = wp_insert_post($postdata );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'); 1358 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()); … … 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' ) { … … 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' ) { … … 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'); 1592 1593 $result = wp_update_post($newpost); 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'); 1626 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.'));
Note: See TracChangeset
for help on using the changeset viewer.