From 0d4bfdbf8c17706b57e92838d1599cb9e82c893b Mon Sep 17 00:00:00 2001 From: donncha Date: Mon, 12 Mar 2007 23:03:30 +0000 Subject: WP Merge to 5028 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@915 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/functions.php | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'wp-includes/functions.php') diff --git a/wp-includes/functions.php b/wp-includes/functions.php index d843b39..29437a5 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1113,7 +1113,7 @@ function wp_upload_dir() { return apply_filters('upload_dir', $uploads); } -function wp_upload_bits($name, $type, $bits, $overwrite = false) { +function wp_upload_bits($name, $type, $bits) { if ( empty($name) ) return array('error' => __("Empty filename")); @@ -1141,21 +1141,10 @@ function wp_upload_bits($name, $type, $bits, $overwrite = false) { $filename = str_replace("$number$ext", ++$number . $ext, $filename); } - // If we are asked to over write the file then make sure - // the $name has the complete path and is writable. - if($overwrite) { - if(!is_writable($name)) { - return(array("error" => __("Can not over write file."))); - } - $new_file = $name; - $filename = basename($name); - } - else { - $new_file = $upload['path'] . "/$filename"; - if ( ! wp_mkdir_p( dirname($new_file) ) ) { - $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file)); - return array('error' => $message); - } + $new_file = $upload['path'] . "/$filename"; + if ( ! wp_mkdir_p( dirname($new_file) ) ) { + $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file)); + return array('error' => $message); } $ifp = @ fopen($new_file, 'wb'); @@ -1170,11 +1159,8 @@ function wp_upload_bits($name, $type, $bits, $overwrite = false) { $perms = $perms & 0000666; @ chmod($new_file, $perms); - // Compute the URL if this is a new file. + // Compute the URL $url = $upload['url'] . "/$filename"; - if($overwrite) { - $url = $name; - } return array('file' => $new_file, 'url' => $url, 'error' => false); } -- cgit