쪽지 발송 시 스팸필터가 작동하도록 개선

- communication.sendMessage 트리거 추가
- 쪽지 발송 차단 시 메시지 추가
This commit is contained in:
SMaker 2013-11-15 17:22:30 +09:00
parent a5f408e05f
commit 6d8137bfc9
5 changed files with 76 additions and 4 deletions

View file

@ -170,6 +170,38 @@ class spamfilterController extends spamfilter
return $output;
}
/**
* @brief The routine process to check the time it takes to store a message, when writing it, and to ban IP/word
*/
function triggerSendMessage(&$obj)
{
if($_SESSION['avoid_log']) return new Object();
// Check the login status, login information, and permission
$is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info');
// In case logged in, check if it is an administrator
if($is_logged)
{
if($logged_info->is_admin == 'Y') return new Object();
}
$oFilterModel = getModel('spamfilter');
// Check if the IP is prohibited
$output = $oFilterModel->isDeniedIP();
if(!$output->toBool()) return $output;
// Check if there is a ban on the word
$text = $obj->title.$obj->content;
$output = $oFilterModel->isDeniedWord($text);
if(!$output->toBool()) return $output;
// Check the specified time
$output = $oFilterModel->checkLimited();
if(!$output->toBool()) return $output;
// Save a log
$this->insertLog();
return new Object();
}
/**
* @brief Log registration
* Register the newly accessed IP address in the log. In case the log interval is withing a certain time,