phpBB

Code Changes

File: phpbb/plupload/plupload.php

  Unmodified   Added   Modified   Removed
Line 163Line 163
			'S_PLUPLOAD'		=> true,
'FILTERS' => $filters,
'CHUNK_SIZE' => $chunk_size,

			'S_PLUPLOAD'		=> true,
'FILTERS' => $filters,
'CHUNK_SIZE' => $chunk_size,

			'S_PLUPLOAD_URL'	=> htmlspecialchars_decode($s_action),

			'S_PLUPLOAD_URL'	=> html_entity_decode($s_action, ENT_COMPAT),

			'MAX_ATTACHMENTS'	=> $max_files,
'ATTACH_ORDER' => ($this->config['display_order']) ? 'asc' : 'desc',
'L_TOO_MANY_ATTACHMENTS' => $this->user->lang('TOO_MANY_ATTACHMENTS', $max_files),

			'MAX_ATTACHMENTS'	=> $max_files,
'ATTACH_ORDER' => ($this->config['display_order']) ? 'asc' : 'desc',
'L_TOO_MANY_ATTACHMENTS' => $this->user->lang('TOO_MANY_ATTACHMENTS', $max_files),

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

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

 
			$preserve_headers_value = $this->config['img_strip_metadata'] ? 'false' : 'true';

			$resize = sprintf(

			$resize = sprintf(

				'resize: {width: %d, height: %d, quality: 85},',

				'resize: {width: %d, height: %d, quality: %d, preserve_headers: %s},',

				(int) $this->config['img_max_width'],

				(int) $this->config['img_max_width'],

				(int) $this->config['img_max_height']



				(int) $this->config['img_max_height'],
(int) $this->config['img_quality'],
$preserve_headers_value

			);
}


			);
}


Line 274Line 277
	}

/**

	}

/**

	* Checks various php.ini values and the maximum file size to determine
* the maximum size chunks a file can be split up into for upload







	 * Checks various php.ini values to determine the maximum chunk
* size a file should be split into for upload.
*
* The intention is to calculate a value which reflects whatever
* the most restrictive limit is set to. And to then set the chunk
* size to half that value, to ensure any required transfer overhead
* and POST data remains well within the limit. Or, if all of the
* limits are set to unlimited, the chunk size will also be unlimited.

	*
* @return int

	*
* @return int

 
	 *
* @access public

	*/
public function get_chunk_size()
{

	*/
public function get_chunk_size()
{

		$max = min(




		$max = 0;

$limits = [
$this->php_ini->getBytes('memory_limit'),

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

			$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']
);







		];

foreach ($limits as $limit_type)
{
if ($limit_type > 0)
{
$max = ($max !== 0) ? min($limit_type, $max) : $limit_type;
}
}





		// Use half of the maximum possible to leave plenty of room for other
// POST data.

 
		return floor($max / 2);
}


		return floor($max / 2);
}


Line 310Line 328
	* by PHP and actually exists, if not, it generates an error
*
* @param string $form_name The name of the file in the form data

	* by PHP and actually exists, if not, it generates an error
*
* @param string $form_name The name of the file in the form data

 
	* @param int $chunk Chunk number
* @param string $file_path File path

	*
* @return null
*/

	*
* @return null
*/