Add config to control short URL for downloading

This commit is contained in:
Kijin Sung 2020-03-15 00:54:56 +09:00
parent e6305404c5
commit 320d5596f6
5 changed files with 15 additions and 1 deletions

View file

@ -130,6 +130,7 @@ class fileAdminController extends file
$config->allow_outlink = Context::get('allow_outlink');
$config->allow_outlink_format = Context::get('allow_outlink_format');
$config->allow_outlink_site = Context::get('allow_outlink_site');
$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'));
// Save and redirect

View file

@ -300,6 +300,7 @@ class fileModel extends file
$config->allowed_filetypes = $config->allowed_filetypes ?? '*.*';
$config->allow_outlink = $config->allow_outlink ?? 'Y';
$config->download_grant = $config->download_grant ?? [];
$config->download_short_url = $config->download_short_url ?? 'N';
$config->inline_download_format = $config->inline_download_format ?? [];
$config->image_autoconv = $config->image_autoconv ?? [];
$config->image_quality_adjustment = $config->image_quality_adjustment ?? 75;

View file

@ -18,6 +18,7 @@ $lang->allow_outlink_format = 'Allowed Formats';
$lang->allowed_filesize = 'Maximum File Size';
$lang->allowed_attach_size = 'Maximum Attachments';
$lang->allowed_filetypes = 'Allowed extentsions';
$lang->download_short_url = 'Use short URL';
$lang->inline_download_format = 'Open in current window';
$lang->inline_download_image = 'Image';
$lang->inline_download_audio = 'Audio';
@ -27,6 +28,7 @@ $lang->inline_download_pdf = 'PDF';
$lang->file_save_changelog = 'Save changelog';
$lang->use_default_file_config = 'Use Default Settings';
$lang->about_use_default_file_config = 'Follow the default settings from the File module.';
$lang->about_download_short_url = 'Using short URLs can fix broken filenames in Android and some other platforms.<br />Short URLs must be enabled, and rewrite rules must be updated to the latest version if you use nginx.';
$lang->about_inline_download_format = 'Selected types of files will be opened in the current window instead of a download dialog when a user clicks the download link.';
$lang->enable_download_group = 'Downloadable Groups';
$lang->about_allow_outlink = 'Allow other websites to link directly to your download URLs.<br />Rhymix does not control links to image files that can be embedded directly in a document.<br />in order to block external links to such images, you may need to modify your web server configuration.';
@ -101,4 +103,4 @@ $lang->about_video_mp4_gif_time = 'treat silent MP4 videos with duration less th
$lang->ffmpeg_path = 'FFmpeg path';
$lang->ffprobe_path = 'FFprobe path';
$lang->msg_cannot_use_ffmpeg = 'FFmpeg and FFprobe must can be executed by PHP.';
$lang->msg_cannot_use_exif = 'PHP Exif module is required.';
$lang->msg_cannot_use_exif = 'PHP Exif module is required.';

View file

@ -18,6 +18,7 @@ $lang->allow_outlink_format = '외부 접근 허용 확장자';
$lang->allowed_filesize = '파일 용량 제한';
$lang->allowed_attach_size = '문서 첨부 제한';
$lang->allowed_filetypes = '허용 확장자';
$lang->download_short_url = '다운로드시 짧은주소 사용';
$lang->inline_download_format = '다운로드시 현재 창 사용';
$lang->inline_download_image = '이미지';
$lang->inline_download_audio = '오디오';
@ -27,6 +28,7 @@ $lang->inline_download_pdf = 'PDF';
$lang->file_save_changelog = '변경 내역 기록';
$lang->use_default_file_config = '기본 파일 설정 사용';
$lang->about_use_default_file_config = '파일 모듈의 기본 설정을 따릅니다.';
$lang->about_download_short_url = '안드로이드 등 일부 환경에서 첨부파일 다운로드시 파일명이 깨지는 문제를 해결할 수 있습니다.<br />짧은주소 사용이 활성화되어 있어야 하며, nginx 사용시 rewrite 규칙을 최신 버전으로 업데이트하여야 합니다.';
$lang->about_inline_download_format = '선택한 종류의 파일은 다운로드 링크를 클릭하더라도 다운로드 창을 열지 않고 현재 창에 표시합니다.';
$lang->enable_download_group = '다운로드 가능 그룹';
$lang->about_allow_outlink = '다른 사이트에서 파일 다운로드 링크에 직접 접근하는 것을 허용합니다.<br />본문에 바로 삽입할 수 있는 이미지 파일은 라이믹스에서 접근을 통제할 수 없으며, 이를 차단하려면 웹서버 설정이 필요합니다.';

View file

@ -30,6 +30,14 @@
<p class="x_help-block">{$lang->about_allow_outlink_site}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->download_short_url}</label>
<div class="x_controls">
<label class="x_inline"><input type="radio" name="download_short_url" value="Y" checked="checked"|cond="$config->download_short_url === 'Y' && config('use_rewrite')" disabled="disabled"|cond="!config('use_rewrite')" /> {$lang->cmd_yes}</label>
<label class="x_inline"><input type="radio" name="download_short_url" value="N" checked="checked"|cond="$config->download_short_url !== 'Y' || !config('use_rewrite')" disabled="disabled"|cond="!config('use_rewrite')" /> {$lang->cmd_no}</label>
<p class="x_help-block">{$lang->about_download_short_url}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->inline_download_format}</label>
<div class="x_controls">