1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-01 14:33:00 +02:00

[ticket/15286] Add event to allow redirects

PHPBB3-15286
This commit is contained in:
Rubén Calvo 2017-08-20 21:44:40 +02:00
parent 3c295abd66
commit 6bd01d1506

View File

@ -266,6 +266,8 @@ else
$display_cat = ATTACHMENT_CATEGORY_NONE;
}
$redirect = '';
/**
* Event to modify data before sending file to browser
*
@ -278,6 +280,7 @@ else
* @var bool thumbnail Flag indicating if the file is a thumbnail
* @since 3.1.6-RC1
* @changed 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions")
* @changed 3.3.0-a1 Add redirect variable
*/
$vars = array(
'attach_id',
@ -286,6 +289,7 @@ else
'extensions',
'mode',
'thumbnail',
'redirect',
);
extract($phpbb_dispatcher->trigger_event('core.download_file_send_to_browser_before', compact($vars)));
@ -306,7 +310,14 @@ else
}
else
{
send_file_to_browser($attachment, $display_cat);
if (!empty($redirect))
{
redirect($redirect, false, true);
}
else {
send_file_to_browser($attachment, $display_cat);
}
file_gc();
}
}