else if (title==null || url==null || excerpt==null || blogName==null) {
error = "title, url, excerpt, and blog_name not specified.";
}
else {
RollerRequest rreq = RollerRequest.getRollerRequest(req);
WeblogEntryData entry = rreq.getWeblogEntry();
WebsiteData website = entry.getWebsite();
boolean siteAllows = website.getAllowComments().booleanValue();
if (entry!=null && siteAllows && entry.getCommentsStillAllowed()) {
// Track trackbacks as comments
CommentData comment = new CommentData();
comment.setContent("[Trackback] "+excerpt);
comment.setName(blogName);
comment.setUrl(url);
comment.setWeblogEntry(entry);
comment.setNotify(Boolean.FALSE);
comment.setPostTime(new Timestamp(new Date().getTime()));
// If comment contains blacklisted text, mark as spam
SpamChecker checker = new SpamChecker();
if (checker.checkTrackback(comment)) {
comment.setSpam(Boolean.TRUE);
logger.debug("Trackback blacklisted: "+comment.getUrl());
error = "REJECTED: trackback contains spam words";
}
// Else, if trackback verification is on...
else if (RollerRuntimeConfig.getBooleanProperty(
"site.trackbackVerification.enabled")) {
// ...ensure trackbacker actually links to us
RollerContext rctx= RollerContext.getRollerContext();
String absurl = rctx.getAbsoluteContextUrl(req);
LinkbackExtractor linkback = new LinkbackExtractor(
comment.getUrl(), absurl + entry.getPermaLink());
if (linkback.getExcerpt() == null) {
comment.setPending(Boolean.TRUE);
comment.setApproved(Boolean.FALSE);
verified = false;
// if we can't verify trackback, then reject it