| 1 | Index: xmlrpc.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- xmlrpc.php (revision 5669) |
|---|
| 4 | +++ xmlrpc.php (working copy) |
|---|
| 5 | @@ -1429,6 +1429,21 @@ |
|---|
| 6 | $type = $data['type']; |
|---|
| 7 | $bits = $data['bits']; |
|---|
| 8 | |
|---|
| 9 | + logIO('O', '(MW) Received '.strlen($bits).' bytes'); |
|---|
| 10 | + |
|---|
| 11 | + if ( !$this->login_pass_ok($user_login, $user_pass) ) |
|---|
| 12 | + return $this->error; |
|---|
| 13 | + |
|---|
| 14 | + set_current_user(0, $user_login); |
|---|
| 15 | + if ( !current_user_can('upload_files') ) { |
|---|
| 16 | + logIO('O', '(MW) User does not have upload_files capability'); |
|---|
| 17 | + $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.')); |
|---|
| 18 | + return $this->error; |
|---|
| 19 | + } |
|---|
| 20 | + |
|---|
| 21 | + if ( $upload_err = apply_filters( "pre_upload_error", false ) ) |
|---|
| 22 | + return new IXR_Error(500, $upload_err); |
|---|
| 23 | + |
|---|
| 24 | if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) { |
|---|
| 25 | // Get postmeta info on the object. |
|---|
| 26 | $old_file = $wpdb->get_row(" |
|---|
| 27 | @@ -1447,21 +1462,6 @@ |
|---|
| 28 | $name = "wpid{$old_file->ID}-{$filename}"; |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | - logIO('O', '(MW) Received '.strlen($bits).' bytes'); |
|---|
| 32 | - |
|---|
| 33 | - if ( !$this->login_pass_ok($user_login, $user_pass) ) |
|---|
| 34 | - return $this->error; |
|---|
| 35 | - |
|---|
| 36 | - set_current_user(0, $user_login); |
|---|
| 37 | - if ( !current_user_can('upload_files') ) { |
|---|
| 38 | - logIO('O', '(MW) User does not have upload_files capability'); |
|---|
| 39 | - $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.')); |
|---|
| 40 | - return $this->error; |
|---|
| 41 | - } |
|---|
| 42 | - |
|---|
| 43 | - if ( $upload_err = apply_filters( "pre_upload_error", false ) ) |
|---|
| 44 | - return new IXR_Error(500, $upload_err); |
|---|
| 45 | - |
|---|
| 46 | $upload = wp_upload_bits($name, $type, $bits, $overwrite); |
|---|
| 47 | if ( ! empty($upload['error']) ) { |
|---|
| 48 | $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']); |
|---|