For those sites that need to make use of the upload functions of FCKEditor, a separate installation of FCKEditor will be required for shared ColdFusion Hosting customers. We have outlined the steps needed to work with most scenarios below. First here are a few TIPS to make your hosted ColdFusion application more secure:
NOTE: On the download site, be sure to download FCKEditor, not CKEditor
- Keep your FCKEditor installation patched. Keep an eye on this page for new releases: http://ckeditor.com/download
- Name the FCKEditor folder something different, such as "wysiwyg" wich is what is used in the example to follow.
- And most important, do not allow uploads via FCKEditor without authentication. Taking this a step further don't make simple registration process to allow uploads, confirm the user is valid.
- Uploads should be kept out of reach, at the same level as your publicly accessible folder.
-------- ~~~~| Self install of FCKEditor |~~~~ --------
I will cover installation, configuration and a simple POST script to capture data from an FCKEditor enabled form.
1. Download & Install FCKEditor (http://ckeditor.com/download/)
-Unzip and upload to the root of your site, for Windows ColdFusion Hosting customers this is the "wwwroot" folder.
*IMPORTANT* -Rename the "FCKEditor" folder to "wysiwyg".
-Delete the "_samples" folder from within the "wysiwyg" folder & cleanup any other un-needed files from the FCKEditor install (optional).
2. Protect the "wysiwyg" installation with authentication.
-Links to authentication methods provided at the bottom of this article, please feel free to post your own methods (not revealing too much).
3. Configure FCKEditor to allow uploads.
-Create folder for "uploads", I chose "d:\home\yourdomain.com\wwwroot\my_uploads\"
-Edit file "\wysiwyg\editor\filemanager\connectors\cfm\config .cfm"
-Set Config.Enabled from false to true.
Code:
// SECURITY: You must explicitly enable this "connector". (Set enabled to "true")
Config.Enabled = true ;
-Set Config.ServerPath "d:\home\yourdomain.com\wwwroot\my_uploads\", save file.
Code:
// Use this to force the server path if FCKeditor is not running directly off
// the root of the application or the FCKeditor directory in the URL is a virtual directory
// or a symbolic link / junction
// Example: C:\inetpub\wwwroot\myDocs\
Config.ServerPath = "d:\home\yourdomain.com\wwwroot\my_uploads\" ;
-Set denied file extensions (Example below) for security measures, save file.
Code:
config.deniedExtensions["File"] ="html,htm,php,php2,php3,php4,php5,phtml,pwml,inc,asp,aspx,ascx,jsp,cfm,cfml,cfc,pl,bat,exe,com,dll,vbs,js,reg,cgi,htaccess,asis,sh,shtml,shtm,phtm";
-Edit file "\wysiwyg\fckconfig.js"
-Set the following variables to from 'php' ro 'cfm', save file.
Code:
// The following value defines which File Browser connector and Quick Upload
// "uploader" to use. It is valid for the default implementation and it is here
// just to make this configuration file cleaner.
// It is not possible to change this value using an external file or even
// inline when creating the editor instance. In that cases you must set the
// values of LinkBrowserURL, ImageBrowserURL and so on.
// Custom implementations should just ignore it.
var _FileBrowserLanguage = 'cfm' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'cfm' ; // asp | aspx | cfm | lasso | perl | php | py
4. Add the editor to the page replacing <cftextarea richtext=true name="richtext">
Code:
<form method="POST" action="sampleposteddata.cfm">
</cfoutput>
<!--- Calculate basepath for FCKeditor. --->
<cfset basePath = "/wysiwyg/">
<cfmodule
template="/wysiwyg/fckeditor.cfm"
basePath="#basePath#"
toolbarSet=""
instanceName="myEditor"
value='<p>This is some <strong>sample text</strong>. You are using a href="http://www.fckeditor.net/">FCKeditor</a>.</p>'
width="100%"
height="200"
>
<cfoutput>
<br />
<input type="submit" value="Submit">
<hr />
</form>
5. Accepting POST data, input from the editor with be passed in variable "FORM.myEditor".
Authentication methods:
http://www.communitymx.com/abstract.cfm?cid=F3AAD
Remember me login (by Ben Nadel)
Code examples can be found in the _samples folder in the FCKEditor download and have been used for this tutorial.
This is a work around for shared ColdFusion 8 Hosting, which has the FCKEditor built in. Per the Adobe ColdFusion Security Advisory, FCKEditor uploads are disabled on all shared ColdFusion 8 servers: APSB08-21