| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <cfprocessingdirective pageencoding="utf-8"> |
|---|
| 3 | <!--- |
|---|
| 4 | Name : c:\projects\blog\client\trackbacks.cfm |
|---|
| 5 | Author : Dave Lobb |
|---|
| 6 | Created : 09/22/05 |
|---|
| 7 | Last Updated : 8/20/06 |
|---|
| 8 | History : Ray modified it for 4.0 |
|---|
| 9 | Use of rb (rkc 8/20/06) |
|---|
| 10 | ---> |
|---|
| 11 | |
|---|
| 12 | <cfparam name="form.blog_name" default=""> |
|---|
| 13 | <cfparam name="form.title" default=""> |
|---|
| 14 | <cfparam name="form.excerpt" default=""> |
|---|
| 15 | <cfparam name="form.url" default=""> |
|---|
| 16 | |
|---|
| 17 | <!--- Modification by Ben Forta - 3rd clause tends to help block errors generated by spam bots ---> |
|---|
| 18 | <cfif not isDefined("url.id") or not application.trackbacksAllowed or not structCount(URL) is 1> |
|---|
| 19 | <cfabort> |
|---|
| 20 | </cfif> |
|---|
| 21 | |
|---|
| 22 | <cfif isDefined("url.delete") and isUserInRole("admin")> |
|---|
| 23 | <cfset application.blog.deleteTrackback(url.delete)> |
|---|
| 24 | </cfif> |
|---|
| 25 | |
|---|
| 26 | <cfif isDefined("form.addtrackback")> |
|---|
| 27 | <cfset errorStr = ""> |
|---|
| 28 | |
|---|
| 29 | <cfif not len(trim(form.blog_name))> |
|---|
| 30 | <cfset errorStr = errorStr & rb("mustincludeblogname") & "<br>"> |
|---|
| 31 | </cfif> |
|---|
| 32 | |
|---|
| 33 | <cfif not len(trim(form.title))> |
|---|
| 34 | <cfset errorStr = errorStr & rb("mustincludeblogtitle") & "<br>"> |
|---|
| 35 | </cfif> |
|---|
| 36 | |
|---|
| 37 | <cfif not len(trim(form.excerpt))> |
|---|
| 38 | <cfset errorStr = errorStr & rb("mustincludeblogexcerpt") & "<br>"> |
|---|
| 39 | </cfif> |
|---|
| 40 | |
|---|
| 41 | <cfif not len(trim(form.url)) or not isURL(form.url)> |
|---|
| 42 | <cfset errorStr = errorStr & rb("mustincludeblogentryurl") & "<br>"> |
|---|
| 43 | </cfif> |
|---|
| 44 | |
|---|
| 45 | <cfif not len(errorStr)> |
|---|
| 46 | <cfset id = application.blog.addTrackBack(form.title, form.url, form.blog_name, form.excerpt, url.id)> |
|---|
| 47 | <!--- Form a message about the TB ---> |
|---|
| 48 | <cfif id is not ""> |
|---|
| 49 | <cfmodule template="tags/trackbackemail.cfm" trackback="#id#" /> |
|---|
| 50 | <cfmodule template="tags/scopecache.cfm" scope="application" clearall="true"> |
|---|
| 51 | </cfif> |
|---|
| 52 | <cfset form.blog_name = ""> |
|---|
| 53 | <cfset form.title = ""> |
|---|
| 54 | <cfset form.excerpt = ""> |
|---|
| 55 | <cfset form.url = ""> |
|---|
| 56 | |
|---|
| 57 | <!--- reload page and close this up ---> |
|---|
| 58 | <cfoutput> |
|---|
| 59 | <script> |
|---|
| 60 | window.opener.location.reload(); |
|---|
| 61 | window.close(); |
|---|
| 62 | </script> |
|---|
| 63 | </cfoutput> |
|---|
| 64 | <cfabort> |
|---|
| 65 | |
|---|
| 66 | </cfif> |
|---|
| 67 | |
|---|
| 68 | </cfif> |
|---|
| 69 | |
|---|
| 70 | <cfset params.byEntry = url.id> |
|---|
| 71 | <cfset article = application.blog.getEntries(params)> |
|---|
| 72 | |
|---|
| 73 | <cfoutput> |
|---|
| 74 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" /> |
|---|
| 75 | |
|---|
| 76 | <html> |
|---|
| 77 | <head> |
|---|
| 78 | <title>#application.blog.getProperty("blogTitle")# : Trackbacks for #article.title#</title> |
|---|
| 79 | <link rel="stylesheet" href="#application.rootURL#/includes/style.css" type="text/css"/> |
|---|
| 80 | </head> |
|---|
| 81 | |
|---|
| 82 | <body style="background:##ffffff;"> |
|---|
| 83 | </cfoutput> |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | <cfoutput> |
|---|
| 87 | <div class="date">Add TrackBack</div> |
|---|
| 88 | <div class="body"> |
|---|
| 89 | <cfif isDefined("errorStr") and len(errorStr)> |
|---|
| 90 | <cfoutput><b>#rb("correctissues")#:</b><ul>#errorStr#</ul></cfoutput> |
|---|
| 91 | </cfif> |
|---|
| 92 | <form action="#cgi.script_name#?id=#url.id#" method="post" enctype="application/x-www-form-urlencoded" id="tbForm"> |
|---|
| 93 | |
|---|
| 94 | <fieldset class="sideBySide"> |
|---|
| 95 | <label for="blogName">Your Blog Name:</label> |
|---|
| 96 | <input type="text" id="blogName" name="blog_name" value="#form.blog_name#" maxlength="255" /> |
|---|
| 97 | </fieldset> |
|---|
| 98 | <fieldset class="sideBySide"> |
|---|
| 99 | <label for="title">Your Blog Entry Title:</label> |
|---|
| 100 | <input type="text" id="title" name="title" value="#form.title#" maxlength="255" /> |
|---|
| 101 | </fieldset> |
|---|
| 102 | <fieldset> |
|---|
| 103 | <label for="excerpt">Excerpt from your Blog:</label><br/> |
|---|
| 104 | <textarea id="excerpt" name="excerpt" cols=50 rows=10>#form.excerpt#</textarea> |
|---|
| 105 | </fieldset> |
|---|
| 106 | <fieldset class="sideBySide"> |
|---|
| 107 | <label for="url">Your Blog Entry URL:</label> |
|---|
| 108 | <input type="text" id="url" name="url" value="#form.url#" maxlength="255" /> |
|---|
| 109 | </fieldset> |
|---|
| 110 | <fieldset style="text-align:center"> |
|---|
| 111 | <input id="submit" type="submit" name="addtrackback" value="#rb("post")#" /> |
|---|
| 112 | </fieldset> |
|---|
| 113 | </form> |
|---|
| 114 | </div> |
|---|
| 115 | |
|---|
| 116 | <cfif isUserInRole("admin")> |
|---|
| 117 | <div class="date">Send TrackBack</div> |
|---|
| 118 | <div class="body"> |
|---|
| 119 | <script language="javascript"> |
|---|
| 120 | function setAction() { |
|---|
| 121 | if (document.sendtb.trackbackURL.value == "") { |
|---|
| 122 | alert('Please provide the trackback url'); |
|---|
| 123 | return false; |
|---|
| 124 | } |
|---|
| 125 | else { |
|---|
| 126 | document.sendtb.action = document.sendtb.trackbackURL.value; |
|---|
| 127 | document.sendtb.submit(); |
|---|
| 128 | return true; |
|---|
| 129 | } |
|---|
| 130 | |
|---|
| 131 | } |
|---|
| 132 | </script> |
|---|
| 133 | <form action="" name="sendtb" method="post" enctype="application/x-www-form-urlencoded" onSubmit="return setAction();"> |
|---|
| 134 | <fieldset class="sideBySide"> |
|---|
| 135 | <label for="blogName">Your Blog Name:</label> |
|---|
| 136 | <input type="text" id="blogName" name="blog_name" value="#form.blog_name#" maxlength="255" /> |
|---|
| 137 | </fieldset> |
|---|
| 138 | <fieldset class="sideBySide"> |
|---|
| 139 | <label for="title">Your Blog Entry Title:</label> |
|---|
| 140 | <input type="text" id="title" name="title" value="#form.title#" maxlength="255" /> |
|---|
| 141 | </fieldset> |
|---|
| 142 | <fieldset> |
|---|
| 143 | <label for="excerpt">Excerpt from your Blog:</label><br/> |
|---|
| 144 | <textarea id="excerpt" name="excerpt" cols=50 rows=10>#form.excerpt#</textarea> |
|---|
| 145 | </fieldset> |
|---|
| 146 | <fieldset class="sideBySide"> |
|---|
| 147 | <label for="url">Your Blog Entry URL:</label> |
|---|
| 148 | <input type="text" id="url" name="url" value="#form.url#" maxlength="255" /> |
|---|
| 149 | </fieldset> |
|---|
| 150 | <fieldset style="text-align:center"> |
|---|
| 151 | <input id="submit" type="submit" name="addtrackback" value="#rb("post")#" /> |
|---|
| 152 | </fieldset> |
|---|
| 153 | |
|---|
| 154 | </form> |
|---|
| 155 | |
|---|
| 156 | </div> |
|---|
| 157 | </cfif> |
|---|
| 158 | </body> |
|---|
| 159 | </html> |
|---|
| 160 | </cfoutput> |
|---|
| 161 | |
|---|
| 162 | <cfsetting enablecfoutputonly=false> |
|---|