mirror of
https://github.com/typecho/typecho.git
synced 2025-03-31 00:02:25 +02:00
fix antispam method
This commit is contained in:
parent
13fc1b7169
commit
0ba45f1006
@ -419,7 +419,7 @@ class Widget_Abstract_Comments extends Widget_Abstract
|
||||
*
|
||||
* @param mixed $text
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function autoP($text)
|
||||
{
|
||||
@ -443,7 +443,7 @@ class Widget_Abstract_Comments extends Widget_Abstract
|
||||
*
|
||||
* @param mixed $text
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function markdown($text)
|
||||
{
|
||||
|
@ -959,7 +959,7 @@ class Widget_Abstract_Contents extends Widget_Abstract
|
||||
*
|
||||
* @param mixed $text
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function autoP($text)
|
||||
{
|
||||
@ -983,7 +983,7 @@ class Widget_Abstract_Contents extends Widget_Abstract
|
||||
*
|
||||
* @param mixed $text
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function markdown($text)
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ class Widget_Archive extends Widget_Abstract_Contents
|
||||
$commentUrl .= '?parent=' . $reply;
|
||||
}
|
||||
|
||||
return $this->options->commentsAntiSpam ? $commentUrl : $this->security->getTokenUrl($commentUrl);
|
||||
return $commentUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1795,35 +1795,36 @@ class Widget_Archive extends Widget_Abstract_Contents
|
||||
(function () {
|
||||
var event = document.addEventListener ? {
|
||||
add: 'addEventListener',
|
||||
focus: 'focus',
|
||||
triggers: ['scroll', 'mousemove', 'keyup', 'touchstart'],
|
||||
load: 'DOMContentLoaded'
|
||||
} : {
|
||||
add: 'attachEvent',
|
||||
focus: 'onfocus',
|
||||
triggers: ['onfocus', 'onmousemove', 'onkeyup', 'ontouchstart'],
|
||||
load: 'onload'
|
||||
};
|
||||
}, added = false;
|
||||
|
||||
document[event.add](event.load, function () {
|
||||
var r = document.getElementById('{$this->respondId}');
|
||||
var r = document.getElementById('{$this->respondId}'),
|
||||
input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = '_';
|
||||
input.value = " . Typecho_Common::shuffleScriptVar(
|
||||
$this->security->getToken($this->request->getRequestUrl())) . "
|
||||
|
||||
if (null != r) {
|
||||
var forms = r.getElementsByTagName('form');
|
||||
if (forms.length > 0) {
|
||||
var f = forms[0], textarea = f.getElementsByTagName('textarea')[0] || f.text, added = false;
|
||||
|
||||
if (null != textarea && 'text' == textarea.name) {
|
||||
textarea[event.add](event.focus, function () {
|
||||
if (!added) {
|
||||
var input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = '_';
|
||||
input.value = " . Typecho_Common::shuffleScriptVar(
|
||||
$this->security->getToken($this->request->getRequestUrl())) . "
|
||||
|
||||
f.appendChild(input);
|
||||
added = true;
|
||||
}
|
||||
});
|
||||
function append() {
|
||||
if (!added) {
|
||||
forms[0].appendChild(input);
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < event.triggers.length; i ++) {
|
||||
var trigger = event.triggers[i];
|
||||
document[event.add](trigger, append);
|
||||
window[event.add](trigger, append);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ class Widget_Feedback extends Widget_Abstract_Comments implements Widget_Interfa
|
||||
private function comment()
|
||||
{
|
||||
// 使用安全模块保护
|
||||
$this->security->enable($this->options->commentsAntiSpam);
|
||||
$this->security->protect();
|
||||
|
||||
$comment = array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user