diff --git a/modules/board/board.controller.php b/modules/board/board.controller.php index d5f1fcae9..5de51d5ac 100644 --- a/modules/board/board.controller.php +++ b/modules/board/board.controller.php @@ -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)) { diff --git a/modules/board/lang/en.php b/modules/board/lang/en.php index 502aeef6c..2f4d21609 100644 --- a/modules/board/lang/en.php +++ b/modules/board/lang/en.php @@ -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 = 'Warning! This can massively increase the size of your database.'; $lang->comment_delete_message = 'Leave Placeholder for Deleted Comment'; diff --git a/modules/board/lang/ko.php b/modules/board/lang/ko.php index a4a05406d..7de816f9e 100644 --- a/modules/board/lang/ko.php +++ b/modules/board/lang/ko.php @@ -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 = '주의! 사용시 디비가 많이 늘어날 수 있습니다.'; $lang->reason_update = '수정한 이유'; diff --git a/modules/board/tpl/board_insert.html b/modules/board/tpl/board_insert.html index 042964d6a..08198b380 100644 --- a/modules/board/tpl/board_insert.html +++ b/modules/board/tpl/board_insert.html @@ -225,6 +225,20 @@

{$lang->about_anonymous_name}

+
+ +
+ KB +

{$lang->about_document_length_limit}

+
+
+
+ +
+ KB +

{$lang->about_comment_length_limit}

+
+