Fix #769 #1359 remove problematic characters in board module

This commit is contained in:
Kijin Sung 2020-07-31 15:03:24 +09:00
parent a740f39538
commit 4c9f2ec3a1
4 changed files with 44 additions and 0 deletions

View file

@ -32,6 +32,23 @@ class boardController extends board
$obj->module_srl = $this->module_srl;
$obj->commentStatus = $obj->comment_status;
// Remove disallowed Unicode symbols.
if ($this->module_info->filter_specialchars !== 'N')
{
if (isset($obj->title))
{
$obj->title = utf8_clean($obj->title);
}
if (isset($obj->content))
{
$obj->content = utf8_clean($obj->content);
}
if (isset($obj->tags))
{
$obj->tags = utf8_clean($obj->tags);
}
}
// Return error if content is empty.
if (is_empty_html_content($obj->content))
{
@ -371,6 +388,15 @@ class boardController extends board
$obj = Context::getRequestVars();
$obj->module_srl = $this->module_srl;
// Remove disallowed Unicode symbols.
if ($this->module_info->filter_specialchars !== 'N')
{
if (isset($obj->content))
{
$obj->content = utf8_clean($obj->content);
}
}
// Return error if content is empty.
if (is_empty_html_content($obj->content))
{

View file

@ -57,6 +57,8 @@ $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->cancel_vote = 'Vote Cancellation';
$lang->filter_specialchars = 'Block Abuse of Unicode Symbols';
$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.';
@ -64,6 +66,8 @@ $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';
$lang->about_cancel_vote = 'Allow users to cancel their votes';
$lang->about_filter_specialchars = 'Prevent use of excessive Unicode accents, RLO characters, and other symbols that hinder readability.';
$lang->document_force_to_move = 'Delete to Trash';
$lang->about_document_force_to_move = 'When a document is deleted, move to Trash instead of deleting it permamently.';
$lang->about_non_login_vote = 'Allow users who are not logged in to vote on articles.';

View file

@ -59,6 +59,7 @@ $lang->protect_content = '글 보호 기능';
$lang->protect_comment = '댓글 보호 기능';
$lang->protect_regdate = '기간 제한 기능';
$lang->cancel_vote = '추천/비추천/신고 취소 허용';
$lang->filter_specialchars = '유니코드 특수문자 오남용 금지';
$lang->document_length_limit = '문서 길이 제한';
$lang->comment_length_limit = '댓글 길이 제한';
$lang->about_document_length_limit = '지나치게 용량이 큰 글을 작성하지 못하도록 합니다. 지저분한 태그가 많이 붙은 글을 붙여넣기하면 제한을 초과할 수도 있습니다.';
@ -67,6 +68,7 @@ $lang->update_order_on_comment = '댓글 작성시 글 수정 시각 갱신';
$lang->about_update_order_on_comment = '댓글이 작성되면 해당 글의 수정 시각을 갱신합니다. 포럼형 게시판, 최근 댓글 표시 기능 등에 필요합니다.';
$lang->non_login_vote = '비회원 추천 허용';
$lang->about_cancel_vote = '추천 비추천 신고를 취소할 수 있습니다.';
$lang->about_filter_specialchars = '가독성에 악영향을 주는 과도한 유니코드 악센트 기호의 조합, RLO 문자 등의 사용을 금지합니다.';
$lang->about_non_login_vote = '로그인하지 않은 방문자도 추천할 수 있도록 합니다.';
$lang->about_protect_regdate = '글이나 댓글을 작성한 후 일정 기간이 지나면 수정 또는 삭제할 수 없도록 합니다. (단위 : day)';
$lang->about_protect_content = '댓글이 달린 글은 수정 또는 삭제할 수 없도록 합니다.';

View file

@ -330,6 +330,18 @@
<p class="x_help-block">{$lang->about_cancel_vote}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->filter_specialchars}</label>
<div class="x_controls">
<label class="x_inline">
<input type="radio" id="filter_specialchars_y" name="filter_specialchars" value="Y" checked="checked"|cond="$module_info->filter_specialchars !== 'N'" /> {$lang->cmd_yes}
</label>
<label class="x_inline">
<input type="radio" id="filter_specialchars_n" name="filter_specialchars" value="N" checked="checked"|cond="$module_info->filter_specialchars === 'N'" /> {$lang->cmd_no}
</label>
<p class="x_help-block">{$lang->about_filter_specialchars}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->protect_content}</label>
<div class="x_controls">