mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +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 EnableCommentsOnPosts { get; set; }
|
||||||
public virtual bool EnableSpamProtection { get; set; }
|
public virtual bool EnableSpamProtection { get; set; }
|
||||||
public virtual string AkismetKey { get; set; }
|
public virtual string AkismetKey { get; set; }
|
||||||
|
public virtual string AkismetUrl { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CommentSettingsHandler : ContentHandler {
|
public class CommentSettingsHandler : ContentHandler {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace Orchard.Comments.Services {
|
|||||||
public bool ValidateComment(Comment comment) {
|
public bool ValidateComment(Comment comment) {
|
||||||
CommentSettingsRecord commentSettingsRecord = CurrentSite.As<CommentSettings>().Record;
|
CommentSettingsRecord commentSettingsRecord = CurrentSite.As<CommentSettings>().Record;
|
||||||
string akismetKey = commentSettingsRecord.AkismetKey;
|
string akismetKey = commentSettingsRecord.AkismetKey;
|
||||||
|
string akismetUrl = commentSettingsRecord.AkismetUrl;
|
||||||
bool enableSpamProtection = commentSettingsRecord.EnableSpamProtection;
|
bool enableSpamProtection = commentSettingsRecord.EnableSpamProtection;
|
||||||
if (enableSpamProtection == false) {
|
if (enableSpamProtection == false) {
|
||||||
return true;
|
return true;
|
||||||
@@ -40,7 +41,10 @@ namespace Orchard.Comments.Services {
|
|||||||
_notifer.Information(T("Please configure your Akismet key for spam protection"));
|
_notifer.Information(T("Please configure your Akismet key for spam protection"));
|
||||||
return true;
|
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 {
|
AkismetComment akismetComment = new AkismetComment {
|
||||||
CommentAuthor = comment.Author,
|
CommentAuthor = comment.Author,
|
||||||
CommentAuthorEmail = comment.Email,
|
CommentAuthorEmail = comment.Email,
|
||||||
|
|||||||
@@ -26,4 +26,9 @@
|
|||||||
<%= Html.EditorFor(x=>x.AkismetKey) %>
|
<%= Html.EditorFor(x=>x.AkismetKey) %>
|
||||||
<%= Html.ValidationMessage("AkismetKey", "*")%>
|
<%= Html.ValidationMessage("AkismetKey", "*")%>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= Html.LabelFor(x=>x.AkismetUrl) %>
|
||||||
|
<%= Html.EditorFor(x=>x.AkismetUrl) %>
|
||||||
|
<%= Html.ValidationMessage("AkismetUrl", "*")%>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|||||||
Reference in New Issue
Block a user