initial commit
This commit is contained in:
commit
252dac3143
1516 changed files with 694271 additions and 0 deletions
273
FCKeditor/editor/filemanager/connectors/cfm/ImageObject.cfc
Normal file
273
FCKeditor/editor/filemanager/connectors/cfm/ImageObject.cfc
Normal file
|
@ -0,0 +1,273 @@
|
|||
<cfcomponent name="ImageObject">
|
||||
<!---
|
||||
ImageObject.cfc written by Rick Root (rick@webworksllc.com)
|
||||
|
||||
Related Web Sites:
|
||||
- http://www.opensourcecf.com/imagecfc (home page)
|
||||
|
||||
|
||||
This is an object oriented interface to the original
|
||||
ImageCFC.
|
||||
|
||||
Example Code:
|
||||
|
||||
io = createObject("component","ImageObject");
|
||||
io.setOption("defaultJpegCompression",95);
|
||||
io.init("#ExpandPath(".")#/emily.jpg");
|
||||
io.scaleWidth(500);
|
||||
io.save("#ExpandPath(".")#/imagex1.jpg");
|
||||
|
||||
io.flipHorizontal();
|
||||
io.save("#ExpandPath(".")#/imagex2.jpg");
|
||||
io.revert();
|
||||
io.filterFastBlur(2,5);
|
||||
io.save("#ExpandPath(".")#/imagex3.jpg");
|
||||
io.revert();
|
||||
io.filterPosterize(32);
|
||||
io.save("#ExpandPath(".")#/imagex4.jpg");
|
||||
|
||||
|
||||
LICENSE
|
||||
-------
|
||||
Copyright (c) 2006, Rick Root <rick@webworksllc.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
- Neither the name of the Webworks, LLC. nor the names of
|
||||
its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
--->
|
||||
|
||||
<cfset variables.img = "">
|
||||
<cfset variables.revertimg = "">
|
||||
<cfset variables.imageCFC = createObject("component","image")>
|
||||
<cfset variables.imageInfo = structNew()>
|
||||
<cfset variables.imageInfo.width = 0>
|
||||
<cfset variables.imageInfo.height = 0>
|
||||
<cfset variables.imageInfo.colorModel = "">
|
||||
<cfset variables.imageInfo.colorspace = "">
|
||||
<cfset variables.imageInfo.objColorModel = "">
|
||||
<cfset variables.imageInfo.objColorspace = "">
|
||||
<cfset variables.imageInfo.sampleModel = "">
|
||||
<cfset variables.imageInfo.imageType = 0>
|
||||
<cfset variables.imageInfo.misc = "">
|
||||
<cfset variables.imageInfo.canModify = false>
|
||||
<cfset variables.imageCFC.setOption("throwonerror",true)>
|
||||
|
||||
<!---
|
||||
|
||||
init(filename) Initialize object from a file.
|
||||
init(width, height) Initialize with a blank image
|
||||
init(bufferedImage) Initiailize with an existing object
|
||||
--->
|
||||
<cffunction name="init" access="public" output="false" returnType="void">
|
||||
<cfargument name="arg1" type="any" required="yes">
|
||||
<cfargument name="arg2" type="any" required="no">
|
||||
|
||||
<cfif isDefined("arg2") and isNumeric(arg1) and isNumeric(arg2)>
|
||||
<cfset arg1 = javacast("int",int(arg1))>
|
||||
<cfset arg2 = javacast("int",int(arg2))>
|
||||
<cfset variables.img = createObject("java","java.awt.image.BufferedImage")>
|
||||
<cfset variables.img.init(arg1,arg2,variables.img.TYPE_INT_RGB)>
|
||||
<cfelseif arg1.getClass().getName() eq "java.awt.image.BufferedImage">
|
||||
<cfset variables.img = arg1>
|
||||
<cfelseif isSimpleValue(arg1) and len(arg1) gt 0>
|
||||
<cfset imageResults = variables.imageCFC.readImage(arg1, "no")>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfelse>
|
||||
<cfthrow message="Object Instantiation Error" detail="You have attempted to initialize ooimage.cfc with invalid arguments. Please consult the documentation for correct initialization arguments.">
|
||||
</cfif>
|
||||
<cfif variables.revertimg eq "">
|
||||
<cfset variables.revertimg = variables.img>
|
||||
</cfif>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
<cfreturn>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="flipHorizontal" access="public" output="true" returnType="void" hint="Flip an image horizontally.">
|
||||
<cfset var imageResults = imageCFC.flipHorizontal(variables.img,"","")>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="getImageInfo" access="public" output="true" returntype="struct" hint="Returns image information.">
|
||||
<cfreturn variables.imageInfo>
|
||||
</cffunction>
|
||||
<cffunction name="getImageObject" access="public" output="true" returntype="struct" hint="Returns a java Buffered Image Object.">
|
||||
<cfreturn variables.img>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="flipVertical" access="public" output="true" returntype="void" hint="Flop an image vertically.">
|
||||
<cfset var imageResults = imageCFC.flipVertical(variables.img,"","")>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="scaleWidth" access="public" output="true" returntype="void" hint="Scale an image to a specific width.">
|
||||
<cfargument name="newWidth" required="yes" type="numeric">
|
||||
<cfset var imageResults = imageCFC.scaleWidth(variables.img,"","", newWidth)>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="scaleHeight" access="public" output="true" returntype="void" hint="Scale an image to a specific height.">
|
||||
<cfargument name="newHeight" required="yes" type="numeric">
|
||||
<cfset var imageResults = imageCFC.scaleHeight(variables.img,"","", newHeight)>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="resize" access="public" output="true" returntype="void" hint="Resize an image to a specific width and height.">
|
||||
<cfargument name="newWidth" required="yes" type="numeric">
|
||||
<cfargument name="newHeight" required="yes" type="numeric">
|
||||
<cfargument name="preserveAspect" required="no" type="boolean" default="FALSE">
|
||||
<cfargument name="cropToExact" required="no" type="boolean" default="FALSE">
|
||||
|
||||
<cfset var imageResults = imageCFC.resize(variables.img,"","",newWidth,newHeight,preserveAspect,cropToExact)>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="crop" access="public" output="true" returntype="void" hint="Crop an image.">
|
||||
<cfargument name="fromX" required="yes" type="numeric">
|
||||
<cfargument name="fromY" required="yes" type="numeric">
|
||||
<cfargument name="newWidth" required="yes" type="numeric">
|
||||
<cfargument name="newHeight" required="yes" type="numeric">
|
||||
<cfset var imageResults = imageCFC.crop(variables.img,"","",fromX,fromY,newWidth,newHeight)>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="rotate" access="public" output="true" returntype="void" hint="Rotate an image (+/-)90, (+/-)180, or (+/-)270 degrees.">
|
||||
<cfargument name="degrees" required="yes" type="numeric">
|
||||
<cfset var imageResults = imageCFC.rotate(variables.img,"","",degrees)>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="setOption" access="public" output="true" returnType="void" hint="Sets values for allowed CFC options.">
|
||||
<cfargument name="key" type="string" required="yes">
|
||||
<cfargument name="val" type="string" required="yes">
|
||||
<cfif lcase(trim(key)) eq "throwonerror">
|
||||
<cfthrow message="Option Configuration Error" detail="You cannot set the throwOnError option when using ImageObject.cfc">
|
||||
</cfif>
|
||||
<cfset imageCFC.setOption(key, val)>
|
||||
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="getOption" access="public" output="true" returnType="any" hint="Returns the current value for the specified CFC option.">
|
||||
<cfargument name="key" type="string" required="yes">
|
||||
<cfreturn imageCFC.getOption(key)>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="filterFastBlur" access="public" output="true" returntype="void" hint="Internal method used for flipping and flopping images.">
|
||||
<cfargument name="blurAmount" required="yes" type="numeric">
|
||||
<cfargument name="iterations" required="yes" type="numeric">
|
||||
<cfset var imageResults = imageCFC.filterFastBlur(variables.img,"","",blurAmount,iterations)>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="filterSharpen" access="public" output="true" returntype="void" hint="Internal method used for flipping and flopping images.">
|
||||
<cfset var imageResults = imageCFC.filterSharpen(variables.img,"","")>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="filterPosterize" access="public" output="true" returntype="void" hint="Internal method used for flipping and flopping images.">
|
||||
<cfargument name="amount" required="yes" type="string">
|
||||
<cfset var imageResults = imageCFC.filterPosterize(variables.img,"","",amount)>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="addText" access="public" output="true" returntype="void" hint="Add text to an image.">
|
||||
<cfargument name="x" required="yes" type="numeric">
|
||||
<cfargument name="y" required="yes" type="numeric">
|
||||
<cfargument name="fontDetails" required="yes" type="struct">
|
||||
<cfargument name="content" required="yes" type="String">
|
||||
<cfset var imageResults = imageCFC.addText(variables.img,"","",x,y,fontDetails,content)>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="watermark" access="public" output="false" returnType="void">
|
||||
<cfargument name="wmImage" required="yes" type="Any">
|
||||
<cfargument name="alpha" required="yes" type="numeric">
|
||||
<cfargument name="placeAtX" required="yes" type="numeric">
|
||||
<cfargument name="placeAtY" required="yes" type="numeric">
|
||||
|
||||
<cfset var imageResults = "">
|
||||
<cfif isSimpleValue(wmImage)>
|
||||
<!--- filename or URL --->
|
||||
<cfset imageResults = imageCFC.watermark(variables.img,"","",wmImage,alpha,placeAtX,placeAtY)>
|
||||
<cfelse>
|
||||
<!--- must be a java object --->
|
||||
<cfset imageResults = imageCFC.watermark(variables.img,wmImage,"","",alpha,placeAtX,placeAtY)>
|
||||
</cfif>
|
||||
<cfset variables.revertimg = variables.img>
|
||||
<cfset variables.img = imageResults.img>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="save" access="public" output="false" returnType="void">
|
||||
<cfargument name="filename" type="string" required="no">
|
||||
<cfargument name="jpegCompression" type="numeric" required="no">
|
||||
<cfif isDefined("arguments.jpegCompression") and isNumeric(arguments.jpegCompression)>
|
||||
<cfset imageCFC.writeImage(filename,variables.img,jpegCompression)>
|
||||
<cfelse>
|
||||
<cfset imageCFC.writeImage(filename,variables.img)>
|
||||
</cfif>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="revert" access="public" output="true" returntype="void" hint="Undo the previous manipulation.">
|
||||
<cfset variables.img = variables.revertimg>
|
||||
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
|
||||
</cffunction>
|
||||
|
||||
</cfcomponent>
|
315
FCKeditor/editor/filemanager/connectors/cfm/cf5_connector.cfm
Normal file
315
FCKeditor/editor/filemanager/connectors/cfm/cf5_connector.cfm
Normal file
|
@ -0,0 +1,315 @@
|
|||
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* File Browser connector for ColdFusion 5.
|
||||
* (based on the original CF connector by Hendrik Kramer - hk@lwd.de)
|
||||
*
|
||||
* Note:
|
||||
* FCKeditor requires that the connector responds with UTF-8 encoded XML.
|
||||
* As ColdFusion 5 does not fully support UTF-8 encoding, we force ASCII
|
||||
* file and folder names in this connector to allow CF5 send a UTF-8
|
||||
* encoded response - code points under 127 in UTF-8 are stored using a
|
||||
* single byte, using the same encoding as ASCII, which is damn handy.
|
||||
* This is all grand for the English speakers, like meself, but I dunno
|
||||
* how others are gonna take to it. Well, the previous version of this
|
||||
* connector already did this with file names and nobody seemed to mind,
|
||||
* so fingers-crossed nobody will mind their folder names being munged too.
|
||||
*
|
||||
--->
|
||||
|
||||
<cfparam name="url.command">
|
||||
<cfparam name="url.type">
|
||||
<cfparam name="url.currentFolder">
|
||||
<!--- note: no serverPath url parameter - see config.cfm if you need to set the serverPath manually --->
|
||||
|
||||
<cfinclude template="config.cfm">
|
||||
|
||||
<cfscript>
|
||||
userFilesPath = config.userFilesPath;
|
||||
|
||||
if ( userFilesPath eq "" )
|
||||
{
|
||||
userFilesPath = "/userfiles/";
|
||||
}
|
||||
|
||||
// make sure the user files path is correctly formatted
|
||||
userFilesPath = replace(userFilesPath, "\", "/", "ALL");
|
||||
userFilesPath = replace(userFilesPath, '//', '/', 'ALL');
|
||||
if ( right(userFilesPath,1) NEQ "/" )
|
||||
{
|
||||
userFilesPath = userFilesPath & "/";
|
||||
}
|
||||
if ( left(userFilesPath,1) NEQ "/" )
|
||||
{
|
||||
userFilesPath = "/" & userFilesPath;
|
||||
}
|
||||
|
||||
// make sure the current folder is correctly formatted
|
||||
url.currentFolder = replace(url.currentFolder, "\", "/", "ALL");
|
||||
url.currentFolder = replace(url.currentFolder, '//', '/', 'ALL');
|
||||
if ( right(url.currentFolder,1) neq "/" )
|
||||
{
|
||||
url.currentFolder = url.currentFolder & "/";
|
||||
}
|
||||
if ( left(url.currentFolder,1) neq "/" )
|
||||
{
|
||||
url.currentFolder = "/" & url.currentFolder;
|
||||
}
|
||||
|
||||
if ( find("/",getBaseTemplatePath()) neq 0 )
|
||||
{
|
||||
fs = "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
fs = "\";
|
||||
}
|
||||
|
||||
// Get the base physical path to the web root for this application. The code to determine the path automatically assumes that
|
||||
// the "FCKeditor" directory in the http request path is directly off the web root for the application and that it's not a
|
||||
// virtual directory or a symbolic link / junction. Use the serverPath config setting to force a physical path if necessary.
|
||||
if ( len(config.serverPath) )
|
||||
{
|
||||
serverPath = config.serverPath;
|
||||
|
||||
if ( right(serverPath,1) neq fs )
|
||||
{
|
||||
serverPath = serverPath & fs;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),"") & replace(userFilesPath,"/",fs,"all");
|
||||
}
|
||||
|
||||
rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ;
|
||||
xmlContent = ""; // append to this string to build content
|
||||
</cfscript>
|
||||
|
||||
<cfset resourceTypeUrl = rereplace( replace( Config.FileTypesPath[url.type], fs, "/", "all"), "/$", "") >
|
||||
|
||||
<cfif isDefined( "Config.FileTypesAbsolutePath" )
|
||||
and structkeyexists( Config.FileTypesAbsolutePath, url.type )
|
||||
and Len( Config.FileTypesAbsolutePath[url.type] )>
|
||||
|
||||
<cfset userFilesServerPath = Config.FileTypesAbsolutePath[url.type] & url.currentFolder>
|
||||
<cfelse>
|
||||
<cftry>
|
||||
<cfset userFilesServerPath = expandpath( resourceTypeUrl ) & url.currentFolder>
|
||||
<!--- Catch: Parameter 1 of function ExpandPath must be a relative path --->
|
||||
<cfcatch type="any">
|
||||
<cfset userFilesServerPath = rootPath & Config.FileTypesPath[url.type] & url.currentFolder>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cfif>
|
||||
|
||||
<cfset userFilesServerPath = replace( userFilesServerPath, "/", fs, "all" ) >
|
||||
<!--- get rid of double directory separators --->
|
||||
<cfset userFilesServerPath = replace( userFilesServerPath, fs & fs, fs, "all") >
|
||||
|
||||
<cfif not config.enabled>
|
||||
|
||||
<cfset xmlContent = "<Error number=""1"" text=""This connector is disabled. Please check the 'editor/filemanager/connectors/cfm/config.cfm' file"" />">
|
||||
|
||||
<cfelseif find("..",url.currentFolder)>
|
||||
|
||||
<cfset xmlContent = "<Error number=""102"" />">
|
||||
|
||||
<cfelseif isDefined("Config.ConfigAllowedCommands") and not ListFind(Config.ConfigAllowedCommands, url.command)>
|
||||
|
||||
<cfset xmlContent = '<Error number="1" text="The "' & url.command & '" command isn''t allowed" />'>
|
||||
|
||||
<cfelseif isDefined("Config.ConfigAllowedTypes") and not ListFind(Config.ConfigAllowedTypes, url.type)>
|
||||
|
||||
<cfset xmlContent = '<Error number="1" text="The "' & url.type & '" type isn''t allowed" />'>
|
||||
|
||||
</cfif>
|
||||
|
||||
<cfset resourceTypeDirectory = left( userFilesServerPath, Len(userFilesServerPath) - Len(url.currentFolder) )>
|
||||
|
||||
<cfif not len(xmlContent) and not directoryexists(resourceTypeDirectory)>
|
||||
<!--- create directories in physical path if they don't already exist --->
|
||||
<cfset currentPath = "">
|
||||
<cftry>
|
||||
<cfloop list="#resourceTypeDirectory#" index="name" delimiters="#fs#">
|
||||
<cfif currentPath eq "" and fs eq "\">
|
||||
<!--- Without checking this, we would have in Windows \C:\ --->
|
||||
<cfif not directoryExists(name)>
|
||||
<cfdirectory action="create" directory="#name#" mode="755">
|
||||
</cfif>
|
||||
<cfelse>
|
||||
<cfif not directoryExists(currentPath & fs & name)>
|
||||
<cfdirectory action="create" directory="#currentPath##fs##name#" mode="755">
|
||||
</cfif>
|
||||
</cfif>
|
||||
|
||||
<cfif fs eq "\" and currentPath eq "">
|
||||
<cfset currentPath = name>
|
||||
<cfelse>
|
||||
<cfset currentPath = currentPath & fs & name>
|
||||
</cfif>
|
||||
</cfloop>
|
||||
|
||||
<cfcatch type="any">
|
||||
|
||||
<!--- this should only occur as a result of a permissions problem --->
|
||||
<cfset xmlContent = "<Error number=""103"" />">
|
||||
|
||||
</cfcatch>
|
||||
|
||||
</cftry>
|
||||
</cfif>
|
||||
|
||||
<cfif not len(xmlContent)>
|
||||
|
||||
<!--- no errors thus far - run command --->
|
||||
|
||||
<!--- we need to know the physical path to the current folder for all commands --->
|
||||
<cfset currentFolderPath = userFilesServerPath>
|
||||
|
||||
<cfswitch expression="#url.command#">
|
||||
|
||||
<cfcase value="FileUpload">
|
||||
<cfset config_included = true >
|
||||
<cfinclude template="cf5_upload.cfm">
|
||||
<cfabort>
|
||||
</cfcase>
|
||||
|
||||
|
||||
<cfcase value="GetFolders">
|
||||
|
||||
<!--- Sort directories first, name ascending --->
|
||||
<cfdirectory
|
||||
action="list"
|
||||
directory="#currentFolderPath#"
|
||||
name="qDir"
|
||||
sort="type,name">
|
||||
|
||||
<cfscript>
|
||||
i=1;
|
||||
folders = "";
|
||||
while( i lte qDir.recordCount ) {
|
||||
if( not compareNoCase( qDir.type[i], "FILE" ))
|
||||
break;
|
||||
if( not listFind(".,..", qDir.name[i]) )
|
||||
folders = folders & '<Folder name="#HTMLEditFormat( qDir.name[i] )#" />';
|
||||
i=i+1;
|
||||
}
|
||||
|
||||
xmlContent = xmlContent & '<Folders>' & folders & '</Folders>';
|
||||
</cfscript>
|
||||
|
||||
</cfcase>
|
||||
|
||||
|
||||
<cfcase value="GetFoldersAndFiles">
|
||||
|
||||
<!--- Sort directories first, name ascending --->
|
||||
<cfdirectory
|
||||
action="list"
|
||||
directory="#currentFolderPath#"
|
||||
name="qDir"
|
||||
sort="type,name">
|
||||
|
||||
<cfscript>
|
||||
i=1;
|
||||
folders = "";
|
||||
files = "";
|
||||
while( i lte qDir.recordCount ) {
|
||||
if( not compareNoCase( qDir.type[i], "DIR" ) and not listFind(".,..", qDir.name[i]) ) {
|
||||
folders = folders & '<Folder name="#HTMLEditFormat(qDir.name[i])#" />';
|
||||
} else if( not compareNoCase( qDir.type[i], "FILE" ) ) {
|
||||
fileSizeKB = round(qDir.size[i] / 1024);
|
||||
files = files & '<File name="#HTMLEditFormat(qDir.name[i])#" size="#IIf( fileSizeKB GT 0, DE( fileSizeKB ), 1)#" />';
|
||||
}
|
||||
i=i+1;
|
||||
}
|
||||
|
||||
xmlContent = xmlContent & '<Folders>' & folders & '</Folders>';
|
||||
xmlContent = xmlContent & '<Files>' & files & '</Files>';
|
||||
</cfscript>
|
||||
|
||||
</cfcase>
|
||||
|
||||
|
||||
<cfcase value="CreateFolder">
|
||||
|
||||
<cfparam name="url.newFolderName" default="">
|
||||
|
||||
<cfscript>
|
||||
newFolderName = url.newFolderName;
|
||||
if( reFind("[^A-Za-z0-9_\-\.]", newFolderName) ) {
|
||||
// Munge folder name same way as we do the filename
|
||||
// This means folder names are always US-ASCII so we don't have to worry about CF5 and UTF-8
|
||||
newFolderName = reReplace(newFolderName, "[^A-Za-z0-9\-\.]", "_", "all");
|
||||
newFolderName = reReplace(newFolderName, "_{2,}", "_", "all");
|
||||
newFolderName = reReplace(newFolderName, "([^_]+)_+$", "\1", "all");
|
||||
newFolderName = reReplace(newFolderName, "$_([^_]+)$", "\1", "all");
|
||||
}
|
||||
</cfscript>
|
||||
|
||||
<cfif not len(newFolderName) or len(newFolderName) gt 255>
|
||||
<cfset errorNumber = 102>
|
||||
<cfelseif directoryExists(currentFolderPath & newFolderName)>
|
||||
<cfset errorNumber = 101>
|
||||
<cfelseif reFind("^\.\.",newFolderName)>
|
||||
<cfset errorNumber = 103>
|
||||
<cfelse>
|
||||
<cfset errorNumber = 0>
|
||||
|
||||
<cftry>
|
||||
<cfdirectory
|
||||
action="create"
|
||||
directory="#currentFolderPath##newFolderName#"
|
||||
mode="755">
|
||||
<cfcatch>
|
||||
<!---
|
||||
un-resolvable error numbers in ColdFusion:
|
||||
* 102 : Invalid folder name.
|
||||
* 103 : You have no permissions to create the folder.
|
||||
--->
|
||||
<cfset errorNumber = 110>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cfif>
|
||||
|
||||
<cfset xmlContent = xmlContent & '<Error number="#errorNumber#" />'>
|
||||
|
||||
</cfcase>
|
||||
|
||||
<cfdefaultcase>
|
||||
<cfthrow type="fckeditor.connector" message="Illegal command: #url.command#">
|
||||
</cfdefaultcase>
|
||||
|
||||
</cfswitch>
|
||||
</cfif>
|
||||
|
||||
<cfscript>
|
||||
xmlHeader = '<?xml version="1.0" encoding="utf-8" ?><Connector command="#url.command#" resourceType="#url.type#">';
|
||||
xmlHeader = xmlHeader & '<CurrentFolder path="#url.currentFolder#" url="#resourceTypeUrl##url.currentFolder#" />';
|
||||
xmlFooter = '</Connector>';
|
||||
</cfscript>
|
||||
|
||||
<cfheader name="Expires" value="#GetHttpTimeString(Now())#">
|
||||
<cfheader name="Pragma" value="no-cache">
|
||||
<cfheader name="Cache-Control" value="no-cache, no-store, must-revalidate">
|
||||
<cfcontent reset="true" type="text/xml; charset=UTF-8">
|
||||
<cfoutput>#xmlHeader##xmlContent##xmlFooter#</cfoutput>
|
296
FCKeditor/editor/filemanager/connectors/cfm/cf5_upload.cfm
Normal file
296
FCKeditor/editor/filemanager/connectors/cfm/cf5_upload.cfm
Normal file
|
@ -0,0 +1,296 @@
|
|||
<cfsetting enablecfoutputonly="Yes">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the "File Uploader" for ColdFusion 5.
|
||||
* Based on connector.cfm by Mark Woods (mark@thickpaddy.com)
|
||||
*
|
||||
* Note:
|
||||
* FCKeditor requires that the connector responds with UTF-8 encoded XML.
|
||||
* As ColdFusion 5 does not fully support UTF-8 encoding, we force ASCII
|
||||
* file and folder names in this connector to allow CF5 send a UTF-8
|
||||
* encoded response - code points under 127 in UTF-8 are stored using a
|
||||
* single byte, using the same encoding as ASCII, which is damn handy.
|
||||
* This is all grand for the English speakers, like meself, but I dunno
|
||||
* how others are gonna take to it. Well, the previous version of this
|
||||
* connector already did this with file names and nobody seemed to mind,
|
||||
* so fingers-crossed nobody will mind their folder names being munged too.
|
||||
*
|
||||
--->
|
||||
|
||||
<cfparam name="url.command" default="QuickUpload">
|
||||
<cfparam name="url.type" default="File">
|
||||
<cfparam name="url.currentFolder" default="/">
|
||||
|
||||
<cfif not isDefined("config_included")>
|
||||
<cfinclude template="config.cfm">
|
||||
</cfif>
|
||||
|
||||
<cfscript>
|
||||
function SendUploadResults(errorNumber, fileUrl, fileName, customMsg)
|
||||
{
|
||||
WriteOutput('<script type="text/javascript">');
|
||||
WriteOutput('window.parent.OnUploadCompleted(' & errorNumber & ', "' & JSStringFormat(fileUrl) & '", "' & JSStringFormat(fileName) & '", "' & JSStringFormat(customMsg) & '");' );
|
||||
WriteOutput('</script>');
|
||||
}
|
||||
</cfscript>
|
||||
|
||||
<cfif NOT config.enabled>
|
||||
<cfset SendUploadResults(1, "", "", "This file uploader is disabled. Please check the ""editor/filemanager/connectors/cfm/config.cfm"" file")>
|
||||
<cfabort>
|
||||
</cfif>
|
||||
|
||||
<cfif isDefined("Config.ConfigAllowedCommands") and not ListFind(Config.ConfigAllowedCommands, url.command)>
|
||||
<cfset SendUploadResults(1, "", "", "The """ & url.command & """ command isn't allowed")>
|
||||
<cfabort>
|
||||
</cfif>
|
||||
|
||||
<cfif isDefined("Config.ConfigAllowedTypes") and not ListFind(Config.ConfigAllowedTypes, url.type)>
|
||||
<cfset SendUploadResults(1, "", "", "The """ & url.type & """ type isn't allowed")>
|
||||
<cfabort>
|
||||
</cfif>
|
||||
|
||||
<cfif find( "..", url.currentFolder)>
|
||||
<cfset SendUploadResults(102)>
|
||||
<cfabort>
|
||||
</cfif>
|
||||
|
||||
<cfscript>
|
||||
userFilesPath = config.userFilesPath;
|
||||
|
||||
if ( userFilesPath eq "" ) {
|
||||
userFilesPath = "/userfiles/";
|
||||
}
|
||||
|
||||
// make sure the user files path is correctly formatted
|
||||
userFilesPath = replace(userFilesPath, "\", "/", "ALL");
|
||||
userFilesPath = replace(userFilesPath, '//', '/', 'ALL');
|
||||
if ( right(userFilesPath,1) NEQ "/" ) {
|
||||
userFilesPath = userFilesPath & "/";
|
||||
}
|
||||
if ( left(userFilesPath,1) NEQ "/" ) {
|
||||
userFilesPath = "/" & userFilesPath;
|
||||
}
|
||||
|
||||
// make sure the current folder is correctly formatted
|
||||
url.currentFolder = replace(url.currentFolder, "\", "/", "ALL");
|
||||
url.currentFolder = replace(url.currentFolder, '//', '/', 'ALL');
|
||||
if ( right(url.currentFolder,1) neq "/" ) {
|
||||
url.currentFolder = url.currentFolder & "/";
|
||||
}
|
||||
if ( left(url.currentFolder,1) neq "/" ) {
|
||||
url.currentFolder = "/" & url.currentFolder;
|
||||
}
|
||||
|
||||
if (find("/",getBaseTemplatePath())) {
|
||||
fs = "/";
|
||||
} else {
|
||||
fs = "\";
|
||||
}
|
||||
|
||||
// Get the base physical path to the web root for this application. The code to determine the path automatically assumes that
|
||||
// the "FCKeditor" directory in the http request path is directly off the web root for the application and that it's not a
|
||||
// virtual directory or a symbolic link / junction. Use the serverPath config setting to force a physical path if necessary.
|
||||
if ( len(config.serverPath) ) {
|
||||
serverPath = config.serverPath;
|
||||
|
||||
if ( right(serverPath,1) neq fs ) {
|
||||
serverPath = serverPath & fs;
|
||||
}
|
||||
} else {
|
||||
serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),"") & replace(userFilesPath,"/",fs,"all");
|
||||
}
|
||||
|
||||
rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ;
|
||||
</cfscript>
|
||||
<cfif url.command eq "QuickUpload">
|
||||
<cfset resourceTypeUrl = rereplace( replace( Config.QuickUploadPath[url.type], fs, "/", "all"), "/$", "") >
|
||||
<cfif isDefined( "Config.QuickUploadAbsolutePath" )
|
||||
and structkeyexists( Config.QuickUploadAbsolutePath, url.type )
|
||||
and Len( Config.QuickUploadAbsolutePath[url.type] )>
|
||||
<cfset userFilesServerPath = Config.QuickUploadAbsolutePath[url.type] & url.currentFolder>
|
||||
<cfelse>
|
||||
<cftry>
|
||||
<cfset userFilesServerPath = expandpath( resourceTypeUrl ) & url.currentFolder>
|
||||
<!--- Catch: Parameter 1 of function ExpandPath must be a relative path --->
|
||||
<cfcatch type="any">
|
||||
<cfset userFilesServerPath = rootPath & Config.QuickUploadPath[url.type] & url.currentFolder>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cfif>
|
||||
<cfelse>
|
||||
<cfset resourceTypeUrl = rereplace( replace( Config.FileTypesPath[url.type], fs, "/", "all"), "/$", "") >
|
||||
<cfif isDefined( "Config.FileTypesAbsolutePath" )
|
||||
and structkeyexists( Config.FileTypesAbsolutePath, url.type )
|
||||
and Len( Config.FileTypesAbsolutePath[url.type] )>
|
||||
<cfset userFilesServerPath = Config.FileTypesAbsolutePath[url.type] & url.currentFolder>
|
||||
<cfelse>
|
||||
<cftry>
|
||||
<cfset userFilesServerPath = expandpath( resourceTypeUrl ) & url.currentFolder>
|
||||
<!--- Catch: Parameter 1 of function ExpandPath must be a relative path --->
|
||||
<cfcatch type="any">
|
||||
<cfset userFilesServerPath = rootPath & Config.FileTypesPath[url.type] & url.currentFolder>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cfif>
|
||||
</cfif>
|
||||
|
||||
<cfset userFilesServerPath = replace( userFilesServerPath, "/", fs, "all" ) >
|
||||
<!--- get rid of double directory separators --->
|
||||
<cfset userFilesServerPath = replace( userFilesServerPath, fs & fs, fs, "all") >
|
||||
|
||||
<!--- create resource type directory if not exists --->
|
||||
<cfset resourceTypeDirectory = left( userFilesServerPath, Len(userFilesServerPath) - Len(url.currentFolder) )>
|
||||
|
||||
<cfif not directoryexists( resourceTypeDirectory )>
|
||||
|
||||
<cfset currentPath = "">
|
||||
<cftry>
|
||||
<cfloop list="#resourceTypeDirectory#" index="name" delimiters="#fs#">
|
||||
<cfif currentPath eq "" and fs eq "\">
|
||||
<!--- Without checking this, we would have in Windows \C:\ --->
|
||||
<cfif not directoryExists(name)>
|
||||
<cfdirectory action="create" directory="#name#" mode="755">
|
||||
</cfif>
|
||||
<cfelse>
|
||||
<cfif not directoryExists(currentPath & fs & name)>
|
||||
<cfdirectory action="create" directory="#currentPath##fs##name#" mode="755">
|
||||
</cfif>
|
||||
</cfif>
|
||||
|
||||
<cfif fs eq "\" and currentPath eq "">
|
||||
<cfset currentPath = name>
|
||||
<cfelse>
|
||||
<cfset currentPath = currentPath & fs & name>
|
||||
</cfif>
|
||||
</cfloop>
|
||||
|
||||
<cfcatch type="any">
|
||||
|
||||
<!--- this should only occur as a result of a permissions problem --->
|
||||
<cfset SendUploadResults(103)>
|
||||
<cfabort>
|
||||
|
||||
</cfcatch>
|
||||
|
||||
</cftry>
|
||||
</cfif>
|
||||
|
||||
<cfset currentFolderPath = userFilesServerPath>
|
||||
<cfset resourceType = url.type>
|
||||
|
||||
<cfset fileName = "">
|
||||
<cfset fileExt = "">
|
||||
|
||||
<!--- Can be overwritten. The last value will be sent with the result --->
|
||||
<cfset customMsg = "">
|
||||
|
||||
<cftry>
|
||||
<!--- first upload the file with an unique filename --->
|
||||
<cffile action="upload"
|
||||
fileField="NewFile"
|
||||
destination="#currentFolderPath#"
|
||||
nameConflict="makeunique"
|
||||
mode="644"
|
||||
attributes="normal">
|
||||
|
||||
<cfif cffile.fileSize EQ 0>
|
||||
<cfthrow>
|
||||
</cfif>
|
||||
|
||||
<cfset lAllowedExtensions = config.allowedExtensions[#resourceType#]>
|
||||
<cfset lDeniedExtensions = config.deniedExtensions[#resourceType#]>
|
||||
|
||||
<cfif ( len(lAllowedExtensions) and not listFindNoCase(lAllowedExtensions,cffile.ServerFileExt) )
|
||||
or ( len(lDeniedExtensions) and listFindNoCase(lDeniedExtensions,cffile.ServerFileExt) )>
|
||||
|
||||
<cfset errorNumber = "202">
|
||||
<cffile action="delete" file="#cffile.ServerDirectory##fs##cffile.ServerFile#">
|
||||
|
||||
<cfelse>
|
||||
|
||||
<cfscript>
|
||||
errorNumber = 0;
|
||||
fileName = cffile.ClientFileName ;
|
||||
fileExt = cffile.ServerFileExt ;
|
||||
fileExisted = false ;
|
||||
|
||||
// munge filename for html download. Only a-z, 0-9, _, - and . are allowed
|
||||
if( reFind("[^A-Za-z0-9_\-\.]", fileName) ) {
|
||||
fileName = reReplace(fileName, "[^A-Za-z0-9\-\.]", "_", "ALL");
|
||||
fileName = reReplace(fileName, "_{2,}", "_", "ALL");
|
||||
fileName = reReplace(fileName, "([^_]+)_+$", "\1", "ALL");
|
||||
fileName = reReplace(fileName, "$_([^_]+)$", "\1", "ALL");
|
||||
}
|
||||
|
||||
// remove additional dots from file name
|
||||
if( isDefined("Config.ForceSingleExtension") and Config.ForceSingleExtension )
|
||||
fileName = replace( fileName, '.', "_", "all" ) ;
|
||||
|
||||
// When the original filename already exists, add numbers (0), (1), (2), ... at the end of the filename.
|
||||
if( compare( cffile.ServerFileName, fileName ) ) {
|
||||
counter = 0;
|
||||
tmpFileName = fileName;
|
||||
while( fileExists("#currentFolderPath##fileName#.#fileExt#") ) {
|
||||
fileExisted = true ;
|
||||
counter = counter + 1 ;
|
||||
fileName = tmpFileName & '(#counter#)' ;
|
||||
}
|
||||
}
|
||||
</cfscript>
|
||||
|
||||
<!--- Rename the uploaded file, if neccessary --->
|
||||
<cfif compare(cffile.ServerFileName,fileName)>
|
||||
|
||||
<cfif fileExisted>
|
||||
<cfset errorNumber = "201">
|
||||
</cfif>
|
||||
<cffile
|
||||
action="rename"
|
||||
source="#currentFolderPath##cffile.ServerFileName#.#cffile.ServerFileExt#"
|
||||
destination="#currentFolderPath##fileName#.#fileExt#"
|
||||
mode="644"
|
||||
attributes="normal">
|
||||
|
||||
</cfif>
|
||||
|
||||
</cfif>
|
||||
|
||||
<cfcatch type="any">
|
||||
|
||||
<cfset errorNumber = "1">
|
||||
<cfset customMsg = cfcatch.message >
|
||||
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
|
||||
<cfif errorNumber EQ 0>
|
||||
<!--- file was uploaded succesfully --->
|
||||
<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##url.currentFolder##fileName#.#fileExt#', "", "")>
|
||||
<cfabort>
|
||||
<cfelseif errorNumber EQ 201>
|
||||
<!--- file was changed (201), submit the new filename --->
|
||||
<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##url.currentFolder##fileName#.#fileExt#', replace( fileName & "." & fileExt, "'", "\'", "ALL"), customMsg)>
|
||||
<cfabort>
|
||||
<cfelse>
|
||||
<!--- An error occured(202). Submit only the error code and a message (if available). --->
|
||||
<cfset SendUploadResults(errorNumber, '', '', customMsg)>
|
||||
<cfabort>
|
||||
</cfif>
|
68
FCKeditor/editor/filemanager/connectors/cfm/cf_basexml.cfm
Normal file
68
FCKeditor/editor/filemanager/connectors/cfm/cf_basexml.cfm
Normal file
|
@ -0,0 +1,68 @@
|
|||
<cfsetting enablecfoutputonly="Yes">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This file include the functions that create the base XML output by the ColdFusion Connector (MX 6.0 and above).
|
||||
--->
|
||||
|
||||
<cffunction name="SetXmlHeaders" returntype="void">
|
||||
<cfheader name="Expires" value="#GetHttpTimeString(Now())#">
|
||||
<cfheader name="Pragma" value="no-cache">
|
||||
<cfheader name="Cache-Control" value="no-cache, no-store, must-revalidate">
|
||||
<cfcontent reset="true" type="text/xml; charset=UTF-8">
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="CreateXmlHeader" returntype="void" output="true">
|
||||
<cfargument name="command" required="true">
|
||||
<cfargument name="resourceType" required="true">
|
||||
<cfargument name="currentFolder" required="true">
|
||||
|
||||
<cfset SetXmlHeaders()>
|
||||
<cfoutput><?xml version="1.0" encoding="utf-8" ?></cfoutput>
|
||||
<cfoutput><Connector command="#ARGUMENTS.command#" resourceType="#ARGUMENTS.resourceType#"></cfoutput>
|
||||
<cfoutput><CurrentFolder path="#HTMLEditFormat(ARGUMENTS.currentFolder)#" url="#HTMLEditFormat( GetUrlFromPath( resourceType, currentFolder, command ) )#" /></cfoutput>
|
||||
<cfset REQUEST.HeaderSent = true>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="CreateXmlFooter" returntype="void" output="true">
|
||||
<cfoutput></Connector></cfoutput>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="SendError" returntype="void" output="true">
|
||||
<cfargument name="number" required="true" type="Numeric">
|
||||
<cfargument name="text" required="true">
|
||||
<cfif isDefined("REQUEST.HeaderSent") and REQUEST.HeaderSent>
|
||||
<cfset SendErrorNode( ARGUMENTS.number, ARGUMENTS.text )>
|
||||
<cfset CreateXmlFooter() >
|
||||
<cfelse>
|
||||
<cfset SetXmlHeaders()>
|
||||
<cfoutput><?xml version="1.0" encoding="utf-8" ?></cfoutput>
|
||||
<cfoutput><Connector></cfoutput>
|
||||
<cfset SendErrorNode( ARGUMENTS.number, ARGUMENTS.text )>
|
||||
<cfset CreateXmlFooter() >
|
||||
</cfif>
|
||||
<cfabort>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="SendErrorNode" returntype="void" output="true">
|
||||
<cfargument name="number" required="true" type="Numeric">
|
||||
<cfargument name="text" required="true">
|
||||
<cfoutput><Error number="#ARGUMENTS.number#" text="#htmleditformat(ARGUMENTS.text)#" /></cfoutput>
|
||||
</cffunction>
|
225
FCKeditor/editor/filemanager/connectors/cfm/cf_commands.cfm
Normal file
225
FCKeditor/editor/filemanager/connectors/cfm/cf_commands.cfm
Normal file
|
@ -0,0 +1,225 @@
|
|||
<cfsetting enablecfoutputonly="Yes">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This file include the functions that handle the Command requests
|
||||
* in the ColdFusion Connector (MX 6.0 and above).
|
||||
--->
|
||||
|
||||
<cffunction name="FileUpload" returntype="void" output="true">
|
||||
<cfargument name="resourceType" type="string" required="yes" default="">
|
||||
<cfargument name="currentFolder" type="string" required="yes" default="">
|
||||
<cfargument name="sCommand" type="string" required="yes" default="">
|
||||
|
||||
<cfset var sFileName = "">
|
||||
<cfset var sFilePart = "">
|
||||
<cfset var sFileExt = "">
|
||||
<cfset var sFileUrl = "">
|
||||
<cfset var sTempFilePath = "">
|
||||
<cfset var errorNumber = 0>
|
||||
<cfset var customMsg = 0>
|
||||
<cfset var counter = 0>
|
||||
<cfset var destination = "">
|
||||
|
||||
<cftry>
|
||||
<cffile action="UPLOAD" filefield="NewFile" destination="#GetTempDirectory()#" nameconflict="makeunique" mode="0755" />
|
||||
<cfset sTempFilePath = CFFILE.ServerDirectory & REQUEST.fs & CFFILE.ServerFile>
|
||||
|
||||
<!--- Map the virtual path to the local server path. --->
|
||||
<cfset sServerDir = ServerMapFolder( ARGUMENTS.resourceType, ARGUMENTS.currentFolder, ARGUMENTS.sCommand) >
|
||||
<!--- Get the uploaded file name. --->
|
||||
<cfset sFileName = SanitizeFileName( CFFILE.ClientFile ) >
|
||||
<cfset sOriginalFileName = sFileName >
|
||||
|
||||
<cfif isDefined( "REQUEST.Config.SecureImageUploads" ) and REQUEST.Config.SecureImageUploads>
|
||||
<cfif not IsImageValid( sTempFilePath, CFFILE.ClientFileExt )>
|
||||
<cftry>
|
||||
<cffile action="delete" file="#sTempFilePath#">
|
||||
<cfcatch type="any">
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
<cfthrow errorcode="202" type="fckeditor">
|
||||
</cfif>
|
||||
</cfif>
|
||||
|
||||
<cfif isDefined( "REQUEST.Config.HtmlExtensions" ) and not listFindNoCase( REQUEST.Config.HtmlExtensions, CFFILE.ClientFileExt )>
|
||||
<cfif DetectHtml( sTempFilePath )>
|
||||
<cftry>
|
||||
<cffile action="delete" file="#sTempFilePath#">
|
||||
<cfcatch type="any">
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
<cfthrow errorcode="202" type="fckeditor">
|
||||
</cfif>
|
||||
</cfif>
|
||||
|
||||
<cfif not IsAllowedExt( CFFILE.ClientFileExt, ARGUMENTS.resourceType )>
|
||||
<cftry>
|
||||
<cffile action="delete" file="#sTempFilePath#">
|
||||
<cfcatch type="any">
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
<cfthrow errorcode="202" type="fckeditor">
|
||||
</cfif>
|
||||
|
||||
<!--- When the original filename already exists, add numbers (0), (1), (2), ... at the end of the filename. --->
|
||||
<cfscript>
|
||||
sFileExt = GetExtension( sFileName ) ;
|
||||
sFilePart = RemoveExtension( sFileName );
|
||||
while( fileExists( sServerDir & sFileName ) )
|
||||
{
|
||||
counter = counter + 1;
|
||||
sFileName = sFilePart & '(#counter#).' & CFFILE.ClientFileExt;
|
||||
errorNumber = 201;
|
||||
}
|
||||
</cfscript>
|
||||
|
||||
<cfset destination = sServerDir & sFileName>
|
||||
<!---
|
||||
<cfdump var="#sTempFilePath#">
|
||||
<cfoutput ><br /></cfoutput>
|
||||
<cfdump var="#destination#">
|
||||
<cfabort>
|
||||
--->
|
||||
<cflock name="#destination#" timeout="30" type="Exclusive">
|
||||
<cftry>
|
||||
<cffile action="move" source="#sTempFilePath#" destination="#destination#" mode="755">
|
||||
<!--- omit CF 6.1 error during moving uploaded file, just copy that file instead of moving --->
|
||||
<cfcatch type="any">
|
||||
<cffile action="copy" source="#sTempFilePath#" destination="#destination#" mode="755">
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cflock>
|
||||
|
||||
<cfset sFileUrl = CombinePaths( GetResourceTypePath( ARGUMENTS.resourceType, sCommand ) , ARGUMENTS.currentFolder ) >
|
||||
<cfset sFileUrl = CombinePaths( sFileUrl , sFileName ) >
|
||||
|
||||
<cfcatch type="fckeditor">
|
||||
<cfset errorNumber = CFCATCH.ErrorCode>
|
||||
</cfcatch>
|
||||
|
||||
<cfcatch type="any">
|
||||
<cfset errorNumber = "1">
|
||||
<cfset customMsg = CFCATCH.Message >
|
||||
</cfcatch>
|
||||
|
||||
</cftry>
|
||||
|
||||
<cfset SendUploadResults( errorNumber, sFileUrl, sFileName, customMsg ) >
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="GetFolders" returntype="void" output="true">
|
||||
<cfargument name="resourceType" type="String" required="true">
|
||||
<cfargument name="currentFolder" type="String" required="true">
|
||||
|
||||
<cfset var i = 1>
|
||||
<cfset var folders = "">
|
||||
<!--- Map the virtual path to the local server path --->
|
||||
<cfset var sServerDir = ServerMapFolder( ARGUMENTS.resourceType, ARGUMENTS.currentFolder, "GetFolders" ) >
|
||||
|
||||
<!--- Sort directories first, name ascending --->
|
||||
<cfdirectory action="list" directory="#sServerDir#" name="qDir" sort="type,name">
|
||||
<cfscript>
|
||||
while( i lte qDir.recordCount )
|
||||
{
|
||||
if( compareNoCase( qDir.type[i], "FILE" ) and not listFind( ".,..", qDir.name[i] ) )
|
||||
{
|
||||
folders = folders & '<Folder name="#HTMLEditFormat( qDir.name[i] )#" />' ;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
</cfscript>
|
||||
<cfoutput><Folders>#folders#</Folders></cfoutput>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="GetFoldersAndfiles" returntype="void" output="true">
|
||||
<cfargument name="resourceType" type="String" required="true">
|
||||
<cfargument name="currentFolder" type="String" required="true">
|
||||
|
||||
<cfset var i = 1>
|
||||
<cfset var folders = "">
|
||||
<cfset var files = "">
|
||||
<!--- Map the virtual path to the local server path --->
|
||||
<cfset var sServerDir = ServerMapFolder( ARGUMENTS.resourceType, ARGUMENTS.currentFolder, "GetFolders" ) >
|
||||
|
||||
<!--- Sort directories first, name ascending --->
|
||||
<cfdirectory action="list" directory="#sServerDir#" name="qDir" sort="type,name">
|
||||
<cfscript>
|
||||
while( i lte qDir.recordCount )
|
||||
{
|
||||
if( not compareNoCase( qDir.type[i], "DIR" ) and not listFind( ".,..", qDir.name[i] ) )
|
||||
{
|
||||
folders = folders & '<Folder name="#HTMLEditFormat(qDir.name[i])#" />' ;
|
||||
}
|
||||
else if( not compareNoCase( qDir.type[i], "FILE" ) )
|
||||
{
|
||||
fileSizeKB = round(qDir.size[i] / 1024) ;
|
||||
files = files & '<File name="#HTMLEditFormat(qDir.name[i])#" size="#IIf( fileSizeKB GT 0, DE( fileSizeKB ), 1)#" />' ;
|
||||
}
|
||||
i = i + 1 ;
|
||||
}
|
||||
</cfscript>
|
||||
<cfoutput><Folders>#folders#</Folders></cfoutput>
|
||||
<cfoutput><Files>#files#</Files></cfoutput>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="CreateFolder" returntype="void" output="true">
|
||||
<cfargument name="resourceType" required="true" type="string">
|
||||
<cfargument name="currentFolder" required="true" type="string">
|
||||
|
||||
<cfset var sNewFolderName = url.newFolderName >
|
||||
<cfset var sServerDir = "" >
|
||||
<cfset var errorNumber = 0>
|
||||
<cfset var sErrorMsg = "">
|
||||
<cfset var currentFolderPath = ServerMapFolder( ARGUMENTS.resourceType, ARGUMENTS.currentFolder, 'CreateFolder' )>
|
||||
|
||||
<cfparam name="url.newFolderName" default="">
|
||||
|
||||
<cfscript>
|
||||
sNewFolderName = SanitizeFolderName( sNewFolderName ) ;
|
||||
</cfscript>
|
||||
|
||||
<cfif not len( sNewFolderName ) or len( sNewFolderName ) gt 255>
|
||||
<cfset errorNumber = 102>
|
||||
<cfelseif directoryExists( currentFolderPath & sNewFolderName )>
|
||||
<cfset errorNumber = 101>
|
||||
<cfelseif find( "..", sNewFolderName )>
|
||||
<cfset errorNumber = 103>
|
||||
<cfelse>
|
||||
<cfset errorNumber = 0>
|
||||
|
||||
<!--- Map the virtual path to the local server path of the current folder. --->
|
||||
<cfset sServerDir = currentFolderPath & sNewFolderName >
|
||||
|
||||
<cftry>
|
||||
<cfdirectory action="create" directory="#currentFolderPath##sNewFolderName#" mode="755">
|
||||
<cfcatch type="any">
|
||||
<!---
|
||||
un-resolvable error numbers in ColdFusion:
|
||||
* 102 : Invalid folder name.
|
||||
* 103 : You have no permissions to create the folder.
|
||||
--->
|
||||
<cfset errorNumber = 110>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cfif>
|
||||
|
||||
<cfoutput><Error number="#errorNumber#" originalDescription="#HTMLEditFormat(sErrorMsg)#" /></cfoutput>
|
||||
</cffunction>
|
89
FCKeditor/editor/filemanager/connectors/cfm/cf_connector.cfm
Normal file
89
FCKeditor/editor/filemanager/connectors/cfm/cf_connector.cfm
Normal file
|
@ -0,0 +1,89 @@
|
|||
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* File Browser connector for ColdFusion (MX 6.0 and above).
|
||||
* (based on the original CF connector by Hendrik Kramer - hk@lwd.de)
|
||||
*
|
||||
--->
|
||||
|
||||
<cfparam name="url.command">
|
||||
<cfparam name="url.type">
|
||||
<cfparam name="url.currentFolder">
|
||||
|
||||
<!--- note: no serverPath url parameter - see config.cfm if you need to set the serverPath manually --->
|
||||
|
||||
<cfinclude template="config.cfm">
|
||||
<cfinclude template="cf_util.cfm">
|
||||
<cfinclude template="cf_io.cfm">
|
||||
<cfinclude template="cf_basexml.cfm">
|
||||
<cfinclude template="cf_commands.cfm">
|
||||
|
||||
<cfif not Config.Enabled>
|
||||
<cfset SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/cfm/config.cfm" file' )>
|
||||
</cfif>
|
||||
|
||||
<cfset REQUEST.Config = Config>
|
||||
<cfif find( "/", getBaseTemplatePath() ) >
|
||||
<cfset REQUEST.Fs = "/">
|
||||
<cfelse>
|
||||
<cfset REQUEST.Fs = "\">
|
||||
</cfif>
|
||||
|
||||
<cfset DoResponse() >
|
||||
|
||||
<cffunction name="DoResponse" output="true" returntype="void">
|
||||
|
||||
<!--- Get the main request informaiton. --->
|
||||
<cfset var sCommand = "#URL.Command#" >
|
||||
<cfset var sResourceType = URL.Type >
|
||||
<cfset var sCurrentFolder = GetCurrentFolder() >
|
||||
|
||||
<!--- Check if it is an allowed command --->
|
||||
<cfif not IsAllowedCommand( sCommand ) >
|
||||
<cfset SendError( 1, "The """ & sCommand & """ command isn't allowed" ) >
|
||||
</cfif>
|
||||
|
||||
<!--- Check if it is an allowed type. --->
|
||||
<cfif not IsAllowedType( sResourceType ) >
|
||||
<cfset SendError( 1, 'Invalid type specified' ) >
|
||||
</cfif>
|
||||
|
||||
<!--- File Upload doesn't have to Return XML, so it must be intercepted before anything. --->
|
||||
<cfif sCommand eq "FileUpload">
|
||||
<cfset FileUpload( sResourceType, sCurrentFolder, sCommand )>
|
||||
<cfabort>
|
||||
</cfif>
|
||||
|
||||
<cfset CreateXmlHeader( sCommand, sResourceType, sCurrentFolder )>
|
||||
|
||||
<!--- Execute the required command. --->
|
||||
<cfif sCommand eq "GetFolders">
|
||||
<cfset GetFolders( sResourceType, sCurrentFolder ) >
|
||||
<cfelseif sCommand eq "GetFoldersAndFiles">
|
||||
<cfset GetFoldersAndFiles( sResourceType, sCurrentFolder ) >
|
||||
<cfelseif sCommand eq "CreateFolder">
|
||||
<cfset CreateFolder( sResourceType, sCurrentFolder ) >
|
||||
</cfif>
|
||||
|
||||
<cfset CreateXmlFooter()>
|
||||
|
||||
<cfexit>
|
||||
</cffunction>
|
288
FCKeditor/editor/filemanager/connectors/cfm/cf_io.cfm
Normal file
288
FCKeditor/editor/filemanager/connectors/cfm/cf_io.cfm
Normal file
|
@ -0,0 +1,288 @@
|
|||
<cfsetting enablecfoutputonly="Yes">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This file include IO specific functions used by the ColdFusion Connector (MX 6.0 and above).
|
||||
*
|
||||
--->
|
||||
|
||||
<cffunction name="CombinePaths" returntype="String" output="true">
|
||||
<cfargument name="sBasePath" required="true">
|
||||
<cfargument name="sFolder" required="true">
|
||||
<cfset sBasePath = RemoveFromEnd( sBasePath, "/" )>
|
||||
<cfset sBasePath = RemoveFromEnd( sBasePath, "\" )>
|
||||
<cfreturn sBasePath & "/" & RemoveFromStart( ARGUMENTS.sFolder, '/' )>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="GetResourceTypePath" returntype="String" output="false">
|
||||
<cfargument name="resourceType" required="true">
|
||||
<cfargument name="sCommand" required="true">
|
||||
|
||||
<cfif ARGUMENTS.sCommand eq "QuickUpload">
|
||||
<cfreturn REQUEST.Config['QuickUploadPath'][ARGUMENTS.resourceType]>
|
||||
<cfelse>
|
||||
<cfreturn REQUEST.Config['FileTypesPath'][ARGUMENTS.resourceType]>
|
||||
</cfif>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="GetResourceTypeDirectory" returntype="String" output="false">
|
||||
<cfargument name="resourceType" required="true">
|
||||
<cfargument name="sCommand" required="true">
|
||||
|
||||
<cfif ARGUMENTS.sCommand eq "QuickUpload">
|
||||
<cfif isDefined( "REQUEST.Config.QuickUploadAbsolutePath" )
|
||||
and structkeyexists( REQUEST.Config.QuickUploadAbsolutePath, ARGUMENTS.resourceType )
|
||||
and Len( REQUEST.Config.QuickUploadAbsolutePath[ARGUMENTS.resourceType] )>
|
||||
<cfreturn REQUEST.Config.QuickUploadAbsolutePath[ARGUMENTS.resourceType]>
|
||||
</cfif>
|
||||
|
||||
<cfreturn expandpath( REQUEST.Config.QuickUploadPath[ARGUMENTS.resourceType] )>
|
||||
<cfelse>
|
||||
<cfif isDefined( "REQUEST.Config.FileTypesAbsolutePath" )
|
||||
and structkeyexists( REQUEST.Config.FileTypesAbsolutePath, ARGUMENTS.resourceType )
|
||||
and Len( REQUEST.Config.FileTypesAbsolutePath[ARGUMENTS.resourceType] )>
|
||||
<cfreturn REQUEST.Config.FileTypesAbsolutePath[ARGUMENTS.resourceType]>
|
||||
</cfif>
|
||||
|
||||
<cfreturn expandpath( REQUEST.Config.FileTypesPath[ARGUMENTS.resourceType] )>
|
||||
</cfif>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="GetUrlFromPath" returntype="String" output="false">
|
||||
<cfargument name="resourceType" required="true">
|
||||
<cfargument name="folderPath" required="true">
|
||||
<cfargument name="sCommand" required="true">
|
||||
|
||||
<cfreturn CombinePaths( GetResourceTypePath( ARGUMENTS.resourceType, ARGUMENTS.sCommand ), ARGUMENTS.folderPath )>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="RemoveExtension" output="false" returntype="String">
|
||||
<cfargument name="fileName" required="true">
|
||||
<cfset var pos = find( ".", reverse ( ARGUMENTS.fileName ) )>
|
||||
|
||||
<cfreturn mid( ARGUMENTS.fileName, 1, Len( ARGUMENTS.fileName ) - pos ) >
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="GetExtension" output="false" returntype="String">
|
||||
<cfargument name="fileName" required="true">
|
||||
<cfset var pos = find( ".", reverse ( ARGUMENTS.fileName ) )>
|
||||
|
||||
<cfif not pos>
|
||||
<cfreturn "">
|
||||
</cfif>
|
||||
|
||||
<cfreturn mid( ARGUMENTS.fileName, pos, Len( ARGUMENTS.fileName ) - pos ) >
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="ServerMapFolder" returntype="String" output="false">
|
||||
<cfargument name="resourceType" required="true">
|
||||
<cfargument name="folderPath" required="true">
|
||||
<cfargument name="sCommand" required="true">
|
||||
|
||||
<!--- Get the resource type directory. --->
|
||||
<cfset var sResourceTypePath = GetResourceTypeDirectory( ARGUMENTS.resourceType, ARGUMENTS.sCommand ) >
|
||||
<!--- Ensure that the directory exists. --->
|
||||
<cfset var sErrorMsg = CreateServerFolder( sResourceTypePath ) >
|
||||
|
||||
<cfif sErrorMsg neq ''>
|
||||
<cfset SendError( 1, 'Error creating folder "' & sResourceTypePath & '" (' & sErrorMsg & ')' )>
|
||||
</cfif>
|
||||
|
||||
<!--- Return the resource type directory combined with the required path. --->
|
||||
<cfreturn CombinePaths( sResourceTypePath , ARGUMENTS.folderPath )>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="GetParentFolder" returntype="string" output="false">
|
||||
<cfargument name="folderPath" required="true">
|
||||
|
||||
<cfreturn rereplace(ARGUMENTS.folderPath, "[/\\\\][^/\\\\]+[/\\\\]?$", "")>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="CreateServerFolder" returntype="String" output="false">
|
||||
<cfargument name="folderPath">
|
||||
|
||||
<!--- Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms --->
|
||||
<cfset folderPath = rereplace(ARGUMENTS.folderPath, "//+", "/", "all")>
|
||||
|
||||
<cfif directoryexists(ARGUMENTS.folderPath) or fileexists(ARGUMENTS.folderPath)>
|
||||
<cfreturn "">
|
||||
<cfelse>
|
||||
<cftry>
|
||||
<cfdirectory action="create" mode="0755" directory="#ARGUMENTS.folderPath#">
|
||||
<cfcatch type="any">
|
||||
<cfreturn CFCATCH.Message>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cfif>
|
||||
|
||||
<cfreturn "">
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="IsAllowedExt" returntype="boolean" output="false">
|
||||
<cfargument name="sExtension" required="true">
|
||||
<cfargument name="resourceType" required="true">
|
||||
|
||||
<cfif isDefined( "REQUEST.Config.AllowedExtensions." & ARGUMENTS.resourceType )
|
||||
and listLen( REQUEST.Config.AllowedExtensions[ARGUMENTS.resourceType] )
|
||||
and not listFindNoCase( REQUEST.Config.AllowedExtensions[ARGUMENTS.resourceType], ARGUMENTS.sExtension )>
|
||||
<cfreturn false>
|
||||
</cfif>
|
||||
|
||||
<cfif isDefined( "REQUEST.Config.DeniedExtensions." & ARGUMENTS.resourceType )
|
||||
and listLen( REQUEST.Config.DeniedExtensions[ARGUMENTS.resourceType] )
|
||||
and listFindNoCase( REQUEST.Config.DeniedExtensions[ARGUMENTS.resourceType], ARGUMENTS.sExtension )>
|
||||
<cfreturn false>
|
||||
</cfif>
|
||||
|
||||
<cfreturn true>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="IsAllowedType" returntype="boolean" output="false">
|
||||
<cfargument name="resourceType">
|
||||
|
||||
<cfif not listFindNoCase( REQUEST.Config.ConfigAllowedTypes, ARGUMENTS.resourceType )>
|
||||
<cfreturn false>
|
||||
</cfif>
|
||||
|
||||
<cfreturn true>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="IsAllowedCommand" returntype="boolean" output="true">
|
||||
<cfargument name="sCommand" required="true" type="String">
|
||||
|
||||
<cfif not listFindNoCase( REQUEST.Config.ConfigAllowedCommands, ARGUMENTS.sCommand )>
|
||||
<cfreturn false>
|
||||
</cfif>
|
||||
|
||||
<cfreturn true>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="GetCurrentFolder" returntype="String" output="false">
|
||||
<cfset var sCurrentFolder = "/">
|
||||
|
||||
<cfif isDefined( "URL.CurrentFolder" )>
|
||||
<cfset sCurrentFolder = URL.CurrentFolder>
|
||||
</cfif>
|
||||
|
||||
<!--- Check the current folder syntax (must begin and start with a slash). --->
|
||||
<cfif not refind( "/$", sCurrentFolder)>
|
||||
<cfset sCurrentFolder = sCurrentFolder & "/">
|
||||
</cfif>
|
||||
|
||||
<cfif not refind( "^/", sCurrentFolder )>
|
||||
<cfset sCurrentFolder = "/" & sCurrentFolder>
|
||||
</cfif>
|
||||
|
||||
<!--- Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms --->
|
||||
<cfset sCurrentFolder = rereplace( sCurrentFolder, "//+", "/", "all" )>
|
||||
|
||||
<cfif find( "..", sCurrentFolder)>
|
||||
<cfset SendError( 102, "" )>
|
||||
</cfif>
|
||||
|
||||
<cfreturn sCurrentFolder>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="SanitizeFolderName" returntype="String" output="false">
|
||||
<cfargument name="sNewFolderName" required="true">
|
||||
|
||||
<!--- Do a cleanup of the folder name to avoid possible problems --->
|
||||
<!--- Remove . \ / | : ? * " < > --->
|
||||
<cfset sNewFolderName = rereplace( sNewFolderName, '\.+|\\+|\/+|\|+|\:+|\?+|\*+|"+|<+|>+', "_", "all" )>
|
||||
|
||||
<cfreturn sNewFolderName>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="BinaryFileRead" returntype="String" output="true">
|
||||
<cfargument name="fileName" required="true" type="string">
|
||||
<cfargument name="bytes" required="true" type="Numeric">
|
||||
|
||||
<cfscript>
|
||||
var chunk = "";
|
||||
var fileReaderClass = "";
|
||||
var fileReader = "";
|
||||
var file = "";
|
||||
var done = false;
|
||||
var counter = 0;
|
||||
var byteArray = "";
|
||||
|
||||
if( not fileExists( ARGUMENTS.fileName ) )
|
||||
{
|
||||
return "" ;
|
||||
}
|
||||
|
||||
if (REQUEST.CFVersion gte 8)
|
||||
{
|
||||
file = FileOpen( ARGUMENTS.fileName, "readbinary" ) ;
|
||||
byteArray = FileRead( file, 1024 ) ;
|
||||
chunk = toString( toBinary( toBase64( byteArray ) ) ) ;
|
||||
FileClose( file ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
fileReaderClass = createObject("java", "java.io.FileInputStream");
|
||||
fileReader = fileReaderClass.init(fileName);
|
||||
|
||||
while(not done)
|
||||
{
|
||||
char = fileReader.read();
|
||||
counter = counter + 1;
|
||||
if ( char eq -1 or counter eq ARGUMENTS.bytes)
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk = chunk & chr(char) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
</cfscript>
|
||||
|
||||
<cfreturn chunk>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="SendUploadResults" returntype="String" output="true">
|
||||
<cfargument name="errorNumber" required="true" type="Numeric">
|
||||
<cfargument name="fileUrl" required="false" type="String" default="">
|
||||
<cfargument name="fileName" required="false" type="String" default="">
|
||||
<cfargument name="customMsg" required="false" type="String" default="">
|
||||
|
||||
<cfoutput>
|
||||
<script type="text/javascript">
|
||||
window.parent.OnUploadCompleted( #errorNumber#, "#JSStringFormat(fileUrl)#", "#JSStringFormat(fileName)#", "#JSStringFormat(customMsg)#" );
|
||||
</script>
|
||||
</cfoutput>
|
||||
<cfabort>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="SanitizeFileName" returntype="String" output="false">
|
||||
<cfargument name="sNewFileName" required="true">
|
||||
|
||||
<cfif isDefined("REQUEST.Config.ForceSingleExtension") and REQUEST.Config.ForceSingleExtension>
|
||||
<cfset sNewFileName = rereplace( sNewFileName, '\.(?![^.]*$)', "_", "all" )>
|
||||
</cfif>
|
||||
|
||||
<!--- Do a cleanup of the file name to avoid possible problems --->
|
||||
<!--- Remove \ / | : ? * " < > --->
|
||||
<cfset sNewFileName = rereplace( sNewFileName, '\\[.]+|\\+|\/+|\|+|\:+|\?+|\*+|"+|<+|>+', "_", "all" )>
|
||||
|
||||
<cfreturn sNewFileName>
|
||||
</cffunction>
|
68
FCKeditor/editor/filemanager/connectors/cfm/cf_upload.cfm
Normal file
68
FCKeditor/editor/filemanager/connectors/cfm/cf_upload.cfm
Normal file
|
@ -0,0 +1,68 @@
|
|||
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* File Browser connector for ColdFusion (MX 6.0 and above).
|
||||
* (based on the original CF connector by Hendrik Kramer - hk@lwd.de)
|
||||
--->
|
||||
|
||||
<cfparam name="url.type" default="File">
|
||||
<cfparam name="url.currentFolder" default="/">
|
||||
|
||||
<!--- note: no serverPath url parameter - see config.cfm if you need to set the serverPath manually --->
|
||||
|
||||
<cfinclude template="config.cfm">
|
||||
<cfinclude template="cf_util.cfm">
|
||||
<cfinclude template="cf_io.cfm">
|
||||
<cfinclude template="cf_commands.cfm">
|
||||
|
||||
<cfset REQUEST.Config = Config>
|
||||
<cfif find( "/", getBaseTemplatePath() ) >
|
||||
<cfset REQUEST.Fs = "/">
|
||||
<cfelse>
|
||||
<cfset REQUEST.Fs = "\">
|
||||
</cfif>
|
||||
|
||||
<cfif not Config.Enabled>
|
||||
<cfset SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/cfm/config.cfm" file' )>
|
||||
</cfif>
|
||||
|
||||
<cfset sCommand = 'QuickUpload'>
|
||||
<cfset sType = "File">
|
||||
|
||||
<cfif isDefined( "URL.Type" )>
|
||||
<cfset sType = URL.Type>
|
||||
</cfif>
|
||||
|
||||
<cfset sCurrentFolder = GetCurrentFolder()>
|
||||
|
||||
<!--- Is enabled the upload? --->
|
||||
<cfif not IsAllowedCommand( sCommand )>
|
||||
<cfset SendUploadResults( "1", "", "", "The """ & sCommand & """ command isn't allowed" )>
|
||||
</cfif>
|
||||
|
||||
<!--- Check if it is an allowed type. --->
|
||||
<cfif not IsAllowedType( sType )>
|
||||
<cfset SendUploadResults( "1", "", "", "Invalid type specified" ) >
|
||||
</cfif>
|
||||
|
||||
<cfset FileUpload( sType, sCurrentFolder, sCommand )>
|
||||
|
||||
|
132
FCKeditor/editor/filemanager/connectors/cfm/cf_util.cfm
Normal file
132
FCKeditor/editor/filemanager/connectors/cfm/cf_util.cfm
Normal file
|
@ -0,0 +1,132 @@
|
|||
<cfsetting enablecfoutputonly="Yes">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This file include generic functions used by the ColdFusion Connector (MX 6.0 and above).
|
||||
--->
|
||||
|
||||
<cffunction name="RemoveFromStart" output="false" returntype="String">
|
||||
<cfargument name="sourceString" type="String">
|
||||
<cfargument name="charToRemove" type="String">
|
||||
|
||||
<cfif left(ARGUMENTS.sourceString, 1) eq ARGUMENTS.charToRemove>
|
||||
<cfreturn mid( ARGUMENTS.sourceString, 2, len(ARGUMENTS.sourceString) -1 )>
|
||||
</cfif>
|
||||
|
||||
<cfreturn ARGUMENTS.sourceString>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="RemoveFromEnd" output="false" returntype="String">
|
||||
<cfargument name="sourceString" type="String">
|
||||
<cfargument name="charToRemove" type="String">
|
||||
|
||||
<cfif right(ARGUMENTS.sourceString, 1) eq ARGUMENTS.charToRemove>
|
||||
<cfreturn mid( ARGUMENTS.sourceString, 1, len(ARGUMENTS.sourceString) -1 )>
|
||||
</cfif>
|
||||
|
||||
<cfreturn ARGUMENTS.sourceString>
|
||||
</cffunction>
|
||||
|
||||
<!---
|
||||
Check file content.
|
||||
Currently this function validates only image files.
|
||||
Returns false if file is invalid.
|
||||
detectionLevel:
|
||||
0 = none
|
||||
1 = check image size for images,
|
||||
2 = use DetectHtml for images
|
||||
---->
|
||||
<cffunction name="IsImageValid" returntype="boolean" output="true">
|
||||
<cfargument name="filePath" required="true" type="String">
|
||||
<cfargument name="extension" required="true" type="String">
|
||||
|
||||
<cfset var imageCFC = "">
|
||||
<cfset var imageInfo = "">
|
||||
|
||||
<cfif not ListFindNoCase("gif,jpeg,jpg,png,swf,psd,bmp,iff,tiff,tif,swc,jpc,jp2,jpx,jb2,xmb,wbmp", ARGUMENTS.extension)>
|
||||
<cfreturn true>
|
||||
</cfif>
|
||||
|
||||
<cftry>
|
||||
<cfif REQUEST.CFVersion gte 8>
|
||||
<cfset objImage = ImageRead(ARGUMENTS.filePath) >
|
||||
<cfset imageInfo = ImageInfo(objImage)>
|
||||
<!--- <cfimage action="info" source="#ARGUMENTS.filePath#" structName="imageInfo" /> --->
|
||||
<cfelse>
|
||||
<cfset imageCFC = createObject("component", "image")>
|
||||
<cfset imageInfo = imageCFC.getImageInfo("", ARGUMENTS.filePath)>
|
||||
</cfif>
|
||||
|
||||
<cfif imageInfo.height lte 0 or imageInfo.width lte 0>
|
||||
<cfreturn false>
|
||||
</cfif>
|
||||
<cfcatch type="any">
|
||||
<cfreturn false>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
|
||||
<cfreturn true>
|
||||
</cffunction>
|
||||
|
||||
<!---
|
||||
Detect HTML in the first KB to prevent against potential security issue with
|
||||
IE/Safari/Opera file type auto detection bug.
|
||||
Returns true if file contain insecure HTML code at the beginning.
|
||||
--->
|
||||
<cffunction name="DetectHtml" output="false" returntype="boolean">
|
||||
<cfargument name="filePath" required="true" type="String">
|
||||
|
||||
<cfset var tags = "<body,<head,<html,<img,<pre,<script,<table,<title">
|
||||
<cfset var chunk = lcase( Trim( BinaryFileRead( ARGUMENTS.filePath, 1024 ) ) )>
|
||||
|
||||
<cfif not Len(chunk)>
|
||||
<cfreturn false>
|
||||
</cfif>
|
||||
|
||||
<cfif refind('<!doctype\W*x?html', chunk)>
|
||||
<cfreturn true>
|
||||
</cfif>
|
||||
|
||||
<cfloop index = "tag" list = "#tags#">
|
||||
<cfif find( tag, chunk )>
|
||||
<cfreturn true>
|
||||
</cfif>
|
||||
</cfloop>
|
||||
|
||||
<!--- type = javascript --->
|
||||
<cfif refind('type\s*=\s*[''"]?\s*(?:\w*/)?(?:ecma|java)', chunk)>
|
||||
<cfreturn true>
|
||||
</cfif> >
|
||||
|
||||
<!--- href = javascript --->
|
||||
<!--- src = javascript --->
|
||||
<!--- data = javascript --->
|
||||
<cfif refind('(?:href|src|data)\s*=\s*[\''"]?\s*(?:ecma|java)script:', chunk)>
|
||||
<cfreturn true>
|
||||
</cfif>
|
||||
|
||||
<!--- url(javascript --->
|
||||
<cfif refind('url\s*\(\s*[\''"]?\s*(?:ecma|java)script:', chunk)>
|
||||
<cfreturn true>
|
||||
</cfif>
|
||||
|
||||
<cfreturn false>
|
||||
</cffunction>
|
||||
|
183
FCKeditor/editor/filemanager/connectors/cfm/config.cfm
Normal file
183
FCKeditor/editor/filemanager/connectors/cfm/config.cfm
Normal file
|
@ -0,0 +1,183 @@
|
|||
<cfsetting enablecfoutputonly="Yes">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Configuration file for the ColdFusion Connector (all versions).
|
||||
--->
|
||||
|
||||
<cfscript>
|
||||
Config = StructNew() ;
|
||||
|
||||
// SECURITY: You must explicitly enable this "connector". (Set enabled to "true")
|
||||
Config.Enabled = true ;
|
||||
|
||||
// Path to uploaded files relative to the document root.
|
||||
Config.UserFilesPath = "/userfiles/" ;
|
||||
|
||||
// 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 = "" ;
|
||||
|
||||
// Due to security issues with Apache modules, it is recommended to leave the
|
||||
// following setting enabled.
|
||||
Config.ForceSingleExtension = true ;
|
||||
|
||||
// Perform additional checks for image files - if set to true, validate image size
|
||||
// (This feature works in MX 6.0 and above)
|
||||
Config.SecureImageUploads = true;
|
||||
|
||||
// What the user can do with this connector
|
||||
Config.ConfigAllowedCommands = "QuickUpload,FileUpload,GetFolders,GetFoldersAndFiles,CreateFolder" ;
|
||||
|
||||
//Allowed Resource Types
|
||||
Config.ConfigAllowedTypes = "File,Image,Flash,Media" ;
|
||||
|
||||
// For security, HTML is allowed in the first Kb of data for files having the
|
||||
// following extensions only.
|
||||
// (This feature works in MX 6.0 and above))
|
||||
Config.HtmlExtensions = "html,htm,xml,xsd,txt,js" ;
|
||||
|
||||
|
||||
// Configuration settings for each Resource Type
|
||||
//
|
||||
// - AllowedExtensions: the possible extensions that can be allowed.
|
||||
// If it is empty then any file type can be uploaded.
|
||||
// - DeniedExtensions: The extensions that won't be allowed.
|
||||
// If it is empty then no restrictions are done here.
|
||||
//
|
||||
// For a file to be uploaded it has to fulfill both the AllowedExtensions
|
||||
// and DeniedExtensions (that's it: not being denied) conditions.
|
||||
//
|
||||
// - FileTypesPath: the virtual folder relative to the document root where
|
||||
// these resources will be located.
|
||||
// Attention: It must start and end with a slash: '/'
|
||||
//
|
||||
// - FileTypesAbsolutePath: the physical path to the above folder. It must be
|
||||
// an absolute path.
|
||||
// If it's an empty string then it will be autocalculated.
|
||||
// Usefull if you are using a virtual directory, symbolic link or alias.
|
||||
// Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
|
||||
// Attention: The above 'FileTypesPath' must point to the same directory.
|
||||
// Attention: It must end with a slash: '/'
|
||||
//
|
||||
//
|
||||
// - QuickUploadPath: the virtual folder relative to the document root where
|
||||
// these resources will be uploaded using the Upload tab in the resources
|
||||
// dialogs.
|
||||
// Attention: It must start and end with a slash: '/'
|
||||
//
|
||||
// - QuickUploadAbsolutePath: the physical path to the above folder. It must be
|
||||
// an absolute path.
|
||||
// If it's an empty string then it will be autocalculated.
|
||||
// Usefull if you are using a virtual directory, symbolic link or alias.
|
||||
// Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
|
||||
// Attention: The above 'QuickUploadPath' must point to the same directory.
|
||||
// Attention: It must end with a slash: '/'
|
||||
|
||||
Config.AllowedExtensions = StructNew() ;
|
||||
Config.DeniedExtensions = StructNew() ;
|
||||
Config.FileTypesPath = StructNew() ;
|
||||
Config.FileTypesAbsolutePath = StructNew() ;
|
||||
Config.QuickUploadPath = StructNew() ;
|
||||
Config.QuickUploadAbsolutePath = StructNew() ;
|
||||
|
||||
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" ;
|
||||
Config.DeniedExtensions["File"] = "" ;
|
||||
Config.FileTypesPath["File"] = Config.UserFilesPath & 'file/' ;
|
||||
Config.FileTypesAbsolutePath["File"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'file/') ) ;
|
||||
Config.QuickUploadPath["File"] = Config.FileTypesPath["File"] ;
|
||||
Config.QuickUploadAbsolutePath["File"] = Config.FileTypesAbsolutePath["File"] ;
|
||||
|
||||
Config.AllowedExtensions["Image"] = "bmp,gif,jpeg,jpg,png" ;
|
||||
Config.DeniedExtensions["Image"] = "" ;
|
||||
Config.FileTypesPath["Image"] = Config.UserFilesPath & 'image/' ;
|
||||
Config.FileTypesAbsolutePath["Image"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'image/') ) ;
|
||||
Config.QuickUploadPath["Image"] = Config.FileTypesPath["Image"] ;
|
||||
Config.QuickUploadAbsolutePath["Image"] = Config.FileTypesAbsolutePath["Image"] ;
|
||||
|
||||
Config.AllowedExtensions["Flash"] = "swf,flv" ;
|
||||
Config.DeniedExtensions["Flash"] = "" ;
|
||||
Config.FileTypesPath["Flash"] = Config.UserFilesPath & 'flash/' ;
|
||||
Config.FileTypesAbsolutePath["Flash"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'flash/') ) ;
|
||||
Config.QuickUploadPath["Flash"] = Config.FileTypesPath["Flash"] ;
|
||||
Config.QuickUploadAbsolutePath["Flash"] = Config.FileTypesAbsolutePath["Flash"] ;
|
||||
|
||||
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" ;
|
||||
Config.DeniedExtensions["Media"] = "" ;
|
||||
Config.FileTypesPath["Media"] = Config.UserFilesPath & 'media/' ;
|
||||
Config.FileTypesAbsolutePath["Media"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'media/') ) ;
|
||||
Config.QuickUploadPath["Media"] = Config.FileTypesPath["Media"] ;
|
||||
Config.QuickUploadAbsolutePath["Media"] = Config.FileTypesAbsolutePath["Media"] ;
|
||||
</cfscript>
|
||||
|
||||
<cftry>
|
||||
<!--- code to maintain backwards compatibility with previous version of cfm connector --->
|
||||
<cfif isDefined("application.userFilesPath")>
|
||||
|
||||
<cflock scope="application" type="readonly" timeout="5">
|
||||
<cfset config.userFilesPath = application.userFilesPath>
|
||||
</cflock>
|
||||
|
||||
<cfelseif isDefined("server.userFilesPath")>
|
||||
|
||||
<cflock scope="server" type="readonly" timeout="5">
|
||||
<cfset config.userFilesPath = server.userFilesPath>
|
||||
</cflock>
|
||||
|
||||
</cfif>
|
||||
|
||||
<!--- look for config struct in application and server scopes --->
|
||||
<cfif isDefined("application.FCKeditor") and isStruct(application.FCKeditor)>
|
||||
|
||||
<cflock scope="application" type="readonly" timeout="5">
|
||||
<cfset variables.FCKeditor = duplicate(application.FCKeditor)>
|
||||
</cflock>
|
||||
|
||||
<cfelseif isDefined("server.FCKeditor") and isStruct(server.FCKeditor)>
|
||||
|
||||
<cflock scope="server" type="readonly" timeout="5">
|
||||
<cfset variables.FCKeditor = duplicate(server.FCKeditor)>
|
||||
</cflock>
|
||||
|
||||
</cfif>
|
||||
<!--- catch potential "The requested scope application has not been enabled" exception --->
|
||||
<cfcatch type="any">
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
|
||||
<cfif isDefined("FCKeditor")>
|
||||
|
||||
<!--- copy key values from external to local config (i.e. override default config as required) --->
|
||||
<cfscript>
|
||||
function structCopyKeys(stFrom, stTo) {
|
||||
for ( key in stFrom ) {
|
||||
if ( isStruct(stFrom[key]) ) {
|
||||
structCopyKeys(stFrom[key],stTo[key]);
|
||||
} else {
|
||||
stTo[key] = stFrom[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
structCopyKeys(FCKeditor, config);
|
||||
</cfscript>
|
||||
|
||||
</cfif>
|
31
FCKeditor/editor/filemanager/connectors/cfm/connector.cfm
Normal file
31
FCKeditor/editor/filemanager/connectors/cfm/connector.cfm
Normal file
|
@ -0,0 +1,31 @@
|
|||
<cfsetting enablecfoutputonly="Yes">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* File Browser connector for ColdFusion (all versions).
|
||||
*
|
||||
--->
|
||||
|
||||
<cfset REQUEST.CFVersion = Left( SERVER.COLDFUSION.PRODUCTVERSION, Find( ",", SERVER.COLDFUSION.PRODUCTVERSION ) - 1 )>
|
||||
<cfif REQUEST.CFVersion lte 5>
|
||||
<cfinclude template="cf5_connector.cfm">
|
||||
<cfelse>
|
||||
<cfinclude template="cf_connector.cfm">
|
||||
</cfif>
|
1325
FCKeditor/editor/filemanager/connectors/cfm/image.cfc
Normal file
1325
FCKeditor/editor/filemanager/connectors/cfm/image.cfc
Normal file
File diff suppressed because it is too large
Load diff
31
FCKeditor/editor/filemanager/connectors/cfm/upload.cfm
Normal file
31
FCKeditor/editor/filemanager/connectors/cfm/upload.cfm
Normal file
|
@ -0,0 +1,31 @@
|
|||
<cfsetting enablecfoutputonly="Yes">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the "File Uploader" for ColdFusion (all versions).
|
||||
*
|
||||
--->
|
||||
|
||||
<cfset REQUEST.CFVersion = Left( SERVER.COLDFUSION.PRODUCTVERSION, Find( ",", SERVER.COLDFUSION.PRODUCTVERSION ) - 1 )>
|
||||
<cfif REQUEST.CFVersion lte 5>
|
||||
<cfinclude template="cf5_upload.cfm">
|
||||
<cfelse>
|
||||
<cfinclude template="cf_upload.cfm">
|
||||
</cfif>
|
Loading…
Add table
Add a link
Reference in a new issue