diff --git a/modules/file/file.admin.controller.php b/modules/file/file.admin.controller.php
index 1f31ff0ab..0b93d6c54 100644
--- a/modules/file/file.admin.controller.php
+++ b/modules/file/file.admin.controller.php
@@ -127,9 +127,10 @@ class fileAdminController extends file
{
// Update configuration
$config = getModel('module')->getModuleConfig('file');
- $config->allow_outlink = Context::get('allow_outlink');
+ $config->allow_outlink = Context::get('allow_outlink') === 'N' ? 'N' : 'Y';
$config->allow_outlink_format = Context::get('allow_outlink_format');
$config->allow_outlink_site = Context::get('allow_outlink_site');
+ $config->allow_multimedia_direct_download = Context::get('allow_multimedia_direct_download') === 'Y' ? 'Y' : 'N';
$config->download_short_url = Context::get('download_short_url') === 'Y' ? 'Y' : 'N';
$config->inline_download_format = array_map('utf8_trim', Context::get('inline_download_format'));
diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php
index cf9fb1f8e..2cd31cd31 100644
--- a/modules/file/file.controller.php
+++ b/modules/file/file.controller.php
@@ -955,7 +955,15 @@ class fileController extends file
{
$storage_path = $this->getStoragePath('binaries', $args->file_srl, $module_srl, $upload_target_srl, $args->regdate);
}
- $args->direct_download = $direct ? 'Y' : 'N';
+
+ if($config->allow_multimedia_direct_download !== 'N')
+ {
+ $args->direct_download = $direct ? 'Y' : 'N';
+ }
+ else
+ {
+ $args->direct_download = Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($args->source_filename, false) ? 'Y' : 'N';
+ }
// Create a directory
if(!Rhymix\Framework\Storage::isDirectory($storage_path) && !Rhymix\Framework\Storage::createDirectory($storage_path))
diff --git a/modules/file/lang/en.php b/modules/file/lang/en.php
index f2578e730..d5d5eba66 100644
--- a/modules/file/lang/en.php
+++ b/modules/file/lang/en.php
@@ -15,6 +15,7 @@ $lang->file_list = 'Attachment List';
$lang->allow_outlink = 'Allow External Link to Download URL';
$lang->allow_outlink_site = 'Allowed Websites';
$lang->allow_outlink_format = 'Allowed Formats';
+$lang->allow_multimedia_direct_download = 'Allow Direct Link to Multimedia Attachments';
$lang->allowed_filesize = 'Maximum File Size';
$lang->allowed_attach_size = 'Maximum Attachments';
$lang->allowed_filetypes = 'Allowed extentsions';
@@ -34,6 +35,7 @@ $lang->enable_download_group = 'Downloadable Groups';
$lang->about_allow_outlink = 'Allow other websites to link directly to your download URLs.
Rhymix does not control links to image files that can be embedded directly in a document.
in order to block external links to such images, you may need to modify your web server configuration.';
$lang->about_allow_outlink_format = 'These file formats will always be allowed.
Please use a comma (,) to separate items: e.g. doc, zip, pdf';
$lang->about_allow_outlink_site = 'These referers will always be allowed.
Please enter one full address per line: e.g. https://www.rhymix.org/';
+$lang->about_allow_multimedia_direct_download = 'Use directly accessible links for audio and video attachments.
This helps reduce server load, as the download of such large files will not go through PHP.
However, unprivileged users may be able to download audio and video files if the link is exposed.';
$lang->about_allowed_filesize = 'You can limit the size of each attached file.
Administrators are limited to this setting or the limit set in the file module, whichever is greater.';
$lang->about_allowed_attach_size = 'You can limit the total size of all attached files in one document.
Administrators are limited to this setting or the limit set in the file module, whichever is greater.';
$lang->about_allowed_filesize_global = 'This is the global limit on the size of each attachment.';
diff --git a/modules/file/lang/ko.php b/modules/file/lang/ko.php
index 8e64ff63a..f0a419f62 100644
--- a/modules/file/lang/ko.php
+++ b/modules/file/lang/ko.php
@@ -18,6 +18,7 @@ $lang->allow_outlink_format = '외부 접근 허용 확장자';
$lang->allowed_filesize = '파일 용량 제한';
$lang->allowed_attach_size = '문서 첨부 제한';
$lang->allowed_filetypes = '허용 확장자';
+$lang->allow_multimedia_direct_download = '멀티미디어 파일 직접 접근 허용';
$lang->download_short_url = '다운로드시 짧은주소 사용';
$lang->inline_download_format = '다운로드시 현재 창 사용';
$lang->inline_download_image = '이미지';
@@ -34,6 +35,7 @@ $lang->enable_download_group = '다운로드 가능 그룹';
$lang->about_allow_outlink = '다른 사이트에서 파일 다운로드 링크에 직접 접근하는 것을 허용합니다.
본문에 바로 삽입할 수 있는 이미지 파일은 라이믹스에서 접근을 통제할 수 없으며, 이를 차단하려면 웹서버 설정이 필요합니다.';
$lang->about_allow_outlink_format = '파일 외부 링크 설정에 상관없이 허용하는 파일 확장자입니다.
여러 개 입력시 쉼표(,)을 이용해서 구분해 주세요. 예) doc, zip, pdf';
$lang->about_allow_outlink_site = '파일 외부 링크 설정에 상관없이 허용하는 사이트 주소입니다.
여러 개 입력시 줄을 바꿔서 구분해 주세요. 예) https://www.rhymix.org/';
+$lang->about_allow_multimedia_direct_download = '오디오, 동영상 등의 멀티미디어 파일 링크를 본문에 삽입할 때 직접 접근이 가능한 링크를 사용합니다.
다운로드시 PHP를 거치지 않게 되므로 서버 부하가 줄어들지만, 권한이 없는 사람에게 링크가 노출되지 않도록 주의해야 합니다.';
$lang->about_allowed_filesize = '각 파일의 용량을 제한할 수 있습니다.
관리자에게는 이 게시판의 제한과 파일 모듈의 제한 중 높은 쪽이 적용됩니다.';
$lang->about_allowed_attach_size = '하나의 문서에 첨부할 수 있는 최대 용량을 제한할 수 있습니다.
관리자에게는 이 게시판의 제한과 파일 모듈의 제한 중 높은 쪽이 적용됩니다.';
$lang->about_allowed_filesize_global = '관리자를 포함하여 사이트 전체에 적용되는 파일 용량 제한입니다.';
diff --git a/modules/file/tpl/download_config.html b/modules/file/tpl/download_config.html
index 74902252c..8f0e1edf0 100644
--- a/modules/file/tpl/download_config.html
+++ b/modules/file/tpl/download_config.html
@@ -30,6 +30,14 @@
{$lang->about_allow_outlink_site}
+{$lang->about_allow_multimedia_direct_download}
+