mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/15286] Add event to allow redirects
PHPBB3-15286
This commit is contained in:
parent
3c295abd66
commit
6bd01d1506
1 changed files with 12 additions and 1 deletions
|
@ -266,6 +266,8 @@ else
|
||||||
$display_cat = ATTACHMENT_CATEGORY_NONE;
|
$display_cat = ATTACHMENT_CATEGORY_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$redirect = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event to modify data before sending file to browser
|
* 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
|
* @var bool thumbnail Flag indicating if the file is a thumbnail
|
||||||
* @since 3.1.6-RC1
|
* @since 3.1.6-RC1
|
||||||
* @changed 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions")
|
* @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(
|
$vars = array(
|
||||||
'attach_id',
|
'attach_id',
|
||||||
|
@ -286,6 +289,7 @@ else
|
||||||
'extensions',
|
'extensions',
|
||||||
'mode',
|
'mode',
|
||||||
'thumbnail',
|
'thumbnail',
|
||||||
|
'redirect',
|
||||||
);
|
);
|
||||||
extract($phpbb_dispatcher->trigger_event('core.download_file_send_to_browser_before', compact($vars)));
|
extract($phpbb_dispatcher->trigger_event('core.download_file_send_to_browser_before', compact($vars)));
|
||||||
|
|
||||||
|
@ -306,7 +310,14 @@ else
|
||||||
}
|
}
|
||||||
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();
|
file_gc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue