diff options
author | Dhruv <dhruv.goel92@gmail.com> | 2013-12-27 00:28:38 +0530 |
---|---|---|
committer | Dhruv <dhruv.goel92@gmail.com> | 2013-12-27 00:28:38 +0530 |
commit | 80c05e861bd8b5264daf6b1f92b69b5b77356f32 (patch) | |
tree | 71bb9e0adce0c26ea2dbd58f7c4d441c1b04767f /phpBB/includes/functions_upload.php | |
parent | 1bb175ce7759e937494f74769b334a9acf3779d2 (diff) | |
parent | f9c7f0fc193802fb866063c88e2d3448b6f0d010 (diff) | |
download | forums-80c05e861bd8b5264daf6b1f92b69b5b77356f32.tar forums-80c05e861bd8b5264daf6b1f92b69b5b77356f32.tar.gz forums-80c05e861bd8b5264daf6b1f92b69b5b77356f32.tar.bz2 forums-80c05e861bd8b5264daf6b1f92b69b5b77356f32.tar.xz forums-80c05e861bd8b5264daf6b1f92b69b5b77356f32.zip |
Merge branch 'develop' into ticket/11271-develop
# By Vjacheslav Trushkin (148) and others
# Via Joas Schilling (50) and others
* develop: (635 commits)
[ticket/12079] Add default value to $multibyte in request.untrimmed_variable().
[ticket/11849] Fix more function calls
[ticket/11849] Update more MCP calls to pagination class
[ticket/11849] Update some ACP modules with new pagination
[ticket/11849] Update rest of the UCP modules
[ticket/11849] Update UCP notifications and pm folder
[ticket/11849] Update search and memberlist
[ticket/11849] Update pagination in viewonline.php
[ticket/11849] Remove old pagination test
[ticket/11849] Update pagination code in viewtopic.php
[ticket/11849] Replace pagination in viewforum.php with class
[ticket/11849] Add service definition
[ticket/11849] Remove pagination functions
[ticket/11849] Test validate_start and on_page
[ticket/11849] Move pagination code to class
[ticket/12060] A little less verbose cleanup of event docblocks
[ticket/12060] Further clarifying new event docblocks as much as possible
[ticket/12060] More fixes to dockblock for acp_bbcodes_modify_create event
[ticket/12060] Remove whitespaces
[ticket/12060] Fix docblock for acp_bbcodes_modify_create event
...
Diffstat (limited to 'phpBB/includes/functions_upload.php')
-rw-r--r-- | phpBB/includes/functions_upload.php | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 4181896eca..04d483e14c 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -44,10 +44,16 @@ class filespec var $upload = ''; /** + * The plupload object + * @var \phpbb\plupload\plupload + */ + protected $plupload; + + /** * File Class * @access private */ - function filespec($upload_ary, $upload_namespace) + function filespec($upload_ary, $upload_namespace, \phpbb\plupload\plupload $plupload = null) { if (!isset($upload_ary)) { @@ -80,6 +86,7 @@ class filespec $this->local = (isset($upload_ary['local_mode'])) ? true : false; $this->upload = $upload_namespace; + $this->plupload = $plupload; } /** @@ -161,12 +168,14 @@ class filespec */ function is_uploaded() { - if (!$this->local && !is_uploaded_file($this->filename)) + $is_plupload = $this->plupload && $this->plupload->is_active(); + + if (!$this->local && !$is_plupload && !is_uploaded_file($this->filename)) { return false; } - if ($this->local && !file_exists($this->filename)) + if (($this->local || $is_plupload) && !file_exists($this->filename)) { return false; } @@ -564,16 +573,28 @@ class fileupload * Upload file from users harddisk * * @param string $form_name Form name assigned to the file input field (if it is an array, the key has to be specified) + * @param \phpbb\plupload\plupload $plupload The plupload object + * * @return object $file Object "filespec" is returned, all further operations can be done with this object * @access public */ - function form_upload($form_name) + function form_upload($form_name, \phpbb\plupload\plupload $plupload = null) { global $user, $request; $upload = $request->file($form_name); unset($upload['local_mode']); - $file = new filespec($upload, $this); + + if ($plupload) + { + $result = $plupload->handle_upload($form_name); + if (is_array($result)) + { + $upload = array_merge($upload, $result); + } + } + + $file = new filespec($upload, $this, $plupload); if ($file->init_error) { |