Changeset 23554 for trunk/wp-includes/class-wp-xmlrpc-server.php
- Timestamp:
- 03/01/2013 04:28:40 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/class-wp-xmlrpc-server.php (modified) (78 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-xmlrpc-server.php
r23531 r23554 281 281 $pmeta = get_metadata_by_mid( 'post', $meta['id'] ); 282 282 if ( isset($meta['key']) ) { 283 $meta['key'] = stripslashes( $meta['key'] ); 283 284 if ( $meta['key'] != $pmeta->meta_key ) 284 285 continue; 286 $meta['value'] = stripslashes_deep( $meta['value'] ); 285 287 if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) ) 286 288 update_metadata_by_mid( 'post', $meta['id'], $meta['value'] ); … … 288 290 delete_metadata_by_mid( 'post', $meta['id'] ); 289 291 } 290 } elseif ( current_user_can( 'add_post_meta', $post_id, $meta['key']) ) {291 wp_add_post_meta( $post_id, $meta['key'], $meta['value'] );292 } elseif ( current_user_can( 'add_post_meta', $post_id, stripslashes( $meta['key'] ) ) ) { 293 add_post_meta( $post_id, $meta['key'], $meta['value'] ); 292 294 } 293 295 } … … 461 463 } 462 464 465 $this->escape( $args ); 466 463 467 $username = $args[0]; 464 468 $password = $args[1]; … … 952 956 return $this->error; 953 957 958 $this->escape( $args ); 959 954 960 $blog_id = (int) $args[0]; 955 961 $username = $args[1]; … … 1234 1240 return $this->error; 1235 1241 1242 $this->escape( $args ); 1243 1236 1244 $blog_id = (int) $args[0]; 1237 1245 $username = $args[1]; … … 1267 1275 $post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] ); 1268 1276 1277 $this->escape( $post ); 1269 1278 $merged_content_struct = array_merge( $post, $content_struct ); 1270 1279 … … 1292 1301 if ( ! $this->minimum_args( $args, 4 ) ) 1293 1302 return $this->error; 1303 1304 $this->escape( $args ); 1294 1305 1295 1306 $blog_id = (int) $args[0]; … … 1367 1378 return $this->error; 1368 1379 1380 $this->escape( $args ); 1381 1369 1382 $blog_id = (int) $args[0]; 1370 1383 $username = $args[1]; … … 1421 1434 if ( ! $this->minimum_args( $args, 3 ) ) 1422 1435 return $this->error; 1436 1437 $this->escape( $args ); 1423 1438 1424 1439 $blog_id = (int) $args[0]; … … 1514 1529 if ( ! $this->minimum_args( $args, 4 ) ) 1515 1530 return $this->error; 1531 1532 $this->escape( $args ); 1516 1533 1517 1534 $blog_id = (int) $args[0]; … … 1600 1617 return $this->error; 1601 1618 1619 $this->escape( $args ); 1620 1602 1621 $blog_id = (int) $args[0]; 1603 1622 $username = $args[1]; … … 1689 1708 if ( ! $this->minimum_args( $args, 5 ) ) 1690 1709 return $this->error; 1710 1711 $this->escape( $args ); 1691 1712 1692 1713 $blog_id = (int) $args[0]; … … 1755 1776 return $this->error; 1756 1777 1778 $this->escape( $args ); 1779 1757 1780 $blog_id = (int) $args[0]; 1758 1781 $username = $args[1]; … … 1806 1829 return $this->error; 1807 1830 1831 $this->escape( $args ); 1832 1808 1833 $blog_id = (int) $args[0]; 1809 1834 $username = $args[1]; … … 1879 1904 return $this->error; 1880 1905 1906 $this->escape( $args ); 1907 1881 1908 $blog_id = (int) $args[0]; 1882 1909 $username = $args[1]; … … 1920 1947 if ( ! $this->minimum_args( $args, 3 ) ) 1921 1948 return $this->error; 1949 1950 $this->escape( $args ); 1922 1951 1923 1952 $blog_id = (int) $args[0]; … … 1988 2017 return $this->error; 1989 2018 2019 $this->escape( $args ); 2020 1990 2021 $blog_id = (int) $args[0]; 1991 2022 $username = $args[1]; … … 2039 2070 return $this->error; 2040 2071 2072 $this->escape( $args ); 2073 2041 2074 $blog_id = (int) $args[0]; 2042 2075 $username = $args[1]; … … 2104 2137 if ( ! $this->minimum_args( $args, 3 ) ) 2105 2138 return $this->error; 2139 2140 $this->escape( $args ); 2106 2141 2107 2142 $blog_id = (int) $args[0]; … … 2150 2185 return $this->error; 2151 2186 2187 $this->escape( $args ); 2188 2152 2189 $blog_id = (int) $args[0]; 2153 2190 $username = $args[1]; … … 2213 2250 */ 2214 2251 function wp_getPage($args) { 2252 $this->escape($args); 2253 2215 2254 $blog_id = (int) $args[0]; 2216 2255 $page_id = (int) $args[1]; … … 2254 2293 */ 2255 2294 function wp_getPages($args) { 2295 $this->escape($args); 2296 2256 2297 $blog_id = (int) $args[0]; 2257 2298 $username = $args[1]; … … 2296 2337 */ 2297 2338 function wp_newPage($args) { 2298 $username = $args[1]; 2299 $password = $args[2]; 2339 // Items not escaped here will be escaped in newPost. 2340 $username = $this->escape($args[1]); 2341 $password = $this->escape($args[2]); 2300 2342 $page = $args[3]; 2301 2343 $publish = $args[4]; … … 2322 2364 */ 2323 2365 function wp_deletePage($args) { 2366 $this->escape($args); 2367 2324 2368 $blog_id = (int) $args[0]; 2325 2369 $username = $args[1]; … … 2361 2405 */ 2362 2406 function wp_editPage($args) { 2407 // Items not escaped here will be escaped in editPost. 2363 2408 $blog_id = (int) $args[0]; 2364 $page_id = (int) $ args[1];2365 $username = $ args[2];2366 $password = $ args[3];2409 $page_id = (int) $this->escape($args[1]); 2410 $username = $this->escape($args[2]); 2411 $password = $this->escape($args[3]); 2367 2412 $content = $args[4]; 2368 2413 $publish = $args[5]; … … 2408 2453 function wp_getPageList($args) { 2409 2454 global $wpdb; 2455 2456 $this->escape($args); 2410 2457 2411 2458 $blog_id = (int) $args[0]; … … 2457 2504 */ 2458 2505 function wp_getAuthors($args) { 2506 2507 $this->escape($args); 2508 2459 2509 $blog_id = (int) $args[0]; 2460 2510 $username = $args[1]; … … 2490 2540 */ 2491 2541 function wp_getTags( $args ) { 2542 $this->escape( $args ); 2543 2492 2544 $blog_id = (int) $args[0]; 2493 2545 $username = $args[1]; … … 2529 2581 */ 2530 2582 function wp_newCategory($args) { 2583 $this->escape($args); 2584 2531 2585 $blog_id = (int) $args[0]; 2532 2586 $username = $args[1]; … … 2588 2642 */ 2589 2643 function wp_deleteCategory($args) { 2644 $this->escape($args); 2645 2590 2646 $blog_id = (int) $args[0]; 2591 2647 $username = $args[1]; … … 2618 2674 */ 2619 2675 function wp_suggestCategories($args) { 2676 $this->escape($args); 2677 2620 2678 $blog_id = (int) $args[0]; 2621 2679 $username = $args[1]; … … 2653 2711 */ 2654 2712 function wp_getComment($args) { 2713 $this->escape($args); 2714 2655 2715 $blog_id = (int) $args[0]; 2656 2716 $username = $args[1]; … … 2692 2752 */ 2693 2753 function wp_getComments($args) { 2754 $this->escape($args); 2755 2694 2756 $blog_id = (int) $args[0]; 2695 2757 $username = $args[1]; … … 2750 2812 */ 2751 2813 function wp_deleteComment($args) { 2814 $this->escape($args); 2815 2752 2816 $blog_id = (int) $args[0]; 2753 2817 $username = $args[1]; … … 2802 2866 */ 2803 2867 function wp_editComment($args) { 2868 $this->escape($args); 2869 2804 2870 $blog_id = (int) $args[0]; 2805 2871 $username = $args[1]; … … 2876 2942 function wp_newComment($args) { 2877 2943 global $wpdb; 2944 2945 $this->escape($args); 2878 2946 2879 2947 $blog_id = (int) $args[0]; … … 2911 2979 2912 2980 if ( $logged_in ) { 2913 $comment['comment_author'] = $ user->display_name;2914 $comment['comment_author_email'] = $ user->user_email;2915 $comment['comment_author_url'] = $ user->user_url;2981 $comment['comment_author'] = $wpdb->escape( $user->display_name ); 2982 $comment['comment_author_email'] = $wpdb->escape( $user->user_email ); 2983 $comment['comment_author_url'] = $wpdb->escape( $user->user_url ); 2916 2984 $comment['user_ID'] = $user->ID; 2917 2985 } else { … … 2960 3028 */ 2961 3029 function wp_getCommentStatusList($args) { 3030 $this->escape( $args ); 3031 2962 3032 $blog_id = (int) $args[0]; 2963 3033 $username = $args[1]; … … 2984 3054 */ 2985 3055 function wp_getCommentCount( $args ) { 3056 $this->escape($args); 3057 2986 3058 $blog_id = (int) $args[0]; 2987 3059 $username = $args[1]; … … 3015 3087 */ 3016 3088 function wp_getPostStatusList( $args ) { 3089 $this->escape( $args ); 3090 3017 3091 $blog_id = (int) $args[0]; 3018 3092 $username = $args[1]; … … 3039 3113 */ 3040 3114 function wp_getPageStatusList( $args ) { 3115 $this->escape( $args ); 3116 3041 3117 $blog_id = (int) $args[0]; 3042 3118 $username = $args[1]; … … 3063 3139 */ 3064 3140 function wp_getPageTemplates( $args ) { 3141 $this->escape( $args ); 3142 3065 3143 $blog_id = (int) $args[0]; 3066 3144 $username = $args[1]; … … 3088 3166 */ 3089 3167 function wp_getOptions( $args ) { 3168 $this->escape( $args ); 3169 3090 3170 $blog_id = (int) $args[0]; 3091 3171 $username = $args[1]; … … 3136 3216 */ 3137 3217 function wp_setOptions( $args ) { 3218 $this->escape( $args ); 3219 3138 3220 $blog_id = (int) $args[0]; 3139 3221 $username = $args[1]; … … 3183 3265 */ 3184 3266 function wp_getMediaItem($args) { 3267 $this->escape($args); 3268 3185 3269 $blog_id = (int) $args[0]; 3186 3270 $username = $args[1]; … … 3226 3310 */ 3227 3311 function wp_getMediaLibrary($args) { 3312 $this->escape($args); 3313 3228 3314 $blog_id = (int) $args[0]; 3229 3315 $username = $args[1]; … … 3266 3352 */ 3267 3353 function wp_getPostFormats( $args ) { 3354 $this->escape( $args ); 3355 3268 3356 $blog_id = (int) $args[0]; 3269 3357 $username = $args[1]; … … 3324 3412 return $this->error; 3325 3413 3414 $this->escape( $args ); 3415 3326 3416 $blog_id = (int) $args[0]; 3327 3417 $username = $args[1]; … … 3368 3458 return $this->error; 3369 3459 3460 $this->escape( $args ); 3461 3370 3462 $blog_id = (int) $args[0]; 3371 3463 $username = $args[1]; … … 3420 3512 return $this->error; 3421 3513 3514 $this->escape( $args ); 3515 3422 3516 $blog_id = (int) $args[0]; 3423 3517 $username = $args[1]; … … 3484 3578 return $this->error; 3485 3579 3580 $this->escape( $args ); 3581 3486 3582 $blog_id = (int) $args[0]; 3487 3583 $username = $args[1]; … … 3532 3628 if ( is_multisite() ) 3533 3629 return $this->_multisite_getUsersBlogs($args); 3630 3631 $this->escape($args); 3534 3632 3535 3633 $username = $args[1]; … … 3594 3692 */ 3595 3693 function blogger_getUserInfo($args) { 3694 3695 $this->escape($args); 3696 3596 3697 $username = $args[1]; 3597 3698 $password = $args[2]; … … 3625 3726 */ 3626 3727 function blogger_getPost($args) { 3728 3729 $this->escape($args); 3730 3627 3731 $post_ID = (int) $args[1]; 3628 3732 $username = $args[2]; … … 3643 3747 $categories = implode(',', wp_get_post_categories($post_ID)); 3644 3748 3645 $content = '<title>'. $post_data['post_title'].'</title>';3749 $content = '<title>'.stripslashes($post_data['post_title']).'</title>'; 3646 3750 $content .= '<category>'.$categories.'</category>'; 3647 $content .= $post_data['post_content'];3751 $content .= stripslashes($post_data['post_content']); 3648 3752 3649 3753 $struct = array( … … 3666 3770 */ 3667 3771 function blogger_getRecentPosts($args) { 3772 3773 $this->escape($args); 3774 3668 3775 // $args[0] = appkey - ignored 3669 3776 $blog_ID = (int) $args[1]; /* though we don't use it yet */ … … 3694 3801 $categories = implode(',', wp_get_post_categories($entry['ID'])); 3695 3802 3696 $content = '<title>'. $entry['post_title'].'</title>';3803 $content = '<title>'.stripslashes($entry['post_title']).'</title>'; 3697 3804 $content .= '<category>'.$categories.'</category>'; 3698 $content .= $entry['post_content'];3805 $content .= stripslashes($entry['post_content']); 3699 3806 3700 3807 $struct[] = array( … … 3744 3851 */ 3745 3852 function blogger_newPost($args) { 3853 3854 $this->escape($args); 3855 3746 3856 $blog_ID = (int) $args[1]; /* though we don't use it yet */ 3747 3857 $username = $args[2]; … … 3795 3905 */ 3796 3906 function blogger_editPost($args) { 3907 3908 $this->escape($args); 3909 3797 3910 $post_ID = (int) $args[1]; 3798 3911 $username = $args[2]; … … 3811 3924 return new IXR_Error(404, __('Sorry, no such post.')); 3812 3925 3926 $this->escape($actual_post); 3927 3813 3928 if ( !current_user_can('edit_post', $post_ID) ) 3814 3929 return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.')); … … 3846 3961 */ 3847 3962 function blogger_deletePost($args) { 3963 $this->escape($args); 3964 3848 3965 $post_ID = (int) $args[1]; 3849 3966 $username = $args[2]; … … 3914 4031 */ 3915 4032 function mw_newPost($args) { 3916 $blog_ID = (int) $args[0]; 3917 $username = $args[1]; 3918 $password = $args[2]; 4033 $this->escape($args); 4034 4035 $blog_ID = (int) $args[0]; 4036 $username = $args[1]; 4037 $password = $args[2]; 3919 4038 $content_struct = $args[3]; 3920 $publish = isset( $args[4] ) ? $args[4] : 0;4039 $publish = isset( $args[4] ) ? $args[4] : 0; 3921 4040 3922 4041 if ( !$user = $this->login($username, $password) ) … … 4198 4317 } 4199 4318 if (!$found) 4200 wp_add_post_meta( $post_ID, 'enclosure', $encstring );4319 add_post_meta( $post_ID, 'enclosure', $encstring ); 4201 4320 } 4202 4321 } … … 4232 4351 */ 4233 4352 function mw_editPost($args) { 4353 4354 $this->escape($args); 4355 4234 4356 $post_ID = (int) $args[0]; 4235 4357 $username = $args[1]; … … 4270 4392 } 4271 4393 4394 $this->escape($postdata); 4272 4395 extract($postdata, EXTR_SKIP); 4273 4396 … … 4497 4620 */ 4498 4621 function mw_getPost($args) { 4622 4623 $this->escape($args); 4624 4499 4625 $post_ID = (int) $args[0]; 4500 4626 $username = $args[1]; … … 4618 4744 */ 4619 4745 function mw_getRecentPosts($args) { 4746 4747 $this->escape($args); 4748 4620 4749 $blog_ID = (int) $args[0]; 4621 4750 $username = $args[1]; … … 4730 4859 */ 4731 4860 function mw_getCategories($args) { 4861 4862 $this->escape($args); 4863 4732 4864 $blog_ID = (int) $args[0]; 4733 4865 $username = $args[1]; … … 4776 4908 global $wpdb; 4777 4909 4778 $blog_ID = (int) $args[0];4779 $username = $ args[1];4780 $password = $args[2];4781 $data = $args[3];4910 $blog_ID = (int) $args[0]; 4911 $username = $wpdb->escape($args[1]); 4912 $password = $wpdb->escape($args[2]); 4913 $data = $args[3]; 4782 4914 4783 4915 $name = sanitize_file_name( $data['name'] ); … … 4866 4998 */ 4867 4999 function mt_getRecentPostTitles($args) { 5000 5001 $this->escape($args); 5002 4868 5003 $blog_ID = (int) $args[0]; 4869 5004 $username = $args[1]; … … 4923 5058 */ 4924 5059 function mt_getCategoryList($args) { 5060 5061 $this->escape($args); 5062 4925 5063 $blog_ID = (int) $args[0]; 4926 5064 $username = $args[1]; … … 4958 5096 */ 4959 5097 function mt_getPostCategories($args) { 5098 5099 $this->escape($args); 5100 4960 5101 $post_ID = (int) $args[0]; 4961 5102 $username = $args[1]; … … 4998 5139 */ 4999 5140 function mt_setPostCategories($args) { 5141 5142 $this->escape($args); 5143 5000 5144 $post_ID = (int) $args[0]; 5001 5145 $username = $args[1]; … … 5107 5251 */ 5108 5252 function mt_publishPost($args) { 5253 5254 $this->escape($args); 5255 5109 5256 $post_ID = (int) $args[0]; 5110 5257 $username = $args[1]; … … 5128 5275 $cats = wp_get_post_categories($post_ID); 5129 5276 $postdata['post_category'] = $cats; 5277 $this->escape($postdata); 5130 5278 5131 5279 $result = wp_update_post($postdata); … … 5150 5298 5151 5299 do_action('xmlrpc_call', 'pingback.ping'); 5300 5301 $this->escape($args); 5152 5302 5153 5303 $pagelinkedfrom = $args[0]; … … 5286 5436 5287 5437 $context = '[...] ' . esc_html( $excerpt ) . ' [...]'; 5288 $pagelinkedfrom = $ pagelinkedfrom;5438 $pagelinkedfrom = $wpdb->escape( $pagelinkedfrom ); 5289 5439 5290 5440 $comment_post_ID = (int) $post_ID; 5291 5441 $comment_author = $title; 5292 5442 $comment_author_email = ''; 5293 $ comment_author;5443 $this->escape($comment_author); 5294 5444 $comment_author_url = $pagelinkedfrom; 5295 5445 $comment_content = $context; 5296 $ comment_content;5446 $this->escape($comment_content); 5297 5447 $comment_type = 'pingback'; 5298 5448 … … 5316 5466 */ 5317 5467 function pingback_extensions_getPingbacks($args) { 5468 5318 5469 global $wpdb; 5319 5470 5320 5471 do_action('xmlrpc_call', 'pingback.extensions.getPingbacks'); 5472 5473 $this->escape($args); 5321 5474 5322 5475 $url = $args;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)