root/trunk/website/blog/admin/notify.cfm

Revision 5, 1.8 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         : notify.cfm
5        Author       : Raymond Camden
6        Created      : 04/20/06
7        Last Updated : 2/28/07
8        History      : Made getEntry not log (2/28/07)
9       
10        This template simply sends the email out for an entry. We do a few sanity checks though:
11       
12        a) The entry's posted date must be within 2 minutes of now(). Why? In theory
13        someone who knows the ID of an old entry and this url could use it to spam folks.
14        By ensuring ...
15       
16        You know what. Screw that. I'm just going to add a mailed flag to entries. Why shouldn't I?
17       
18        I still need to ensure that posted is either now or before now (in case the cfhttp call is slowed
19        down). I also need to check that released = 1
20       
21        Notice - this is run by CF. The human output is just for testing.
22--->
23
24<cfif not structKeyExists(url, "id")>
25        <cfabort>
26</cfif>
27
28<cftry>
29        <cfset entry = application.blog.getEntry(url.id,true)>
30        <cfcatch>
31                <cfoutput>Error getting entry.</cfoutput>
32                <cfabort>
33        </cfcatch>
34</cftry>
35
36<!--- is it released? --->
37<cfif not entry.released>
38        <cfoutput>Not released.</cfoutput>
39        <cfabort>
40</cfif>
41
42<!--- was it already mailed? --->
43<cfif entry.mailed>
44        <cfoutput>Already mailed.</cfoutput>
45        <cfabort>
46</cfif>
47
48<!--- is posted < now()? --->
49<cfif dateCompare(entry.posted, application.blog.blognow()) is 1>
50        <cfoutput>This entry is in the future.</cfoutput>
51        <cfabort>
52</cfif>
53
54<cfoutput>Yes, I will be emailing this.</cfoutput>
55<cfset application.blog.mailEntry(url.id)>
56
57<cfoutput>Clear the cache</cfoutput>
58<cfmodule template="../tags/scopecache.cfm" scope="application" clearAll="true" />
59
60<cfoutput>Now delete the scheduled task.</cfoutput>
61<cfschedule action="delete" task="BlogCFC Notifier #url.id#">
62
63<cfsetting enablecfoutputonly=false>
Note: See TracBrowser for help on using the browser.