phpBB

Code Changes

File: includes/functions_download.php

  Unmodified   Added   Modified   Removed
Line 124Line 124
*/
function send_file_to_browser($attachment, $upload_dir, $category)
{

*/
function send_file_to_browser($attachment, $upload_dir, $category)
{

	global $user, $db, $config, $phpbb_root_path;

	global $user, $db, $config, $phpbb_dispatcher, $phpbb_root_path;


$filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename'];



$filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename'];


Line 148Line 148

// Now send the File Contents to the Browser
$size = @filesize($filename);


// Now send the File Contents to the Browser
$size = @filesize($filename);

 

/**
* Event to alter attachment before it is sent to browser.
*
* @event core.send_file_to_browser_before
* @var array attachment Attachment data
* @var string upload_dir Relative path of upload directory
* @var int category Attachment category
* @var string filename Path to file, including filename
* @var int size File size
* @since 3.1.11-RC1
*/
$vars = array(
'attachment',
'upload_dir',
'category',
'filename',
'size',
);
extract($phpbb_dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars)));


// To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work)



// To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work)


Line 677Line 697
*/
function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id)
{

*/
function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id)
{

 
	global $phpbb_dispatcher;


	if (!$auth->acl_get('u_pm_download'))
{
send_status_line(403, 'Forbidden');

	if (!$auth->acl_get('u_pm_download'))
{
send_status_line(403, 'Forbidden');

Line 684Line 706
	}

$allowed = phpbb_download_check_pm_auth($db, $user_id, $msg_id);

	}

$allowed = phpbb_download_check_pm_auth($db, $user_id, $msg_id);

 

/**
* Event to modify PM attachments download auth
*
* @event core.modify_pm_attach_download_auth
* @var bool allowed Whether the user is allowed to download from that PM or not
* @var int msg_id The id of the PM to download from
* @var int user_id The user id for auth check
* @since 3.1.11-RC1
*/
$vars = array('allowed', 'msg_id', 'user_id');
extract($phpbb_dispatcher->trigger_event('core.modify_pm_attach_download_auth', compact($vars)));


if (!$allowed)
{


if (!$allowed)
{