root/trunk/website/blog/trackback.cfm @ 42

Revision 5, 2.6 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

Line 
1<cfsetting enablecfoutputonly=true>
2<cfprocessingdirective pageencoding="utf-8">
3<!---
4        Name         : c:\projects\blog\client\trackbackb.cfm
5        Author       : Dave Lobb
6        Created      : 09/22/05
7        Last Updated : 2/28/07
8        History      : Ray modified it for 4.0
9                                 : Don't log the getEntry (rkc 2/28/07)
10--->
11
12<!--- TBs allowed? --->
13<cfif not application.blog.getProperty("allowtrackbacks")><cfabort></cfif>
14
15<!--- Kill TB
16This link doesn't authenticate at all, but gives us one click clean up of TBs from email. --->
17<cfif isDefined("url.kill") and len(trim(url.kill))>
18        <cftry>
19                <cfset application.blog.deleteTrackback(url.kill)>
20                <cflocation url="#application.rootURL#" addToken="false">
21                <cfcatch>
22                        <!--- silently fail --->
23                </cfcatch>
24        </cftry>
25</cfif>
26
27<cfcontent type="text/xml; charset=UTF-8">
28
29<!---
30http://www.sixapart.com/pronet/docs/trackback_spec
31--->
32
33
34<cfset response = '<?xml version="1.0" encoding="utf-8"?><response><error>{code}</error>{message}</response>'>
35<cfset message = '<message>{error}</message>'>
36<cfset error = "">
37       
38<cfif cgi.REQUEST_METHOD eq "POST">
39        <cfparam name="form.title" default="">
40        <cfparam name="form.excerpt" default="">
41        <cfparam name="form.blog_name" default="">
42               
43        <!--- must have entry id --->
44        <cfif not len(cgi.query_string)>
45                <cfset error = "Could not find post - please check trackback URL">
46        <cfelse>
47                <cfset entry = cgi.query_string>
48                <cftry>
49                        <cfset blogEntry = application.blog.getEntry(entry,true)>
50                        <!--- must have url --->
51                        <cfif structKeyExists(form, "url")>
52                                <cfset id = application.blog.addTrackBack(form.title, form.url, form.blog_name, form.excerpt, entry)>
53                                <cfif id is not "">
54                                        <!--- Form a message about the TB --->
55                                        <cfmodule template="tags/trackbackemail.cfm" trackback="#id#" />
56                                        <cfmodule template="tags/scopecache.cfm" scope="application" clearall="true">
57                                </cfif>
58                        <cfelse>
59                                <cfset error = "URL not provided">
60                        </cfif>
61
62                        <cfcatch>
63                                <!--- person TBed a bad entry --->
64                                <cfset error = "Bad Entry">
65                        </cfcatch>
66                </cftry>                       
67        </cfif>
68<cfelse>
69        <cfset error = "TrackBack request not POSTed">
70</cfif>
71       
72<cfif not len(error)>
73        <cfset response = replace(response, "{code}", "0")>
74        <cfset response = replace(response, "{message}", "")>
75<cfelse>
76        <cfset response = replace(response, "{code}", "1")>
77        <cfset message = replace(message, "{error}", error)>
78        <cfset response = replace(response, "{message}", message)>
79</cfif>
80       
81<cfset getPageContext().getOut().clear()> 
82<cfoutput>#trim(response)#</cfoutput>
83
84<cfsetting enablecfoutputonly=false>    
85
Note: See TracBrowser for help on using the browser.