| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <cfprocessingdirective pageencoding="utf-8"> |
|---|
| 3 | <!--- |
|---|
| 4 | Name : /client/admin/index.cfm |
|---|
| 5 | Author : Raymond Camden |
|---|
| 6 | Created : 04/12/06 |
|---|
| 7 | Last Updated : 4/13/06 |
|---|
| 8 | History : Various changes, forgotten keys, new keys (rkc 9/5/06) |
|---|
| 9 | : Comment moderation support (tr 12/7/06) |
|---|
| 10 | : support new properties (rkc 12/14/06) |
|---|
| 11 | : change moderate postings to moderate comments (rkc 4/13/07) |
|---|
| 12 | ---> |
|---|
| 13 | |
|---|
| 14 | <cfif not application.settings> |
|---|
| 15 | <cflocation url="index.cfm" addToken="false"> |
|---|
| 16 | </cfif> |
|---|
| 17 | |
|---|
| 18 | <!--- quick utility func to change foo,moo to foo<newline>moo and reverse ---> |
|---|
| 19 | <cfscript> |
|---|
| 20 | function toLines(str) { return replace(str, ",", chr(10), "all"); } |
|---|
| 21 | function toList(str) { |
|---|
| 22 | str = replace(str, chr(10), "", "all"); |
|---|
| 23 | str = replace(str, chr(13), ",", "all"); |
|---|
| 24 | return str; |
|---|
| 25 | } |
|---|
| 26 | </cfscript> |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | <cfset settings = application.blog.getProperties()> |
|---|
| 30 | <cfset validDBTypes = application.blog.getValidDBTypes()> |
|---|
| 31 | |
|---|
| 32 | <cfloop item="setting" collection="#settings#"> |
|---|
| 33 | <cfparam name="form.#setting#" default="#settings[setting]#"> |
|---|
| 34 | </cfloop> |
|---|
| 35 | <!--- |
|---|
| 36 | we can use all the settings, but username and password may get overwritten |
|---|
| 37 | by a login attempt, see this bug report: |
|---|
| 38 | http://blogcfc.riaforge.org/index.cfm?event=page.issue&issueid=4CEC3A8A-C919-ED1E-17FD790A1A7DE997 |
|---|
| 39 | ---> |
|---|
| 40 | <cfparam name="form.dsn_username" default="#settings.username#"> |
|---|
| 41 | <cfparam name="form.dsn_password" default="#settings.password#"> |
|---|
| 42 | |
|---|
| 43 | <cfif structKeyExists(form, "cancel")> |
|---|
| 44 | <cflocation url="index.cfm" addToken="false"> |
|---|
| 45 | </cfif> |
|---|
| 46 | |
|---|
| 47 | <cfif structKeyExists(form, "save")> |
|---|
| 48 | <cfset errors = arrayNew(1)> |
|---|
| 49 | |
|---|
| 50 | <cfif not len(trim(form.blogtitle))> |
|---|
| 51 | <cfset arrayAppend(errors, "Your blog must have a title.")> |
|---|
| 52 | </cfif> |
|---|
| 53 | |
|---|
| 54 | <cfif not len(trim(form.blogurl))> |
|---|
| 55 | <cfset arrayAppend(errors, "Your blog url cannot be blank.")> |
|---|
| 56 | <cfelseif right(form.blogurl, 9) is not "index.cfm"> |
|---|
| 57 | <cfset arrayAppend(errors, "The blogurl setting must end with index.cfm.")> |
|---|
| 58 | </cfif> |
|---|
| 59 | |
|---|
| 60 | <cfif len(trim(form.commentsfrom)) and not isEmail(form.commentsfrom)> |
|---|
| 61 | <cfset arrayAppend(errors, "The commentsfrom setting must be a valid email address.")> |
|---|
| 62 | </cfif> |
|---|
| 63 | |
|---|
| 64 | <cfif len(trim(form.maxentries)) and not isNumeric(form.maxentries)> |
|---|
| 65 | <cfset arrayAppend(errors, "Max entries must be numeric.")> |
|---|
| 66 | </cfif> |
|---|
| 67 | |
|---|
| 68 | <cfif len(trim(form.offset)) and not isNumeric(form.offset)> |
|---|
| 69 | <cfset arrayAppend(errors, "Offset must be numeric.")> |
|---|
| 70 | </cfif> |
|---|
| 71 | |
|---|
| 72 | <cfset form.pingurls = toList(form.pingurls)> |
|---|
| 73 | |
|---|
| 74 | <cfif not len(trim(form.dsn))> |
|---|
| 75 | <cfset arrayAppend(errors, "Your blog must have a dsn.")> |
|---|
| 76 | </cfif> |
|---|
| 77 | |
|---|
| 78 | <cfif not len(trim(form.locale))> |
|---|
| 79 | <cfset arrayAppend(errors, "Your blog must have a locale.")> |
|---|
| 80 | </cfif> |
|---|
| 81 | |
|---|
| 82 | <cfset form.ipblocklist = toList(form.ipblocklist)> |
|---|
| 83 | <cfset form.trackbackspamlist = listSort(toList(form.trackbackspamlist),"textnocase")> |
|---|
| 84 | |
|---|
| 85 | <cfif not arrayLen(errors)> |
|---|
| 86 | <!--- copy dsn_* ---> |
|---|
| 87 | <cfset form.username = form.dsn_username> |
|---|
| 88 | <cfset form.password = form.dsn_password> |
|---|
| 89 | |
|---|
| 90 | <!--- make a list of the keys we will send. ---> |
|---|
| 91 | <cfset keylist = "blogtitle,blogdescription,blogkeywords,blogurl,commentsfrom,maxentries,offset,pingurls,dsn,blogdbtype,locale,ipblocklist,moderate,allowtrackbacks,usetweetbacks,trackbackspamlist,mailserver,mailusername,mailpassword,users,usecaptcha,allowgravatars,owneremail,username,password,filebrowse,imageroot,itunessubtitle,itunessummary,ituneskeywords,itunesauthor,itunesimage,itunesexplicit"> |
|---|
| 92 | <cfloop index="key" list="#keylist#"> |
|---|
| 93 | <cfif structKeyExists(form, key)> |
|---|
| 94 | <cfset application.blog.setProperty(key, trim(form[key]))> |
|---|
| 95 | </cfif> |
|---|
| 96 | </cfloop> |
|---|
| 97 | <cflocation url="settings.cfm?reinit=1&settingsupdated=1" addToken="false"> |
|---|
| 98 | </cfif> |
|---|
| 99 | </cfif> |
|---|
| 100 | |
|---|
| 101 | <cfmodule template="../tags/adminlayout.cfm" title="Settings"> |
|---|
| 102 | |
|---|
| 103 | <cfif structKeyExists(url, "settingsupdated")> |
|---|
| 104 | <cfoutput> |
|---|
| 105 | <div style="margin: 15px 0; padding: 15px; border: 5px solid ##cd6f6f; background-color: ##f79992; color: ##c54043; font-weight: bold; text-align: center;"> |
|---|
| 106 | Your settings have been updated and your cache refreshed. |
|---|
| 107 | </div> |
|---|
| 108 | </cfoutput> |
|---|
| 109 | </cfif> |
|---|
| 110 | |
|---|
| 111 | <cfoutput> |
|---|
| 112 | <p> |
|---|
| 113 | Please edit your settings below. <b>Be warned:</b> A mistake here can make both the blog and this |
|---|
| 114 | administrator unreachable. Be careful! ("Here be dragons...") |
|---|
| 115 | </p> |
|---|
| 116 | </cfoutput> |
|---|
| 117 | |
|---|
| 118 | <cfif structKeyExists(variables, "errors") and arrayLen(errors)> |
|---|
| 119 | <cfoutput> |
|---|
| 120 | <div class="errors"> |
|---|
| 121 | Please correct the following error(s): |
|---|
| 122 | <ul> |
|---|
| 123 | <cfloop index="x" from="1" to="#arrayLen(errors)#"> |
|---|
| 124 | <li>#errors[x]#</li> |
|---|
| 125 | </cfloop> |
|---|
| 126 | </ul> |
|---|
| 127 | </div> |
|---|
| 128 | </cfoutput> |
|---|
| 129 | </cfif> |
|---|
| 130 | |
|---|
| 131 | <cfoutput> |
|---|
| 132 | <form action="settings.cfm" method="post"> |
|---|
| 133 | <table> |
|---|
| 134 | <tr> |
|---|
| 135 | <td align="right">blog title:</td> |
|---|
| 136 | <td><input type="text" name="blogtitle" value="#htmlEditFormat(form.blogtitle)#" class="txtField" maxlength="255"></td> |
|---|
| 137 | </tr> |
|---|
| 138 | <tr valign="top"> |
|---|
| 139 | <td align="right">blog description:</td> |
|---|
| 140 | <td><textarea name="blogdescription" class="txtAreaShort">#htmlEditFormat(form.blogdescription)#</textarea></td> |
|---|
| 141 | </tr> |
|---|
| 142 | <tr valign="top"> |
|---|
| 143 | <td align="right">blog keywords:</td> |
|---|
| 144 | <td><input type="text" name="blogkeywords" value="#htmlEditFormat(form.blogkeywords)#" class="txtField" maxlength="255"></td> |
|---|
| 145 | </tr> |
|---|
| 146 | <tr valign="top"> |
|---|
| 147 | <td align="right">owner email:</td> |
|---|
| 148 | <td><input type="text" name="owneremail" value="#htmlEditFormat(form.owneremail)#" class="txtField" maxlength="255"></td> |
|---|
| 149 | </tr> |
|---|
| 150 | <tr> |
|---|
| 151 | <td align="right">blog url:</td> |
|---|
| 152 | <td><input type="text" name="blogurl" value="#form.blogurl#" class="txtField" maxlength="255"></td> |
|---|
| 153 | </tr> |
|---|
| 154 | <tr> |
|---|
| 155 | <td align="right">comments sent from:</td> |
|---|
| 156 | <td><input type="text" name="commentsfrom" value="#form.commentsfrom#" class="txtField" maxlength="255"></td> |
|---|
| 157 | </tr> |
|---|
| 158 | <tr> |
|---|
| 159 | <td align="right">max entries:</td> |
|---|
| 160 | <td><input type="text" name="maxentries" value="#form.maxentries#" class="txtField" maxlength="255"></td> |
|---|
| 161 | </tr> |
|---|
| 162 | <tr> |
|---|
| 163 | <td align="right">offset:</td> |
|---|
| 164 | <td><input type="text" name="offset" value="#form.offset#" class="txtField" maxlength="255"></td> |
|---|
| 165 | </tr> |
|---|
| 166 | <tr valign="top"> |
|---|
| 167 | <td align="right">ping urls:</td> |
|---|
| 168 | <td><textarea name="pingurls" class="txtAreaShort">#toLines(form.pingurls)#</textarea></td> |
|---|
| 169 | </tr> |
|---|
| 170 | <tr> |
|---|
| 171 | <td align="right">dsn:</td> |
|---|
| 172 | <td><input type="text" name="dsn" value="#form.dsn#" class="txtField" maxlength="50"></td> |
|---|
| 173 | </tr> |
|---|
| 174 | <tr> |
|---|
| 175 | <td align="right">blog database type:</td> |
|---|
| 176 | <td> |
|---|
| 177 | <select name="blogdbtype"> |
|---|
| 178 | <cfloop index="dbtype" list="#validDBTypes#"> |
|---|
| 179 | <option value="#dbtype#" <cfif form.blogdbtype is dbtype>selected</cfif>>#dbtype#</option> |
|---|
| 180 | </cfloop> |
|---|
| 181 | </select> |
|---|
| 182 | </td> |
|---|
| 183 | </tr> |
|---|
| 184 | <tr valign="top"> |
|---|
| 185 | <td align="right">dsn username:</td> |
|---|
| 186 | <td><input type="text" name="dsn_username" value="#form.dsn_username#" class="txtField" maxlength="255"></td> |
|---|
| 187 | </tr> |
|---|
| 188 | <tr valign="top"> |
|---|
| 189 | <td align="right">dsn password:</td> |
|---|
| 190 | <td><input type="text" name="dsn_password" value="#form.dsn_password#" class="txtField" maxlength="255"></td> |
|---|
| 191 | </tr> |
|---|
| 192 | <tr> |
|---|
| 193 | <td align="right">locale:</td> |
|---|
| 194 | <td><input type="text" name="locale" value="#form.locale#" class="txtField" maxlength="50"></td> |
|---|
| 195 | </tr> |
|---|
| 196 | <tr valign="top"> |
|---|
| 197 | <td align="right">ip block list:</td> |
|---|
| 198 | <td><textarea name="ipblocklist" class="txtAreaShort">#toLines(form.ipblocklist)#</textarea></td> |
|---|
| 199 | </tr> |
|---|
| 200 | <tr> |
|---|
| 201 | <td align="right">moderate comments:</td> |
|---|
| 202 | <td> |
|---|
| 203 | <select name="moderate"> |
|---|
| 204 | <option value="yes" <cfif form.moderate>selected</cfif>>Yes</option> |
|---|
| 205 | <option value="no" <cfif not form.moderate>selected</cfif>>No</option> |
|---|
| 206 | </select> |
|---|
| 207 | </td> |
|---|
| 208 | </tr> |
|---|
| 209 | <tr> |
|---|
| 210 | <td align="right">use captcha:</td> |
|---|
| 211 | <td> |
|---|
| 212 | <select name="usecaptcha"> |
|---|
| 213 | <option value="yes" <cfif form.usecaptcha>selected</cfif>>Yes</option> |
|---|
| 214 | <option value="no" <cfif not form.usecaptcha>selected</cfif>>No</option> |
|---|
| 215 | </select> |
|---|
| 216 | </td> |
|---|
| 217 | </tr> |
|---|
| 218 | <tr> |
|---|
| 219 | <td align="right">use tweetbacks:</td> |
|---|
| 220 | <td> |
|---|
| 221 | <select name="usetweetbacks"> |
|---|
| 222 | <option value="yes" <cfif form.usetweetbacks>selected</cfif>>Yes</option> |
|---|
| 223 | <option value="no" <cfif not form.usetweetbacks>selected</cfif>>No</option> |
|---|
| 224 | </select> |
|---|
| 225 | </td> |
|---|
| 226 | </tr> |
|---|
| 227 | <tr> |
|---|
| 228 | <td align="right">allow trackbacks:</td> |
|---|
| 229 | <td> |
|---|
| 230 | <select name="allowtrackbacks"> |
|---|
| 231 | <option value="yes" <cfif form.allowtrackbacks>selected</cfif>>Yes</option> |
|---|
| 232 | <option value="no" <cfif not form.allowtrackbacks>selected</cfif>>No</option> |
|---|
| 233 | </select> |
|---|
| 234 | </td> |
|---|
| 235 | </tr> |
|---|
| 236 | <tr valign="top"> |
|---|
| 237 | <td align="right">trackback spamlist:</td> |
|---|
| 238 | <td><textarea name="trackbackspamlist" class="txtAreaShort">#toLines(form.trackbackspamlist)#</textarea></td> |
|---|
| 239 | </tr> |
|---|
| 240 | <tr> |
|---|
| 241 | <td align="right">allow gravatars:</td> |
|---|
| 242 | <td> |
|---|
| 243 | <select name="allowgravatars"> |
|---|
| 244 | <option value="yes" <cfif form.allowgravatars>selected</cfif>>Yes</option> |
|---|
| 245 | <option value="no" <cfif not form.allowgravatars>selected</cfif>>No</option> |
|---|
| 246 | </select> |
|---|
| 247 | </td> |
|---|
| 248 | </tr> |
|---|
| 249 | <tr> |
|---|
| 250 | <td align="right">show file manager:</td> |
|---|
| 251 | <td> |
|---|
| 252 | <select name="filebrowse"> |
|---|
| 253 | <option value="yes" <cfif form.filebrowse>selected</cfif>>Yes</option> |
|---|
| 254 | <option value="no" <cfif not form.filebrowse>selected</cfif>>No</option> |
|---|
| 255 | </select> |
|---|
| 256 | </td> |
|---|
| 257 | </tr> |
|---|
| 258 | <tr> |
|---|
| 259 | <td align="right">image root for dynamic images:</td> |
|---|
| 260 | <td><input type="text" name="imageroot" value="#form.imageroot#" class="txtField" maxlength="50"></td> |
|---|
| 261 | </tr> |
|---|
| 262 | <tr> |
|---|
| 263 | <td align="right">mail server:</td> |
|---|
| 264 | <td><input type="text" name="mailserver" value="#form.mailserver#" class="txtField" maxlength="50"></td> |
|---|
| 265 | </tr> |
|---|
| 266 | <tr> |
|---|
| 267 | <td align="right">mail username:</td> |
|---|
| 268 | <td><input type="text" name="mailusername" value="#form.mailusername#" class="txtField" maxlength="50"></td> |
|---|
| 269 | </tr> |
|---|
| 270 | <tr> |
|---|
| 271 | <td align="right">mail password:</td> |
|---|
| 272 | <td><input type="text" name="mailpassword" value="#form.mailpassword#" class="txtField" maxlength="50"></td> |
|---|
| 273 | </tr> |
|---|
| 274 | <tr> |
|---|
| 275 | <td align="right">users:</td> |
|---|
| 276 | <td><input type="text" name="users" value="#form.users#" class="txtField" maxlength="255"></td> |
|---|
| 277 | </tr> |
|---|
| 278 | <tr> |
|---|
| 279 | <td colspan="2">The following entries are specifically related to podcasting.</td> |
|---|
| 280 | </tr> |
|---|
| 281 | <tr> |
|---|
| 282 | <td align="right">itunes Subtitle:</td> |
|---|
| 283 | <td><input type="text" name="itunessubtitle" value="#form.itunessubtitle#" class="txtField" maxlength="50"></td> |
|---|
| 284 | </tr> |
|---|
| 285 | <tr> |
|---|
| 286 | <td align="right">itunes Summary:</td> |
|---|
| 287 | <td><input type="text" name="itunessummary" value="#form.itunessummary#" class="txtField" maxlength="50"></td> |
|---|
| 288 | </tr> |
|---|
| 289 | <tr> |
|---|
| 290 | <td align="right">itunes Keywords:</td> |
|---|
| 291 | <td><input type="text" name="ituneskeywords" value="#form.ituneskeywords#" class="txtField" maxlength="50"></td> |
|---|
| 292 | </tr> |
|---|
| 293 | <tr> |
|---|
| 294 | <td align="right">itunes Author:</td> |
|---|
| 295 | <td><input type="text" name="itunesauthor" value="#form.itunesauthor#" class="txtField" maxlength="50"></td> |
|---|
| 296 | </tr> |
|---|
| 297 | <tr> |
|---|
| 298 | <td align="right">itunes Image:</td> |
|---|
| 299 | <td><input type="text" name="itunesimage" value="#form.itunesimage#" class="txtField" maxlength="50"></td> |
|---|
| 300 | </tr> |
|---|
| 301 | <tr> |
|---|
| 302 | <td align="right">itunes Explicit:</td> |
|---|
| 303 | <td> |
|---|
| 304 | <select name="itunesexplicit"> |
|---|
| 305 | <option value="yes" <cfif form.itunesexplicit>selected</cfif>>Yes</option> |
|---|
| 306 | <option value="no" <cfif not form.itunesexplicit>selected</cfif>>No</option> |
|---|
| 307 | </select> |
|---|
| 308 | </td> |
|---|
| 309 | </tr> |
|---|
| 310 | <tr> |
|---|
| 311 | <td> </td> |
|---|
| 312 | <td><input type="submit" name="cancel" value="Cancel"> <input type="submit" name="save" value="Save"></td> |
|---|
| 313 | </tr> |
|---|
| 314 | </table> |
|---|
| 315 | </form> |
|---|
| 316 | </cfoutput> |
|---|
| 317 | |
|---|
| 318 | |
|---|
| 319 | </cfmodule> |
|---|
| 320 | |
|---|
| 321 | <cfsetting enablecfoutputonly=false> |
|---|