aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/plupload/plupload.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-07-20 21:37:34 +0200
committerMarc Alexander <admin@m-a-styles.de>2014-07-20 21:37:34 +0200
commitb94ce7b93209f232e40bcd254b33bd4094ef01e0 (patch)
treed41c170d970a502bbcb8af098430c32025918f24 /phpBB/phpbb/plupload/plupload.php
parent449ffbe7992bcda2f28ceaf861329e913575149a (diff)
downloadforums-b94ce7b93209f232e40bcd254b33bd4094ef01e0.tar
forums-b94ce7b93209f232e40bcd254b33bd4094ef01e0.tar.gz
forums-b94ce7b93209f232e40bcd254b33bd4094ef01e0.tar.bz2
forums-b94ce7b93209f232e40bcd254b33bd4094ef01e0.tar.xz
forums-b94ce7b93209f232e40bcd254b33bd4094ef01e0.zip
[ticket/12560] Add methods to set upload and temp paths in plupload
The paths will be reset to the default paths after an upload is complete. PHPBB3-12560
Diffstat (limited to 'phpBB/phpbb/plupload/plupload.php')
-rw-r--r--phpBB/phpbb/plupload/plupload.php31
1 files changed, 29 insertions, 2 deletions
diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php
index c610d49a63..3c686a552f 100644
--- a/phpBB/phpbb/plupload/plupload.php
+++ b/phpBB/phpbb/plupload/plupload.php
@@ -79,8 +79,7 @@ class plupload
$this->php_ini = $php_ini;
$this->mimetype_guesser = $mimetype_guesser;
- $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path'];
- $this->temporary_directory = $this->upload_directory . '/plupload';
+ $this->set_default_directories();
}
/**
@@ -120,6 +119,9 @@ class plupload
{
rename("{$file_path}.part", $file_path);
+ // Reset upload directories to defaults once completed
+ $this->set_default_directories();
+
// Need to modify some of the $_FILES values to reflect the new file
return array(
'tmp_name' => $file_path,
@@ -372,4 +374,29 @@ class plupload
);
}
}
+
+ /**
+ * Sets the default directories for uploads
+ *
+ * @return null
+ */
+ protected function set_default_directories()
+ {
+ $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path'];
+ $this->temporary_directory = $this->upload_directory . '/plupload';
+ }
+
+ /**
+ * Sets the upload directories to the specified paths
+ *
+ * @param string $upload_directory Upload directory
+ * @param string $temporary_directory Temporary directory
+ *
+ * @return null
+ */
+ public function set_upload_directories($upload_directory, $temporary_directory)
+ {
+ $this->upload_directory = $upload_directory;
+ $this->temporary_directory = $temporary_directory;
+ }
}