Ticket #5418: 5418.xmlrpc.diff

File 5418.xmlrpc.diff, 5.4 KB (added by DD32, 4 years ago)

no-commit: Shows edits to xmlrpc.php without spacing modifications

  • .php

    old new  
    459459* wp_getAuthors 
    460460*/ 
    461461function wp_getAuthors($args) { 
    462 global $wpdb; 
    463462 
    464463$this->escape($args); 
    465464 
     
    533532* wp_suggestCategories 
    534533*/ 
    535534function wp_suggestCategories($args) { 
    536 global $wpdb; 
    537  
    538535$this->escape($args); 
    539536 
    540537$blog_id                                = (int) $args[0]; 
     
    625622return $this->error; 
    626623} 
    627624 
    628 $user_data = get_userdatabylogin($user_login); 
    629625$post_data = wp_get_single_post($post_ID, ARRAY_A); 
    630626 
    631627$categories = implode(',', wp_get_post_categories($post_ID)); 
     
    648644/* blogger.getRecentPosts ...gets recent posts */ 
    649645function blogger_getRecentPosts($args) { 
    650646 
    651 global $wpdb; 
    652  
    653647$this->escape($args); 
    654648 
    655649$blog_ID    = (int) $args[1]; /* though we don't use it yet */ 
     
    767761/* blogger.newPost ...creates a new post */ 
    768762function blogger_newPost($args) { 
    769763 
    770 global $wpdb; 
    771  
    772764$this->escape($args); 
    773765 
    774766$blog_ID    = (int) $args[1]; /* though we don't use it yet */ 
     
    803795if ( is_wp_error( $post_ID ) ) 
    804796return new IXR_Error(500, $post_ID->get_error_message()); 
    805797 
    806 if (!$post_ID) { 
     798if (!$post_ID) 
    807799return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 
    808 } 
     800 
    809801$this->attach_uploads( $post_ID, $post_content ); 
    810802 
    811803logIO('O', "Posted ! ID: $post_ID"); 
     
    813805return $post_ID; 
    814806} 
    815807 
    816  
    817808/* blogger.editPost ...edits a post */ 
    818809function blogger_editPost($args) { 
    819810 
    820 global $wpdb; 
    821  
    822811$this->escape($args); 
    823812 
    824813$post_ID     = (int) $args[1]; 
     
    867856 
    868857/* blogger.deletePost ...deletes a post */ 
    869858function blogger_deletePost($args) { 
    870  
    871 global $wpdb; 
    872  
    873859$this->escape($args); 
    874860 
    875861$post_ID     = (int) $args[1]; 
     
    908894 
    909895/* metaweblog.newPost creates a post */ 
    910896function mw_newPost($args) { 
    911  
    912 global $wpdb, $post_default_category; 
    913  
    914897$this->escape($args); 
    915898 
    916899$blog_ID     = (int) $args[0]; // we will support this in the near future 
     
    11221105/* metaweblog.editPost ...edits a post */ 
    11231106function mw_editPost($args) { 
    11241107 
    1125 global $wpdb, $post_default_category; 
    1126  
    11271108$this->escape($args); 
    11281109 
    11291110$post_ID     = (int) $args[0]; 
     
    13301311/* metaweblog.getPost ...returns a post */ 
    13311312function mw_getPost($args) { 
    13321313 
    1333 global $wpdb; 
    1334  
    13351314$this->escape($args); 
    13361315 
    13371316$post_ID     = (int) $args[0]; 
     
    13451324$postdata = wp_get_single_post($post_ID, ARRAY_A); 
    13461325 
    13471326if ($postdata['post_date'] != '') { 
    1348  
    13491327$post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date']); 
    13501328$post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt']); 
    13511329 
    13521330$categories = array(); 
    13531331$catids = wp_get_post_categories($post_ID); 
    1354 foreach($catids as $catid) { 
     1332foreach($catids as $catid) 
    13551333$categories[] = get_cat_name($catid); 
    1356 } 
    13571334 
    13581335$tagnames = array(); 
    13591336$tags = wp_get_post_tags( $post_ID ); 
    13601337if ( !empty( $tags ) ) { 
    1361 foreach ( $tags as $tag ) { 
     1338foreach ( $tags as $tag ) 
    13621339$tagnames[] = $tag->name; 
    1363 } 
    13641340$tagnames = implode( ', ', $tagnames ); 
    13651341} else { 
    13661342$tagnames = ''; 
     
    14961472/* metaweblog.getCategories ...returns the list of categories on a given blog */ 
    14971473function mw_getCategories($args) { 
    14981474 
    1499 global $wpdb; 
    1500  
    15011475$this->escape($args); 
    15021476 
    15031477$blog_ID     = (int) $args[0]; 
     
    15761550$name = "wpid{$old_file->ID}-{$filename}"; 
    15771551} 
    15781552 
    1579 $upload = wp_upload_bits($name, $type, $bits, $overwrite); 
     1553$upload = wp_upload_bits($name, $type, $bits); 
    15801554if ( ! empty($upload['error']) ) { 
    15811555$errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']); 
    15821556logIO('O', '(MW) ' . $errorString); 
     
    16541628/* mt.getCategoryList ...returns the list of categories on a given blog */ 
    16551629function mt_getCategoryList($args) { 
    16561630 
    1657 global $wpdb; 
    1658  
    16591631$this->escape($args); 
    16601632 
    16611633$blog_ID     = (int) $args[0]; 
     
    18341806 
    18351807/* pingback.ping gets a pingback and registers it */ 
    18361808function pingback_ping($args) { 
    1837 global $wpdb, $wp_version; 
     1809global $wpdb; 
    18381810 
    18391811$this->escape($args); 
    18401812 
     
    18471819$pagelinkedto = str_replace('&', '&', $pagelinkedto); 
    18481820$pagelinkedto = str_replace('&', '&', $pagelinkedto); 
    18491821 
    1850 $error_code = -1; 
    1851  
    18521822// Check if the page linked to is in our site 
    18531823$pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home'))); 
    18541824if( !$pos1 ) 
     
    19121882return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.')); 
    19131883 
    19141884// Let's check that the remote site didn't already pingback this entry 
    1915 $result = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_ID' AND comment_author_url = '$pagelinkedfrom'"); 
     1885$wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_ID' AND comment_author_url = '$pagelinkedfrom'"); 
    19161886 
    19171887if ( $wpdb->num_rows ) // We already have a Pingback from this URL 
    19181888return new IXR_Error(48, __('The pingback has already been registered.')); 
     
    19741944$pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom); 
    19751945 
    19761946$context = '[...] ' . wp_specialchars( $excerpt ) . ' [...]'; 
    1977 $original_pagelinkedfrom = $pagelinkedfrom; 
    19781947$pagelinkedfrom = $wpdb->escape( $pagelinkedfrom ); 
    1979 $original_title = $title; 
    19801948 
    19811949$comment_post_ID = (int) $post_ID; 
    19821950$comment_author = $title;