Ticket #35185: 35185.2.diff
File 35185.2.diff, 5.4 KB (added by , 10 years ago) |
---|
-
src/wp-includes/class-IXR.php
class IXR_Message 296 296 break; 297 297 } 298 298 } while (true); 299 299 xml_parser_free($this->_parser); 300 300 301 301 // Grab the error messages, if any 302 302 if ($this->messageType == 'fault') { 303 303 $this->faultCode = $this->params[0]['faultCode']; 304 304 $this->faultString = $this->params[0]['faultString']; 305 305 } 306 306 return true; 307 307 } 308 308 309 309 function tag_open($parser, $tag, $attr) 310 310 { 311 $this->_currentTagContents = '';311 $this->_currentTagContents = null; 312 312 $this->currentTag = $tag; 313 313 switch($tag) { 314 314 case 'methodCall': 315 315 case 'methodResponse': 316 316 case 'fault': 317 317 $this->messageType = $tag; 318 318 break; 319 319 /* Deal with stacks of arrays and structs */ 320 320 case 'data': // data is to all intents and puposes more interesting than array 321 321 $this->_arraystructstypes[] = 'array'; 322 322 $this->_arraystructs[] = array(); 323 323 break; 324 324 case 'struct': 325 325 $this->_arraystructstypes[] = 'struct'; 326 326 $this->_arraystructs[] = array(); … … class IXR_Message 347 347 case 'double': 348 348 $value = (double)trim($this->_currentTagContents); 349 349 $valueFlag = true; 350 350 break; 351 351 case 'string': 352 352 $value = (string)trim($this->_currentTagContents); 353 353 $valueFlag = true; 354 354 break; 355 355 case 'dateTime.iso8601': 356 356 $value = new IXR_Date(trim($this->_currentTagContents)); 357 357 $valueFlag = true; 358 358 break; 359 359 case 'value': 360 360 // "If no type is indicated, the type is string." 361 361 if ( !$this->_valueHasType ) { 362 $value = trim( $this->_currentTagContents );362 $value = is_null( $this->_currentTagContents ) ? null : trim( $this->_currentTagContents ); 363 363 $valueFlag = true; 364 364 } 365 365 break; 366 366 case 'boolean': 367 367 $value = (boolean)trim($this->_currentTagContents); 368 368 $valueFlag = true; 369 369 break; 370 370 case 'base64': 371 371 $value = base64_decode($this->_currentTagContents); 372 372 $valueFlag = true; 373 373 break; 374 374 /* Deal with stacks of arrays and structs */ 375 375 case 'data': 376 376 case 'struct': 377 377 $value = array_pop($this->_arraystructs); -
src/wp-includes/class-wp-xmlrpc-server.php
class wp_xmlrpc_server extends IXR_Serve 4912 4912 case 'draft': 4913 4913 case 'pending': 4914 4914 case 'private': 4915 4915 case 'publish': 4916 4916 $post_status = $content_struct["{$post_type}_status"]; 4917 4917 break; 4918 4918 default: 4919 4919 $post_status = $publish ? 'publish' : 'draft'; 4920 4920 break; 4921 4921 } 4922 4922 } 4923 4923 4924 4924 $post_excerpt = isset($content_struct['mt_excerpt']) ? $content_struct['mt_excerpt'] : null; 4925 4925 $post_more = isset($content_struct['mt_text_more']) ? $content_struct['mt_text_more'] : null; 4926 4926 4927 $tags_input = isset($content_struct['mt_keywords']) ? $content_struct['mt_keywords'] : null;4927 $tags_input = array_key_exists( 'mt_keywords', $content_struct ) ? $content_struct['mt_keywords'] : null; 4928 4928 4929 4929 if ( isset($content_struct['mt_allow_comments']) ) { 4930 4930 if ( !is_numeric($content_struct['mt_allow_comments']) ) { 4931 4931 switch ( $content_struct['mt_allow_comments'] ) { 4932 4932 case 'closed': 4933 4933 $comment_status = 'closed'; 4934 4934 break; 4935 4935 case 'open': 4936 4936 $comment_status = 'open'; 4937 4937 break; 4938 4938 default: 4939 4939 $comment_status = get_default_comment_status( $post_type ); 4940 4940 break; 4941 4941 } 4942 4942 } else { … … class wp_xmlrpc_server extends IXR_Serve 5323 5323 $post_status = $publish ? 'publish' : 'draft'; 5324 5324 if ( isset( $content_struct["{$post_type}_status"] ) ) { 5325 5325 switch( $content_struct["{$post_type}_status"] ) { 5326 5326 case 'draft': 5327 5327 case 'pending': 5328 5328 case 'private': 5329 5329 case 'publish': 5330 5330 $post_status = $content_struct["{$post_type}_status"]; 5331 5331 break; 5332 5332 default: 5333 5333 $post_status = $publish ? 'publish' : 'draft'; 5334 5334 break; 5335 5335 } 5336 5336 } 5337 5337 5338 $tags_input = isset( $content_struct['mt_keywords']) ? $content_struct['mt_keywords'] : null;5338 $tags_input = array_key_exists( 'mt_keywords', $content_struct ) ? $content_struct['mt_keywords'] : null; 5339 5339 5340 5340 if ( 'publish' == $post_status || 'private' == $post_status ) { 5341 5341 if ( 'page' == $post_type && ! current_user_can( 'publish_pages' ) ) { 5342 5342 return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this page.' ) ); 5343 5343 } elseif ( ! current_user_can( 'publish_posts' ) ) { 5344 5344 return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this post.' ) ); 5345 5345 } 5346 5346 } 5347 5347 5348 5348 if ( $post_more ) 5349 5349 $post_content = $post_content . "<!--more-->" . $post_more; 5350 5350 5351 5351 $to_ping = null; 5352 5352 if ( isset( $content_struct['mt_tb_ping_urls'] ) ) { 5353 5353 $to_ping = $content_struct['mt_tb_ping_urls'];