mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-18 17:47:54 +08:00
- Comments: Adding another setting for akismet.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4041575
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Orchard.Comments.Models {
|
||||
public virtual bool EnableCommentsOnPosts { get; set; }
|
||||
public virtual bool EnableSpamProtection { get; set; }
|
||||
public virtual string AkismetKey { get; set; }
|
||||
public virtual string AkismetUrl { get; set; }
|
||||
}
|
||||
|
||||
public class CommentSettingsHandler : ContentHandler {
|
||||
|
@@ -32,6 +32,7 @@ namespace Orchard.Comments.Services {
|
||||
public bool ValidateComment(Comment comment) {
|
||||
CommentSettingsRecord commentSettingsRecord = CurrentSite.As<CommentSettings>().Record;
|
||||
string akismetKey = commentSettingsRecord.AkismetKey;
|
||||
string akismetUrl = commentSettingsRecord.AkismetUrl;
|
||||
bool enableSpamProtection = commentSettingsRecord.EnableSpamProtection;
|
||||
if (enableSpamProtection == false) {
|
||||
return true;
|
||||
@@ -40,7 +41,10 @@ namespace Orchard.Comments.Services {
|
||||
_notifer.Information(T("Please configure your Akismet key for spam protection"));
|
||||
return true;
|
||||
}
|
||||
Akismet akismetApi = new Akismet(akismetKey, "http://www.orchardproject.net", null);
|
||||
if (String.IsNullOrEmpty(akismetUrl)) {
|
||||
akismetUrl = "http://www.orchardproject.net";
|
||||
}
|
||||
Akismet akismetApi = new Akismet(akismetKey, akismetUrl, null);
|
||||
AkismetComment akismetComment = new AkismetComment {
|
||||
CommentAuthor = comment.Author,
|
||||
CommentAuthorEmail = comment.Email,
|
||||
|
@@ -26,4 +26,9 @@
|
||||
<%= Html.EditorFor(x=>x.AkismetKey) %>
|
||||
<%= Html.ValidationMessage("AkismetKey", "*")%>
|
||||
</li>
|
||||
<li>
|
||||
<%= Html.LabelFor(x=>x.AkismetUrl) %>
|
||||
<%= Html.EditorFor(x=>x.AkismetUrl) %>
|
||||
<%= Html.ValidationMessage("AkismetUrl", "*")%>
|
||||
</li>
|
||||
</ol>
|
||||
|
Reference in New Issue
Block a user