phpBB

Code Changes

File: phpbb/plupload/plupload.php

  Unmodified   Added   Modified   Removed
Line 39Line 39
	protected $user;

/**

	protected $user;

/**

	* @var \phpbb\php\ini

	* @var \bantu\IniGetWrapper\IniGetWrapper

	*/
protected $php_ini;


	*/
protected $php_ini;


Line 67Line 67
	* @param \phpbb\config\config $config
* @param \phpbb\request\request_interface $request
* @param \phpbb\user $user

	* @param \phpbb\config\config $config
* @param \phpbb\request\request_interface $request
* @param \phpbb\user $user

	* @param \phpbb\php\ini $php_ini

	* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini

	* @param \phpbb\mimetype\guesser $mimetype_guesser
*/

	* @param \phpbb\mimetype\guesser $mimetype_guesser
*/

	public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \phpbb\php\ini $php_ini, \phpbb\mimetype\guesser $mimetype_guesser)

	public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \phpbb\mimetype\guesser $mimetype_guesser)

	{
$this->phpbb_root_path = $phpbb_root_path;
$this->config = $config;

	{
$this->phpbb_root_path = $phpbb_root_path;
$this->config = $config;

Line 125Line 125
			// Need to modify some of the $_FILES values to reflect the new file
return array(
'tmp_name' => $file_path,

			// Need to modify some of the $_FILES values to reflect the new file
return array(
'tmp_name' => $file_path,

				'name' => $this->request->variable('real_filename', ''),

				'name' => $this->request->variable('real_filename', '', true),

				'size' => filesize($file_path),
'type' => $this->mimetype_guesser->guess($file_path, $file_name),
);

				'size' => filesize($file_path),
'type' => $this->mimetype_guesser->guess($file_path, $file_name),
);

Line 266Line 266
		if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0)
{
$resize = sprintf(

		if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0)
{
$resize = sprintf(

				'resize: {width: %d, height: %d, quality: 100},',
(int) $this->config['img_max_height'],
(int) $this->config['img_max_width']

				'resize: {width: %d, height: %d, quality: 85},',
(int) $this->config['img_max_width'],
(int) $this->config['img_max_height']

			);
}


			);
}


Line 284Line 284
	public function get_chunk_size()
{
$max = min(

	public function get_chunk_size()
{
$max = min(

			$this->php_ini->get_bytes('upload_max_filesize'),
$this->php_ini->get_bytes('post_max_size'),
max(1, $this->php_ini->get_bytes('memory_limit')),

			$this->php_ini->getBytes('upload_max_filesize'),
$this->php_ini->getBytes('post_max_size'),
max(1, $this->php_ini->getBytes('memory_limit')),

			$this->config['max_filesize']
);


			$this->config['max_filesize']
);


Line 303Line 303
			$this->temporary_directory,
$this->config['plupload_salt'],
md5($file_name),

			$this->temporary_directory,
$this->config['plupload_salt'],
md5($file_name),

			\filespec::get_extension($file_name)

			\phpbb\files\filespec::get_extension($file_name)

		);
}


		);
}


Line 326Line 326

$tmp_file = $this->temporary_filepath($upload['tmp_name']);



$tmp_file = $this->temporary_filepath($upload['tmp_name']);


		if (!move_uploaded_file($upload['tmp_name'], $tmp_file))

		if (!phpbb_is_writable($this->temporary_directory) || !move_uploaded_file($upload['tmp_name'], $tmp_file))

		{
$this->emit_error(103, 'PLUPLOAD_ERR_MOVE_UPLOADED');
}

		{
$this->emit_error(103, 'PLUPLOAD_ERR_MOVE_UPLOADED');
}