diff --git a/install.php b/install.php
index 744ea2e1..aaedaeb3 100644
--- a/install.php
+++ b/install.php
@@ -357,6 +357,7 @@ Typecho_Cookie::set('__typecho_lang', $lang);
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'commentsShowCommentOnly', 'user' => 0, 'value' => 0)));
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'commentsAvatar', 'user' => 0, 'value' => 1)));
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'commentsAvatarRating', 'user' => 0, 'value' => 'G')));
+ $installDb->query($installDb->insert('table.options')->rows(array('name' => 'commentsAntiSpam', 'user' => 0, 'value' => 1)));
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'routingTable', 'user' => 0, 'value' => 'a:25:{s:5:"index";a:3:{s:3:"url";s:1:"/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:7:"archive";a:3:{s:3:"url";s:6:"/blog/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:2:"do";a:3:{s:3:"url";s:22:"/action/[action:alpha]";s:6:"widget";s:9:"Widget_Do";s:6:"action";s:6:"action";}s:4:"post";a:3:{s:3:"url";s:24:"/archives/[cid:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:10:"attachment";a:3:{s:3:"url";s:26:"/attachment/[cid:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:8:"category";a:3:{s:3:"url";s:17:"/category/[slug]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:3:"tag";a:3:{s:3:"url";s:12:"/tag/[slug]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:6:"author";a:3:{s:3:"url";s:22:"/author/[uid:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:6:"search";a:3:{s:3:"url";s:19:"/search/[keywords]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:10:"index_page";a:3:{s:3:"url";s:21:"/page/[page:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:12:"archive_page";a:3:{s:3:"url";s:26:"/blog/page/[page:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:13:"category_page";a:3:{s:3:"url";s:32:"/category/[slug]/[page:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:8:"tag_page";a:3:{s:3:"url";s:27:"/tag/[slug]/[page:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:11:"author_page";a:3:{s:3:"url";s:37:"/author/[uid:digital]/[page:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:11:"search_page";a:3:{s:3:"url";s:34:"/search/[keywords]/[page:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:12:"archive_year";a:3:{s:3:"url";s:18:"/[year:digital:4]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:13:"archive_month";a:3:{s:3:"url";s:36:"/[year:digital:4]/[month:digital:2]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:11:"archive_day";a:3:{s:3:"url";s:52:"/[year:digital:4]/[month:digital:2]/[day:digital:2]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:17:"archive_year_page";a:3:{s:3:"url";s:38:"/[year:digital:4]/page/[page:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:18:"archive_month_page";a:3:{s:3:"url";s:56:"/[year:digital:4]/[month:digital:2]/page/[page:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:16:"archive_day_page";a:3:{s:3:"url";s:72:"/[year:digital:4]/[month:digital:2]/[day:digital:2]/page/[page:digital]/";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:12:"comment_page";a:3:{s:3:"url";s:53:"[permalink:string]/comment-page-[commentPage:digital]";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}s:4:"feed";a:3:{s:3:"url";s:20:"/feed[feed:string:0]";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:4:"feed";}s:8:"feedback";a:3:{s:3:"url";s:31:"[permalink:string]/[type:alpha]";s:6:"widget";s:15:"Widget_Feedback";s:6:"action";s:6:"action";}s:4:"page";a:3:{s:3:"url";s:12:"/[slug].html";s:6:"widget";s:14:"Widget_Archive";s:6:"action";s:6:"render";}}')));
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'actionTable', 'user' => 0, 'value' => 'a:0:{}')));
$installDb->query($installDb->insert('table.options')->rows(array('name' => 'panelTable', 'user' => 0, 'value' => 'a:0:{}')));
diff --git a/var/Typecho/Common.php b/var/Typecho/Common.php
index f7cb13fc..384d9c3a 100644
--- a/var/Typecho/Common.php
+++ b/var/Typecho/Common.php
@@ -22,7 +22,7 @@ define('__TYPECHO_MB_SUPPORTED__', function_exists('mb_get_info'));
class Typecho_Common
{
/** 程序版本 */
- const VERSION = '1.0/14.10.9';
+ const VERSION = '1.0/14.10.10';
/**
* 允许的属性
diff --git a/var/Upgrade.php b/var/Upgrade.php
index 4a2033e0..79614bb0 100644
--- a/var/Upgrade.php
+++ b/var/Upgrade.php
@@ -1189,5 +1189,19 @@ Typecho_Date::setTimezoneOffset($options->timezone);
$db->query($db->insert('table.options')
->rows(array('name' => 'lang', 'user' => 0, 'value' => 'zh_CN')));
}
+
+ /**
+ * v1_0r14_10_10
+ *
+ * @param mixed $db
+ * @param mixed $options
+ * @access public
+ * @return void
+ */
+ public function v1_0r14_10_10($db, $options)
+ {
+ $db->query($db->insert('table.options')
+ ->rows(array('name' => 'commentsAntiSpam', 'user' => 0, 'value' => 1)));
+ }
}
diff --git a/var/Widget/Archive.php b/var/Widget/Archive.php
index 2ce5dffc..579ddfa5 100644
--- a/var/Widget/Archive.php
+++ b/var/Widget/Archive.php
@@ -306,7 +306,7 @@ class Widget_Archive extends Widget_Abstract_Contents
$commentUrl .= '?parent=' . $reply;
}
- return $this->security->getTokenUrl($commentUrl);
+ return $this->options->commentsAntiSpam ? $commentUrl : $this->security->getTokenUrl($commentUrl);
}
/**
@@ -1632,6 +1632,7 @@ class Widget_Archive extends Widget_Abstract_Contents
'rss2' => $this->_feedUrl,
'rss1' => $this->_feedRssUrl,
'commentReply' => 1,
+ 'antiSpam' => 1,
'atom' => $this->_feedAtomUrl
);
@@ -1690,83 +1691,133 @@ class Widget_Archive extends Widget_Abstract_Contents
if ('' != $allows['commentReply']) {
if (1 == $allows['commentReply']) {
$header .= "";
+ };
+})();
+
+";
} else {
$header .= '';
}
}
}
+ /** 反垃圾设置 */
+ if ($this->options->commentsAntiSpam && $this->is('single')) {
+ if ('' != $allows['antiSpam']) {
+ if (1 == $allows['antiSpam']) {
+ $header .= "";
+ } else {
+ $header .= '';
+ }
+ }
+ }
+
/** 插件支持 */
$this->pluginHandle()->header($header, $this);
diff --git a/var/Widget/Options/Discussion.php b/var/Widget/Options/Discussion.php
index 999eb1c9..893c71b2 100644
--- a/var/Widget/Options/Discussion.php
+++ b/var/Widget/Options/Discussion.php
@@ -113,6 +113,7 @@ class Widget_Options_Discussion extends Widget_Abstract_Options implements Widge
'commentsRequireMail' => _t('必须填写邮箱'),
'commentsRequireURL' => _t('必须填写网址'),
'commentsCheckReferer' => _t('检查评论来源页 URL 是否与文章链接一致'),
+ 'commentsAntiSpam' => _t('开启反垃圾保护'),
'commentsAutoClose' => _t('在文章发布 %s 天以后自动关闭评论',
'