mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-27 06:13:32 +09:00
Move RFC5987 encoding function to UA class
This commit is contained in:
parent
8fe8c9203e
commit
c3fe8d265b
2 changed files with 63 additions and 19 deletions
|
|
@ -342,25 +342,8 @@ class fileController extends file
|
|||
exit();
|
||||
}
|
||||
|
||||
// Filename encoding for browsers that support RFC 5987
|
||||
if(preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11)
|
||||
{
|
||||
$filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"';
|
||||
}
|
||||
elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6)
|
||||
{
|
||||
$filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"';
|
||||
}
|
||||
// Filename encoding for browsers that do not support RFC 5987
|
||||
elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
|
||||
{
|
||||
$filename = rawurlencode($filename);
|
||||
$filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename_param = 'filename="' . $filename . '"';
|
||||
}
|
||||
// Encode the filename.
|
||||
$filename_param = Rhymix\Framework\UA::encodeFilenameForDownload($filename);
|
||||
|
||||
// Close context to prevent blocking the session
|
||||
Context::close();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue