mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Fix #775 스팸필터에서 오류내역으로 스팸키워드노출 여부를 설정
This commit is contained in:
parent
04ab022864
commit
ced76f7e50
6 changed files with 70 additions and 12 deletions
|
|
@ -12,12 +12,17 @@ $lang->check_trackback = '트랙백 검사';
|
|||
$lang->word = '키워드';
|
||||
$lang->hit = '히트';
|
||||
$lang->latest_hit = '최근 히트';
|
||||
$lang->display_keyword = '키워드 출력';
|
||||
$lang->custom_message = '에러메세지 설정';
|
||||
$lang->about_display_keyword = '글, 댓글 제한으로 인해 등록하지 못하였을 경우 에러메세지에 키워드를 출력합니다. 기본값은 출력합니다.';
|
||||
$lang->about_custom_message = '키워드를 출력하지 않을시 에러메세지를 설정합니다.';
|
||||
$lang->about_interval = '지정된 시간 내에 글을 등록하지 못하게 합니다.';
|
||||
$lang->about_denied_ip = '한 줄에 하나씩 IP 주소 또는 대역을 입력하세요. "//" 또는 "#" 뒷부분은 설명으로 저장됩니다. 예: 127.0.0.1 //설명, 127.0.0.1 #설명<br>IP 대역 표기법은 <a href="https://github.com/rhymix/rhymix-docs/blob/master/ko/misc/ipfilter.md" target="_blank">매뉴얼</a>을 참고하십시오.';
|
||||
$lang->about_denied_word = '한 줄에 하나씩 스팸 키워드를 입력하세요. (2~40자)';
|
||||
$lang->msg_alert_limited_by_config = '%d초 이내에 연속 글 작성은 금지됩니다. 계속 시도하면 IP가 차단될 수 있습니다.';
|
||||
$lang->msg_alert_limited_message_by_config = '%d초 이내에 연속 쪽지 발송은 금지됩니다. 계속 시도하면 IP가 차단될 수 있습니다.';
|
||||
$lang->msg_alert_denied_word = '"%s"은(는) 사용이 금지된 단어입니다.';
|
||||
$lang->msg_alert_do_not_display_keyword_denied_word = '내용 혹은 제목에 사용이 금지된 단어가 있습니다. 관리자에게 문의하세요.';
|
||||
$lang->msg_alert_registered_denied_ip = 'IP가 차단되었습니다. 사이트 관리자에게 문의 바랍니다.';
|
||||
$lang->msg_alert_trackback_denied = '한 글에는 하나의 트랙백만 허용됩니다.';
|
||||
$lang->cmd_interval = '글, 댓글 스팸 차단';
|
||||
|
|
|
|||
|
|
@ -17,32 +17,35 @@ class spamfilterAdminController extends spamfilter
|
|||
function procSpamfilterAdminInsertConfig()
|
||||
{
|
||||
// Get the default information
|
||||
$args = Context::gets('limits', 'limits_interval', 'limits_count', 'check_trackback', 'ipv4_block_range', 'ipv6_block_range');
|
||||
|
||||
$args = Context::gets('limits', 'limits_interval', 'limits_count', 'check_trackback', 'ipv4_block_range', 'ipv6_block_range', 'display_keyword', 'custom_message');
|
||||
|
||||
// Set default values
|
||||
if ($args->limits != 'Y')
|
||||
if($args->limits != 'Y')
|
||||
{
|
||||
$args->limits = 'N';
|
||||
}
|
||||
if ($args->check_trackback != 'Y')
|
||||
if($args->check_trackback != 'Y')
|
||||
{
|
||||
$args->check_trackback = 'N';
|
||||
}
|
||||
if (!preg_match('#^/(\d+)$#', $args->ipv4_block_range, $matches) || $matches[1] > 32 || $matches[1] < 16)
|
||||
if(!preg_match('#^/(\d+)$#', $args->ipv4_block_range, $matches) || $matches[1] > 32 || $matches[1] < 16)
|
||||
{
|
||||
$args->ipv4_block_range = '';
|
||||
}
|
||||
if (!preg_match('#^/(\d+)$#', $args->ipv6_block_range, $matches) || $matches[1] > 128 || $matches[1] < 64)
|
||||
if(!preg_match('#^/(\d+)$#', $args->ipv6_block_range, $matches) || $matches[1] > 128 || $matches[1] < 64)
|
||||
{
|
||||
$args->ipv6_block_range = '';
|
||||
}
|
||||
$args->limits_interval = intval($args->limits_interval);
|
||||
$args->limits_count = intval($args->limits_count);
|
||||
|
||||
|
||||
// Create and insert the module Controller object
|
||||
$oModuleController = getController('module');
|
||||
$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter', $args);
|
||||
if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
|
||||
if(!$moduleConfigOutput->toBool())
|
||||
{
|
||||
return $moduleConfigOutput;
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class spamfilterAdminView extends spamfilter
|
|||
// Get configurations (using module model object)
|
||||
$oModuleModel = getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('spamfilter');
|
||||
Context::set('config',$config);
|
||||
Context::set('config', $config);
|
||||
|
||||
$this->setTemplateFile('config_block');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,10 @@ class spamfilterController extends spamfilter
|
|||
}
|
||||
$text = utf8_trim(utf8_normalize_spaces(htmlspecialchars_decode(strip_tags($text))));
|
||||
$output = $oFilterModel->isDeniedWord($text);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
// Check the specified time beside the modificaiton time
|
||||
if($obj->document_srl == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,8 +87,34 @@ class spamfilterModel extends spamfilter
|
|||
{
|
||||
$args = new stdClass();
|
||||
$args->word = $word;
|
||||
$output = executeQuery('spamfilter.updateDeniedWordHit', $args);
|
||||
return new Object(-1,sprintf(lang('msg_alert_denied_word'), $word));
|
||||
executeQuery('spamfilter.updateDeniedWordHit', $args);
|
||||
|
||||
$config = $this->getConfig();
|
||||
if($config->display_keyword === 'Y')
|
||||
{
|
||||
$custom_message = sprintf(lang('msg_alert_denied_word'), $word);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($config->custom_message)
|
||||
{
|
||||
if(preg_match('/^\\$user_lang->[a-zA-Z0-9]+$/', $config->custom_message))
|
||||
{
|
||||
getController('module')->replaceDefinedLangCode($config->custom_message);
|
||||
$custom_message = htmlspecialchars($config->custom_message);
|
||||
}
|
||||
else
|
||||
{
|
||||
$custom_message = $config->custom_message;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$custom_message = lang('spamfilter.msg_alert_do_not_display_keyword_denied_word');
|
||||
}
|
||||
}
|
||||
|
||||
return new Object(-1, $custom_message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,27 @@
|
|||
<p class="x_help-block">{$lang->cmd_check_trackback_help}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->display_keyword}</label>
|
||||
<div class="x_controls">
|
||||
<label for="display_keyword_yes" class="x_inline">
|
||||
<input type="radio" name="display_keyword" id="display_keyword_yes" value="Y" checked="checked"|cond="$config->display_keyword!='N' || !$config->display_keyword" />
|
||||
{$lang->cmd_yes}
|
||||
</label>
|
||||
<label for="display_keyword_no" class="x_inline">
|
||||
<input type="radio" name="display_keyword" id="display_keyword_no" value="N" checked="checked"|cond="$config->display_keyword=='N'" />
|
||||
{$lang->cmd_no}
|
||||
</label>
|
||||
<p class="x_help-block">{$lang->about_display_keyword}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="custom_message">{$lang->custom_message}</label>
|
||||
<div class="x_controls">
|
||||
<textarea name="custom_message" id="custom_message" class="lang_code">{htmlspecialchars($config->custom_message)}</textarea>
|
||||
<p class="x_help-block">{$lang->about_custom_message}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label for="limits_interval" class="x_control-label">{$lang->cmd_limits_interval}</label>
|
||||
<div class="x_controls">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue