1<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
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 * File Browser connector for ColdFusion (MX 6.0 and above).
23 * (based on the original CF connector by Hendrik Kramer - hk@lwd.de)
24 *
25--->
26
27<cfparam name="url.command">
28<cfparam name="url.type">
29<cfparam name="url.currentFolder">
30
31<!--- note: no serverPath url parameter - see config.cfm if you need to set the serverPath manually --->
32
33<cfinclude template="config.cfm">
34<cfinclude template="cf_util.cfm">
35<cfinclude template="cf_io.cfm">
36<cfinclude template="cf_basexml.cfm">
37<cfinclude template="cf_commands.cfm">
38
39<cfif not Config.Enabled>
40	<cfset SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/cfm/config.cfm" file' )>
41</cfif>
42
43<cfset REQUEST.Config = Config>
44<cfif find( "/", getBaseTemplatePath() ) >
45	<cfset REQUEST.Fs = "/">
46<cfelse>
47	<cfset REQUEST.Fs = "\">
48</cfif>
49
50<cfset DoResponse() >
51
52<cffunction name="DoResponse" output="true" returntype="void">
53
54	<!--- Get the main request informaiton. --->
55	<cfset var sCommand	= "#URL.Command#" >
56	<cfset var sResourceType	= URL.Type >
57	<cfset var sCurrentFolder	= GetCurrentFolder() >
58
59	<!--- Check if it is an allowed command --->
60	<cfif not IsAllowedCommand( sCommand ) >
61		<cfset SendError( 1, "The """ & sCommand & """ command isn't allowed" ) >
62	</cfif>
63
64	<!--- Check if it is an allowed type. --->
65	<cfif not IsAllowedType( sResourceType ) >
66		<cfset SendError( 1, 'Invalid type specified' ) >
67	</cfif>
68
69	<!--- File Upload doesn't have to Return XML, so it must be intercepted before anything. --->
70	<cfif sCommand eq "FileUpload">
71		<cfset FileUpload( sResourceType, sCurrentFolder, sCommand )>
72		<cfabort>
73	</cfif>
74
75	<cfset CreateXmlHeader( sCommand, sResourceType, sCurrentFolder )>
76
77	<!--- Execute the required command. --->
78	<cfif sCommand eq "GetFolders">
79		<cfset GetFolders( sResourceType, sCurrentFolder ) >
80	<cfelseif sCommand eq "GetFoldersAndFiles">
81		<cfset GetFoldersAndFiles( sResourceType, sCurrentFolder ) >
82	<cfelseif sCommand eq "CreateFolder">
83		<cfset CreateFolder( sResourceType, sCurrentFolder ) >
84	</cfif>
85
86	<cfset CreateXmlFooter()>
87
88	<cfexit>
89</cffunction>
90