| 1 | <!--- load the file that grabs all values from the ini file ---> |
|---|
| 2 | <cfinclude template="cffpConfig.cfm"> |
|---|
| 3 | |
|---|
| 4 | <cfset akismetHTTPRequest = 1> |
|---|
| 5 | |
|---|
| 6 | <cfif structKeyExists(url,"type")> |
|---|
| 7 | <cftry> |
|---|
| 8 | <!--- send form contents to Akismet API ---> |
|---|
| 9 | <cfhttp url="http://#cffpConfig.akismetAPIKey#.rest.akismet.com/1.1/submit-#url.type#" timeout="10" method="post"> |
|---|
| 10 | <cfhttpparam name="key" type="formfield" value="#cffpConfig.akismetAPIKey#"> |
|---|
| 11 | <cfhttpparam name="blog" type="formfield" value="#cffpConfig.akismetBlogURL#"> |
|---|
| 12 | <cfhttpparam name="user_ip" type="formfield" value="#urlDecode(url.user_ip,'utf-8')#"> |
|---|
| 13 | <cfhttpparam name="user_agent" type="formfield" value="CFFormProtect/1.0 | Akismet/1.11"> |
|---|
| 14 | <cfhttpparam name="referrer" type="formfield" value="#urlDecode(url.referrer,'utf-8')#"> |
|---|
| 15 | <cfhttpparam name="comment_author" type="formfield" value="#urlDecode(url.comment_author,'utf-8')#"> |
|---|
| 16 | <cfif cffpConfig.akismetFormEmailField neq ""> |
|---|
| 17 | <cfhttpparam name="comment_author_email" type="formfield" value="#urlDecode(url.comment_author_email,'utf-8')#"> |
|---|
| 18 | </cfif> |
|---|
| 19 | <cfif cffpConfig.akismetFormURLField neq ""> |
|---|
| 20 | <cfhttpparam name="comment_author_url" type="formfield" value="#urlDecode(url.comment_author_url,'utf-8')#"> |
|---|
| 21 | </cfif> |
|---|
| 22 | <cfhttpparam name="comment_content" type="formfield" value="#urlDecode(url.comment_content,'utf-8')#"> |
|---|
| 23 | </cfhttp> |
|---|
| 24 | <cfcatch type="any"> |
|---|
| 25 | <cfset akismetHTTPRequest = 0> |
|---|
| 26 | </cfcatch> |
|---|
| 27 | </cftry> |
|---|
| 28 | |
|---|
| 29 | <cfif akismetHTTPRequest> |
|---|
| 30 | Thank you for submitting this data to Akismet |
|---|
| 31 | <cfelse> |
|---|
| 32 | Could not contact Akistmet server. |
|---|
| 33 | </cfif> |
|---|
| 34 | <cfelse> |
|---|
| 35 | Invalid URL. |
|---|
| 36 | </cfif> |
|---|