Changeset 1580
- Timestamp:
- 09/01/2004 04:13:35 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc.php
r1569 r1580 35 35 logIO("I", $HTTP_RAW_POST_DATA); 36 36 37 37 38 function printr($var, $do_not_echo = false) { 38 39 // from php.net/print_r user contributed notes … … 46 47 return $code; 47 48 } 49 50 function mkdir_p($target) { 51 // from php.net/mkdir user contributed notes 52 if (file_exists($target)) { 53 if (!is_dir($target)) { 54 return false; 55 } else { 56 return true; 57 } 58 } 59 60 // Attempting to create the directory may clutter up our display. 61 if (@mkdir($target)) { 62 return true; 63 } 64 65 // If the above failed, attempt to create the parent node, then try again. 66 if (mkdir_p(dirname($target))) { 67 return mkdir_p($target); 68 } 69 70 return false; 71 } 72 48 73 49 74 class wp_xmlrpc_server extends IXR_Server { … … 85 110 function login_pass_ok($user_login, $user_pass) { 86 111 if (!user_pass_ok($user_login, $user_pass)) { 87 $this->error = new IXR_Error(403, 'Bad login/pass combination.' .$user_login);112 $this->error = new IXR_Error(403, 'Bad login/pass combination.'); 88 113 return false; 89 114 } … … 616 641 'postid' => $postdata['ID'], 617 642 'content' => $postdata['post_content'], 618 'perma link' => $link,643 'permaLink' => $link, 619 644 'categories' => $categories, 620 645 'mt_excerpt' => $postdata['post_excerpt'], … … 759 784 // User has not enough privileges 760 785 logIO('O', '(MW) Not enough privilege: user level too low'); 761 $this->error = new IXR_Error(401, 'You are not allowed to upload files to this site. sdff'.$user_data->user_level);786 $this->error = new IXR_Error(401, 'You are not allowed to upload files to this site.'); 762 787 return $this->error; 763 788 } … … 777 802 $url = $file_url.$prefix.$name; 778 803 779 /* encode & write data (binary) */ 780 $ifp = fopen($localpath, 'wb'); 781 $success = fwrite($ifp, $bits); 782 fclose($ifp); 783 @chmod($localpath, 0666); 784 785 if($success) { 786 $resp = array($url); 787 return $resp; 804 if (mkdir_p(dirname($localpath))) { 805 806 /* encode & write data (binary) */ 807 $ifp = fopen($localpath, 'wb'); 808 $success = fwrite($ifp, $bits); 809 fclose($ifp); 810 @chmod($localpath, 0666); 811 812 if($success) { 813 $resp = array($url); 814 return $resp; 815 } else { 816 logIO('O', '(MW) Could not write file '.$name.' to '.$localpath); 817 return new IXR_Error(500, 'Could not write file '.$name); 818 } 819 788 820 } else { 789 logIO('O', '(MW) Could not write file '.$name.' to '.$localpath); 790 return new IXR_Error(500, 'Could not write file '.$name.' to '.$localpath); 821 return new IXR_Error(500, 'Could not create directories for '.$name); 791 822 } 792 823 }
Note: See TracChangeset
for help on using the changeset viewer.