mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/13904] Fix uploading for use with new filespec class
PHPBB3-13904
This commit is contained in:
parent
891ffb8ac7
commit
0cbb713cc2
3 changed files with 16 additions and 10 deletions
|
@ -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);
|
$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;
|
$filedata['post_attach'] = false;
|
||||||
return $filedata;
|
return $filedata;
|
||||||
|
|
|
@ -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[] = '';
|
$file->error[] = '';
|
||||||
return $file;
|
return $file;
|
||||||
|
@ -250,9 +252,11 @@ class fileupload
|
||||||
$upload['type'] = $filedata['type'];
|
$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[] = '';
|
$file->error[] = '';
|
||||||
return $file;
|
return $file;
|
||||||
|
@ -488,7 +492,9 @@ class fileupload
|
||||||
|
|
||||||
$upload_ary['tmp_name'] = $filename;
|
$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);
|
$this->common_checks($file);
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
|
|
|
@ -60,7 +60,7 @@ class filespec
|
||||||
* File Class
|
* File Class
|
||||||
* @access private
|
* @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
|
// @todo call this via files
|
||||||
//$this->set_upload_ary($upload_ary);
|
//$this->set_upload_ary($upload_ary);
|
||||||
|
@ -109,9 +109,9 @@ class filespec
|
||||||
*
|
*
|
||||||
* @return bool True if there was an init error, false if not
|
* @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'];
|
$this->height = $this->image_info['height'];
|
||||||
|
|
||||||
// Check image type
|
// 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']]))
|
if (!isset($types[$this->image_info['type']]) || !in_array($this->extension, $types[$this->image_info['type']]))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue