diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-07-15 16:08:20 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-09-09 08:27:58 +0200 |
commit | adcc901af181b6727dd7af89a3926c9923a58471 (patch) | |
tree | 720561f2a804e91717124607c5a4e8701336b13d /phpBB/phpbb/files/upload.php | |
parent | cf9b6ed4742f95b75125963935f4f2d9e9cfa62c (diff) | |
download | forums-adcc901af181b6727dd7af89a3926c9923a58471.tar forums-adcc901af181b6727dd7af89a3926c9923a58471.tar.gz forums-adcc901af181b6727dd7af89a3926c9923a58471.tar.bz2 forums-adcc901af181b6727dd7af89a3926c9923a58471.tar.xz forums-adcc901af181b6727dd7af89a3926c9923a58471.zip |
[ticket/13904] Fix minor issues and move local_upload to its own class
PHPBB3-13904
Diffstat (limited to 'phpBB/phpbb/files/upload.php')
-rw-r--r-- | phpBB/phpbb/files/upload.php | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/phpBB/phpbb/files/upload.php b/phpBB/phpbb/files/upload.php index 09f2b9408d..471c9c378f 100644 --- a/phpBB/phpbb/files/upload.php +++ b/phpBB/phpbb/files/upload.php @@ -200,86 +200,6 @@ class upload } /** - * Move file from another location to phpBB - * - * @param string $source_file Filename of source file - * @param array|bool $filedata Array with filedata or false - * - * @return filespec Object "filespec" is returned, all further operations can be done with this object - */ - function local_upload($source_file, $filedata = false) - { - $upload = array(); - - $upload['local_mode'] = true; - $upload['tmp_name'] = $source_file; - - if ($filedata === false) - { - $upload['name'] = utf8_basename($source_file); - $upload['size'] = 0; - } - else - { - $upload['name'] = $filedata['realname']; - $upload['size'] = $filedata['size']; - $upload['type'] = $filedata['type']; - } - - /** @var filespec $file */ - $file = $this->factory->get('filespec') - ->set_upload_ary($upload) - ->set_upload_namespace($this); - - if ($file->init_error()) - { - $file->error[] = ''; - return $file; - } - - if (isset($upload['error'])) - { - $error = $this->assign_internal_error($upload['error']); - - if ($error !== false) - { - $file->error[] = $error; - return $file; - } - } - - // PHP Upload filesize exceeded - if ($file->get('filename') == 'none') - { - $max_filesize = @ini_get('upload_max_filesize'); - $unit = 'MB'; - - if (!empty($max_filesize)) - { - $unit = strtolower(substr($max_filesize, -1, 1)); - $max_filesize = (int) $max_filesize; - - $unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB'); - } - - $file->error[] = (empty($max_filesize)) ?$this->language->lang($this->error_prefix . 'PHP_SIZE_NA') : $this->language->lang($this->error_prefix . 'PHP_SIZE_OVERRUN', $max_filesize, $this->language->lang($unit)); - return $file; - } - - // Not correctly uploaded - if (!$file->is_uploaded()) - { - $file->error[] = $this->language->lang($this->error_prefix . 'NOT_UPLOADED'); - return $file; - } - - $this->common_checks($file); - $this->request->overwrite('local', $upload, request_interface::FILES); - - return $file; - } - - /** * Remote upload method * Uploads file from given url * |