mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Add option to limit the size of documents and comments
지나치게 용량이 큰 글을 등록하여 서버 과부하나 트래픽을 유발하는 경우가 있음. 예: ㅋㅋㅋ를 1000만 번쯤 복사해서 넣는다거나... 이런 문제를 막기 위해 게시판에서 글과 댓글의 용량을 제한할 수 있도록 함. 지저분한 태그가 많이 붙은 HTML 콘텐츠을 복붙하는 경우에 대비하여 기본값은 글 1024KB, 댓글 128KB로 여유있게 책정하였으며 사이트 특성에 따라 줄이면 됨.
This commit is contained in:
parent
f11d3053f3
commit
adb93006b4
4 changed files with 44 additions and 0 deletions
|
|
@ -38,6 +38,13 @@ class boardController extends board
|
|||
return $this->setError('msg_empty_content');
|
||||
}
|
||||
|
||||
// Return error if content is too large.
|
||||
$document_length_limit = ($this->module_info->document_length_limit ?: 1024) * 1024;
|
||||
if (strlen($obj->content) > $document_length_limit && !$this->grant->manager)
|
||||
{
|
||||
return $this->setError('msg_content_too_long');
|
||||
}
|
||||
|
||||
// unset document style if not manager
|
||||
if(!$this->grant->manager)
|
||||
{
|
||||
|
|
@ -356,7 +363,20 @@ class boardController extends board
|
|||
// get the relevant data for inserting comment
|
||||
$obj = Context::getRequestVars();
|
||||
$obj->module_srl = $this->module_srl;
|
||||
|
||||
// Return error if content is empty.
|
||||
if (is_empty_html_content($obj->content))
|
||||
{
|
||||
return $this->setError('msg_empty_content');
|
||||
}
|
||||
|
||||
// Return error if content is too large.
|
||||
$comment_length_limit = ($this->module_info->comment_length_limit ?: 128) * 1024;
|
||||
if (strlen($obj->content) > $comment_length_limit && !$this->grant->manager)
|
||||
{
|
||||
return $this->setError('msg_content_too_long');
|
||||
}
|
||||
|
||||
if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC';
|
||||
if(!is_array($this->module_info->use_status))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ $lang->about_allow_no_category = 'Allow users to write documents without selecti
|
|||
$lang->protect_content = 'Protect Content';
|
||||
$lang->protect_comment = 'Protect Comment';
|
||||
$lang->protect_regdate = 'Update/Delete Time Limit';
|
||||
$lang->document_length_limit = 'Limit Document Size';
|
||||
$lang->comment_length_limit = 'Limit Comment Size';
|
||||
$lang->about_document_length_limit = 'Restrict documents that are too large. This limit may be triggered by copying and pasting a web page that contains a lot of unnecessary tags.';
|
||||
$lang->about_comment_length_limit = 'Restrict comments that are too large.';
|
||||
$lang->update_order_on_comment = 'Update Document on New Comment';
|
||||
$lang->about_update_order_on_comment = 'When a new comment is posted, update the update timestamp of the parent document. This is needed for forums.';
|
||||
$lang->non_login_vote = 'Allow guest votes';
|
||||
|
|
@ -67,6 +71,7 @@ $lang->msg_board_update_protect_comment = 'You cannot update a comment when ther
|
|||
$lang->msg_protect_regdate_document = 'You cannot update or delete a document after %d days.';
|
||||
$lang->msg_protect_regdate_comment = 'You cannot update or delete a comment after %d days.';
|
||||
$lang->msg_dont_have_update_log = 'This document has no update log.';
|
||||
$lang->msg_content_too_long = 'The content is too long.';
|
||||
$lang->original_letter = 'Original';
|
||||
$lang->msg_warning_update_log = '<span class="x_label x_label-important">Warning!</span> This can massively increase the size of your database.';
|
||||
$lang->comment_delete_message = 'Leave Placeholder for Deleted Comment';
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ $lang->about_allow_no_category = '분류를 선택하지 않은 글도 허용하
|
|||
$lang->protect_content = '글 보호 기능';
|
||||
$lang->protect_comment = '댓글 보호 기능';
|
||||
$lang->protect_regdate = '기간 제한 기능';
|
||||
$lang->document_length_limit = '문서 길이 제한';
|
||||
$lang->comment_length_limit = '댓글 길이 제한';
|
||||
$lang->about_document_length_limit = '지나치게 용량이 큰 글을 작성하지 못하도록 합니다. 지저분한 태그가 많이 붙은 글을 붙여넣기하면 제한을 초과할 수도 있습니다.';
|
||||
$lang->about_comment_length_limit = '지나치게 용량이 큰 댓글을 작성하지 못하도록 합니다.';
|
||||
$lang->update_order_on_comment = '댓글 작성시 글 수정 시각 갱신';
|
||||
$lang->about_update_order_on_comment = '댓글이 작성되면 해당 글의 수정 시각을 갱신합니다. 포럼형 게시판, 최근 댓글 표시 기능 등에 필요합니다.';
|
||||
$lang->non_login_vote = '비회원 추천 허용';
|
||||
|
|
@ -66,6 +70,7 @@ $lang->msg_board_update_protect_comment = '대댓글이 달린 댓글은 수정
|
|||
$lang->msg_protect_regdate_document = '%d일 이상 지난 글은 수정 또는 삭제할 수 없습니다.';
|
||||
$lang->msg_protect_regdate_comment = '%d일 이상 지난 댓글은 수정 또는 삭제할 수 없습니다.';
|
||||
$lang->msg_dont_have_update_log = '업데이트 로그가 기록되어 있지 않은 게시글입니다.';
|
||||
$lang->msg_content_too_long = '내용이 너무 깁니다.';
|
||||
$lang->original_letter = '원본글';
|
||||
$lang->msg_warning_update_log = '<span class="x_label x_label-important">주의!</span> 사용시 디비가 많이 늘어날 수 있습니다.';
|
||||
$lang->reason_update = '수정한 이유';
|
||||
|
|
|
|||
|
|
@ -225,6 +225,20 @@
|
|||
<p class="x_help-block">{$lang->about_anonymous_name}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->document_length_limit}</label>
|
||||
<div class="x_controls">
|
||||
<input type="number" name="document_length_limit" id="document_length_limit" value="{$module_info->document_length_limit ?: 1024}" /> KB
|
||||
<p class="x_help-block">{$lang->about_document_length_limit}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->comment_length_limit}</label>
|
||||
<div class="x_controls">
|
||||
<input type="number" name="comment_length_limit" id="comment_length_limit" value="{$module_info->comment_length_limit ?: 128}" /> KB
|
||||
<p class="x_help-block">{$lang->about_comment_length_limit}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->consultation}</label>
|
||||
<div class="x_controls">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue