You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/02/02 03:01:33 UTC

svn commit: r502440 - /incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/TrackbackLinkbackCommentValidator.java

Author: agilliland
Date: Thu Feb  1 18:01:33 2007
New Revision: 502440

URL: http://svn.apache.org/viewvc?view=rev&rev=502440
Log:
Comment validator for trackback linkbacks must be sensitive to trackbackVerification runtime config property.


Modified:
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/TrackbackLinkbackCommentValidator.java

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/TrackbackLinkbackCommentValidator.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/TrackbackLinkbackCommentValidator.java?view=diff&rev=502440&r1=502439&r2=502440
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/TrackbackLinkbackCommentValidator.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/TrackbackLinkbackCommentValidator.java Thu Feb  1 18:01:33 2007
@@ -21,11 +21,13 @@
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.ResourceBundle;
+import org.apache.roller.config.RollerRuntimeConfig;
 import org.apache.roller.pojos.CommentData;
 import org.apache.roller.util.LinkbackExtractor;
 import org.apache.roller.util.RollerMessages;
 import org.apache.roller.util.URLUtilities;
 
+
 /**
  * Validates comment if comment's URL links back to the comment's entry,
  * intended for use with trackbacks only.
@@ -39,6 +41,13 @@
     }
     
     public int validate(CommentData comment, RollerMessages messages) {
+        
+        // linkback validation can be toggled at runtime, so check if it's enabled
+        // if it's disabled then just return a score of 100
+        if(!RollerRuntimeConfig.getBooleanProperty("site.trackbackVerification.enabled")) {
+            return 100;
+        }
+        
         int ret = 0;
         LinkbackExtractor linkback = null;
         try {
@@ -52,7 +61,7 @@
         } catch (MalformedURLException ignored1) {
         } catch (IOException ignored2) {}
         
-        if (linkback == null && linkback.getExcerpt() != null) {
+        if (linkback != null && linkback.getExcerpt() != null) {
             ret = 100;
         } else {
             messages.addError("comment.validator.trackbackLinkbackMessage");