1<cfsetting enablecfoutputonly="Yes">
2<!---
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
5 *
6 * == BEGIN LICENSE ==
7 *
8 * Licensed under the terms of any of the following licenses at your
9 * choice:
10 *
11 *  - GNU General Public License Version 2 or later (the "GPL")
12 *    http://www.gnu.org/licenses/gpl.html
13 *
14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 *    http://www.gnu.org/licenses/lgpl.html
16 *
17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
18 *    http://www.mozilla.org/MPL/MPL-1.1.html
19 *
20 * == END LICENSE ==
21 *
22 * Configuration file for the ColdFusion Connector (all versions).
23--->
24
25<cfscript>
26	Config = StructNew() ;
27
28	// SECURITY: You must explicitly enable this "connector". (Set enabled to "true")
29	Config.Enabled = true ;
30
31	// Path to uploaded files relative to the document root.
32	Config.UserFilesPath = "/userfiles/" ;
33
34	// Use this to force the server path if FCKeditor is not running directly off
35	// the root of the application or the FCKeditor directory in the URL is a virtual directory
36	// or a symbolic link / junction
37	// Example: C:\inetpub\wwwroot\myDocs\
38	Config.ServerPath = "" ;
39
40	// Due to security issues with Apache modules, it is reccomended to leave the
41	// following setting enabled.
42	Config.ForceSingleExtension = true ;
43
44	// Perform additional checks for image files - if set to true, validate image size
45	// (This feature works in MX 6.0 and above)
46	Config.SecureImageUploads = true;
47
48	// What the user can do with this connector
49	Config.ConfigAllowedCommands 			= "QuickUpload,FileUpload,GetFolders,GetFoldersAndFiles,CreateFolder" ;
50
51	//Allowed Resource Types
52	Config.ConfigAllowedTypes 				= "File,Image,Flash,Media" ;
53
54	// For security, HTML is allowed in the first Kb of data for files having the
55	// following extensions only.
56	// (This feature works in MX 6.0 and above))
57	Config.HtmlExtensions					= "html,htm,xml,xsd,txt,js" ;
58
59
60//	Configuration settings for each Resource Type
61//
62//	- AllowedExtensions: the possible extensions that can be allowed.
63//		If it is empty then any file type can be uploaded.
64//	- DeniedExtensions: The extensions that won't be allowed.
65//		If it is empty then no restrictions are done here.
66//
67//	For a file to be uploaded it has to fullfil both the AllowedExtensions
68//	and DeniedExtensions (that's it: not being denied) conditions.
69//
70//	- FileTypesPath: the virtual folder relative to the document root where
71//		these resources will be located.
72//		Attention: It must start and end with a slash: '/'
73//
74//	- FileTypesAbsolutePath: the physical path to the above folder. It must be
75//		an absolute path.
76//		If it's an empty string then it will be autocalculated.
77//		Usefull if you are using a virtual directory, symbolic link or alias.
78//		Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
79//		Attention: The above 'FileTypesPath' must point to the same directory.
80//		Attention: It must end with a slash: '/'
81//
82//
83//	 - QuickUploadPath: the virtual folder relative to the document root where
84//		these resources will be uploaded using the Upload tab in the resources
85//		dialogs.
86//		Attention: It must start and end with a slash: '/'
87//
88//	 - QuickUploadAbsolutePath: the physical path to the above folder. It must be
89//		an absolute path.
90//		If it's an empty string then it will be autocalculated.
91//		Usefull if you are using a virtual directory, symbolic link or alias.
92//		Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
93//		Attention: The above 'QuickUploadPath' must point to the same directory.
94//		Attention: It must end with a slash: '/'
95
96	Config.AllowedExtensions 				= StructNew() ;
97	Config.DeniedExtensions 				= StructNew() ;
98	Config.FileTypesPath 					= StructNew() ;
99	Config.FileTypesAbsolutePath 			= StructNew() ;
100	Config.QuickUploadPath 					= StructNew() ;
101	Config.QuickUploadAbsolutePath 			= StructNew() ;
102
103	Config.AllowedExtensions["File"]	 	= "7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xml,zip" ;
104	Config.DeniedExtensions["File"] 		= "" ;
105	Config.FileTypesPath["File"] 			= Config.UserFilesPath & 'file/' ;
106	Config.FileTypesAbsolutePath["File"] 	= iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'file/') ) ;
107	Config.QuickUploadPath["File"] 			= Config.FileTypesPath["File"] ;
108	Config.QuickUploadAbsolutePath["File"] 	= Config.FileTypesAbsolutePath["File"] ;
109
110	Config.AllowedExtensions["Image"] 		= "bmp,gif,jpeg,jpg,png,psd,tif,tiff" ;
111	Config.DeniedExtensions["Image"] 		= "" ;
112	Config.FileTypesPath["Image"] 			= Config.UserFilesPath & 'image/' ;
113	Config.FileTypesAbsolutePath["Image"] 	= iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'image/') ) ;
114	Config.QuickUploadPath["Image"] 		= Config.FileTypesPath["Image"] ;
115	Config.QuickUploadAbsolutePath["Image"] = Config.FileTypesAbsolutePath["Image"] ;
116
117	Config.AllowedExtensions["Flash"] 		= "swf,fla" ;
118	Config.DeniedExtensions["Flash"] 		= "" ;
119	Config.FileTypesPath["Flash"] 			= Config.UserFilesPath & 'flash/' ;
120	Config.FileTypesAbsolutePath["Flash"] 	= iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'flash/') ) ;
121	Config.QuickUploadPath["Flash"] 		= Config.FileTypesPath["Flash"] ;
122	Config.QuickUploadAbsolutePath["Flash"] = Config.FileTypesAbsolutePath["Flash"] ;
123
124	Config.AllowedExtensions["Media"] 		= "aiff,asf,avi,bmp,fla,flv,gif,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,png,qt,ram,rm,rmi,rmvb,swf,tif,tiff,wav,wma,wmv" ;
125	Config.DeniedExtensions["Media"] 		= "" ;
126	Config.FileTypesPath["Media"] 			= Config.UserFilesPath & 'media/' ;
127	Config.FileTypesAbsolutePath["Media"] 	= iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'media/') ) ;
128	Config.QuickUploadPath["Media"] 		= Config.FileTypesPath["Media"] ;
129	Config.QuickUploadAbsolutePath["Media"] = Config.FileTypesAbsolutePath["Media"] ;
130</cfscript>
131
132<cftry>
133<!--- code to maintain backwards compatibility with previous version of cfm connector --->
134<cfif isDefined("application.userFilesPath")>
135
136	<cflock scope="application" type="readonly" timeout="5">
137		<cfset config.userFilesPath = application.userFilesPath>
138	</cflock>
139
140<cfelseif isDefined("server.userFilesPath")>
141
142	<cflock scope="server" type="readonly" timeout="5">
143		<cfset config.userFilesPath = server.userFilesPath>
144	</cflock>
145
146</cfif>
147
148<!--- look for config struct in application and server scopes --->
149<cfif isDefined("application.FCKeditor") and isStruct(application.FCKeditor)>
150
151	<cflock scope="application" type="readonly" timeout="5">
152	<cfset variables.FCKeditor = duplicate(application.FCKeditor)>
153	</cflock>
154
155<cfelseif isDefined("server.FCKeditor") and isStruct(server.FCKeditor)>
156
157	<cflock scope="server" type="readonly" timeout="5">
158	<cfset variables.FCKeditor = duplicate(server.FCKeditor)>
159	</cflock>
160
161</cfif>
162	<!--- catch potential "The requested scope application has not been enabled" exception --->
163	<cfcatch type="any">
164	</cfcatch>
165</cftry>
166
167<cfif isDefined("FCKeditor")>
168
169	<!--- copy key values from external to local config (i.e. override default config as required) --->
170	<cfscript>
171		function structCopyKeys(stFrom, stTo) {
172			for ( key in stFrom ) {
173				if ( isStruct(stFrom[key]) ) {
174					structCopyKeys(stFrom[key],stTo[key]);
175				} else {
176					stTo[key] = stFrom[key];
177				}
178			}
179		}
180		structCopyKeys(FCKeditor, config);
181	</cfscript>
182
183</cfif>
184