root/trunk/website/blog/send.cfm

Revision 5, 4.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         : Send
5        Author       : Raymond Camden
6        Created      : April 15, 2006
7        Last Updated : February 28, 2007
8        History      : Use mailserver/u/p in send (rkc 6/25/06)
9                                 : rb use, captcha (rkc 8/20/06)
10                                 : CSS mods by Scott Stroz (rkc 8/24/06)
11                                 : htmlEditFormat the title (rkc 10/12/06)
12                                 : Don't log the getEntry (rkc 2/28/07)
13        Purpose          : Sends a blog entry
14--->
15
16<cfif not isDefined("url.id")>
17        <cflocation url="/" addToken="false">
18<cfelse>
19        <cftry>
20                <cfset entry = application.blog.getEntry(url.id,true)>
21                <cfcatch>
22                        <cflocation url="/" addToken="false">
23                </cfcatch>
24        </cftry>
25</cfif>
26
27<cfset showForm = true>
28<cfparam name="form.email" default="">
29<cfparam name="form.remail" default="">
30<cfparam name="form.notes" default="">
31<cfparam name="form.captchaText" default="">
32
33<cfif structKeyExists(form, "send")>
34        <cfset errorStr = "">
35        <cfif not len(trim(form.email)) or not isEmail(form.email)>
36                <cfset errorStr = errorStr & rb("mustincludeemail") & "<br />">
37        </cfif>
38        <cfif not len(trim(form.remail)) or not isEmail(form.remail)>
39                <cfset errorStr = errorStr & rb("mustincludereceiveremail") & "<br />">
40        </cfif>
41
42        <!--- captcha validation --->
43        <cfif application.useCaptcha>
44                <cfif not len(form.captchaText)>
45                   <cfset errorStr = errorStr & "Please enter the Captcha text.<br>">
46                <cfelseif NOT application.captcha.validateCaptcha(form.captchaHash,form.captchaText)>
47                   <cfset errorStr = errorStr & "The captcha text you have entered is incorrect.<br>">
48                </cfif>
49        </cfif>
50       
51        <cfif not len(errorStr)>
52       
53                <cfsavecontent variable="body">
54                        <cfoutput>
55                        <p>
56                        The following blog entry was sent to you from: <b>#form.email#</b><br />
57                        It came from the blog: <b>#htmlEditFormat(application.blog.getProperty("blogtitle"))#</b><br />
58                        The entry is titled: <b>#entry.title#</b><br />
59                        The entry can be found here: <b><a href="#application.blog.makeLink(entry.id)#">#application.blog.makeLink(entry.id)#</a></b>
60                        </p>
61                       
62                        <cfif len(form.notes)>
63                        <p>
64                        The following notes were included:<br />
65                        <b>#form.notes#</b>
66                        </p>
67                        <p>
68                        <hr>
69                        </p>
70                        </cfif>
71                        #application.blog.renderEntry(entry.body)#
72                        <cfif len(entry.morebody)>#application.blog.renderEntry(entry.morebody)#</cfif>
73                        </cfoutput>
74                </cfsavecontent>
75               
76                <cfset application.utils.mail(
77                                to=form.remail,
78                                from=form.email,
79                                cc=application.blog.getProperty("owneremail"),
80                                subject="#rb("blogentryfrom")#: #application.blog.getProperty("blogtitle")#",
81                                type="html",
82                                body=body,
83                                mailserver=application.blog.getProperty("mailserver"),
84                                mailusername=application.blog.getProperty("mailusername"),
85                                mailpassword=application.blog.getProperty("mailpassword")
86                                        )>
87                                                                                               
88                <cfset showForm = false>
89
90        </cfif>
91       
92</cfif>
93
94<cfmodule template="tags/layout.cfm" title="#rb("send")#">
95       
96       
97        <cfoutput>
98        <div class="date"><b>#rb("sendentry")#: #entry.title#</b></div>
99       
100        <div class="body">
101       
102        <cfif showForm>
103
104        <p>
105        #rb("sendform")#
106        </p>
107
108        <cfif isDefined("errorStr") and len(errorStr)>
109                <cfoutput><b>#rb("correctissues")#:</b><ul>#errorStr#</ul></cfoutput>
110        </cfif>
111       
112                <form action="#cgi.script_name#?#cgi.query_string#" method="post">
113    <fieldset id="sendForm">
114             <div>
115              <label for="email">#rb("youremailaddress")#:</label>
116              <input type="text" id="email" name="email" value="#form.email#" style="width:300px;">
117            </div>
118             <div>
119              <label for="remail">#rb("receiveremailaddress")#:</label>
120              <input type="text" id="remail" name="remail" value="#form.remail#" style="width:300px;">
121            </div>
122             <div>
123              <label for="remail">#rb("optionalnotes")#:</label>
124              <textarea name="notes" id="notes">#form.notes#</textarea>
125            </div>
126                <cfif application.useCaptcha>
127                        <cfset variables.captcha = application.captcha.createHashReference() />
128            <div>
129                                <input type="hidden" name="captchaHash" value="#variables.captcha.hash#" />
130                                <label for="captchaText" class="longLabel">#rb("captchatext")#:</label>
131                                <input type="text" name="captchaText" size="6" /><br>
132                                <img src="#application.blog.getRootURL()#showCaptcha.cfm?hashReference=#variables.captcha.hash#" vspace="5"/>
133            </div>
134                </cfif>
135            <div>
136              <input type="submit" id="submit" name="send" value="#rb("sendentry")#">
137             </div>
138    </fieldset>
139
140                </form>
141
142        <cfelse>
143       
144                <p>
145                #rb("entrysent")#
146                </p>
147               
148        </cfif>
149       
150        </div>
151        </cfoutput>
152       
153</cfmodule>
154
155<cfsetting enablecfoutputonly=false>
Note: See TracBrowser for help on using the browser.