aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-05-31 14:47:57 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-09-09 08:27:35 +0200
commit0cbb713cc2a6249cb12507db7d0fa78ce8663ae6 (patch)
tree77e3ca909b083376ad20eda4c356e917b935de70 /phpBB
parent891ffb8ac76637f1ee84c16464ec6ad654131126 (diff)
downloadforums-0cbb713cc2a6249cb12507db7d0fa78ce8663ae6.tar
forums-0cbb713cc2a6249cb12507db7d0fa78ce8663ae6.tar.gz
forums-0cbb713cc2a6249cb12507db7d0fa78ce8663ae6.tar.bz2
forums-0cbb713cc2a6249cb12507db7d0fa78ce8663ae6.tar.xz
forums-0cbb713cc2a6249cb12507db7d0fa78ce8663ae6.zip
[ticket/13904] Fix uploading for use with new filespec class
PHPBB3-13904
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions_posting.php2
-rw-r--r--phpBB/includes/functions_upload.php16
-rw-r--r--phpBB/phpbb/files/filespec.php8
3 files changed, 16 insertions, 10 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index e4520d7f03..e91f8bb56d 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -435,7 +435,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
$file = ($local) ? $upload->local_upload($local_storage, $local_filedata, $mimetype_guesser) : $upload->form_upload($form_name, $mimetype_guesser, $plupload);
- if ($file->init_error)
+ if ($file->init_error())
{
$filedata['post_attach'] = false;
return $filedata;
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 220d31098c..c759631c47 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -169,9 +169,11 @@ class fileupload
}
}
- $file = new filespec($upload, $this, $this->filesystem, $mimetype_guesser, $plupload);
+ $file = new \phpbb\files\filespec($this->filesystem, $mimetype_guesser, $plupload);
+ $file->set_upload_ary($upload);
+ $file->set_upload_namespace($this);
- if ($file->init_error)
+ if ($file->init_error())
{
$file->error[] = '';
return $file;
@@ -250,9 +252,11 @@ class fileupload
$upload['type'] = $filedata['type'];
}
- $file = new filespec($upload, $this, $this->filesystem, $mimetype_guesser);
+ $file = new \phpbb\files\filespec($this->filesystem, $mimetype_guesser);
+ $file->set_upload_ary($upload);
+ $file->set_upload_namespace($this);
- if ($file->init_error)
+ if ($file->init_error())
{
$file->error[] = '';
return $file;
@@ -488,7 +492,9 @@ class fileupload
$upload_ary['tmp_name'] = $filename;
- $file = new filespec($upload_ary, $this, $this->filesystem, $mimetype_guesser);
+ $file = new \phpbb\files\filespec($this->filesystem, $mimetype_guesser);
+ $file->set_upload_ary($upload_ary);
+ $file->set_upload_namespace($this);
$this->common_checks($file);
return $file;
diff --git a/phpBB/phpbb/files/filespec.php b/phpBB/phpbb/files/filespec.php
index 4e52d13d01..8501b217f7 100644
--- a/phpBB/phpbb/files/filespec.php
+++ b/phpBB/phpbb/files/filespec.php
@@ -60,7 +60,7 @@ class filespec
* File Class
* @access private
*/
- function filespec(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
+ function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
// @todo call this via files
//$this->set_upload_ary($upload_ary);
@@ -109,9 +109,9 @@ class filespec
*
* @return bool True if there was an init error, false if not
*/
- protected function init_error()
+ public function init_error()
{
- return !isset($upload_ary);
+ return !isset($this->filename);
}
/**
@@ -422,7 +422,7 @@ class filespec
$this->height = $this->image_info['height'];
// Check image type
- $types = fileupload::image_types();
+ $types = \fileupload::image_types();
if (!isset($types[$this->image_info['type']]) || !in_array($this->extension, $types[$this->image_info['type']]))
{