Changeset 63006 for trunk/src/wp-includes/class-wp-xmlrpc-server.php
- Timestamp:
- 08/04/2026 07:25:22 AM (2 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r62933 r63006 6441 6441 * 6442 6442 * @param array $args { 6443 * Method arguments. Note: arguments must be ordered as documented.6443 * Method arguments. Note: top-level arguments must be ordered as documented. 6444 6444 * 6445 6445 * @type int $0 Blog ID (unused). 6446 6446 * @type string $1 Username. 6447 6447 * @type string $2 Password. 6448 * @type array $3 Data. 6448 * @type array $3 { 6449 * Data for the file to upload. 6450 * 6451 * @type string $name File name. Sanitized with sanitize_file_name(). 6452 * @type string $type Optional. File MIME type, stored as the attachment's 6453 * post MIME type. Default empty string. 6454 * @type string $bits Optional. File contents. Default empty string. 6455 * @type int $post_id Optional. ID of the post to attach the file to. 6456 * Default 0. 6457 * } 6449 6458 * } 6450 6459 * @return array|IXR_Error 6451 6460 */ 6452 6461 public function mw_newMediaObject( $args ) { 6462 if ( ! $this->minimum_args( $args, 4 ) ) { 6463 return $this->error; 6464 } 6465 6453 6466 $username = $this->escape( $args[1] ); 6454 6467 $password = $this->escape( $args[2] ); 6455 6468 $data = $args[3]; 6456 6469 6457 $name = sanitize_file_name( $data['name'] );6458 $type = $data['type'];6459 $bits = $data['bits'];6460 6461 6470 $user = $this->login( $username, $password ); 6462 6471 if ( ! $user ) { … … 6471 6480 return $this->error; 6472 6481 } 6482 6483 if ( 6484 ! is_array( $data ) || 6485 ! is_string( $data['name'] ?? null ) || 6486 ! is_string( $data['type'] ?? '' ) || 6487 ! is_string( $data['bits'] ?? '' ) 6488 ) { 6489 return new IXR_Error( 400, __( 'Invalid attachment data.' ) ); 6490 } 6491 6492 $name = sanitize_file_name( $data['name'] ); 6493 6494 // A name consisting only of characters the sanitizer strips leaves nothing to write to. 6495 if ( '' === $name ) { 6496 return new IXR_Error( 400, __( 'Invalid attachment data.' ) ); 6497 } 6498 6499 $type = $data['type'] ?? ''; 6500 $bits = $data['bits'] ?? ''; 6473 6501 6474 6502 if ( is_multisite() && upload_is_user_over_quota( false ) ) {
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)