[ticket/14285] Remove support for old browsers

PHPBB3-14285
This commit is contained in:
Rubén Calvo 2018-06-30 04:04:19 +02:00 committed by rubencm
parent 2f043cdb61
commit 0b136a6231
3 changed files with 2 additions and 22 deletions

View file

@ -43,26 +43,6 @@ function wrap_img_in_html($src, $title)
echo '</html>'; echo '</html>';
} }
/**
* Get a browser friendly UTF-8 encoded filename
*/
function header_filename($file)
{
global $request;
$user_agent = $request->header('User-Agent');
// There be dragons here.
// Not many follows the RFC...
if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Konqueror') !== false)
{
return "filename=" . rawurlencode($file);
}
// follow the RFC for extended filename for the rest
return "filename*=UTF-8''" . rawurlencode($file);
}
/** /**
* Garbage Collection * Garbage Collection
* *

View file

@ -313,7 +313,7 @@ class attachment extends controller
} }
else else
{ {
header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . "; filename*=UTF-8''" . rawurlencode(htmlspecialchars_decode($attachment['real_filename'])));
if (strpos($attachment['mimetype'], 'image') !== 0) if (strpos($attachment['mimetype'], 'image') !== 0)
{ {

View file

@ -66,7 +66,7 @@ class avatar extends controller
{ {
if (!headers_sent()) if (!headers_sent())
{ {
header('Content-Disposition: inline; ' . header_filename($file)); header("Content-Disposition: inline; filename*=UTF-8''" . rawurlencode($file));
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600*24*365) . ' GMT'); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600*24*365) . ' GMT');
} }