summaryrefslogtreecommitdiffstats
path: root/wp-includes/functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-03-12 23:03:30 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-03-12 23:03:30 +0000
commit0d4bfdbf8c17706b57e92838d1599cb9e82c893b (patch)
treef02f84d4c598373d7e5921ea3d3e66fd50850d24 /wp-includes/functions.php
parentbed8532fd2d9cc526a74f4fc4214887b37cf6e71 (diff)
downloadwordpress-mu-0d4bfdbf8c17706b57e92838d1599cb9e82c893b.tar.gz
wordpress-mu-0d4bfdbf8c17706b57e92838d1599cb9e82c893b.tar.xz
wordpress-mu-0d4bfdbf8c17706b57e92838d1599cb9e82c893b.zip
WP Merge to 5028
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@915 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/functions.php')
-rw-r--r--wp-includes/functions.php26
1 files changed, 6 insertions, 20 deletions
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);
}