mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-20 02:08:51 +00:00
[ticket/13904] Split up local_upload method
PHPBB3-13904
This commit is contained in:
parent
167cc58f27
commit
636a29d589
1 changed files with 31 additions and 16 deletions
|
@ -65,22 +65,7 @@ class local extends base
|
|||
*/
|
||||
protected 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'];
|
||||
}
|
||||
$upload = $this->get_upload_ary($source_file, $filedata);
|
||||
|
||||
/** @var filespec $file */
|
||||
$file = $this->factory->get('filespec')
|
||||
|
@ -134,4 +119,34 @@ class local extends base
|
|||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve upload array
|
||||
*
|
||||
* @param string $source_file Source file name
|
||||
* @param array $filedata File data array
|
||||
*
|
||||
* @return array Upload array
|
||||
*/
|
||||
protected function get_upload_ary($source_file, $filedata)
|
||||
{
|
||||
$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'];
|
||||
}
|
||||
|
||||
return $upload;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue