Merge branch 'pr/55' into develop

Conflicts:
	modules/communication/communication.controller.php
This commit is contained in:
bnu 2013-11-23 20:18:20 +09:00
commit bf85de4e26
8 changed files with 109 additions and 23 deletions

View file

@ -114,8 +114,13 @@ class communicationController extends communication
// send a message
$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
if(!$output->toBool())
{
return $output;
}
// send an e-mail
if($output->toBool() && $send_mail == 'Y')
if($send_mail == 'Y')
{
$view_url = Context::getRequestUri();
$content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url);
@ -196,12 +201,16 @@ class communicationController extends communication
// Call a trigger (before)
$trigger_obj = new stdClass();
$trigger_obj->sender = $sender_args;
$trigger_obj->receiver = $receiver_args;
$trigger_output = ModuleHandler::triggerCall('communication.sendMessage', 'before', $trigger_obj);
if(!$trigger_output->toBool())
$trigger_obj->sender_srl = $sender_srl;
$trigger_obj->receiver_srl = $receiver_srl;
$trigger_obj->message_srl = $message_srl;
$trigger_obj->title = $title;
$trigger_obj->content = $content;
$trigger_obj->sender_log = $sender_log;
$triggerOutput = ModuleHandler::triggerCall('communication.sendMessage', 'before', $trigger_obj);
if(!$triggerOutput->toBool())
{
return $trigger_output;
return $triggerOutput;
}
$oDB = DB::getInstance();

View file

@ -133,7 +133,7 @@
<value xml:lang="vi"><![CDATA[Tất cả những bài viết trong thời gian giới hạn sẽ bị chặn.]]></value>
</item>
<item name="about_limit_count">
<value xml:lang="ko"><![CDATA[지정된 시간 내에 제한수를 넘겨서 글 작성을 시도하면 스팸으로 인식, 해당 IP의 글 작성, 댓글 작성, 트랙백 발송 등을 금지합니다.]]></value>
<value xml:lang="ko"><![CDATA[지정된 시간 내에 제한수를 넘겨서 글 작성을 시도하면 스팸으로 인식, 해당 IP의 글 작성, 댓글 작성, 트랙백 발송, 쪽지 발송 등을 금지합니다.]]></value>
<value xml:lang="en"><![CDATA[If exceeded the posting limitation,
that IP will be regarded as a spam, thus will have limitations on posting articles, comments, and trackbacks.]]></value>
<value xml:lang="jp"><![CDATA[指定した時間に制限数を超える書き込みが行われるとスパムとして認識し、該当IPを禁止します。]]></value>
@ -204,6 +204,9 @@ l'article qui comporte le mot ne sera pas affichagé.]]></value>
<value xml:lang="tr"><![CDATA[%s saniyede bir yazı göndermek mümkün değildir.\n Denemeyi sürdürürseniz, IP adresiniz kara listeye alınacaktır.]]></value>
<value xml:lang="vi"><![CDATA[Không được phép gửi bài thứ 2 trong khoảng thời gian %s giây.\n Nếu bạn cứ tiếp tục, IP của bạn sẽ bị thêm vào danh sách IP bị cấm.]]></value>
</item>
<item name="msg_alert_limited_message_by_config">
<value xml:lang="ko"><![CDATA[%s 초 이내에 쪽지 발송은 금지 됩니다. 계속 시도하면 금지 IP에 등록될 수 있습니다.]]></value>
</item>
<item name="msg_alert_denied_word">
<value xml:lang="ko"><![CDATA["%s"는 사용 금지된 단어입니다.]]></value>
<value xml:lang="en"><![CDATA[The word "%s" is not allowed.]]></value>
@ -241,7 +244,7 @@ l'article qui comporte le mot ne sera pas affichagé.]]></value>
<value xml:lang="vi"><![CDATA[Chỉ cho phép một liên kết Web trên một bài viết.]]></value>
</item>
<item name="cmd_interval">
<value xml:lang="ko"><![CDATA[10초 동안 3회 이상 글을 작성하면 스패머로 간주하시겠습니까? 글, 댓글 작성과 엮인글 발송을 차단합니다.]]></value>
<value xml:lang="ko"><![CDATA[10초 동안 3회 이상 글을 작성하면 스패머로 간주하시겠습니까? 글, 댓글 작성과 엮인글 발송, 쪽지 발송을 차단합니다.]]></value>
<value xml:lang="en"><![CDATA[Do you want to blacklist the users who attempt to post articles more than 3 times for 10 seconds? The blacklisted users cannot write articles or comments and send trackbacks.]]></value>
  <value xml:lang="jp"><![CDATA[10秒の間3回以上書き込みをすると、スパムとみなしますか書き込み、コメント作成とトラックバックの送信をブロックします。]]></value>
</item>

View file

@ -21,6 +21,8 @@ class spamfilter extends ModuleObject
// 2008-12-17 Add a spamfilter for post modification actions
$oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before');
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
// 2013-11-14 The trigger which try to perform spam filtering when new message are registered
$oModuleController->insertTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before');
return new Object();
}
@ -39,6 +41,8 @@ class spamfilter extends ModuleObject
// 2008-12-17 Add a spamfilter for post modification actions
if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true;
if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true;
// 2013-11-14 The trigger which try to perform spam filtering when new message are registered
if(!$oModuleModel->getTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before')) return true;
/**
* Add the hit count field (hit)
@ -76,6 +80,11 @@ class spamfilter extends ModuleObject
{
$oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before');
}
// 2013-11-14 The trigger which try to perform spam filtering when new message are registered
if(!$oModuleModel->getTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before'))
{
$oModuleController->insertTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before');
}
/**
* Add the hit count field (hit)

View file

@ -170,6 +170,33 @@ 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();
$logged_info = Context::get('logged_info');
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(TRUE);
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,

View file

@ -97,7 +97,7 @@ class spamfilterModel extends spamfilter
/**
* @brief Check the specified time
*/
function checkLimited()
function checkLimited($isMessage = FALSE)
{
$config = $this->getConfig();
@ -118,7 +118,14 @@ class spamfilterModel extends spamfilter
// If the number of limited posts is not reached, keep creating.
if($count)
{
$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
if($isMessage)
{
$message = sprintf(Context::getLang('msg_alert_limited_message_by_config'), $interval);
}
else
{
$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
}
$oSpamFilterController = &getController('spamfilter');
$oSpamFilterController->insertLog();

View file

@ -132,6 +132,7 @@ function doFillWidgetVars() {
else node.value = unescaped_val;
jQuery('#'+name).val(node.value);
break;
case "radio" :
case "checkbox" :
if(selected_node.getAttribute(name)) {
var val = selected_node.getAttribute(name).split(',');

View file

@ -2,6 +2,7 @@
<load target="../../module/tpl/js/module_list.js" />
<load target="../../module/tpl/js/mid.js" />
<!--%load_js_plugin("ui.colorpicker")-->
<div class="x_control-group">
<label class="x_control-label" for="skin">{$lang->skin}</label>
<div class="x_controls">
@ -12,6 +13,7 @@
<input type="button" class="x_btn" value="{$lang->cmd_select}" />
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="colorset">{$lang->colorset}</label>
<div class="x_controls">
@ -19,6 +21,7 @@
</select>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="widget_cache">{$lang->widget_cache}</label>
<div class="x_controls">
@ -26,6 +29,7 @@
<p class="x_help-inline">{$lang->about_widget_cache}</p>
</div>
</div>
{@$suggestion_id = 0}
<block loop="$widget_info->extra_var => $id, $var">
{@$suggestion_id++}
@ -36,20 +40,25 @@
<h1>{$var->group}</h1>
{@$group = $var->group}
</block>
{@$not_first = true}
<div class="x_control-group <!--@if($var->type == 'mid' || $var->type == 'module_srl_list')-->moduleSearch moduleSearch1 modulefinder<!--@end-->">
<label class="x_control-label" for="{$id}">{$var->name}</label>
<label class="x_control-label" for="{$id}"|cond="$var->type != 'radio' && $var->type != 'checkbox'">{$var->name}</label>
<div class="x_controls">
<div cond="$var->type == 'text'">
<block cond="$var->type == 'text'">
<input type="text" name="{$id}" />
</div>
<input cond="$var->type == 'color'" type="text" name="{$id}" value="" id="{$id}" class="color-indicator" style="width:178px" />
<div cond="$var->type == 'textarea'">
</block>
<block cond="$var->type == 'color'">
<input type="text" name="{$id}" value="" id="{$id}" class="color-indicator" style="width:178px" />
</block>
<block cond="$var->type == 'textarea'">
<textarea cond="$var->type == 'textarea'" name="{$id}" id="{$id}" rows="8" cols="42"></textarea>
</div>
<select cond="$var->type == 'select'" name="{$id}" id="{$id}">
<option loop="$var->options => $key, $val" value="{$key}">{$val}</option>
</select>
</block>
<block cond="$var->type == 'select'">
<select name="{$id}" id="{$id}">
<option loop="$var->options => $key, $val" value="{$key}">{$val}</option>
</select>
</block>
<block cond="$var->type == 'select-multi-order'">
<!--@if($var->init_options && is_array($var->init_options))-->
{@$inits = array_keys($var->init_options)}
@ -122,15 +131,28 @@
<input type="hidden" name="{$id}" />
<a class="x_btn modalAnchor filebox" href="#modalFilebox">{$lang->cmd_select}</a>
</block>
<select cond="$var->type == 'menu'" name="{$id}">
<option value="">-</option>
<option loop="$menu_list => $key, $val" value="{$val->menu_srl}">{$val->title}</option>
</select>
<block cond="$var->type == 'menu'">
<select name="{$id}">
<option value="">-</option>
<option loop="$menu_list => $key, $val" value="{$val->menu_srl}">{$val->title}</option>
</select>
</block>
<block cond="$var->type == 'radio'">
<label loop="$var->options => $key, $val">
<input type="radio" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
</label>
</block>
<block cond="$var->type == 'checkbox'">
<label loop="$var->options => $key, $val">
<input type="checkbox" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
</label>
</block>
<p cond="$var->description">{$var->description}</p>
</div>
</div>
</block>
</section>
<script>
xe.current_lang = "{$lang_type}";
</script>

View file

@ -87,6 +87,14 @@
<a href="#modalFilebox" class="modalAnchor filebox">{$lang->cmd_select}</a>
{@$use_filebox = TRUE}
</block>
<label loop="$var->options => $key, $val" cond="$var->type == 'radio'">
<input type="radio" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
</label>
<label loop="$var->options => $key, $val" cond="$var->type == 'checkbox'">
<input type="checkbox" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
</label>
<span class="x_help-block">{$var->description}</span>
</div>
</div>