aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_download.php
diff options
context:
space:
mode:
authorjaviexin <javiexin@gmail.com>2017-02-10 14:41:42 +0100
committerGitHub <noreply@github.com>2017-02-10 14:41:42 +0100
commitfc50fd272b9685221e130114b2365b23bd543048 (patch)
tree94e95ddbc792d66ecd508f8db7293f76801f6caf /phpBB/includes/functions_download.php
parent09f6637597fff1dcdfc6117067c1f758fa23f60d (diff)
parent1470985ff20197589cbbab96180d80b0148d20d5 (diff)
downloadforums-fc50fd272b9685221e130114b2365b23bd543048.tar
forums-fc50fd272b9685221e130114b2365b23bd543048.tar.gz
forums-fc50fd272b9685221e130114b2365b23bd543048.tar.bz2
forums-fc50fd272b9685221e130114b2365b23bd543048.tar.xz
forums-fc50fd272b9685221e130114b2365b23bd543048.zip
Merge branch '3.1.x' into ticket/15081
Diffstat (limited to 'phpBB/includes/functions_download.php')
-rw-r--r--phpBB/includes/functions_download.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php
index 86c60c31ff..053e362682 100644
--- a/phpBB/includes/functions_download.php
+++ b/phpBB/includes/functions_download.php
@@ -124,7 +124,7 @@ function wrap_img_in_html($src, $title)
*/
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'];
@@ -149,6 +149,26 @@ function send_file_to_browser($attachment, $upload_dir, $category)
// 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)
// Check if headers already sent or not able to get the file contents.