[ticket/14285] Remove support for old browsers

PHPBB3-14285
This commit is contained in:
Rubén Calvo 2018-07-11 08:58:53 +02:00 committed by rubencm
parent 0e92744fa4
commit af222e73f3

View file

@ -186,7 +186,6 @@ class attachment extends controller
$vars = array( $vars = array(
'attach_id', 'attach_id',
'attachment', 'attachment',
'display_cat',
'extensions', 'extensions',
'mode', 'mode',
'thumbnail', 'thumbnail',
@ -199,7 +198,7 @@ class attachment extends controller
return new RedirectResponse($redirect); return new RedirectResponse($redirect);
} }
$this->send_file_to_browser($attachment, $display_cat); $this->send_file_to_browser($attachment);
$time = new \Datetime(); $time = new \Datetime();
$this->response->setExpires($time->modify('+1 year')); $this->response->setExpires($time->modify('+1 year'));
@ -211,7 +210,7 @@ class attachment extends controller
/** /**
* Send file to browser * Send file to browser
*/ */
protected function send_file_to_browser($attachment, $category) protected function send_file_to_browser($attachment)
{ {
$filename = $attachment['physical_filename']; $filename = $attachment['physical_filename'];
@ -220,13 +219,6 @@ class attachment extends controller
throw new http_exception(404, 'ERROR_NO_ATTACHMENT'); throw new http_exception(404, 'ERROR_NO_ATTACHMENT');
} }
// Correct the mime type - we force application/octetstream for all files, except images
// Please do not change this, it is a security precaution
if ($category != ATTACHMENT_CATEGORY_IMAGE || strpos($attachment['mimetype'], 'image') !== 0)
{
$attachment['mimetype'] = (strpos(strtolower($this->user->browser), 'msie') !== false || strpos(strtolower($this->user->browser), 'opera') !== false) ? 'application/octetstream' : 'application/octet-stream';
}
/** /**
* Event to alter attachment before it is sent to browser. * Event to alter attachment before it is sent to browser.
* *
@ -238,7 +230,6 @@ class attachment extends controller
*/ */
$vars = array( $vars = array(
'attachment', 'attachment',
'category',
'filename', 'filename',
); );
extract($this->dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars))); extract($this->dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars)));