Changeset 25264

Show
Ignore:
Timestamp:
23.03.2012 14:27:19 (8 years ago)
Author:
sjm84
Message:

Added the ability to output a captcha image (need to put the private key into siteconfig.xml)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java

    r25107 r25264  
    2727import java.text.SimpleDateFormat; 
    2828 
     29import net.tanesha.recaptcha.ReCaptcha; 
     30import net.tanesha.recaptcha.ReCaptchaFactory; 
     31 
    2932import org.apache.log4j.*; 
    3033import org.w3c.dom.Node; 
     
    105108    public static byte[] toUTF8(String orig) 
    106109    { 
    107  
    108110        try 
    109111        { 
     
    116118            return orig.getBytes(); 
    117119        } 
     120    } 
     121     
     122    public static String replace(String orig, String match, String replacement) 
     123    { 
     124        return orig.replace(match, replacement); 
    118125    } 
    119126 
     
    472479        return true; 
    473480    } 
     481     
     482    public static String reCAPTCHAimage() 
     483    { 
     484        ReCaptcha c = ReCaptchaFactory.newReCaptcha("6LckI88SAAAAACUYjj97WMcnz5HPjVp3lI-x-ue8", "6LckI88SAAAAAGnGy1PwuXYZzIMXZYoPxN51bWWG", false); 
     485        return c.createRecaptchaHtml(null, null); 
     486    } 
    474487}