Changeset 45590 for trunk/src/wp-includes/class-wp-xmlrpc-server.php
- Timestamp:
- 07/02/2019 11:41:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r45554 r45590 669 669 $password = $args[1]; 670 670 671 if ( ! $user = $this->login( $username, $password ) ) { 671 $user = $this->login( $username, $password ); 672 if ( ! $user ) { 672 673 return $this->error; 673 674 } … … 1271 1272 $content_struct = $args[3]; 1272 1273 1273 if ( ! $user = $this->login( $username, $password ) ) { 1274 $user = $this->login( $username, $password ); 1275 if ( ! $user ) { 1274 1276 return $this->error; 1275 1277 } … … 1673 1675 $content_struct = $args[4]; 1674 1676 1675 if ( ! $user = $this->login( $username, $password ) ) { 1677 $user = $this->login( $username, $password ); 1678 if ( ! $user ) { 1676 1679 return $this->error; 1677 1680 } … … 1745 1748 $post_id = (int) $args[3]; 1746 1749 1747 if ( ! $user = $this->login( $username, $password ) ) { 1750 $user = $this->login( $username, $password ); 1751 if ( ! $user ) { 1748 1752 return $this->error; 1749 1753 } … … 1844 1848 } 1845 1849 1846 if ( ! $user = $this->login( $username, $password ) ) { 1850 $user = $this->login( $username, $password ); 1851 if ( ! $user ) { 1847 1852 return $this->error; 1848 1853 } … … 1904 1909 } 1905 1910 1906 if ( ! $user = $this->login( $username, $password ) ) { 1911 $user = $this->login( $username, $password ); 1912 if ( ! $user ) { 1907 1913 return $this->error; 1908 1914 } … … 2002 2008 $content_struct = $args[3]; 2003 2009 2004 if ( ! $user = $this->login( $username, $password ) ) { 2010 $user = $this->login( $username, $password ); 2011 if ( ! $user ) { 2005 2012 return $this->error; 2006 2013 } … … 2106 2113 $content_struct = $args[4]; 2107 2114 2108 if ( ! $user = $this->login( $username, $password ) ) { 2115 $user = $this->login( $username, $password ); 2116 if ( ! $user ) { 2109 2117 return $this->error; 2110 2118 } … … 2221 2229 $term_id = (int) $args[4]; 2222 2230 2223 if ( ! $user = $this->login( $username, $password ) ) { 2231 $user = $this->login( $username, $password ); 2232 if ( ! $user ) { 2224 2233 return $this->error; 2225 2234 } … … 2299 2308 $term_id = (int) $args[4]; 2300 2309 2301 if ( ! $user = $this->login( $username, $password ) ) { 2310 $user = $this->login( $username, $password ); 2311 if ( ! $user ) { 2302 2312 return $this->error; 2303 2313 } … … 2363 2373 $filter = isset( $args[4] ) ? $args[4] : array(); 2364 2374 2365 if ( ! $user = $this->login( $username, $password ) ) { 2375 $user = $this->login( $username, $password ); 2376 if ( ! $user ) { 2366 2377 return $this->error; 2367 2378 } … … 2468 2479 } 2469 2480 2470 if ( ! $user = $this->login( $username, $password ) ) { 2481 $user = $this->login( $username, $password ); 2482 if ( ! $user ) { 2471 2483 return $this->error; 2472 2484 } … … 2525 2537 } 2526 2538 2527 if ( ! $user = $this->login( $username, $password ) ) { 2539 $user = $this->login( $username, $password ); 2540 if ( ! $user ) { 2528 2541 return $this->error; 2529 2542 } … … 2610 2623 } 2611 2624 2612 if ( ! $user = $this->login( $username, $password ) ) { 2625 $user = $this->login( $username, $password ); 2626 if ( ! $user ) { 2613 2627 return $this->error; 2614 2628 } … … 2672 2686 } 2673 2687 2674 if ( ! $user = $this->login( $username, $password ) ) { 2688 $user = $this->login( $username, $password ); 2689 if ( ! $user ) { 2675 2690 return $this->error; 2676 2691 } … … 2751 2766 } 2752 2767 2753 if ( ! $user = $this->login( $username, $password ) ) { 2768 $user = $this->login( $username, $password ); 2769 if ( ! $user ) { 2754 2770 return $this->error; 2755 2771 } … … 2800 2816 $content_struct = $args[3]; 2801 2817 2802 if ( ! $user = $this->login( $username, $password ) ) { 2818 $user = $this->login( $username, $password ); 2819 if ( ! $user ) { 2803 2820 return $this->error; 2804 2821 } … … 2879 2896 $password = $args[3]; 2880 2897 2881 if ( ! $user = $this->login( $username, $password ) ) { 2898 $user = $this->login( $username, $password ); 2899 if ( ! $user ) { 2882 2900 return $this->error; 2883 2901 } … … 2926 2944 $num_pages = isset( $args[3] ) ? (int) $args[3] : 10; 2927 2945 2928 if ( ! $user = $this->login( $username, $password ) ) { 2946 $user = $this->login( $username, $password ); 2947 if ( ! $user ) { 2929 2948 return $this->error; 2930 2949 } … … 2984 3003 $password = $this->escape( $args[2] ); 2985 3004 2986 if ( ! $user = $this->login( $username, $password ) ) { 3005 $user = $this->login( $username, $password ); 3006 if ( ! $user ) { 2987 3007 return $this->error; 2988 3008 } … … 3020 3040 $page_id = (int) $args[3]; 3021 3041 3022 if ( ! $user = $this->login( $username, $password ) ) { 3042 $user = $this->login( $username, $password ); 3043 if ( ! $user ) { 3023 3044 return $this->error; 3024 3045 } … … 3086 3107 $escaped_password = $this->escape( $password ); 3087 3108 3088 if ( ! $user = $this->login( $escaped_username, $escaped_password ) ) { 3109 $user = $this->login( $escaped_username, $escaped_password ); 3110 if ( ! $user ) { 3089 3111 return $this->error; 3090 3112 } … … 3144 3166 $password = $args[2]; 3145 3167 3146 if ( ! $user = $this->login( $username, $password ) ) { 3168 $user = $this->login( $username, $password ); 3169 if ( ! $user ) { 3147 3170 return $this->error; 3148 3171 } … … 3204 3227 $password = $args[2]; 3205 3228 3206 if ( ! $user = $this->login( $username, $password ) ) { 3229 $user = $this->login( $username, $password ); 3230 if ( ! $user ) { 3207 3231 return $this->error; 3208 3232 } … … 3247 3271 $password = $args[2]; 3248 3272 3249 if ( ! $user = $this->login( $username, $password ) ) { 3273 $user = $this->login( $username, $password ); 3274 if ( ! $user ) { 3250 3275 return $this->error; 3251 3276 } … … 3260 3285 $tags = array(); 3261 3286 3262 if ( $all_tags = get_tags() ) { 3287 $all_tags = get_tags(); 3288 if ( $all_tags ) { 3263 3289 foreach ( (array) $all_tags as $tag ) { 3264 3290 $struct = array(); … … 3299 3325 $category = $args[3]; 3300 3326 3301 if ( ! $user = $this->login( $username, $password ) ) { 3327 $user = $this->login( $username, $password ); 3328 if ( ! $user ) { 3302 3329 return $this->error; 3303 3330 } … … 3381 3408 $category_id = (int) $args[3]; 3382 3409 3383 if ( ! $user = $this->login( $username, $password ) ) { 3410 $user = $this->login( $username, $password ); 3411 if ( ! $user ) { 3384 3412 return $this->error; 3385 3413 } … … 3433 3461 $max_results = (int) $args[4]; 3434 3462 3435 if ( ! $user = $this->login( $username, $password ) ) { 3463 $user = $this->login( $username, $password ); 3464 if ( ! $user ) { 3436 3465 return $this->error; 3437 3466 } … … 3482 3511 $comment_id = (int) $args[3]; 3483 3512 3484 if ( ! $user = $this->login( $username, $password ) ) { 3513 $user = $this->login( $username, $password ); 3514 if ( ! $user ) { 3485 3515 return $this->error; 3486 3516 } … … 3489 3519 do_action( 'xmlrpc_call', 'wp.getComment' ); 3490 3520 3491 if ( ! $comment = get_comment( $comment_id ) ) { 3521 $comment = get_comment( $comment_id ); 3522 if ( ! $comment ) { 3492 3523 return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); 3493 3524 } … … 3533 3564 $struct = isset( $args[3] ) ? $args[3] : array(); 3534 3565 3535 if ( ! $user = $this->login( $username, $password ) ) { 3566 $user = $this->login( $username, $password ); 3567 if ( ! $user ) { 3536 3568 return $this->error; 3537 3569 } … … 3619 3651 $comment_ID = (int) $args[3]; 3620 3652 3621 if ( ! $user = $this->login( $username, $password ) ) { 3653 $user = $this->login( $username, $password ); 3654 if ( ! $user ) { 3622 3655 return $this->error; 3623 3656 } … … 3686 3719 $content_struct = $args[4]; 3687 3720 3688 if ( ! $user = $this->login( $username, $password ) ) { 3721 $user = $this->login( $username, $password ); 3722 if ( ! $user ) { 3689 3723 return $this->error; 3690 3724 } … … 3918 3952 $password = $args[2]; 3919 3953 3920 if ( ! $user = $this->login( $username, $password ) ) { 3954 $user = $this->login( $username, $password ); 3955 if ( ! $user ) { 3921 3956 return $this->error; 3922 3957 } … … 3954 3989 $post_id = (int) $args[3]; 3955 3990 3956 if ( ! $user = $this->login( $username, $password ) ) { 3991 $user = $this->login( $username, $password ); 3992 if ( ! $user ) { 3957 3993 return $this->error; 3958 3994 } … … 4000 4036 $password = $args[2]; 4001 4037 4002 if ( ! $user = $this->login( $username, $password ) ) { 4038 $user = $this->login( $username, $password ); 4039 if ( ! $user ) { 4003 4040 return $this->error; 4004 4041 } … … 4034 4071 $password = $args[2]; 4035 4072 4036 if ( ! $user = $this->login( $username, $password ) ) { 4073 $user = $this->login( $username, $password ); 4074 if ( ! $user ) { 4037 4075 return $this->error; 4038 4076 } … … 4068 4106 $password = $args[2]; 4069 4107 4070 if ( ! $user = $this->login( $username, $password ) ) { 4108 $user = $this->login( $username, $password ); 4109 if ( ! $user ) { 4071 4110 return $this->error; 4072 4111 } … … 4104 4143 $options = isset( $args[3] ) ? (array) $args[3] : array(); 4105 4144 4106 if ( ! $user = $this->login( $username, $password ) ) { 4145 $user = $this->login( $username, $password ); 4146 if ( ! $user ) { 4107 4147 return $this->error; 4108 4148 } … … 4167 4207 $options = (array) $args[3]; 4168 4208 4169 if ( ! $user = $this->login( $username, $password ) ) { 4209 $user = $this->login( $username, $password ); 4210 if ( ! $user ) { 4170 4211 return $this->error; 4171 4212 } … … 4223 4264 $attachment_id = (int) $args[3]; 4224 4265 4225 if ( ! $user = $this->login( $username, $password ) ) { 4266 $user = $this->login( $username, $password ); 4267 if ( ! $user ) { 4226 4268 return $this->error; 4227 4269 } … … 4234 4276 do_action( 'xmlrpc_call', 'wp.getMediaItem' ); 4235 4277 4236 if ( ! $attachment = get_post( $attachment_id ) ) { 4278 $attachment = get_post( $attachment_id ); 4279 if ( ! $attachment ) { 4237 4280 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 4238 4281 } … … 4274 4317 $struct = isset( $args[3] ) ? $args[3] : array(); 4275 4318 4276 if ( ! $user = $this->login( $username, $password ) ) { 4319 $user = $this->login( $username, $password ); 4320 if ( ! $user ) { 4277 4321 return $this->error; 4278 4322 } … … 4329 4373 $password = $args[2]; 4330 4374 4331 if ( ! $user = $this->login( $username, $password ) ) { 4375 $user = $this->login( $username, $password ); 4376 if ( ! $user ) { 4332 4377 return $this->error; 4333 4378 } … … 4412 4457 } 4413 4458 4414 if ( ! $user = $this->login( $username, $password ) ) { 4459 $user = $this->login( $username, $password ); 4460 if ( ! $user ) { 4415 4461 return $this->error; 4416 4462 } … … 4468 4514 } 4469 4515 4470 if ( ! $user = $this->login( $username, $password ) ) { 4516 $user = $this->login( $username, $password ); 4517 if ( ! $user ) { 4471 4518 return $this->error; 4472 4519 } … … 4537 4584 } 4538 4585 4539 if ( ! $user = $this->login( $username, $password ) ) { 4586 $user = $this->login( $username, $password ); 4587 if ( ! $user ) { 4540 4588 return $this->error; 4541 4589 } … … 4544 4592 do_action( 'xmlrpc_call', 'wp.getRevisions' ); 4545 4593 4546 if ( ! $post = get_post( $post_id ) ) { 4594 $post = get_post( $post_id ); 4595 if ( ! $post ) { 4547 4596 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4548 4597 } … … 4609 4658 $revision_id = (int) $args[3]; 4610 4659 4611 if ( ! $user = $this->login( $username, $password ) ) { 4660 $user = $this->login( $username, $password ); 4661 if ( ! $user ) { 4612 4662 return $this->error; 4613 4663 } … … 4616 4666 do_action( 'xmlrpc_call', 'wp.restoreRevision' ); 4617 4667 4618 if ( ! $revision = wp_get_post_revision( $revision_id ) ) { 4668 $revision = wp_get_post_revision( $revision_id ); 4669 if ( ! $revision ) { 4619 4670 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4620 4671 } … … 4624 4675 } 4625 4676 4626 if ( ! $post = get_post( $revision->post_parent ) ) { 4677 $post = get_post( $revision->post_parent ); 4678 if ( ! $post ) { 4627 4679 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4628 4680 } … … 4676 4728 $password = $args[2]; 4677 4729 4678 if ( ! $user = $this->login( $username, $password ) ) { 4730 $user = $this->login( $username, $password ); 4731 if ( ! $user ) { 4679 4732 return $this->error; 4680 4733 } … … 4757 4810 $password = $args[2]; 4758 4811 4759 if ( ! $user = $this->login( $username, $password ) ) { 4812 $user = $this->login( $username, $password ); 4813 if ( ! $user ) { 4760 4814 return $this->error; 4761 4815 } … … 4801 4855 $password = $args[3]; 4802 4856 4803 if ( ! $user = $this->login( $username, $password ) ) { 4857 $user = $this->login( $username, $password ); 4858 if ( ! $user ) { 4804 4859 return $this->error; 4805 4860 } … … 4862 4917 } 4863 4918 4864 if ( ! $user = $this->login( $username, $password ) ) { 4919 $user = $this->login( $username, $password ); 4920 if ( ! $user ) { 4865 4921 return $this->error; 4866 4922 } … … 4955 5011 $publish = $args[5]; 4956 5012 4957 if ( ! $user = $this->login( $username, $password ) ) { 5013 $user = $this->login( $username, $password ); 5014 if ( ! $user ) { 4958 5015 return $this->error; 4959 5016 } … … 5031 5088 $publish = $args[5]; 5032 5089 5033 if ( ! $user = $this->login( $username, $password ) ) { 5090 $user = $this->login( $username, $password ); 5091 if ( ! $user ) { 5034 5092 return $this->error; 5035 5093 } … … 5104 5162 $password = $args[3]; 5105 5163 5106 if ( ! $user = $this->login( $username, $password ) ) { 5164 $user = $this->login( $username, $password ); 5165 if ( ! $user ) { 5107 5166 return $this->error; 5108 5167 } … … 5190 5249 $publish = isset( $args[4] ) ? $args[4] : 0; 5191 5250 5192 if ( ! $user = $this->login( $username, $password ) ) { 5251 $user = $this->login( $username, $password ); 5252 if ( ! $user ) { 5193 5253 return $this->error; 5194 5254 } … … 5432 5492 $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' ); 5433 5493 5434 $post_ID = $postdata['ID'] = get_default_post_to_edit( $post_type, true )->ID; 5494 $post_ID = get_default_post_to_edit( $post_type, true )->ID; 5495 $postdata['ID'] = $post_ID; 5435 5496 5436 5497 // Only posts can be sticky … … 5500 5561 public function add_enclosure_if_new( $post_ID, $enclosure ) { 5501 5562 if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 5502 $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n"; 5503 $found = false; 5504 if ( $enclosures = get_post_meta( $post_ID, 'enclosure' ) ) { 5563 $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n"; 5564 $found = false; 5565 $enclosures = get_post_meta( $post_ID, 'enclosure' ); 5566 if ( $enclosures ) { 5505 5567 foreach ( $enclosures as $enc ) { 5506 5568 // This method used to omit the trailing new line. #23219 … … 5566 5628 $publish = isset( $args[4] ) ? $args[4] : 0; 5567 5629 5568 if ( ! $user = $this->login( $username, $password ) ) { 5630 $user = $this->login( $username, $password ); 5631 if ( ! $user ) { 5569 5632 return $this->error; 5570 5633 } … … 5894 5957 $password = $args[2]; 5895 5958 5896 if ( ! $user = $this->login( $username, $password ) ) { 5959 $user = $this->login( $username, $password ); 5960 if ( ! $user ) { 5897 5961 return $this->error; 5898 5962 } … … 6039 6103 } 6040 6104 6041 if ( ! $user = $this->login( $username, $password ) ) { 6105 $user = $this->login( $username, $password ); 6106 if ( ! $user ) { 6042 6107 return $this->error; 6043 6108 } … … 6159 6224 $password = $args[2]; 6160 6225 6161 if ( ! $user = $this->login( $username, $password ) ) { 6226 $user = $this->login( $username, $password ); 6227 if ( ! $user ) { 6162 6228 return $this->error; 6163 6229 } … … 6172 6238 $categories_struct = array(); 6173 6239 6174 if ( $cats = get_categories( array( 'get' => 'all' ) ) ) { 6240 $cats = get_categories( array( 'get' => 'all' ) ); 6241 if ( $cats ) { 6175 6242 foreach ( $cats as $cat ) { 6176 6243 $struct = array(); … … 6222 6289 $bits = $data['bits']; 6223 6290 6224 if ( ! $user = $this->login( $username, $password ) ) { 6291 $user = $this->login( $username, $password ); 6292 if ( ! $user ) { 6225 6293 return $this->error; 6226 6294 } … … 6256 6324 * @param bool $error Whether to pre-empt the media upload. Default false. 6257 6325 */ 6258 if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) { 6326 $upload_err = apply_filters( 'pre_upload_error', false ); 6327 if ( $upload_err ) { 6259 6328 return new IXR_Error( 500, $upload_err ); 6260 6329 } … … 6338 6407 } 6339 6408 6340 if ( ! $user = $this->login( $username, $password ) ) { 6409 $user = $this->login( $username, $password ); 6410 if ( ! $user ) { 6341 6411 return $this->error; 6342 6412 } … … 6395 6465 $password = $args[2]; 6396 6466 6397 if ( ! $user = $this->login( $username, $password ) ) { 6467 $user = $this->login( $username, $password ); 6468 if ( ! $user ) { 6398 6469 return $this->error; 6399 6470 } … … 6408 6479 $categories_struct = array(); 6409 6480 6410 if ($cats = get_categories(6481 $cats = get_categories( 6411 6482 array( 6412 6483 'hide_empty' => 0, 6413 6484 'hierarchical' => 0, 6414 6485 ) 6415 ) ) { 6486 ); 6487 if ( $cats ) { 6416 6488 foreach ( $cats as $cat ) { 6417 6489 $struct = array(); … … 6447 6519 $password = $args[2]; 6448 6520 6449 if ( ! $user = $this->login( $username, $password ) ) { 6521 $user = $this->login( $username, $password ); 6522 if ( ! $user ) { 6450 6523 return $this->error; 6451 6524 } … … 6501 6574 $categories = $args[3]; 6502 6575 6503 if ( ! $user = $this->login( $username, $password ) ) { 6576 $user = $this->login( $username, $password ); 6577 if ( ! $user ) { 6504 6578 return $this->error; 6505 6579 } … … 6624 6698 $password = $args[2]; 6625 6699 6626 if ( ! $user = $this->login( $username, $password ) ) { 6700 $user = $this->login( $username, $password ); 6701 if ( ! $user ) { 6627 6702 return $this->error; 6628 6703 } … … 6703 6778 // if so, then let's use it and drop the old code. 6704 6779 $urltest = parse_url( $pagelinkedto ); 6705 if ( $post_ID = url_to_postid( $pagelinkedto ) ) { 6780 $post_ID = url_to_postid( $pagelinkedto ); 6781 if ( $post_ID ) { 6706 6782 // $way 6707 6783 } elseif ( isset( $urltest['path'] ) && preg_match( '#p/[0-9]{1,}#', $urltest['path'], $match ) ) { … … 6723 6799 } elseif ( is_string( $urltest['fragment'] ) ) { 6724 6800 // ...or a string #title, a little more complicated 6725 $title = preg_replace( '/[^a-z0-9]/i', '.', $urltest['fragment'] ); 6726 $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title ); 6727 if ( ! ( $post_ID = $wpdb->get_var( $sql ) ) ) { 6801 $title = preg_replace( '/[^a-z0-9]/i', '.', $urltest['fragment'] ); 6802 $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title ); 6803 $post_ID = $wpdb->get_var( $sql ); 6804 if ( ! $post_ID ) { 6728 6805 // returning unknown error '0' is better than die()ing 6729 6806 return $this->pingback_error( 0, '' ); … … 6775 6852 ); 6776 6853 6777 $request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args ); 6778 $remote_source = $remote_source_original = wp_remote_retrieve_body( $request ); 6854 $request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args ); 6855 $remote_source = wp_remote_retrieve_body( $request ); 6856 $remote_source_original = $remote_source; 6779 6857 6780 6858 if ( ! $remote_source ) {
Note: See TracChangeset
for help on using the changeset viewer.