aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-07-15 17:12:24 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-09-09 08:28:00 +0200
commit636a29d589e92765b5746a977b3b53c1bb4e818c (patch)
treeb1e33b94d95f9e2c87d7a992e84c3270b0c1386c /phpBB/phpbb/files
parent[ticket/13904] Add types base class (diff)
downloadphpbb-636a29d589e92765b5746a977b3b53c1bb4e818c.tar.gz
phpbb-636a29d589e92765b5746a977b3b53c1bb4e818c.tar.bz2
phpbb-636a29d589e92765b5746a977b3b53c1bb4e818c.zip
[ticket/13904] Split up local_upload method
PHPBB3-13904
Diffstat (limited to 'phpBB/phpbb/files')
-rw-r--r--phpBB/phpbb/files/types/local.php47
1 files changed, 31 insertions, 16 deletions
diff --git a/phpBB/phpbb/files/types/local.php b/phpBB/phpbb/files/types/local.php
index 38876d8ab4..d439f01866 100644
--- a/phpBB/phpbb/files/types/local.php
+++ b/phpBB/phpbb/files/types/local.php
@@ -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;
+ }
}