Index: /FCKeditor/trunk/_whatsnew.html
===================================================================
--- /FCKeditor/trunk/_whatsnew.html	(revision 412)
+++ /FCKeditor/trunk/_whatsnew.html	(revision 413)
@@ -45,4 +45,17 @@
 			file has been renamed to ".htaccess" as it doesn't bring security concerns, being
 			active out of the box.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/454">#454</a>] The file browser and upload
+			connectors have been unified so they can reuse the same configuration settings.<br>
+			The asp and php connectors have been improved so it's easy to select the location of the destination 
+			folder for each  file type, and it's no longer neccesary to use the "file", "image", "flash" subfolders<br>
+			<span style="color: #ff0000">Attention:</span> The location of all the connectors have been changed in 
+			the fckconfig.js file. Please check your settings to match the current ones. Also review carefully the 
+			config file for your server language.
+			</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/688">#688</a>] Now the Perl quik upload is 
+			available.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/561">#561</a>] The asp connector provides an
+			AbsolutePath setting so it's possible to set the url to a full domain or a relative path and specify that
+			way the physical folder where the files are stored..</li>
 	</ul>
 	<p>
@@ -59,4 +72,12 @@
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/497">#497</a>] Fixed EMBED
 			attributes handling in IE.</li>
+		<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1315722&group_id=75348&atid=543655">SF 
+			Patch 1315722</a>] Avoid getting a cached version of the folder contents after uploading a file</li>
+		<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1386086&group_id=75348&atid=543655">SF 
+			Patch 1386086</a>] The php connector has been protected so mkdir doesn't fail if there are double slashes.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/943">#943</a>] The PHP connector now specifies 
+			that the included files are relative to the current path.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/560">#560</a>] The PHP connector will work better if the
+			connector or the userfiles folder is a symlink.</li>
 	</ul>
 	<h3>
Index: /FCKeditor/trunk/editor/filemanager/browser/default/browser.css
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/browser.css	(revision 412)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/browser.css	(revision 413)
@@ -47,4 +47,5 @@
 
 	background-color: #ffffff;
+	margin: 10px;
 }
 
Index: /FCKeditor/trunk/editor/filemanager/browser/default/browser.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/browser.html	(revision 412)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/browser.html	(revision 413)
@@ -69,4 +69,7 @@
 	if ( params ) sUrl += '&' + params ;
 
+	// Add a random salt to avoid getting a cached version of the command execution
+	sUrl += '&uuid=' + new Date().getTime() ;
+
 	var oXML = new FCKXml() ;
 
@@ -135,4 +138,10 @@
 		return 'default.icon' ;
 }
+
+function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
+{
+	window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ) ;
+}
+
 		</script>
 	</head>
Index: /FCKeditor/trunk/editor/filemanager/browser/default/frmfolders.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/frmfolders.html	(revision 412)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/frmfolders.html	(revision 413)
@@ -167,5 +167,5 @@
 	{
 		var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
-		oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ;
+		oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ) ;
 	}
 
Index: /FCKeditor/trunk/editor/filemanager/browser/default/frmresourceslist.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/frmresourceslist.html	(revision 412)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/frmresourceslist.html	(revision 413)
@@ -35,18 +35,25 @@
 }
 
+function ProtectPath(path)
+{
+	path = path.replace( /\\/g, '\\\\') ;
+	path = path.replace( /'/g, '\\\'') ;
+	return path ;
+}
+
 oListManager.GetFolderRowHtml = function( folderName, folderPath )
 {
 	// Build the link to view the folder.
-	var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath.replace( /'/g, '\\\'') + '\');return false;">' ;
+	var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ;
 
 	return '<tr>' +
 			'<td width="16">' +
 				sLink +
-				'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"></a>' +
-			'</td><td nowrap colspan="2">&nbsp;' +
+				'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +
+			'<\/td><td nowrap colspan="2">&nbsp;' +
 				sLink +
 				folderName +
-				'</a>' +
-		'</td></tr>' ;
+				'<\/a>' +
+		'<\/td><\/tr>' ;
 }
 
@@ -54,5 +61,5 @@
 {
 	// Build the link to view the folder.
-	var sLink = '<a href="#" onclick="OpenFile(\'' + fileUrl.replace( /'/g, '\\\'') + '\');return false;">' ;
+	var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ;
 
 	// Get the file icon.
@@ -62,13 +69,13 @@
 			'<td width="16">' +
 				sLink +
-				'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"></a>' +
-			'</td><td>&nbsp;' +
+				'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +
+			'<\/td><td>&nbsp;' +
 				sLink +
 				fileName +
-				'</a>' +
-			'</td><td align="right" nowrap>&nbsp;' +
+				'<\/a>' +
+			'<\/td><td align="right" nowrap>&nbsp;' +
 				fileSize +
 				' KB' +
-		'</td></tr>' ;
+		'<\/td><\/tr>' ;
 }
 
@@ -156,5 +163,5 @@
 	</script>
 </head>
-<body class="FileArea" bottommargin="10" leftmargin="10" topmargin="10" rightmargin="10">
+<body class="FileArea">
 </body>
 </html>
Index: /FCKeditor/trunk/editor/filemanager/browser/default/frmupload.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/browser/default/frmupload.html	(revision 412)
+++ /FCKeditor/trunk/editor/filemanager/browser/default/frmupload.html	(revision 413)
@@ -24,4 +24,5 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 	<head>
+		<title>File Upload</title>
 		<link href="browser.css" type="text/css" rel="stylesheet" />
 		<script type="text/javascript" src="js/common.js"></script>
@@ -57,5 +58,5 @@
 	window.parent.frames['frmUploadWorker'].location = 'javascript:void(0)' ;
 
-	// Reset the upload form (On IE we must do a little trick to avout problems).
+	// Reset the upload form (On IE we must do a little trick to avoid problems).
 	if ( document.all )
 		document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
Index: /FCKeditor/trunk/editor/filemanager/connectors/asp/basexml.asp
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/asp/basexml.asp	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/asp/basexml.asp	(revision 413)
@@ -0,0 +1,62 @@
+﻿<%
+ ' 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.
+%>
+<%
+
+Sub SetXmlHeaders()
+	' Cleans the response buffer.
+	Response.Clear()
+
+	' Prevent the browser from caching the result.
+	Response.CacheControl = "no-cache"
+
+	' Set the response format.
+	Response.CharSet		= "UTF-8"
+	Response.ContentType	= "text/xml"
+End Sub
+
+Sub CreateXmlHeader( command, resourceType, currentFolder, url )
+	' Create the XML document header.
+	Response.Write "<?xml version=""1.0"" encoding=""utf-8"" ?>"
+
+	' Create the main "Connector" node.
+	Response.Write "<Connector command=""" & command & """ resourceType=""" & resourceType & """>"
+
+	' Add the current folder node.
+	Response.Write "<CurrentFolder path=""" & ConvertToXmlAttribute( currentFolder ) & """ url=""" & ConvertToXmlAttribute( url ) & """ />"
+End Sub
+
+Sub CreateXmlFooter()
+	Response.Write "</Connector>"
+End Sub
+
+Sub SendError( number, text )
+	SetXmlHeaders
+
+	' Create the XML document header.
+	Response.Write "<?xml version=""1.0"" encoding=""utf-8"" ?>"
+
+	Response.Write "<Connector><Error number=""" & number & """ text=""" & Server.HTMLEncode( text ) & """ /></Connector>"
+
+	Response.End
+End Sub
+%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/asp/class_upload.asp
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/asp/class_upload.asp	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/asp/class_upload.asp	(revision 413)
@@ -0,0 +1,262 @@
+﻿<!--
+ * 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 ==
+ *
+ * These are the classes used to handle ASP upload without using third
+ * part components (OCX/DLL).
+-->
+<%
+'**********************************************
+' File:		NetRube_Upload.asp
+' Version:	NetRube Upload Class Version 2.3 Build 20070528
+' Author:	NetRube
+' Email:	NetRube@126.com
+' Date:		05/28/2007
+' Comments:	The code for the Upload.
+'			This can free usage, but please
+'			not to delete this copyright information.
+'			If you have a modification version,
+'			Please send out a duplicate to me.
+'**********************************************
+' 文件名:	NetRube_Upload.asp
+' 版本:		NetRube Upload Class Version 2.3 Build 20070528
+' 作者:		NetRube(网络乡巴佬)
+' 电子邮件:	NetRube@126.com
+' 日期:		2007年05月28日
+' 声明:		文件上传类
+'			本上传类可以自由使用，但请保留此版权声明信息
+'			如果您对本上传类进行修改增强，
+'			请发送一份给俺。
+'**********************************************
+
+Class NetRube_Upload
+
+	Public	File, Form
+	Private oSourceData
+	Private nMaxSize, nErr, sAllowed, sDenied
+	
+	Private Sub Class_Initialize
+		nErr		= 0
+		nMaxSize	= 1048576
+		
+		Set File			= Server.CreateObject("Scripting.Dictionary")
+		File.CompareMode	= 1
+		Set Form			= Server.CreateObject("Scripting.Dictionary")
+		Form.CompareMode	= 1
+		
+		Set oSourceData		= Server.CreateObject("ADODB.Stream")
+		oSourceData.Type	= 1
+		oSourceData.Mode	= 3
+		oSourceData.Open
+	End Sub
+	
+	Private Sub Class_Terminate
+		Form.RemoveAll
+		Set Form = Nothing
+		File.RemoveAll
+		Set File = Nothing
+		
+		oSourceData.Close
+		Set oSourceData = Nothing
+	End Sub
+	
+	Public Property Get Version
+		Version = "NetRube Upload Class Version 2.3 Build 20070528"
+	End Property
+
+	Public Property Get ErrNum
+		ErrNum	= nErr
+	End Property
+	
+	Public Property Let MaxSize(nSize)
+		nMaxSize	= nSize
+	End Property
+	
+	Public Property Let Allowed(sExt)
+		sAllowed	= sExt
+	End Property
+	
+	Public Property Let Denied(sExt)
+		sDenied	= sExt
+	End Property
+
+	Public Sub GetData
+		Dim aCType
+		aCType = Split(Request.ServerVariables("HTTP_CONTENT_TYPE"), ";")
+		If aCType(0) <> "multipart/form-data" Then
+			nErr = 1
+			Exit Sub
+		End If
+		
+		Dim nTotalSize
+		nTotalSize	= Request.TotalBytes
+		If nTotalSize < 1 Then
+			nErr = 2
+			Exit Sub
+		End If
+		If nMaxSize > 0 And nTotalSize > nMaxSize Then
+			nErr = 3
+			Exit Sub
+		End If
+		
+		'Thankful long(yrl031715@163.com)
+		'Fix upload large file.
+		'**********************************************
+		' 修正作者：long
+		' 联系邮件: yrl031715@163.com
+		' 修正时间：2007年5月6日
+		' 修正说明：由于iis6的Content-Length 头信息中包含的请求长度超过了 AspMaxRequestEntityAllowed 的值（默认200K）, IIS 将返回一个 403 错误信息.
+		'          直接导致在iis6下调试FCKeditor上传功能时，一旦文件超过200K,上传文件时文件管理器失去响应，受此影响，文件的快速上传功能也存在在缺陷。
+		'          在参考 宝玉 的 Asp无组件上传带进度条 演示程序后作出如下修改，以修正在iis6下的错误。
+
+		Dim nTotalBytes, nPartBytes, ReadBytes
+		ReadBytes = 0
+		nTotalBytes = Request.TotalBytes
+		'循环分块读取
+		Do While ReadBytes < nTotalBytes
+			'分块读取
+			nPartBytes = 64 * 1024 '分成每块64k
+			If nPartBytes + ReadBytes > nTotalBytes Then 
+				nPartBytes = nTotalBytes - ReadBytes
+			End If
+			oSourceData.Write Request.BinaryRead(nPartBytes)
+			ReadBytes = ReadBytes + nPartBytes
+		Loop
+		'**********************************************
+		oSourceData.Position = 0
+		
+		Dim oTotalData, oFormStream, sFormHeader, sFormName, bCrLf, nBoundLen, nFormStart, nFormEnd, nPosStart, nPosEnd, sBoundary
+		
+		oTotalData	= oSourceData.Read
+		bCrLf		= ChrB(13) & ChrB(10)
+		sBoundary	= MidB(oTotalData, 1, InStrB(1, oTotalData, bCrLf) - 1)
+		nBoundLen	= LenB(sBoundary) + 2
+		nFormStart	= nBoundLen
+		
+		Set oFormStream = Server.CreateObject("ADODB.Stream")
+		
+		Do While (nFormStart + 2) < nTotalSize
+			nFormEnd	= InStrB(nFormStart, oTotalData, bCrLf & bCrLf) + 3
+			
+			With oFormStream
+				.Type	= 1
+				.Mode	= 3
+				.Open
+				oSourceData.Position = nFormStart
+				oSourceData.CopyTo oFormStream, nFormEnd - nFormStart
+				.Position	= 0
+				.Type		= 2
+				.CharSet	= "UTF-8"
+				sFormHeader	= .ReadText
+				.Close
+			End With
+			
+			nFormStart	= InStrB(nFormEnd, oTotalData, sBoundary) - 1
+			nPosStart	= InStr(22, sFormHeader, " name=", 1) + 7
+			nPosEnd		= InStr(nPosStart, sFormHeader, """")
+			sFormName	= Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
+			
+			If InStr(45, sFormHeader, " filename=", 1) > 0 Then
+				Set File(sFormName)			= New NetRube_FileInfo
+				File(sFormName).FormName	= sFormName
+				File(sFormName).Start		= nFormEnd
+				File(sFormName).Size		= nFormStart - nFormEnd - 2
+				nPosStart					= InStr(nPosEnd, sFormHeader, " filename=", 1) + 11
+				nPosEnd						= InStr(nPosStart, sFormHeader, """")
+				File(sFormName).ClientPath	= Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
+				File(sFormName).Name		= Mid(File(sFormName).ClientPath, InStrRev(File(sFormName).ClientPath, "\") + 1)
+				File(sFormName).Ext			= LCase(Mid(File(sFormName).Name, InStrRev(File(sFormName).Name, ".") + 1))
+				nPosStart					= InStr(nPosEnd, sFormHeader, "Content-Type: ", 1) + 14
+				nPosEnd						= InStr(nPosStart, sFormHeader, vbCr)
+				File(sFormName).MIME		= Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
+			Else
+				With oFormStream
+					.Type	= 1
+					.Mode	= 3
+					.Open
+					oSourceData.Position = nFormEnd
+					oSourceData.CopyTo oFormStream, nFormStart - nFormEnd - 2
+					.Position	= 0
+					.Type		= 2
+					.CharSet	= "UTF-8"
+					Form(sFormName)	= .ReadText
+					.Close
+				End With
+			End If
+			
+			nFormStart	= nFormStart + nBoundLen
+		Loop
+		
+		oTotalData = ""
+		Set oFormStream = Nothing
+	End Sub
+
+	Public Sub SaveAs(sItem, sFileName)
+		If File(sItem).Size < 1 Then
+			nErr = 2
+			Exit Sub
+		End If
+		
+		If Not IsAllowed(File(sItem).Ext) Then
+			nErr = 4
+			Exit Sub
+		End If
+		
+		If InStr( LCase( sFileName ), "::$data" ) > 0 Then
+			nErr = 4
+			Exit Sub
+		End If
+		
+		Dim oFileStream
+		Set oFileStream = Server.CreateObject("ADODB.Stream")
+		With oFileStream
+			.Type		= 1
+			.Mode		= 3
+			.Open
+			oSourceData.Position = File(sItem).Start
+			oSourceData.CopyTo oFileStream, File(sItem).Size
+			.Position	= 0
+			.SaveToFile sFileName, 2
+			.Close
+		End With
+		Set oFileStream = Nothing
+	End Sub
+	
+	Private Function IsAllowed(sExt)
+		Dim oRE
+		Set oRE	= New RegExp
+		oRE.IgnoreCase	= True
+		oRE.Global		= True
+		
+		If sDenied = "" Then
+			oRE.Pattern	= sAllowed
+			IsAllowed	= (sAllowed = "") Or oRE.Test(sExt)
+		Else
+			oRE.Pattern	= sDenied
+			IsAllowed	= Not oRE.Test(sExt)
+		End If
+		
+		Set oRE	= Nothing
+	End Function
+End Class
+
+Class NetRube_FileInfo
+	Dim FormName, ClientPath, Path, Name, Ext, Content, Size, MIME, Start
+End Class
+%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/asp/commands.asp
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/asp/commands.asp	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/asp/commands.asp	(revision 413)
@@ -0,0 +1,196 @@
+﻿<%
+ ' 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 ASP Connector.
+%>
+<%
+Sub GetFolders( resourceType, currentFolder )
+	' Map the virtual path to the local server path.
+	Dim sServerDir
+	sServerDir = ServerMapFolder( resourceType, currentFolder, "GetFolders" )
+
+	' Open the "Folders" node.
+	Response.Write "<Folders>"
+
+	Dim oFSO, oCurrentFolder, oFolders, oFolder
+	Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
+	if not (oFSO.FolderExists( sServerDir ) ) then
+		Set oFSO = Nothing
+		SendError 102, currentFolder
+	end if
+
+	Set oCurrentFolder = oFSO.GetFolder( sServerDir )
+	Set oFolders = oCurrentFolder.SubFolders
+
+	For Each oFolder in oFolders
+		Response.Write "<Folder name=""" & ConvertToXmlAttribute( oFolder.name ) & """ />"
+	Next
+
+	Set oFSO = Nothing
+
+	' Close the "Folders" node.
+	Response.Write "</Folders>"
+End Sub
+
+Sub GetFoldersAndFiles( resourceType, currentFolder )
+	' Map the virtual path to the local server path.
+	Dim sServerDir
+	sServerDir = ServerMapFolder( resourceType, currentFolder, "GetFoldersAndFiles" )
+
+	Dim oFSO, oCurrentFolder, oFolders, oFolder, oFiles, oFile
+	Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
+	if not (oFSO.FolderExists( sServerDir ) ) then
+		Set oFSO = Nothing
+		SendError 102, currentFolder
+	end if
+
+	Set oCurrentFolder = oFSO.GetFolder( sServerDir )
+	Set oFolders	= oCurrentFolder.SubFolders
+	Set oFiles		= oCurrentFolder.Files
+
+	' Open the "Folders" node.
+	Response.Write "<Folders>"
+
+	For Each oFolder in oFolders
+		Response.Write "<Folder name=""" & ConvertToXmlAttribute( oFolder.name ) & """ />"
+	Next
+
+	' Close the "Folders" node.
+	Response.Write "</Folders>"
+
+	' Open the "Files" node.
+	Response.Write "<Files>"
+
+	For Each oFile in oFiles
+		Dim iFileSize
+		iFileSize = Round( oFile.size / 1024 )
+		If ( iFileSize < 1 AND oFile.size <> 0 ) Then iFileSize = 1
+
+		Response.Write "<File name=""" & ConvertToXmlAttribute( oFile.name ) & """ size=""" & iFileSize & """ />"
+	Next
+
+	' Close the "Files" node.
+	Response.Write "</Files>"
+End Sub
+
+Sub CreateFolder( resourceType, currentFolder )
+	Dim sErrorNumber
+
+	Dim sNewFolderName
+	sNewFolderName = Request.QueryString( "NewFolderName" )
+	sNewFolderName = SanitizeFolderName( sNewFolderName )
+
+	If ( sNewFolderName = "" OR InStr( 1, sNewFolderName, ".." ) > 0  ) Then
+		sErrorNumber = "102"
+	Else
+		' Map the virtual path to the local server path of the current folder.
+		Dim sServerDir
+		sServerDir = ServerMapFolder( resourceType, CombinePaths(currentFolder, sNewFolderName), "CreateFolder" )
+
+		On Error Resume Next
+
+		CreateServerFolder sServerDir
+
+		Dim iErrNumber, sErrDescription
+		iErrNumber		= err.number
+		sErrDescription	= err.Description
+
+		On Error Goto 0
+
+		Select Case iErrNumber
+			Case 0
+				sErrorNumber = "0"
+			Case 52
+				sErrorNumber = "102"	' Invalid Folder Name.
+			Case 70
+				sErrorNumber = "103"	' Security Error.
+			Case 76
+				sErrorNumber = "102"	' Path too long.
+			Case Else
+				sErrorNumber = "110"
+		End Select
+	End If
+
+	' Create the "Error" node.
+	Response.Write "<Error number=""" & sErrorNumber & """ originalNumber=""" & iErrNumber & """ originalDescription=""" & ConvertToXmlAttribute( sErrDescription ) & """ />"
+End Sub
+
+Sub FileUpload( resourceType, currentFolder, sCommand )
+	Dim oUploader
+	Set oUploader = New NetRube_Upload
+	oUploader.MaxSize	= 0
+	oUploader.Allowed	= ConfigAllowedExtensions.Item( resourceType )
+	oUploader.Denied	= ConfigDeniedExtensions.Item( resourceType )
+	oUploader.GetData
+
+	Dim sErrorNumber
+	sErrorNumber = "0"
+
+	Dim sFileName, sOriginalFileName, sExtension
+	sFileName = ""
+
+	If oUploader.ErrNum > 1 Then
+		sErrorNumber = "202"
+	Else
+		' Map the virtual path to the local server path.
+		Dim sServerDir
+		sServerDir = ServerMapFolder( resourceType, currentFolder, sCommand )
+
+		Dim oFSO
+		Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
+		if not (oFSO.FolderExists( sServerDir ) ) then
+			sErrorNumber = "102"
+		else
+			' Get the uploaded file name.
+			sFileName	= oUploader.File( "NewFile" ).Name
+			sExtension	= oUploader.File( "NewFile" ).Ext
+			sFileName = SanitizeFileName( sFileName )
+			sOriginalFileName = sFileName
+
+			Dim iCounter
+			iCounter = 0
+
+			Do While ( True )
+				Dim sFilePath
+				sFilePath = sServerDir & sFileName
+
+				If ( oFSO.FileExists( sFilePath ) ) Then
+					iCounter = iCounter + 1
+					sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
+					sErrorNumber = "201"
+				Else
+					oUploader.SaveAs "NewFile", sFilePath
+					If oUploader.ErrNum > 0 Then sErrorNumber = "202"
+					Exit Do
+				End If
+			Loop
+		end if
+	End If
+
+	Set oUploader	= Nothing
+
+	dim sFileUrl
+	sFileUrl = CombinePaths( GetResourceTypePath( resourceType, sCommand ) , sFileName )
+
+	SendUploadResults sErrorNumber, sFileUrl, sFileName, ""
+End Sub
+
+%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/asp/config.asp
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/asp/config.asp	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/asp/config.asp	(revision 413)
@@ -0,0 +1,130 @@
+﻿<%
+ ' 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 File Manager Connector for ASP.
+%>
+<%
+
+' SECURITY: You must explicitelly enable this "connector" (set it to "True").
+' WARNING: don't just set "ConfigIsEnabled = true", you must be sure that only 
+'		authenticated users can access this file or use some kind of session checking.
+Dim ConfigIsEnabled
+ConfigIsEnabled = False
+
+' @Packager.Remove.Start
+' Attention: In the development version (SVN) the ASP connector is enabled by default.
+ConfigIsEnabled = true
+' @Packager.Remove.End
+
+
+' Path to user files relative to the document root.
+' This setting is preserved only for backward compatibility. 
+' You should look at the settings for each resource type to get the full potential
+Dim ConfigUserFilesPath
+ConfigUserFilesPath = "/userfiles/"
+
+' Due to security issues with Apache modules, it is reccomended to leave the
+' following setting enabled.
+Dim ConfigForceSingleExtension
+ConfigForceSingleExtension = true 
+
+' What the user can do with this connector
+Dim ConfigAllowedCommands
+ConfigAllowedCommands = "QuickUpload|FileUpload|GetFolders|GetFoldersAndFiles|CreateFolder"
+
+' Allowed Resource Types
+Dim ConfigAllowedTypes
+ConfigAllowedTypes = "File|Image|Flash|Media"
+
+'
+'	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 fullfil 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: '/'
+'
+
+Dim ConfigAllowedExtensions, ConfigDeniedExtensions, ConfigFileTypesPath, ConfigFileTypesAbsolutePath, ConfigQuickUploadPath, ConfigQuickUploadAbsolutePath
+Set ConfigAllowedExtensions	= CreateObject( "Scripting.Dictionary" )
+Set ConfigDeniedExtensions	= CreateObject( "Scripting.Dictionary" )
+Set ConfigFileTypesPath	= CreateObject( "Scripting.Dictionary" )
+Set ConfigFileTypesAbsolutePath	= CreateObject( "Scripting.Dictionary" )
+Set ConfigQuickUploadPath	= CreateObject( "Scripting.Dictionary" )
+Set ConfigQuickUploadAbsolutePath	= CreateObject( "Scripting.Dictionary" )
+
+ConfigAllowedExtensions.Add	"File", ""
+ConfigDeniedExtensions.Add	"File", "html|htm|php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|com|dll|vbs|js|reg|cgi|htaccess|asis|sh|shtml|shtm|phtm"
+ConfigFileTypesPath.Add "File", "http://127.0.0.1/userfiles/file/"
+ConfigFileTypesAbsolutePath.Add "File", "d:\inetpub\wwwroot\docs\file\"
+ConfigQuickUploadPath.Add "File", ConfigUserFilesPath
+ConfigQuickUploadAbsolutePath.Add "File", ""
+
+ConfigAllowedExtensions.Add	"Image", "jpg|gif|jpeg|png|bmp"
+ConfigDeniedExtensions.Add	"Image", ""
+ConfigFileTypesPath.Add "Image", "http://127.0.0.1/userfiles/image/"
+ConfigFileTypesAbsolutePath.Add "Image", "d:\inetpub\wwwroot\docs\image\"
+ConfigQuickUploadPath.Add "Image", ConfigUserFilesPath
+ConfigQuickUploadAbsolutePath.Add "Image", ""
+
+ConfigAllowedExtensions.Add	"Flash", "swf|fla"
+ConfigDeniedExtensions.Add	"Flash", ""
+ConfigFileTypesPath.Add "Flash", ConfigUserFilesPath & "flash/"
+ConfigFileTypesAbsolutePath.Add "Flash", ""
+ConfigQuickUploadPath.Add "Flash", ConfigUserFilesPath
+ConfigQuickUploadAbsolutePath.Add "Flash", ""
+
+ConfigAllowedExtensions.Add	"Media", "swf|fla|jpg|gif|jpeg|png|avi|mpg|mpeg|mp(1-4)|wma|wmv|wav|mid|midi|rmi|rm|ram|rmvb|mov|qt"
+ConfigDeniedExtensions.Add	"Media", ""
+ConfigFileTypesPath.Add "Media", ConfigUserFilesPath & "media/"
+ConfigFileTypesAbsolutePath.Add "Media", ""
+ConfigQuickUploadPath.Add "Media", ConfigUserFilesPath
+ConfigQuickUploadAbsolutePath.Add "Media", ""
+
+%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/asp/connector.asp
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/asp/connector.asp	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/asp/connector.asp	(revision 413)
@@ -0,0 +1,88 @@
+﻿<%@ CodePage=65001 Language="VBScript"%>
+<%
+Option Explicit
+Response.Buffer = True
+%>
+<%
+ ' 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 Manager Connector for ASP.
+%>
+<!--#include file="config.asp"-->
+<!--#include file="util.asp"-->
+<!--#include file="io.asp"-->
+<!--#include file="basexml.asp"-->
+<!--#include file="commands.asp"-->
+<!--#include file="class_upload.asp"-->
+<%
+
+If ( ConfigIsEnabled = False ) Then
+	SendError 1, "This connector is disabled. Please check the ""editor/filemanager/connectors/asp/config.asp"" file"
+End If
+
+DoResponse
+
+Sub DoResponse()
+	Dim sCommand, sResourceType, sCurrentFolder
+
+	' Get the main request information.
+	sCommand = Request.QueryString("Command")
+
+	sResourceType = Request.QueryString("Type")
+	If ( sResourceType = "" ) Then sResourceType = "File"
+
+	sCurrentFolder = GetCurrentFolder()
+
+	' Check if it is an allowed command 
+	if ( Not IsAllowedCommand( sCommand ) ) then
+		SendError 1, "The """ & sCommand & """ command isn't allowed"
+	end if
+
+	' Check if it is an allowed resource type.
+	if ( Not IsAllowedType( sResourceType ) ) Then 
+		SendError 1, "The """ & sResourceType & """ resource type isn't allowed"
+	end if
+
+	' File Upload doesn't have to Return XML, so it must be intercepted before anything.
+	If ( sCommand = "FileUpload" ) Then
+		FileUpload sResourceType, sCurrentFolder, sCommand
+		Exit Sub
+	End If
+
+	SetXmlHeaders
+
+	CreateXmlHeader sCommand, sResourceType, sCurrentFolder, GetUrlFromPath( sResourceType, sCurrentFolder, sCommand)
+
+	' Execute the required command.
+	Select Case sCommand
+		Case "GetFolders"
+			GetFolders sResourceType, sCurrentFolder
+		Case "GetFoldersAndFiles"
+			GetFoldersAndFiles sResourceType, sCurrentFolder
+		Case "CreateFolder"
+			CreateFolder sResourceType, sCurrentFolder
+	End Select
+
+	CreateXmlFooter
+
+	Response.End
+End Sub
+
+%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/asp/io.asp
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/asp/io.asp	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/asp/io.asp	(revision 413)
@@ -0,0 +1,222 @@
+﻿<%
+ ' 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 ASP Connector.
+%>
+<%
+function CombinePaths( sBasePath, sFolder)
+	CombinePaths =  RemoveFromEnd( sBasePath, "/" ) & "/" & RemoveFromStart( sFolder, "/" )
+end function
+
+Function GetResourceTypePath( resourceType, sCommand )
+	if ( sCommand = "QuickUpload") then
+		GetResourceTypePath = ConfigQuickUploadPath.Item( resourceType )
+	else
+		GetResourceTypePath = ConfigFileTypesPath.Item( resourceType )
+	end if
+end Function
+
+Function GetResourceTypeDirectory( resourceType, sCommand )
+	if ( sCommand = "QuickUpload") then
+
+		if ( ConfigQuickUploadAbsolutePath.Item( resourceType ) <> "" ) then
+			GetResourceTypeDirectory = ConfigQuickUploadAbsolutePath.Item( resourceType )
+		else
+			' Map the "UserFiles" path to a local directory.
+			GetResourceTypeDirectory = Server.MapPath( ConfigQuickUploadPath.Item( resourceType ) ) 
+		end if
+	else
+		if ( ConfigFileTypesAbsolutePath.Item( resourceType ) <> "" ) then 
+			GetResourceTypeDirectory = ConfigFileTypesAbsolutePath.Item( resourceType )
+		else
+			' Map the "UserFiles" path to a local directory.
+			GetResourceTypeDirectory = Server.MapPath( ConfigFileTypesPath.Item( resourceType ) ) 
+		end if
+	end if
+end Function
+
+Function GetUrlFromPath( resourceType, folderPath, sCommand )
+	GetUrlFromPath = CombinePaths( GetResourceTypePath( resourceType, sCommand ), folderPath )
+End Function
+
+Function RemoveExtension( fileName )
+	RemoveExtension = Left( fileName, InStrRev( fileName, "." ) - 1 )
+End Function
+
+Function ServerMapFolder( resourceType, folderPath, sCommand )
+	Dim sResourceTypePath
+	' Get the resource type directory.
+	sResourceTypePath = GetResourceTypeDirectory( resourceType, sCommand ) 
+
+	' Ensure that the directory exists.
+	CreateServerFolder sResourceTypePath
+
+	' Return the resource type directory combined with the required path.
+	ServerMapFolder = CombinePaths( sResourceTypePath, folderPath )
+End Function
+
+Sub CreateServerFolder( folderPath )
+	Dim oFSO
+	Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
+
+	Dim sParent
+	sParent = oFSO.GetParentFolderName( folderPath )
+
+	' Check if the parent exists, or create it.
+	If ( NOT oFSO.FolderExists( sParent ) ) Then CreateServerFolder( sParent )
+
+	If ( oFSO.FolderExists( folderPath ) = False ) Then
+		On Error resume next
+		oFSO.CreateFolder( folderPath )
+
+		if err.number<>0 then
+		dim sErrorNumber
+		Dim iErrNumber, sErrDescription
+		iErrNumber		= err.number
+		sErrDescription	= err.Description
+
+		On Error Goto 0
+
+		Select Case iErrNumber
+			Case 52
+				sErrorNumber = "102"	' Invalid Folder Name.
+			Case 70
+				sErrorNumber = "103"	' Security Error.
+			Case 76
+				sErrorNumber = "102"	' Path too long.
+			Case Else
+				sErrorNumber = "110"
+			End Select
+
+			SendError sErrorNumber, "CreateServerFolder(" & folderPath & ") : " & sErrDescription
+		end if
+
+	End If
+
+	Set oFSO = Nothing
+End Sub
+
+Function IsAllowedExt( extension, resourceType )
+	Dim oRE
+	Set oRE	= New RegExp
+	oRE.IgnoreCase	= True
+	oRE.Global		= True
+
+	Dim sAllowed, sDenied
+	sAllowed	= ConfigAllowedExtensions.Item( resourceType )
+	sDenied		= ConfigDeniedExtensions.Item( resourceType )
+
+	IsAllowedExt = True
+
+	If sDenied <> "" Then
+		oRE.Pattern	= sDenied
+		IsAllowedExt	= Not oRE.Test( extension )
+	End If
+
+	If IsAllowedExt And sAllowed <> "" Then
+		oRE.Pattern		= sAllowed
+		IsAllowedExt	= oRE.Test( extension )
+	End If
+
+	Set oRE	= Nothing
+End Function
+
+Function IsAllowedType( resourceType )
+	Dim oRE
+	Set oRE	= New RegExp
+	oRE.IgnoreCase	= True
+	oRE.Global		= True
+	oRE.Pattern		= "^(" & ConfigAllowedTypes & ")$"
+
+	IsAllowedType = oRE.Test( resourceType )
+
+	Set oRE	= Nothing
+End Function
+
+Function IsAllowedCommand( sCommand )
+	Dim oRE
+	Set oRE	= New RegExp
+	oRE.IgnoreCase	= True
+	oRE.Global		= True
+	oRE.Pattern		= "^(" & ConfigAllowedCommands & ")$"
+
+	IsAllowedCommand = oRE.Test( sCommand )
+
+	Set oRE	= Nothing
+End Function
+
+function GetCurrentFolder()
+	dim sCurrentFolder
+	sCurrentFolder = Request.QueryString("CurrentFolder")
+	If ( sCurrentFolder = "" ) Then sCurrentFolder = "/"
+
+	' Check the current folder syntax (must begin and start with a slash).
+	If ( Right( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = sCurrentFolder & "/"
+	If ( Left( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = "/" & sCurrentFolder
+
+	' Check for invalid folder paths (..)
+	If ( InStr( 1, sCurrentFolder, ".." ) <> 0 ) Then
+		SendError 102, ""
+	End If
+
+	GetCurrentFolder = sCurrentFolder
+end function
+
+' Do a cleanup of the folder name to avoid possible problems
+function SanitizeFolderName( sNewFolderName )
+	Dim oRegex
+	Set oRegex = New RegExp
+	oRegex.Global		= True
+
+' remove . \ / | : ? *  " < >
+	oRegex.Pattern = "(\.|\\|\/|\||:|\?|\*|""|\<|\>)"
+	SanitizeFolderName = oRegex.Replace( sNewFolderName, "_" )
+
+	Set oRegex = Nothing
+end function
+
+' Do a cleanup of the file name to avoid possible problems
+function SanitizeFileName( sNewFileName )
+	Dim oRegex
+	Set oRegex = New RegExp
+	oRegex.Global		= True
+
+	if ( ConfigForceSingleExtension = True ) then
+		oRegex.Pattern = "\.(?![^.]*$)"
+		sNewFileName = oRegex.Replace( sNewFileName, "_" )
+	end if
+
+' remove \ / | : ? *  " < >
+	oRegex.Pattern = "(\\|\/|\||:|\?|\*|""|\<|\>)"
+	SanitizeFileName = oRegex.Replace( sNewFileName, "_" )
+
+	Set oRegex = Nothing
+end function
+
+' This is the function that sends the results of the uploading process.
+Sub SendUploadResults( errorNumber, fileUrl, fileName, customMsg )
+	Response.Clear
+	Response.Write "<script type=""text/javascript"">"
+	Response.Write "window.parent.OnUploadCompleted(" & errorNumber & ",""" & Replace( fileUrl, """", "\""" ) & """,""" & Replace( fileName, """", "\""" ) & """,""" & Replace( customMsg , """", "\""" ) & """) ;"
+	Response.Write "</script>"
+	Response.End
+End Sub
+
+%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/asp/upload.asp
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/asp/upload.asp	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/asp/upload.asp	(revision 413)
@@ -0,0 +1,61 @@
+﻿<%@ CodePage=65001 Language="VBScript"%>
+<%
+Option Explicit
+Response.Buffer = True
+%>
+<%
+ ' 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 ASP.
+%>
+<!--#include file="config.asp"-->
+<!--#include file="util.asp"-->
+<!--#include file="io.asp"-->
+<!--#include file="commands.asp"-->
+<!--#include file="class_upload.asp"-->
+<%
+
+' Check if this uploader has been enabled.
+If ( ConfigIsEnabled = False ) Then
+	SendUploadResults "1", "", "", "This file uploader is disabled. Please check the ""editor/filemanager/connectors/asp/config.asp"" file"
+End If
+
+	Dim sCommand, sResourceType, sCurrentFolder
+
+	sCommand = "QuickUpload"
+
+	sResourceType = Request.QueryString("Type")
+	If ( sResourceType = "" ) Then sResourceType = "File"
+
+	sCurrentFolder = GetCurrentFolder()
+
+	' Is Upload enabled?
+	if ( Not IsAllowedCommand( sCommand ) ) then
+		SendUploadResults "1", "", "", "The """ & sCommand & """ command isn't allowed"
+	end if
+
+	' Check if it is an allowed resource type.
+	if ( Not IsAllowedType( sResourceType ) ) Then
+		SendUploadResults "1", "", "", "The " & sResourceType & " resource type isn't allowed"
+	end if
+
+	FileUpload sResourceType, sCurrentFolder, sCommand
+
+%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/asp/util.asp
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/asp/util.asp	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/asp/util.asp	(revision 413)
@@ -0,0 +1,55 @@
+﻿<%
+ ' 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 ASP Connector.
+%>
+<%
+Function RemoveFromStart( sourceString, charToRemove )
+	Dim oRegex
+	Set oRegex = New RegExp
+	oRegex.Pattern = "^" & charToRemove & "+"
+
+	RemoveFromStart = oRegex.Replace( sourceString, "" )
+End Function
+
+Function RemoveFromEnd( sourceString, charToRemove )
+	Dim oRegex
+	Set oRegex = New RegExp
+	oRegex.Pattern = charToRemove & "+$"
+
+	RemoveFromEnd = oRegex.Replace( sourceString, "" )
+End Function
+
+Function ConvertToXmlAttribute( value )
+	ConvertToXmlAttribute = Replace( value, "&", "&amp;" )
+End Function
+
+Function InArray( value, sourceArray )
+	Dim i
+	For i = 0 to UBound( sourceArray )
+		If sourceArray(i) = value Then
+			InArray = True
+			Exit Function
+		End If
+	Next
+	InArray = False
+End Function
+
+%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/aspx/connector.aspx
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/aspx/connector.aspx	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/aspx/connector.aspx	(revision 413)
@@ -0,0 +1,30 @@
+<%@ Page language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowserConnector" AutoEventWireup="false" %>
+<%--
+ * 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 Browser Connector for ASP.NET.
+ *
+ * The code of this page if included in the FCKeditor.Net package,
+ * in the FredCK.FCKeditorV2.dll assembly file. So to use it you must
+ * include that DLL in your "bin" directory.
+ *
+ * To download the FCKeditor.Net package, go to our official web site:
+ * http://www.fckeditor.net
+--%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/aspx/upload.aspx
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/aspx/upload.aspx	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/aspx/upload.aspx	(revision 413)
@@ -0,0 +1,30 @@
+<%@ Page language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.Uploader" AutoEventWireup="false" %>
+<%--
+ * 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 Uploader for ASP.NET.
+ *
+ * The code of this page if included in the FCKeditor.Net package,
+ * in the FredCK.FCKeditorV2.dll assemblyfile. So to use it you must
+ * include that DLL in your "bin" directory.
+ *
+ * To download the FCKeditor.Net package, go to our official web site:
+ * http://www.fckeditor.net
+--%>
Index: /FCKeditor/trunk/editor/filemanager/connectors/cfm/commands.cfm
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/cfm/commands.cfm	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/cfm/commands.cfm	(revision 413)
@@ -0,0 +1,137 @@
+<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.
+--->
+<cffunction name="FileUpload">
+	<cfargument name="resourceType" type="string" required="yes" default="">
+	<cfargument name="currentFolderPath" type="string" required="yes" default="">
+
+	<cfset fileName = "">
+	<cfset fileExt = "">
+
+	<!--- Can be overwritten. The last value will be sent with the result --->
+	<cfset customMsg = "">
+
+	<cftry>
+
+		<!--- TODO: upload to a temp directory and move file if extension is allowed --->
+
+		<!--- 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;
+
+			// 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");
+			}
+
+			// 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#") ) {
+					counter = counter + 1;
+					fileName = tmpFileName & '(#counter#)';
+				}
+			}
+			</cfscript>
+
+			<!--- Rename the uploaded file, if neccessary --->
+			<cfif compare(cffile.ServerFileName,fileName)>
+
+				<cfset errorNumber = "201">
+				<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, '#userFilesPath##url.type#/#fileName#.#fileExt#')>
+	<cfelseif errorNumber EQ 201>
+		<!--- file was changed (201), submit the new filename --->
+		<cfset SendUploadResults(errorNumber, '#userFilesPath##url.type#/#fileName#.#fileExt#', replace( fileName & "." & fileExt, "'", "\'", "ALL"), customMsg)>
+	<cfelse>
+		<!--- An error occured(202). Submit only the error code and a message (if available). --->
+		<cfset SendUploadResults(errorNumber, '', '', customMsg)>
+	</cfif>
+
+</cffunction>
+
+<cffunction name="SendUploadResults">
+	<cfargument name="errorNumber" type="numeric" required="yes">
+	<cfargument name="fileUrl" type="string" required="no" default="">
+	<cfargument name="fileName" type="string" required="no" default="">
+	<cfargument name="customMsg" type="string" required="no" default="">
+
+	<cfoutput>
+		<script type="text/javascript">
+			window.parent.OnUploadCompleted(#errorNumber#, "#JSStringFormat(fileUrl)#", "#JSStringFormat(fileName)#", "#JSStringFormat(customMsg)#");
+		</script>
+	</cfoutput>
+
+	<cfabort><!--- Result sent, stop processing this page --->
+</cffunction>
Index: /FCKeditor/trunk/editor/filemanager/connectors/cfm/config.cfm
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/cfm/config.cfm	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/cfm/config.cfm	(revision 413)
@@ -0,0 +1,101 @@
+<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.
+--->
+<cfscript>
+	config = StructNew();
+
+	// SECURITY: You must explicitly enable this "connector". (Set enabled to "true")
+	config.enabled = false;
+
+	// 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 = ""; 
+
+	config.allowedExtensions = StructNew();
+	config.deniedExtensions = StructNew();
+
+	config.allowedExtensions["File"] = "";
+	config.deniedExtensions["File"] = "html,htm,php,php2,php3,php4,php5,phtml,pwml,inc,asp,aspx,ascx,jsp,cfm,cfc,pl,bat,exe,com,dll,vbs,js,reg,cgi,htaccess,asis,sh,shtml,shtm,phtm";
+
+	config.allowedExtensions["Image"] = "png,gif,jpg,jpeg,bmp";
+	config.deniedExtensions["Image"] = "";
+
+	config.allowedExtensions["Flash"] = "swf,fla";
+	config.deniedExtensions["Flash"] = "";
+
+	config.allowedExtensions["Media"] = "swf,fla,jpg,gif,jpeg,png,avi,mpg,mpeg,mp3,mp4,m4a,wma,wmv,wav,mid,midi,rmi,rm,ram,rmvb,mov,qt";
+	config.deniedExtensions["Media"] = "";
+</cfscript>
+
+<!--- 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>
+
+<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>
Index: /FCKeditor/trunk/editor/filemanager/connectors/cfm/connector.cfm
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/cfm/connector.cfm	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/cfm/connector.cfm	(revision 413)
@@ -0,0 +1,279 @@
+﻿<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.
+ * (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">
+<cfinclude template="commands.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");
+	}
+
+	// map the user files path to a physical directory
+	userFilesServerPath = serverPath & url.type & replace(url.currentFolder,"/",fs,"all");
+
+	xmlContent = ""; // append to this string to build content
+</cfscript>
+
+<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"" />">
+
+</cfif>
+
+<cfif not len(xmlContent)>
+
+<!--- create directories in physical path if they don't already exist --->
+<cfset currentPath = "">
+<cftry>
+	<cfloop list="#userFilesServerPath#" index="name" delimiters="/">
+
+		<cfif not directoryExists(currentPath & fs & name)>
+				<cfdirectory action="create" directory="#currentPath##fs##name#" mode="755">
+		</cfif>
+
+		<cfset currentPath = currentPath & fs & name>
+
+	</cfloop>
+
+	<!--- create sub-directory for file type if it doesn't already exist --->
+	<!---
+		<cfif not directoryExists(userFilesServerPath & url.type)>
+		<cfdirectory action="create" directory="#userFilesServerPath##url.type#" mode="755">
+	</cfif>
+	--->
+<cfcatch>
+
+	<!--- 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 FileUpload(url.type, currentFolderPath)>
+
+		</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="#userFilesPath##url.type##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>	
Index: /FCKeditor/trunk/editor/filemanager/connectors/cfm/upload.cfm
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/cfm/upload.cfm	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/cfm/upload.cfm	(revision 413)
@@ -0,0 +1,89 @@
+<!---
+ * 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.
+ * Based on connector.cfm by Mark Woods (mark@thickpaddy.com)
+--->
+
+<cfparam name="url.type" default="File">
+<cfparam name="url.currentFolder" default="/">
+
+<cfinclude template="config.cfm">
+<cfinclude template="commands.cfm">
+
+<cfif NOT config.enabled>
+	<cfset SendUploadResults(1, '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/cfm/config.cfm" file')>
+<cfelse>
+	<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");
+		}
+
+		// map the user files path to a physical directory
+		userFilesServerPath = serverPath & url.type & replace(url.currentFolder,"/",fs,"all");
+
+	</cfscript>
+	<cfset currentFolderPath = userFilesServerPath>
+
+	<cfset FileUpload(url.type, currentFolderPath)>
+
+</cfif>
Index: /FCKeditor/trunk/editor/filemanager/connectors/lasso/config.lasso
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/lasso/config.lasso	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/lasso/config.lasso	(revision 413)
@@ -0,0 +1,65 @@
+[//lasso
+/*
+ * 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 File Manager Connector for Lasso.
+ */
+
+    /*.....................................................................
+    The connector uses the file tags, which require authentication. Enter a
+    valid username and password from Lasso admin for a group with file tags
+    permissions for uploads and the path you define in UserFilesPath below.
+    */
+
+	var('connection') = array(
+		-username='xxxxxxxx',
+		-password='xxxxxxxx'
+	);
+
+
+    /*.....................................................................
+    Set the base path for files that users can upload and browse (relative
+    to server root).
+
+    Set which file extensions are allowed and/or denied for each file type.
+    */
+	var('config') = map(
+		'Enabled' = false,
+		'UserFilesPath' = '/userfiles/',
+		'Subdirectories' = map(
+			'File' = 'File/',
+			'Image' = 'Image/',
+			'Flash' = 'Flash/',
+			'Media' = 'Media/'
+		),
+		'AllowedExtensions' = map(
+			'File' = array(),
+			'Image' = array('jpg','gif','jpeg','png'),
+			'Flash' = array('swf','fla'),
+			'Media' = array('swf','fla','jpg','gif','jpeg','png','avi','mpg','mpeg')
+		),
+		'DeniedExtensions' = map(
+			'File' = array('html','htm','php','php2','php3','php4','php5','phtml','pwml','inc','asp','aspx','ascx','jsp','cfm','cfc','pl','bat','exe','com','dll','vbs','js','reg','cgi','lasso','lassoapp','htaccess','asis','sh','shtml','shtm','phtm'),
+			'Image' = array(),
+			'Flash' = array(),
+			'Media' = array()
+		)
+	);
+]
Index: /FCKeditor/trunk/editor/filemanager/connectors/lasso/connector.lasso
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/lasso/connector.lasso	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/lasso/connector.lasso	(revision 413)
@@ -0,0 +1,249 @@
+[//lasso
+/*
+ * 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 Manager Connector for Lasso.
+ */
+
+    /*.....................................................................
+    Include global configuration. See config.lasso for details.
+    */
+	include('config.lasso');
+
+
+    /*.....................................................................
+    Translate current date/time to GMT for custom header.
+    */
+	var('headerDate') = date_localtogmt(date)->format('%a, %d %b %Y %T GMT');
+
+
+    /*.....................................................................
+    Convert query string parameters to variables and initialize output.
+    */
+	var(
+		'Command'		=	action_param('Command'),
+		'Type'			=	action_param('Type'),
+		'CurrentFolder'	=	action_param('CurrentFolder'),
+		'ServerPath'	=	action_param('ServerPath'),
+		'NewFolderName'	=	action_param('NewFolderName'),
+		'NewFile'		=	null,
+		'NewFileName'	=	string,
+		'OrigFilePath'	=	string,
+		'NewFilePath'	=	string,
+		'commandData'	=	string,
+		'folders'		=	'\t<Folders>\n',
+		'files'			=	'\t<Files>\n',
+		'errorNumber'	=	integer,
+		'responseType'	=	'xml',
+		'uploadResult'	=	'0'
+	);
+
+
+    /*.....................................................................
+    Calculate the path to the current folder.
+    */
+	$ServerPath == '' ? $ServerPath = $config->find('UserFilesPath');
+
+	var('currentFolderURL' = $ServerPath
+		+ $config->find('Subdirectories')->find(action_param('Type'))
+		+ action_param('CurrentFolder')
+	);
+
+
+    /*.....................................................................
+    Build the appropriate response per the 'Command' parameter. Wrap the
+    entire process in an inline for file tag permissions.
+    */
+	inline($connection);
+		select($Command);
+            /*.............................................................
+            List all subdirectories in the 'Current Folder' directory.
+            */
+			case('GetFolders');
+				$commandData += '\t<Folders>\n';
+
+				iterate(file_listdirectory($currentFolderURL), local('this'));
+					#this->endswith('/') ? $commandData += '\t\t<Folder name="' + #this->removetrailing('/')& + '" />\n';
+				/iterate;
+
+				$commandData += '\t</Folders>\n';
+
+
+            /*.............................................................
+            List both files and folders in the 'Current Folder' directory.
+            Include the file sizes in kilobytes.
+            */
+			case('GetFoldersAndFiles');
+				iterate(file_listdirectory($currentFolderURL), local('this'));
+					if(#this->endswith('/'));
+						$folders += '\t\t<Folder name="' + #this->removetrailing('/')& + '" />\n';
+					else;
+						local('size') = file_getsize($currentFolderURL + #this) / 1024;
+						$files += '\t\t<File name="' + #this + '" size="' + #size + '" />\n';
+					/if;
+				/iterate;
+
+				$folders += '\t</Folders>\n';
+				$files += '\t</Files>\n';
+
+				$commandData += $folders + $files;
+
+
+            /*.............................................................
+            Create a directory 'NewFolderName' within the 'Current Folder.'
+            */
+			case('CreateFolder');
+				var('newFolder' = $currentFolderURL + $NewFolderName + '/');
+				file_create($newFolder);
+
+
+                /*.........................................................
+                Map Lasso's file error codes to FCKEditor's error codes.
+                */
+				select(file_currenterror( -errorcode));
+					case(0);
+						$errorNumber = 0;
+					case( -9983);
+						$errorNumber = 101;
+					case( -9976);
+						$errorNumber = 102;
+					case( -9977);
+						$errorNumber = 102;
+					case( -9961);
+						$errorNumber = 103;
+					case;
+						$errorNumber = 110;
+				/select;
+
+				$commandData += '<Error number="' + $errorNumber + '" />\n';
+
+
+            /*.............................................................
+            Process an uploaded file.
+            */
+			case('FileUpload');
+                /*.........................................................
+                This is the only command that returns an HTML response.
+                */
+				$responseType = 'html';
+
+
+                /*.........................................................
+                Was a file actually uploaded?
+                */
+				file_uploads->size ? $NewFile = file_uploads->get(1) | $uploadResult = '202';
+
+				if($uploadResult == '0');
+                    /*.....................................................
+                    Split the file's extension from the filename in order
+                    to follow the API's naming convention for duplicate
+                    files. (Test.txt, Test(1).txt, Test(2).txt, etc.)
+                    */
+					$NewFileName = $NewFile->find('OrigName');
+					$OrigFilePath = $currentFolderURL + $NewFileName;
+					$NewFilePath = $OrigFilePath;
+					local('fileExtension') = '.' + $NewFile->find('OrigExtension');
+					local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&;
+
+
+                    /*.....................................................
+                    Make sure the file extension is allowed.
+                    */
+					if($config->find('DeniedExtensions')->find($Type) >> $NewFile->find('OrigExtension'));
+						$uploadResult = '202';
+					else;
+                        /*.................................................
+                        Rename the target path until it is unique.
+                        */
+						while(file_exists($NewFilePath));
+							$NewFilePath = $currentFolderURL + #shortFileName + '(' + loop_count + ')' + #fileExtension;
+						/while;
+
+
+                        /*.................................................
+                        Copy the uploaded file to its final location.
+                        */
+						file_copy($NewFile->find('path'), $NewFilePath);
+
+
+                        /*.................................................
+                        Set the error code for the response. Note whether
+                        the file had to be renamed.
+                        */
+						select(file_currenterror( -errorcode));
+							case(0);
+								$OrigFilePath != $NewFilePath ? $uploadResult = '201, \'' + $NewFilePath->split('/')->last + '\'';
+							case;
+								$uploadResult = '202';
+						/select;
+					/if;
+				/if;
+
+
+                /*.........................................................
+                Set the HTML response.
+                */
+				$__html_reply__ = '\
+<script type="text/javascript">
+	window.parent.frames[\'frmUpload\'].OnUploadCompleted(' + $uploadResult + ');
+</script>
+				';
+		/select;
+	/inline;
+
+
+    /*.....................................................................
+    Send a custom header for xml responses.
+    */
+	if($responseType == 'xml');
+		header;
+]
+HTTP/1.0 200 OK
+Date: [$headerDate]
+Server: Lasso Professional [lasso_version( -lassoversion)]
+Expires: Mon, 26 Jul 1997 05:00:00 GMT
+Last-Modified: [$headerDate]
+Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
+Pragma: no-cache
+Keep-Alive: timeout=15, max=98
+Connection: Keep-Alive
+Content-Type: text/xml; charset=utf-8
+[//lasso
+		/header;
+
+
+        /*.................................................................
+        Set the content type encoding for Lasso.
+        */
+		content_type('text/xml; charset=utf-8');
+
+
+        /*.................................................................
+        Wrap the response as XML and output.
+        */
+		$__html_reply__ = '\
+<?xml version="1.0" encoding="utf-8" ?>
+<Connector command="' + $Command + '" resourceType="' + $Type + '">
+	<CurrentFolder path="' + $CurrentFolder + '" url="' + $currentFolderURL + '" />
+' + $commandData + '
+</Connector>
+		';
+	/if;
+]
Index: /FCKeditor/trunk/editor/filemanager/connectors/lasso/upload.lasso
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/lasso/upload.lasso	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/lasso/upload.lasso	(revision 413)
@@ -0,0 +1,157 @@
+[//lasso
+/*
+ * 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 Lasso.
+ */
+
+    /*.....................................................................
+    Include global configuration. See config.lasso for details.
+    */
+	include('config.lasso');
+
+
+    /*.....................................................................
+    Convert query string parameters to variables and initialize output.
+    */
+	var(
+		'Type'			=	action_param('Type'),
+		'CurrentFolder'	=	action_param('CurrentFolder'),
+		'ServerPath'	=	action_param('ServerPath'),
+		'NewFile'		=	null,
+		'NewFileName'	=	string,
+		'OrigFilePath'	=	string,
+		'NewFilePath'	=	string,
+		'errorNumber'	=	0,
+		'customMsg'		=	''
+	);
+
+	$Type == '' ? $Type = 'File';
+
+
+    /*.....................................................................
+    Calculate the path to the current folder.
+    */
+	$ServerPath == '' ? $ServerPath = $config->find('UserFilesPath');
+
+	var('currentFolderURL' = $ServerPath
+		+ $config->find('Subdirectories')->find(action_param('Type'))
+		+ action_param('CurrentFolder')
+	);
+
+
+	/*.....................................................................
+	Custom tag sets the HTML response.
+	*/
+
+	define_tag(
+		'sendresults',
+		-namespace='fck_',
+		-priority='replace',
+		-required='errorNumber',
+		-type='integer',
+		-optional='fileUrl',
+		-type='string',
+		-optional='fileName',
+		-type='string',
+		-optional='customMsg',
+		-type='string',
+		-description='Sets the HTML response for the FCKEditor Quick Upload feature.'
+	);
+		$__html_reply__ = '\
+<script type="text/javascript">
+	window.parent.OnUploadCompleted(' + #errorNumber + ',"'
+		+ string_replace(#fileUrl, -find='"', -replace='\\"') + '","'
+		+ string_replace(#fileName, -find='"', -replace='\\"') + '","'
+		+ string_replace(#customMsg, -find='"', -replace='\\"') + '");
+</script>
+		';
+	/define_tag;
+
+
+	if($config->find('Enabled'));
+		/*.................................................................
+		Process an uploaded file.
+		*/
+		inline($connection);
+			/*.............................................................
+			Was a file actually uploaded?
+			*/
+			file_uploads->size ? $NewFile = file_uploads->get(1) | $errorNumber = 202;
+
+			if($errorNumber == 0);
+				/*.........................................................
+				Split the file's extension from the filename in order
+				to follow the API's naming convention for duplicate
+				files. (Test.txt, Test(1).txt, Test(2).txt, etc.)
+				*/
+				$NewFileName = $NewFile->find('OrigName');
+				$OrigFilePath = $currentFolderURL + $NewFileName;
+				$NewFilePath = $OrigFilePath;
+				local('fileExtension') = '.' + $NewFile->find('OrigExtension');
+				local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&;
+
+
+				/*.........................................................
+				Make sure the file extension is allowed.
+				*/
+
+				if($config->find('DeniedExtensions')->find($Type) >> $NewFile->find('OrigExtension'));
+					$errorNumber = 202;
+				else;
+					/*.....................................................
+					Rename the target path until it is unique.
+					*/
+					while(file_exists($NewFilePath));
+						$NewFileName = #shortFileName + '(' + loop_count + ')' + #fileExtension;
+						$NewFilePath = $currentFolderURL + $NewFileName;
+					/while;
+
+
+					/*.....................................................
+					Copy the uploaded file to its final location.
+					*/
+					file_copy($NewFile->find('path'), $NewFilePath);
+
+
+					/*.....................................................
+					Set the error code for the response.
+					*/
+					select(file_currenterror( -errorcode));
+						case(0);
+							$OrigFilePath != $NewFilePath ? $errorNumber = 201;
+						case;
+							$errorNumber = 202;
+					/select;
+				/if;
+			/if;
+		/inline;
+	else;
+		$errorNumber = 1;
+		$customMsg = 'This file uploader is disabled. Please check the "editor/filemanager/upload/lasso/config.lasso" file.';
+	/if;
+
+	fck_sendresults(
+		-errorNumber=$errorNumber,
+		-fileUrl=$NewFilePath,
+		-fileName=$NewFileName,
+		-customMsg=$customMsg
+	);
+]
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/basexml.pl
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/basexml.pl	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/basexml.pl	(revision 413)
@@ -0,0 +1,63 @@
+#####
+#  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 Manager Connector for Perl.
+#####
+
+sub CreateXmlHeader
+{
+	local($command,$resourceType,$currentFolder) = @_;
+
+	# Create the XML document header.
+	print '<?xml version="1.0" encoding="utf-8" ?>';
+
+	# Create the main "Connector" node.
+	print '<Connector command="' . $command . '" resourceType="' . $resourceType . '">';
+
+	# Add the current folder node.
+	print '<CurrentFolder path="' . ConvertToXmlAttribute($currentFolder) . '" url="' . ConvertToXmlAttribute(GetUrlFromPath($resourceType,$currentFolder)) . '" />';
+}
+
+sub CreateXmlFooter
+{
+	print '</Connector>';
+}
+
+sub SendError
+{
+	local( $number, $text ) = @_;
+
+	print << "_HTML_HEAD_";
+Content-Type:text/xml; charset=utf-8
+Pragma: no-cache
+Cache-Control: no-cache
+Expires: Thu, 01 Dec 1994 16:00:00 GMT
+
+_HTML_HEAD_
+
+	# Create the XML document header
+	print '<?xml version="1.0" encoding="utf-8" ?>' ;
+
+	print '<Connector><Error number="' . $number . '" text="' . &specialchar_cnv( $text ) . '" /></Connector>' ;
+
+	exit ;
+}
+
+1;
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl	(revision 413)
@@ -0,0 +1,168 @@
+#####
+#  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 Manager Connector for Perl.
+#####
+
+sub GetFolders
+{
+
+	local($resourceType, $currentFolder) = @_;
+
+	# Map the virtual path to the local server path.
+	$sServerDir = &ServerMapFolder($resourceType, $currentFolder);
+	print "<Folders>";			# Open the "Folders" node.
+
+	opendir(DIR,"$sServerDir");
+	@files = grep(!/^\.\.?$/,readdir(DIR));
+	closedir(DIR);
+
+	foreach $sFile (@files) {
+		if($sFile != '.' && $sFile != '..' && (-d "$sServerDir$sFile")) {
+			$cnv_filename = &ConvertToXmlAttribute($sFile);
+			print '<Folder name="' . $cnv_filename . '" />';
+		}
+	}
+	print "</Folders>";			# Close the "Folders" node.
+}
+
+sub GetFoldersAndFiles
+{
+
+	local($resourceType, $currentFolder) = @_;
+	# Map the virtual path to the local server path.
+	$sServerDir = &ServerMapFolder($resourceType,$currentFolder);
+
+	# Initialize the output buffers for "Folders" and "Files".
+	$sFolders	= '<Folders>';
+	$sFiles		= '<Files>';
+
+	opendir(DIR,"$sServerDir");
+	@files = grep(!/^\.\.?$/,readdir(DIR));
+	closedir(DIR);
+
+	foreach $sFile (@files) {
+		if($sFile ne '.' && $sFile ne '..') {
+			if(-d "$sServerDir$sFile") {
+				$cnv_filename = &ConvertToXmlAttribute($sFile);
+				$sFolders .= '<Folder name="' . $cnv_filename . '" />' ;
+			} else {
+				($iFileSize,$refdate,$filedate,$fileperm) = (stat("$sServerDir$sFile"))[7,8,9,2];
+				if($iFileSize > 0) {
+					$iFileSize = int($iFileSize / 1024);
+					if($iFileSize < 1) {
+						$iFileSize = 1;
+					}
+				}
+				$cnv_filename = &ConvertToXmlAttribute($sFile);
+				$sFiles	.= '<File name="' . $cnv_filename . '" size="' . $iFileSize . '" />' ;
+			}
+		}
+	}
+	print $sFolders ;
+	print '</Folders>';			# Close the "Folders" node.
+	print $sFiles ;
+	print '</Files>';			# Close the "Files" node.
+}
+
+sub CreateFolder
+{
+
+	local($resourceType, $currentFolder) = @_;
+	$sErrorNumber	= '0' ;
+	$sErrorMsg		= '' ;
+
+	if($FORM{'NewFolderName'} ne "") {
+		$sNewFolderName = $FORM{'NewFolderName'};
+		# Map the virtual path to the local server path of the current folder.
+		$sServerDir = &ServerMapFolder($resourceType, $currentFolder);
+		if(-w $sServerDir) {
+			$sServerDir .= $sNewFolderName;
+			$sErrorMsg = &CreateServerFolder($sServerDir);
+			if($sErrorMsg == 0) {
+				$sErrorNumber = '0';
+			} elsif($sErrorMsg eq 'Invalid argument' || $sErrorMsg eq 'No such file or directory') {
+				$sErrorNumber = '102';		#// Path too long.
+			} else {
+				$sErrorNumber = '110';
+			}
+		} else {
+			$sErrorNumber = '103';
+		}
+	} else {
+		$sErrorNumber = '102' ;
+	}
+	# Create the "Error" node.
+	$cnv_errmsg = &ConvertToXmlAttribute($sErrorMsg);
+	print '<Error number="' . $sErrorNumber . '" originalDescription="' . $cnv_errmsg . '" />';
+}
+
+sub FileUpload
+{
+eval("use File::Copy;");
+
+	local($resourceType, $currentFolder) = @_;
+
+	$sErrorNumber = '0' ;
+	$sFileName = '' ;
+	if($new_fname) {
+		# Map the virtual path to the local server path.
+		$sServerDir = &ServerMapFolder($resourceType,$currentFolder);
+
+		# Get the uploaded file name.
+		$sFileName = $new_fname;
+		$sOriginalFileName = $sFileName;
+
+		$iCounter = 0;
+		while(1) {
+			$sFilePath = $sServerDir . $sFileName;
+			if(-e $sFilePath) {
+				$iCounter++ ;
+				($path,$BaseName,$ext) = &RemoveExtension($sOriginalFileName);
+				$sFileName = $BaseName . '(' . $iCounter . ').' . $ext;
+				$sErrorNumber = '201';
+			} else {
+				copy("$img_dir/$new_fname","$sFilePath");
+				chmod(0777,$sFilePath);
+				unlink("$img_dir/$new_fname");
+				last;
+			}
+		}
+	} else {
+		$sErrorNumber = '202' ;
+	}
+	$sFileName	=~ s/"/\\"/g;
+
+	SendUploadResults($sErrorNumber, $resourceType.$currentFolder.$sFileName, $sFileName, '');
+}
+
+sub SendUploadResults
+{
+
+	local($sErrorNumber, $sFileUrl, $sFileName, $customMsg) = @_;
+
+	print "Content-type: text/html\n\n";
+	print '<script type="text/javascript">';
+	print 'window.parent.OnUploadCompleted(' . $sErrorNumber . ',"' . JS_cnv($sFileUrl) . '","' . JS_cnv($sFileName) . '","' . JS_cnv($customMsg) . '") ;';
+	print '</script>';
+	exit ;
+}
+
+1;
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/connector.cgi
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/connector.cgi	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/connector.cgi	(revision 413)
@@ -0,0 +1,137 @@
+#!/usr/bin/env perl
+
+#####
+#  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 Manager Connector for Perl.
+#####
+
+##
+# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file.
+##
+
+## START: Hack for Windows (Not important to understand the editor code... Perl specific).
+if(Windows_check()) {
+	chdir(GetScriptPath($0));
+}
+
+sub Windows_check
+{
+	# IIS,PWS(NT/95)
+	$www_server_os = $^O;
+	# Win98 & NT(SP4)
+	if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; }
+	# AnHTTPd/Omni/IIS
+	if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; }
+	# Win Apache
+	if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; }
+	if($www_server_os=~ /win/i) { return(1); }
+	return(0);
+}
+
+sub GetScriptPath {
+	local($path) = @_;
+	if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; }
+	$path;
+}
+## END: Hack for IIS
+
+require 'util.pl';
+require 'io.pl';
+require 'basexml.pl';
+require 'commands.pl';
+require 'upload_fck.pl';
+
+##
+# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR.
+##
+## &SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/perl/connector.cgi" file' ) ;
+
+	&read_input();
+
+	if($FORM{'ServerPath'} ne "") {
+		$GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'};
+		if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) {
+			$GLOBALS{'UserFilesPath'} .= '/' ;
+		}
+	} else {
+		$GLOBALS{'UserFilesPath'} = '/userfiles/';
+	}
+
+	# Map the "UserFiles" path to a local directory.
+	$rootpath = &GetRootPath();
+	$GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'};
+
+	&DoResponse();
+
+sub DoResponse
+{
+
+	if($FORM{'Command'} eq "" || $FORM{'Type'} eq "" || $FORM{'CurrentFolder'} eq "") {
+		return ;
+	}
+	# Get the main request informaiton.
+	$sCommand		= $FORM{'Command'};
+	$sResourceType	= $FORM{'Type'};
+	$sCurrentFolder	= $FORM{'CurrentFolder'};
+
+	# Check the current folder syntax (must begin and start with a slash).
+	if(!($sCurrentFolder =~ /\/$/)) {
+		$sCurrentFolder .= '/';
+	}
+	if(!($sCurrentFolder =~ /^\//)) {
+		$sCurrentFolder = '/' . $sCurrentFolder;
+	}
+
+	# Check for invalid folder paths (..)
+	if ( $sCurrentFolder =~ /\.\./ ) {
+		SendError( 102, "" ) ;
+	}
+
+	# File Upload doesn't have to Return XML, so it must be intercepted before anything.
+	if($sCommand eq 'FileUpload') {
+		FileUpload($sResourceType,$sCurrentFolder);
+		return ;
+	}
+
+	print << "_HTML_HEAD_";
+Content-Type:text/xml; charset=utf-8
+Pragma: no-cache
+Cache-Control: no-cache
+Expires: Thu, 01 Dec 1994 16:00:00 GMT
+
+_HTML_HEAD_
+
+	&CreateXmlHeader($sCommand,$sResourceType,$sCurrentFolder);
+
+	# Execute the required command.
+	if($sCommand eq 'GetFolders') {
+		&GetFolders($sResourceType,$sCurrentFolder);
+	} elsif($sCommand eq 'GetFoldersAndFiles') {
+		&GetFoldersAndFiles($sResourceType,$sCurrentFolder);
+	} elsif($sCommand eq 'CreateFolder') {
+		&CreateFolder($sResourceType,$sCurrentFolder);
+	}
+
+	&CreateXmlFooter();
+
+	exit ;
+}
+
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/io.pl
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/io.pl	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/io.pl	(revision 413)
@@ -0,0 +1,131 @@
+#####
+#  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 Manager Connector for Perl.
+#####
+
+sub GetUrlFromPath
+{
+	local($resourceType, $folderPath) = @_;
+
+	if($resourceType eq '') {
+		$rmpath = &RemoveFromEnd($GLOBALS{'UserFilesPath'},'/');
+		return("$rmpath$folderPath");
+	} else {
+		return("$GLOBALS{'UserFilesPath'}$resourceType$folderPath");
+	}
+}
+
+sub RemoveExtension
+{
+	local($fileName) = @_;
+	local($path, $base, $ext);
+	if($fileName !~ /\./) {
+		$fileName .= '.';
+	}
+	if($fileName =~ /([^\\\/]*)\.(.*)$/) {
+		$base = $1;
+		$ext  = $2;
+		if($fileName =~ /(.*)$base\.$ext$/) {
+			$path = $1;
+		}
+	}
+	return($path,$base,$ext);
+
+}
+
+sub ServerMapFolder
+{
+	local($resourceType,$folderPath) = @_;
+
+	# Get the resource type directory.
+	$sResourceTypePath = $GLOBALS{'UserFilesDirectory'} . $resourceType . '/';
+
+	# Ensure that the directory exists.
+	&CreateServerFolder($sResourceTypePath);
+
+	# Return the resource type directory combined with the required path.
+	$rmpath = &RemoveFromStart($folderPath,'/');
+	return("$sResourceTypePath$rmpath");
+}
+
+sub GetParentFolder
+{
+	local($folderPath) = @_;
+
+	$folderPath =~ s/[\/][^\/]+[\/]?$//g;
+	return $folderPath;
+}
+
+sub CreateServerFolder
+{
+	local($folderPath) = @_;
+
+	$sParent = &GetParentFolder($folderPath);
+	# Check if the parent exists, or create it.
+	if(!(-e $sParent)) {
+		$sErrorMsg = &CreateServerFolder($sParent);
+		if($sErrorMsg == 1) {
+			return(1);
+		}
+	}
+	if(!(-e $folderPath)) {
+		umask(000);
+		mkdir("$folderPath",0777);
+		chmod(0777,"$folderPath");
+		return(0);
+	} else {
+		return(1);
+	}
+}
+
+sub GetRootPath
+{
+#use Cwd;
+
+#	my $dir = getcwd;
+#	print $dir;
+#	$dir  =~ s/$ENV{'DOCUMENT_ROOT'}//g;
+#	print $dir;
+#	return($dir);
+
+#	$wk = $0;
+#	$wk =~ s/\/connector\.cgi//g;
+#	if($wk) {
+#		$current_dir = $wk;
+#	} else {
+#		$current_dir = `pwd`;
+#	}
+#	return($current_dir);
+use Cwd;
+
+	if($ENV{'DOCUMENT_ROOT'}) {
+		$dir = $ENV{'DOCUMENT_ROOT'};
+	} else {
+		my $dir = getcwd;
+		$workdir =~ s/\/connector\.cgi//g;
+		$dir  =~ s/$workdir//g;
+	}
+	return($dir);
+
+
+
+}
+1;
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/upload.cgi
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/upload.cgi	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/upload.cgi	(revision 413)
@@ -0,0 +1,118 @@
+#!/usr/bin/env perl
+
+#####
+#  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 Manager Connector for Perl.
+#####
+
+##
+# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file.
+##
+
+## START: Hack for Windows (Not important to understand the editor code... Perl specific).
+if(Windows_check()) {
+	chdir(GetScriptPath($0));
+}
+
+sub Windows_check
+{
+	# IIS,PWS(NT/95)
+	$www_server_os = $^O;
+	# Win98 & NT(SP4)
+	if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; }
+	# AnHTTPd/Omni/IIS
+	if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; }
+	# Win Apache
+	if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; }
+	if($www_server_os=~ /win/i) { return(1); }
+	return(0);
+}
+
+sub GetScriptPath {
+	local($path) = @_;
+	if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; }
+	$path;
+}
+## END: Hack for IIS
+
+require 'util.pl';
+require 'io.pl';
+require 'basexml.pl';
+require 'commands.pl';
+require 'upload_fck.pl';
+
+##
+# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR.
+##
+##	&SendUploadResults(1, '', '', 'This connector is disabled. Please check the "editor/filemanager/connectors/perl/upload.cgi" file' ) ;
+
+	&read_input();
+
+	if($FORM{'ServerPath'} ne "") {
+		$GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'};
+		if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) {
+			$GLOBALS{'UserFilesPath'} .= '/' ;
+		}
+	} else {
+		$GLOBALS{'UserFilesPath'} = '/userfiles/';
+	}
+
+	# Map the "UserFiles" path to a local directory.
+	$rootpath = &GetRootPath();
+	$GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'};
+
+	&DoResponse();
+
+sub DoResponse
+{
+	# Get the main request information.
+	$sCommand		= 'FileUpload'; #$FORM{'Command'};
+	$sResourceType	= $FORM{'Type'};
+	$sCurrentFolder	= $FORM{'CurrentFolder'};
+
+	if ($sResourceType eq '') {
+		$sResourceType = 'File' ;
+	}
+	if ($sCurrentFolder eq '') {
+		$sCurrentFolder = '/' ;
+	}
+
+	# Check the current folder syntax (must begin and start with a slash).
+	if(!($sCurrentFolder =~ /\/$/)) {
+		$sCurrentFolder .= '/';
+	}
+	if(!($sCurrentFolder =~ /^\//)) {
+		$sCurrentFolder = '/' . $sCurrentFolder;
+	}
+
+	# Check for invalid folder paths (..)
+	if ( $sCurrentFolder =~ /\.\./ ) {
+		SendError( 102, "" ) ;
+	}
+
+	# File Upload doesn't have to Return XML, so it must be intercepted before anything.
+	if($sCommand eq 'FileUpload') {
+		FileUpload($sResourceType,$sCurrentFolder);
+		return ;
+	}
+
+}
+
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/upload_fck.pl
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/upload_fck.pl	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/upload_fck.pl	(revision 413)
@@ -0,0 +1,667 @@
+#####
+#  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 Manager Connector for Perl.
+#####
+
+# image data save dir
+$img_dir	= './temp/';
+
+
+# File size max(unit KB)
+$MAX_CONTENT_SIZE =  30000;
+
+# Filelock (1=use,0=not use)
+$PM{'flock'}		= '1';
+
+
+# upload Content-Type list
+my %UPLOAD_CONTENT_TYPE_LIST = (
+	'image/(x-)?png'						=>	'png',	# PNG image
+	'image/p?jpe?g'							=>	'jpg',	# JPEG image
+	'image/gif'								=>	'gif',	# GIF image
+	'image/x-xbitmap'						=>	'xbm',	# XBM image
+
+	'image/(x-(MS-)?)?bmp'					=>	'bmp',	# Windows BMP image
+	'image/pict'							=>	'pict',	# Macintosh PICT image
+	'image/tiff'							=>	'tif',	# TIFF image
+	'application/pdf'						=>	'pdf',	# PDF image
+	'application/x-shockwave-flash'			=>	'swf',	# Shockwave Flash
+
+	'video/(x-)?msvideo'					=>	'avi',	# Microsoft Video
+	'video/quicktime'						=>	'mov',	# QuickTime Video
+	'video/mpeg'							=>	'mpeg',	# MPEG Video
+	'video/x-mpeg2'							=>	'mpv2', # MPEG2 Video
+
+	'audio/(x-)?midi?'						=>	'mid',	# MIDI Audio
+	'audio/(x-)?wav'						=>	'wav',	# WAV Audio
+	'audio/basic'							=>	'au',	# ULAW Audio
+	'audio/mpeg'							=>	'mpga',	# MPEG Audio
+
+	'application/(x-)?zip(-compressed)?'	=>	'zip',	# ZIP Compress
+
+	'text/html'								=>	'html', # HTML
+	'text/plain'							=>	'txt',	# TEXT
+	'(?:application|text)/(?:rtf|richtext)'	=>	'rtf',	# RichText
+
+	'application/msword'					=>	'doc',	# Microsoft Word
+	'application/vnd.ms-excel'				=>	'xls',	# Microsoft Excel
+
+	''
+);
+
+# Upload is permitted.
+# A regular expression is possible.
+my %UPLOAD_EXT_LIST = (
+	'png'					=>	'PNG image',
+	'p?jpe?g|jpe|jfif|pjp'	=>	'JPEG image',
+	'gif'					=>	'GIF image',
+	'xbm'					=>	'XBM image',
+
+	'bmp|dib|rle'			=>	'Windows BMP image',
+	'pi?ct'					=>	'Macintosh PICT image',
+	'tiff?'					=>	'TIFF image',
+	'pdf'					=>	'PDF image',
+	'swf'					=>	'Shockwave Flash',
+
+	'avi'					=>	'Microsoft Video',
+	'moo?v|qt'				=>	'QuickTime Video',
+	'm(p(e?gv?|e|v)|1v)'	=>	'MPEG Video',
+	'mp(v2|2v)'				=>	'MPEG2 Video',
+
+	'midi?|kar|smf|rmi|mff'	=>	'MIDI Audio',
+	'wav'					=>	'WAVE Audio',
+	'au|snd'				=>	'ULAW Audio',
+	'mp(e?ga|2|a|3)|abs'	=>	'MPEG Audio',
+
+	'zip'					=>	'ZIP Compress',
+	'lzh'					=>	'LZH Compress',
+	'cab'					=>	'CAB Compress',
+
+	'd?html?'				=>	'HTML',
+	'rtf|rtx'				=>	'RichText',
+	'txt|text'				=>	'Text',
+
+	''
+);
+
+
+# sjis or euc
+my $CHARCODE = 'sjis';
+
+$TRANS_2BYTE_CODE = 0;
+
+##############################################################################
+# Summary
+#
+# Form Read input
+#
+# Parameters
+# Returns
+# Memo
+##############################################################################
+sub read_input
+{
+eval("use File::Copy;");
+eval("use File::Path;");
+
+	my ($FORM) = @_;
+
+
+	mkdir($img_dir,0777);
+	chmod(0777,$img_dir);
+
+	undef $img_data_exists;
+	undef @NEWFNAMES;
+	undef @NEWFNAME_DATA;
+
+	if($ENV{'CONTENT_LENGTH'} > 10000000 || $ENV{'CONTENT_LENGTH'} > $MAX_CONTENT_SIZE * 1024) {
+		&upload_error(
+			'Size Error',
+			sprintf(
+				"Transmitting size is too large.MAX <strong>%d KB</strong> Now Size <strong>%d KB</strong>(<strong>%d bytes</strong> Over)",
+				$MAX_CONTENT_SIZE,
+				int($ENV{'CONTENT_LENGTH'} / 1024),
+				$ENV{'CONTENT_LENGTH'} - $MAX_CONTENT_SIZE * 1024
+			)
+		);
+	}
+
+	my $Buffer;
+	if($ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/) {
+		# METHOD POST only
+		return	unless($ENV{'CONTENT_LENGTH'});
+
+		binmode(STDIN);
+		# STDIN A pause character is detected.'(MacIE3.0 boundary of $ENV{'CONTENT_TYPE'} cannot be trusted.)
+		my $Boundary = <STDIN>;
+		$Boundary =~ s/\x0D\x0A//;
+		$Boundary = quotemeta($Boundary);
+		while(<STDIN>) {
+			if(/^\s*Content-Disposition:/i) {
+				my($name,$ContentType,$FileName);
+				# form data get
+				if(/\bname="([^"]+)"/i || /\bname=([^\s:;]+)/i) {
+					$name = $1;
+					$name	=~ tr/+/ /;
+					$name	=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+					&Encode(\$name);
+				}
+				if(/\bfilename="([^"]*)"/i || /\bfilename=([^\s:;]*)/i) {
+					$FileName = $1 || 'unknown';
+				}
+				# head read
+				while(<STDIN>) {
+					last	if(! /\w/);
+					if(/^\s*Content-Type:\s*"([^"]+)"/i || /^\s*Content-Type:\s*([^\s:;]+)/i) {
+						$ContentType = $1;
+					}
+				}
+				# body read
+				$value = "";
+				while(<STDIN>) {
+					last	if(/^$Boundary/o);
+					$value .= $_;
+				};
+				$lastline = $_;
+				$value =~s /\x0D\x0A$//;
+				if($value ne '') {
+					if($FileName || $ContentType) {
+						$img_data_exists = 1;
+						(
+							$FileName,		#
+							$Ext,			#
+							$Length,		#
+							$ImageWidth,	#
+							$ImageHeight,	#
+							$ContentName	#
+						) = &CheckContentType(\$value,$FileName,$ContentType);
+
+						$FORM{$name}	= $FileName;
+						$new_fname		= $FileName;
+						push(@NEWFNAME_DATA,"$FileName\t$Ext\t$Length\t$ImageWidth\t$ImageHeight\t$ContentName");
+
+						# Multi-upload correspondence
+						push(@NEWFNAMES,$new_fname);
+						open(OUT,">$img_dir/$new_fname");
+						binmode(OUT);
+						eval "flock(OUT,2);" if($PM{'flock'} == 1);
+						print OUT $value;
+						eval "flock(OUT,8);" if($PM{'flock'} == 1);
+						close(OUT);
+
+					} elsif($name) {
+						$value	=~ tr/+/ /;
+						$value	=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+						&Encode(\$value,'trans');
+						$FORM{$name} .= "\0"			if(defined($FORM{$name}));
+						$FORM{$name} .= $value;
+					}
+				}
+			};
+			last if($lastline =~ /^$Boundary\-\-/o);
+		}
+	} elsif($ENV{'CONTENT_LENGTH'}) {
+		read(STDIN,$Buffer,$ENV{'CONTENT_LENGTH'});
+	}
+	foreach(split(/&/,$Buffer),split(/&/,$ENV{'QUERY_STRING'})) {
+		my($name, $value) = split(/=/);
+		$name	=~ tr/+/ /;
+		$name	=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+		$value	=~ tr/+/ /;
+		$value	=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+
+		&Encode(\$name);
+		&Encode(\$value,'trans');
+		$FORM{$name} .= "\0"			if(defined($FORM{$name}));
+		$FORM{$name} .= $value;
+
+	}
+
+}
+
+##############################################################################
+# Summary
+#
+#	CheckContentType
+#
+# Parameters
+# Returns
+# Memo
+##############################################################################
+sub CheckContentType
+{
+
+	my($DATA,$FileName,$ContentType) = @_;
+	my($Ext,$ImageWidth,$ImageHeight,$ContentName,$Infomation);
+	my $DataLength = length($$DATA);
+
+	# An unknown file type
+
+	$_ = $ContentType;
+	my $UnknownType = (
+		!$_
+		|| /^application\/(x-)?macbinary$/i
+		|| /^application\/applefile$/i
+		|| /^application\/octet-stream$/i
+		|| /^text\/plane$/i
+		|| /^x-unknown-content-type/i
+	);
+
+	# MacBinary(Mac Unnecessary data are deleted.)
+	if($UnknownType || $ENV{'HTTP_USER_AGENT'} =~ /Macintosh|Mac_/) {
+		if($DataLength > 128 && !unpack("C",substr($$DATA,0,1)) && !unpack("C",substr($$DATA,74,1)) && !unpack("C",substr($$DATA,82,1)) ) {
+			my $MacBinary_ForkLength = unpack("N", substr($$DATA, 83, 4));		# ForkLength Get
+			my $MacBinary_FileName = quotemeta(substr($$DATA, 2, unpack("C",substr($$DATA, 1, 1))));
+			if($MacBinary_FileName && $MacBinary_ForkLength && $DataLength >= $MacBinary_ForkLength + 128
+					&& ($FileName =~ /$MacBinary_FileName/i || substr($$DATA,102,4) eq 'mBIN')) {	# DATA TOP 128byte MacBinary!!
+				$$DATA				= substr($$DATA,128,$MacBinary_ForkLength);
+				my $ResourceLength	= $DataLength - $MacBinary_ForkLength - 128;
+				$DataLength			= $MacBinary_ForkLength;
+			}
+		}
+	}
+
+	# A file name is changed into EUC.
+#	&jcode::convert(\$FileName,'euc',$FormCodeDefault);
+#	&jcode::h2z_euc(\$FileName);
+	$FileName =~ s/^.*\\//;					# Windows, Mac
+	$FileName =~ s/^.*\///;					# UNIX
+	$FileName =~ s/&/&amp;/g;
+	$FileName =~ s/"/&quot;/g;
+	$FileName =~ s/</&lt;/g;
+	$FileName =~ s/>/&gt;/g;
+#
+#	if($CHARCODE ne 'euc') {
+#		&jcode::convert(\$FileName,$CHARCODE,'euc');
+#	}
+
+	# An extension is extracted and it changes into a small letter.
+	my $FileExt;
+	if($FileName =~ /\.(\w+)$/) {
+		$FileExt = $1;
+		$FileExt =~ tr/A-Z/a-z/;
+	}
+
+	# Executable file detection (ban on upload)
+	if($$DATA =~ /^MZ/) {
+		$Ext = 'exe';
+	}
+	# text
+	if(!$Ext && ($UnknownType || $ContentType =~ /^text\//i || $ContentType =~ /^application\/(?:rtf|richtext)$/i || $ContentType =~ /^image\/x-xbitmap$/i)
+				&& ! $$DATA =~ /[\000-\006\177\377]/) {
+#		$$DATA =~ s/\x0D\x0A/\n/g;
+#		$$DATA =~ tr/\x0D\x0A/\n\n/;
+#
+#		if(
+#			$$DATA =~ /<\s*SCRIPT(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*(?:.|\n)*?\bONLOAD\s*=(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*(?:.|\n)*?\bONCLICK\s*=(?:.|\n)*?>/i
+#				) {
+#			$Infomation = '(JavaScript contains)';
+#		}
+#		if($$DATA =~ /<\s*TABLE(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*BLINK(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*MARQUEE(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*OBJECT(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*EMBED(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*FRAME(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*APPLET(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*FORM(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*(?:.|\n)*?\bSRC\s*=(?:.|\n)*?>/i
+#				|| $$DATA =~ /<\s*(?:.|\n)*?\bDYNSRC\s*=(?:.|\n)*?>/i
+#				) {
+#			$Infomation = '(the HTML tag which is not safe is included)';
+#		}
+
+		if($FileExt =~ /^txt$/i || $FileExt =~ /^cgi$/i || $FileExt =~ /^pl$/i) {								# Text File
+			$Ext = 'txt';
+		} elsif($ContentType =~ /^text\/html$/i || $FileExt =~ /html?/i || $$DATA =~ /<\s*HTML(?:.|\n)*?>/i) {	# HTML File
+			$Ext = 'html';
+		} elsif($ContentType =~ /^image\/x-xbitmap$/i || $FileExt =~ /^xbm$/i) {								# XBM(x-BitMap) Image
+			my $XbmName = $1;
+			my ($XbmWidth, $XbmHeight);
+			if($$DATA =~ /\#define\s*$XbmName\_width\s*(\d+)/i) {
+				$XbmWidth = $1;
+			}
+			if($$DATA =~ /\#define\s*$XbmName\_height\s*(\d+)/i) {
+				$XbmHeight = $1;
+			}
+			if($XbmWidth && $XbmHeight) {
+				$Ext = 'xbm';
+				$ImageWidth		= $XbmWidth;
+				$ImageHeight	= $XbmHeight;
+			}
+		} else {		#
+			$Ext = 'txt';
+		}
+	}
+
+	# image
+	if(!$Ext && ($UnknownType || $ContentType =~ /^image\//i)) {
+		# PNG
+		if($$DATA =~ /^\x89PNG\x0D\x0A\x1A\x0A/) {
+			if(substr($$DATA, 12, 4) eq 'IHDR') {
+				$Ext = 'png';
+				($ImageWidth, $ImageHeight) = unpack("N2", substr($$DATA, 16, 8));
+			}
+		} elsif($$DATA =~ /^GIF8(?:9|7)a/) {															# GIF89a(modified), GIF89a, GIF87a
+			$Ext = 'gif';
+			($ImageWidth, $ImageHeight) = unpack("v2", substr($$DATA, 6, 4));
+		} elsif($$DATA =~ /^II\x2a\x00\x08\x00\x00\x00/ || $$DATA =~ /^MM\x00\x2a\x00\x00\x00\x08/) {	# TIFF
+			$Ext = 'tif';
+		} elsif($$DATA =~ /^BM/) {																		# BMP
+			$Ext = 'bmp';
+		} elsif($$DATA =~ /^\xFF\xD8\xFF/ || $$DATA =~ /JFIF/) {										# JPEG
+			my $HeaderPoint = index($$DATA, "\xFF\xD8\xFF", 0);
+			my $Point = $HeaderPoint + 2;
+			while($Point < $DataLength) {
+				my($Maker, $MakerType, $MakerLength) = unpack("C2n",substr($$DATA,$Point,4));
+				if($Maker != 0xFF || $MakerType == 0xd9 || $MakerType == 0xda) {
+					last;
+				} elsif($MakerType >= 0xC0 && $MakerType <= 0xC3) {
+					$Ext = 'jpg';
+					($ImageHeight, $ImageWidth) = unpack("n2", substr($$DATA, $Point + 5, 4));
+					if($HeaderPoint > 0) {
+						$$DATA = substr($$DATA, $HeaderPoint);
+						$DataLength = length($$DATA);
+					}
+					last;
+				} else {
+					$Point += $MakerLength + 2;
+				}
+			}
+		}
+	}
+
+	# audio
+	if(!$Ext && ($UnknownType || $ContentType =~ /^audio\//i)) {
+		# MIDI Audio
+		if($$DATA =~ /^MThd/) {
+			$Ext = 'mid';
+		} elsif($$DATA =~ /^\x2esnd/) {		# ULAW Audio
+			$Ext = 'au';
+		} elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) {
+			my $HeaderPoint = index($$DATA, "RIFF", 0);
+			$_ = substr($$DATA, $HeaderPoint + 8, 8);
+			if(/^WAVEfmt $/) {
+				# WAVE
+				if(unpack("V",substr($$DATA, $HeaderPoint + 16, 4)) == 16) {
+					$Ext = 'wav';
+				} else {					# RIFF WAVE MP3
+					$Ext = 'mp3';
+				}
+			} elsif(/^RMIDdata$/) {			# RIFF MIDI
+				$Ext = 'rmi';
+			} elsif(/^RMP3data$/) {			# RIFF MP3
+				$Ext = 'rmp';
+			}
+			if($ContentType =~ /^audio\//i) {
+				$Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')';
+			}
+		}
+	}
+
+	# a binary file
+	unless ($Ext) {
+		# PDF image
+		if($$DATA =~ /^\%PDF/) {
+			# Picture size is not measured.
+			$Ext = 'pdf';
+		} elsif($$DATA =~ /^FWS/) {		# Shockwave Flash
+			$Ext = 'swf';
+		} elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) {
+			my $HeaderPoint = index($$DATA, "RIFF", 0);
+			$_ = substr($$DATA,$HeaderPoint + 8, 8);
+			# AVI
+			if(/^AVI LIST$/) {
+				$Ext = 'avi';
+			}
+			if($ContentType =~ /^video\//i) {
+				$Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')';
+			}
+		} elsif($$DATA =~ /^PK/) {			# ZIP Compress File
+			$Ext = 'zip';
+		} elsif($$DATA =~ /^MSCF/) {		# CAB Compress File
+			$Ext = 'cab';
+		} elsif($$DATA =~ /^Rar\!/) {		# RAR Compress File
+			$Ext = 'rar';
+		} elsif(substr($$DATA, 2, 5) =~ /^\-lh(\d+|d)\-$/) {		# LHA Compress File
+			$Infomation .= "(lh$1)";
+			$Ext = 'lzh';
+		} elsif(substr($$DATA, 325, 25) eq "Apple Video Media Handler" || substr($$DATA, 325, 30) eq "Apple \x83\x72\x83\x66\x83\x49\x81\x45\x83\x81\x83\x66\x83\x42\x83\x41\x83\x6E\x83\x93\x83\x68\x83\x89") {
+			# QuickTime
+			$Ext = 'mov';
+		}
+	}
+
+	# Header analysis failure
+	unless ($Ext) {
+		# It will be followed if it applies for the MIME type from the browser.
+		foreach (keys %UPLOAD_CONTENT_TYPE_LIST) {
+			next unless ($_);
+			if($ContentType =~ /^$_$/i) {
+				$Ext = $UPLOAD_CONTENT_TYPE_LIST{$_};
+				$ContentName = &CheckContentExt($Ext);
+				if(
+					grep {$_ eq $Ext;} (
+						'png',
+						'gif',
+						'jpg',
+						'xbm',
+						'tif',
+						'bmp',
+						'pdf',
+						'swf',
+						'mov',
+						'zip',
+						'cab',
+						'lzh',
+						'rar',
+						'mid',
+						'rmi',
+						'au',
+						'wav',
+						'avi',
+						'exe'
+					)
+				) {
+					$Infomation .= ' / Header analysis failure';
+				}
+				if($Ext ne $FileExt && &CheckContentExt($FileExt) eq $ContentName) {
+					$Ext = $FileExt;
+				}
+				last;
+			}
+		}
+		# a MIME type is unknown--It judges from an extension.
+		unless ($Ext) {
+			$ContentName = &CheckContentExt($FileExt);
+			if($ContentName) {
+				$Ext = $FileExt;
+				$Infomation .= ' /	MIME type is unknown('. $ContentType. ')';
+				last;
+			}
+		}
+	}
+
+#	$ContentName = &CheckContentExt($Ext)	unless($ContentName);
+#	if($Ext && $ContentName) {
+#		$ContentName .=  $Infomation;
+#	} else {
+#		&upload_error(
+#			'Extension Error',
+#			"$FileName A not corresponding extension ($Ext)<BR>The extension which can be responded ". join(',', sort values(%UPLOAD_EXT_LIST))
+#		);
+#	}
+
+#	# SSI Tag Deletion
+#	if($Ext =~ /.?html?/ && $$DATA =~ /<\!/) {
+#		foreach (
+#			'config',
+#			'echo',
+#			'exec',
+#			'flastmod',
+#			'fsize',
+#			'include'
+#		) {
+#			$$DATA =~ s/\#\s*$_/\&\#35\;$_/ig
+#		}
+#	}
+
+	return (
+		$FileName,
+		$Ext,
+		int($DataLength / 1024 + 1),
+		$ImageWidth,
+		$ImageHeight,
+		$ContentName
+	);
+}
+
+##############################################################################
+# Summary
+#
+# Extension discernment
+#
+# Parameters
+# Returns
+# Memo
+##############################################################################
+
+sub CheckContentExt
+{
+
+	my($Ext) = @_;
+	my $ContentName;
+	foreach (keys %UPLOAD_EXT_LIST) {
+		next	unless ($_);
+		if($_ && $Ext =~ /^$_$/) {
+			$ContentName = $UPLOAD_EXT_LIST{$_};
+			last;
+		}
+	}
+	return $ContentName;
+
+}
+
+##############################################################################
+# Summary
+#
+# Form decode
+#
+# Parameters
+# Returns
+# Memo
+##############################################################################
+sub Encode
+{
+
+	my($value,$Trans) = @_;
+
+#	my $FormCode = &jcode::getcode($value) || $FormCodeDefault;
+#	$FormCodeDefault ||= $FormCode;
+#
+#	if($Trans && $TRANS_2BYTE_CODE) {
+#		if($FormCode ne 'euc') {
+#			&jcode::convert($value, 'euc', $FormCode);
+#		}
+#		&jcode::tr(
+#			$value,
+#			"\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA",
+#			'0-9A-Za-z'
+#		);
+#		if($CHARCODE ne 'euc') {
+#			&jcode::convert($value,$CHARCODE,'euc');
+#		}
+#	} else {
+#		if($CHARCODE ne $FormCode) {
+#			&jcode::convert($value,$CHARCODE,$FormCode);
+#		}
+#	}
+#	if($CHARCODE eq 'euc') {
+#		&jcode::h2z_euc($value);
+#	} elsif($CHARCODE eq 'sjis') {
+#		&jcode::h2z_sjis($value);
+#	}
+
+}
+
+##############################################################################
+# Summary
+#
+# Error Msg
+#
+# Parameters
+# Returns
+# Memo
+##############################################################################
+
+sub upload_error
+{
+
+	local($error_message)	= $_[0];
+	local($error_message2)	= $_[1];
+
+	print "Content-type: text/html\n\n";
+	print<<EOF;
+<HTML>
+<HEAD>
+<TITLE>Error Message</TITLE></HEAD>
+<BODY>
+<table border="1" cellspacing="10" cellpadding="10">
+	<TR bgcolor="#0000B0">
+	<TD bgcolor="#0000B0" NOWRAP><font size="-1" color="white"><B>Error Message</B></font></TD>
+	</TR>
+</table>
+<UL>
+<H4> $error_message </H4>
+$error_message2 <BR>
+</UL>
+</BODY>
+</HTML>
+EOF
+	&rm_tmp_uploaded_files; 		# Image Temporary deletion
+	exit;
+}
+
+##############################################################################
+# Summary
+#
+# Image Temporary deletion
+#
+# Parameters
+# Returns
+# Memo
+##############################################################################
+
+sub rm_tmp_uploaded_files
+{
+	if($img_data_exists == 1){
+		sleep 1;
+		foreach $fname_list(@NEWFNAMES) {
+			if(-e "$img_dir/$fname_list") {
+				unlink("$img_dir/$fname_list");
+			}
+		}
+	}
+
+}
+1;
Index: /FCKeditor/trunk/editor/filemanager/connectors/perl/util.pl
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/perl/util.pl	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/perl/util.pl	(revision 413)
@@ -0,0 +1,68 @@
+#####
+#  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 Manager Connector for Perl.
+#####
+
+sub RemoveFromStart
+{
+	local($sourceString, $charToRemove) = @_;
+	$sPattern = '^' . $charToRemove . '+' ;
+	$sourceString =~ s/^$charToRemove+//g;
+	return $sourceString;
+}
+
+sub RemoveFromEnd
+{
+	local($sourceString, $charToRemove) = @_;
+	$sPattern = $charToRemove . '+$' ;
+	$sourceString =~ s/$charToRemove+$//g;
+	return $sourceString;
+}
+
+sub ConvertToXmlAttribute
+{
+	local($value) = @_;
+	return $value;
+#	return utf8_encode(htmlspecialchars($value));
+
+}
+
+sub specialchar_cnv
+{
+	local($ch) = @_;
+
+	$ch =~ s/&/&amp;/g;		# &
+	$ch =~ s/\"/&quot;/g;	#"
+	$ch =~ s/\'/&#39;/g;	# '
+	$ch =~ s/</&lt;/g;		# <
+	$ch =~ s/>/&gt;/g;		# >
+	return($ch);
+}
+
+sub JS_cnv
+{
+	local($ch) = @_;
+
+	$ch =~ s/\"/\\\"/g;	#"
+	return($ch);
+}
+
+1;
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/basexml.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/basexml.php	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/basexml.php	(revision 413)
@@ -0,0 +1,93 @@
+<?php
+/*
+ * 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 ==
+ *
+ * These functions define the base of the XML response sent by the PHP
+ * connector.
+ */
+
+function SetXmlHeaders()
+{
+	ob_end_clean() ;
+
+	// Prevent the browser from caching the result.
+	// Date in the past
+	header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
+	// always modified
+	header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
+	// HTTP/1.1
+	header('Cache-Control: no-store, no-cache, must-revalidate') ;
+	header('Cache-Control: post-check=0, pre-check=0', false) ;
+	// HTTP/1.0
+	header('Pragma: no-cache') ;
+
+	// Set the response format.
+	header( 'Content-Type: text/xml; charset=utf-8' ) ;
+}
+
+function CreateXmlHeader( $command, $resourceType, $currentFolder )
+{
+	SetXmlHeaders() ;
+
+	// Create the XML document header.
+	echo '<?xml version="1.0" encoding="utf-8" ?>' ;
+
+	// Create the main "Connector" node.
+	echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
+
+	// Add the current folder node.
+	echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ;
+
+	$GLOBALS['HeaderSent'] = true ;
+}
+
+function CreateXmlFooter()
+{
+	echo '</Connector>' ;
+}
+
+function SendError( $number, $text )
+{
+	if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
+	{ 
+		SendErrorNode( $number, $text ) ;
+		CreateXmlFooter() ;
+	}
+	else
+	{
+		SetXmlHeaders() ;
+
+		// Create the XML document header
+		echo '<?xml version="1.0" encoding="utf-8" ?>' ;
+
+		echo '<Connector>' ;
+		
+		SendErrorNode( $number, $text ) ;
+		
+		echo '</Connector>' ;
+	}
+	exit ;
+}
+
+function SendErrorNode(  $number, $text )
+{
+	echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;
+}
+?>
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/commands.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/commands.php	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/commands.php	(revision 413)
@@ -0,0 +1,219 @@
+<?php
+/*
+ * 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 Manager Connector for PHP.
+ */
+
+function GetFolders( $resourceType, $currentFolder )
+{
+	// Map the virtual path to the local server path.
+	$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' ) ;
+
+	// Array that will hold the folders names.
+	$aFolders	= array() ;
+
+	$oCurrentFolder = opendir( $sServerDir ) ;
+
+	while ( $sFile = readdir( $oCurrentFolder ) )
+	{
+		if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
+			$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
+	}
+
+	closedir( $oCurrentFolder ) ;
+
+	// Open the "Folders" node.
+	echo "<Folders>" ;
+
+	natcasesort( $aFolders ) ;
+	foreach ( $aFolders as $sFolder )
+		echo $sFolder ;
+
+	// Close the "Folders" node.
+	echo "</Folders>" ;
+}
+
+function GetFoldersAndFiles( $resourceType, $currentFolder )
+{
+	// Map the virtual path to the local server path.
+	$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ;
+
+	// Arrays that will hold the folders and files names.
+	$aFolders	= array() ;
+	$aFiles		= array() ;
+
+	$oCurrentFolder = opendir( $sServerDir ) ;
+
+	while ( $sFile = readdir( $oCurrentFolder ) )
+	{
+		if ( $sFile != '.' && $sFile != '..' )
+		{
+			if ( is_dir( $sServerDir . $sFile ) )
+				$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
+			else
+			{
+				$iFileSize = filesize( $sServerDir . $sFile ) ;
+				if ( $iFileSize > 0 )
+				{
+					$iFileSize = round( $iFileSize / 1024 ) ;
+					if ( $iFileSize < 1 ) $iFileSize = 1 ;
+				}
+
+				$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
+			}
+		}
+	}
+
+	// Send the folders
+	natcasesort( $aFolders ) ;
+	echo '<Folders>' ;
+
+	foreach ( $aFolders as $sFolder )
+		echo $sFolder ;
+
+	echo '</Folders>' ;
+
+	// Send the files
+	natcasesort( $aFiles ) ;
+	echo '<Files>' ;
+
+	foreach ( $aFiles as $sFiles )
+		echo $sFiles ;
+
+	echo '</Files>' ;
+}
+
+function CreateFolder( $resourceType, $currentFolder )
+{
+	$sErrorNumber	= '0' ;
+	$sErrorMsg		= '' ;
+
+	if ( isset( $_GET['NewFolderName'] ) )
+	{
+		$sNewFolderName = $_GET['NewFolderName'] ;
+		$sNewFolderName = SanitizeFolderName( $sNewFolderName ) ;
+
+		if ( strpos( $sNewFolderName, '..' ) !== FALSE )
+			$sErrorNumber = '102' ;		// Invalid folder name.
+		else
+		{
+			// Map the virtual path to the local server path of the current folder.
+			$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' ) ;
+
+			if ( is_writable( $sServerDir ) )
+			{
+				$sServerDir .= $sNewFolderName ;
+
+				$sErrorMsg = CreateServerFolder( $sServerDir ) ;
+
+				switch ( $sErrorMsg )
+				{
+					case '' :
+						$sErrorNumber = '0' ;
+						break ;
+					case 'Invalid argument' :
+					case 'No such file or directory' :
+						$sErrorNumber = '102' ;		// Path too long.
+						break ;
+					default :
+						$sErrorNumber = '110' ;
+						break ;
+				}
+			}
+			else
+				$sErrorNumber = '103' ;
+		}
+	}
+	else
+		$sErrorNumber = '102' ;
+
+	// Create the "Error" node.
+	echo '<Error number="' . $sErrorNumber . '" originalDescription="' . ConvertToXmlAttribute( $sErrorMsg ) . '" />' ;
+}
+
+function FileUpload( $resourceType, $currentFolder, $sCommand )
+{
+	$sErrorNumber = '0' ;
+	$sFileName = '' ;
+
+	if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) )
+	{
+		global $Config ;
+
+		$oFile = $_FILES['NewFile'] ;
+
+		// Map the virtual path to the local server path.
+		$sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ;
+
+		// Get the uploaded file name.
+		$sFileName = $oFile['name'] ;
+		$sFileName = SanitizeFileName( $sFileName ) ;
+
+		$sOriginalFileName = $sFileName ;
+
+		// Get the extension.
+		$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
+		$sExtension = strtolower( $sExtension ) ;
+
+		// Check if it is an allowed extension.
+		if ( IsAllowedExt( $sExtension, $resourceType ) )
+		{
+			$iCounter = 0 ;
+
+			while ( true )
+			{
+				$sFilePath = $sServerDir . $sFileName ;
+
+				if ( is_file( $sFilePath ) )
+				{
+					$iCounter++ ;
+					$sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
+					$sErrorNumber = '201' ;
+				}
+				else
+				{
+					move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
+
+					if ( is_file( $sFilePath ) )
+					{
+						$oldumask = umask(0) ;
+						chmod( $sFilePath, 0777 ) ;
+						umask( $oldumask ) ;
+					}
+
+					break ;
+				}
+			}
+		}
+		else
+			$sErrorNumber = '202' ;
+	}
+	else
+		$sErrorNumber = '202' ;
+
+
+	$sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $sFileName ) ;
+
+	SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ;
+
+	exit ;
+}
+?>
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/config.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/config.php	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/config.php	(revision 413)
@@ -0,0 +1,123 @@
+<?php
+/*
+ * 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 File Manager Connector for PHP.
+ */
+
+global $Config ;
+
+// SECURITY: You must explicitelly enable this "connector". (Set it to "true").
+// WARNING: don't just set "ConfigIsEnabled = true", you must be sure that only 
+//		authenticated users can access this file or use some kind of session checking.
+$Config['Enabled'] = false ;
+
+// @Packager.Remove.Start
+// Attention: In the development version (SVN) the PHP connector is enabled by default.
+$Config['Enabled'] = true ;
+// @Packager.Remove.End
+
+// Path to user files relative to the document root.
+$Config['UserFilesPath'] = '/userfiles/' ;
+
+// Fill the following value it you prefer to specify the absolute path for the
+// user files directory. Usefull if you are using a virtual directory, symbolic
+// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
+// Attention: The above 'UserFilesPath' must point to the same directory.
+$Config['UserFilesAbsolutePath'] = '' ;
+
+// Due to security issues with Apache modules, it is reccomended to leave the
+// following setting enabled.
+$Config['ForceSingleExtension'] = true ;
+
+// What the user can do with this connector
+$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder') ;
+
+// Allowed Resource Types
+$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media') ;
+
+/*
+	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 fullfil 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']['File']	= array() ;
+$Config['DeniedExtensions']['File']		= array('html','htm','php','php2','php3','php4','php5','phtml','pwml','inc','asp','aspx','ascx','jsp','cfm','cfc','pl','bat','exe','com','dll','vbs','js','reg','cgi','htaccess','asis','sh','shtml','shtm','phtm') ;
+$Config['FileTypesPath']['File']		= $Config['UserFilesPath'] . 'file/' ;
+$Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ;
+$Config['QuickUploadPath']['File']		= $Config['UserFilesPath'] ;
+$Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ;
+
+$Config['AllowedExtensions']['Image']	= array('jpg','gif','jpeg','png') ;
+$Config['DeniedExtensions']['Image']	= array() ;
+$Config['FileTypesPath']['Image']		= $Config['UserFilesPath'] . 'image/' ;
+$Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ;
+$Config['QuickUploadPath']['Image']		= $Config['UserFilesPath'] ;
+$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;
+
+$Config['AllowedExtensions']['Flash']	= array('swf','fla') ;
+$Config['DeniedExtensions']['Flash']	= array() ;
+$Config['FileTypesPath']['Flash']		= $Config['UserFilesPath'] . 'flash/' ;
+$Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ;
+$Config['QuickUploadPath']['Flash']		= $Config['UserFilesPath'] ;
+$Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ;
+
+$Config['AllowedExtensions']['Media']	= array('swf','fla','jpg','gif','jpeg','png','avi','mpg','mpeg') ;
+$Config['DeniedExtensions']['Media']	= array() ;
+$Config['FileTypesPath']['Media']		= $Config['UserFilesPath'] . 'media/' ;
+$Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ;
+$Config['QuickUploadPath']['Media']		= $Config['UserFilesPath'] ;
+$Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'] ;
+
+?>
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/connector.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/connector.php	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/connector.php	(revision 413)
@@ -0,0 +1,83 @@
+<?php
+/*
+ * 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 Manager Connector for PHP.
+ */
+
+ob_start() ;
+
+require('./config.php') ;
+require('./util.php') ;
+require('./io.php') ;
+require('./basexml.php') ;
+require('./commands.php') ;
+
+if ( !$Config['Enabled'] )
+	SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ;
+
+DoResponse() ;
+
+function DoResponse()
+{
+	if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
+		return ;
+
+	// Get the main request informaiton.
+	$sCommand		= $_GET['Command'] ;
+	$sResourceType	= $_GET['Type'] ;
+	$sCurrentFolder	= GetCurrentFolder() ;
+
+	// Check if it is an allowed command 
+	if ( ! IsAllowedCommand( $sCommand ) ) 
+		SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ) ;
+
+	// Check if it is an allowed type.
+	if ( !IsAllowedType( $sResourceType ) )
+		SendError( 1, 'Invalid type specified' ) ;
+
+	// File Upload doesn't have to Return XML, so it must be intercepted before anything.
+	if ( $sCommand == 'FileUpload' )
+	{
+		FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ;
+		return ;
+	}
+
+	CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
+
+	// Execute the required command.
+	switch ( $sCommand )
+	{
+		case 'GetFolders' :
+			GetFolders( $sResourceType, $sCurrentFolder ) ;
+			break ;
+		case 'GetFoldersAndFiles' :
+			GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
+			break ;
+		case 'CreateFolder' :
+			CreateFolder( $sResourceType, $sCurrentFolder ) ;
+			break ;
+	}
+
+	CreateXmlFooter() ;
+
+	exit ;
+}
+?>
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/io.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/io.php	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/io.php	(revision 413)
@@ -0,0 +1,260 @@
+<?php
+/*
+ * 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 Manager Connector for PHP.
+ */
+function CombinePaths( $sBasePath, $sFolder )
+{
+	return RemoveFromEnd( $sBasePath, '/' ) . '/' . RemoveFromStart( $sFolder, '/' ) ;
+}
+function GetResourceTypePath( $resourceType, $sCommand )
+{
+	global $Config ;
+
+	if ( $sCommand == "QuickUpload") 
+		return $Config['QuickUploadPath'][$resourceType] ;
+	else
+		return $Config['FileTypesPath'][$resourceType] ;
+}
+
+function GetResourceTypeDirectory( $resourceType, $sCommand )
+{
+	global $Config ;
+	if ( $sCommand == "QuickUpload") 
+	{
+		if ( strlen( $Config['QuickUploadAbsolutePath'][$resourceType] ) > 0 )
+			return $Config['QuickUploadAbsolutePath'][$resourceType] ;
+
+		// Map the "UserFiles" path to a local directory.
+		return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ) ;
+	}
+	else
+	{
+		if ( strlen( $Config['FileTypesAbsolutePath'][$resourceType] ) > 0 )
+			return $Config['FileTypesAbsolutePath'][$resourceType] ;
+
+		// Map the "UserFiles" path to a local directory.
+		return Server_MapPath( $Config['FileTypesPath'][$resourceType] ) ;
+	}
+}
+
+function GetUrlFromPath( $resourceType, $folderPath, $sCommand )
+{
+	return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath ) ;
+}
+
+function RemoveExtension( $fileName )
+{
+	return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ;
+}
+
+function ServerMapFolder( $resourceType, $folderPath, $sCommand )
+{
+	// Get the resource type directory.
+	$sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand ) ;
+
+	// Ensure that the directory exists.
+	$sErrorMsg = CreateServerFolder( $sResourceTypePath ) ;
+	if ( $sErrorMsg != '' )
+		SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ;
+
+	// Return the resource type directory combined with the required path.
+	return CombinePaths( $sResourceTypePath , $folderPath ) ;
+}
+
+function GetParentFolder( $folderPath )
+{
+	$sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ;
+	return preg_replace( $sPattern, '', $folderPath ) ;
+}
+
+function CreateServerFolder( $folderPath )
+{
+	$sParent = GetParentFolder( $folderPath ) ;
+
+	// Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms
+	while ( strpos($folderPath, '//') !== false )
+	{
+		$folderPath = str_replace( '//', '/', $folderPath ) ;
+	}
+
+	// Check if the parent exists, or create it.
+	if ( !file_exists( $sParent ) )
+	{
+		$sErrorMsg = CreateServerFolder( $sParent ) ;
+		if ( $sErrorMsg != '' )
+			return $sErrorMsg ;
+	}
+
+	if ( !file_exists( $folderPath ) )
+	{
+		// Turn off all error reporting.
+		error_reporting( 0 ) ;
+
+		$php_errormsg = '' ;
+		// Enable error tracking to catch the error.
+		ini_set( 'track_errors', '1' ) ;
+
+		// To create the folder with 0777 permissions, we need to set umask to zero.
+		$oldumask = umask(0) ;
+		mkdir( $folderPath, 0777 ) ;
+		umask( $oldumask ) ;
+
+		$sErrorMsg = $php_errormsg ;
+
+		// Restore the configurations.
+		ini_restore( 'track_errors' ) ;
+		ini_restore( 'error_reporting' ) ;
+
+		return $sErrorMsg ;
+	}
+	else
+		return '' ;
+}
+
+function GetRootPath()
+{
+	$sRealPath = realpath( './' ) ;
+
+	$sSelfPath = $_SERVER['PHP_SELF'] ;
+	$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ;
+
+	$sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath ) ;
+	
+	$position = strpos( $sRealPath, $sSelfPath ) ;
+
+	// This can check only that this script isn't run from a virtual dir
+	// But it avoids the problems that arise if it isn't checked
+	if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) )
+		SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ) ;
+
+	return substr( $sRealPath, 0, $position ) ;
+}
+
+// Emulate the asp Server.mapPath function.
+// given an url path return the physical directory that it corresponds to
+function Server_MapPath( $path )
+{
+	// This function is available only for Apache
+	if ( function_exists( 'apache_lookup_uri' ) )
+	{
+		$info = apache_lookup_uri( $path ) ;
+		return $info->filename . $info->path_info ;
+	}
+
+	// This isn't correct but for the moment there's no other solution
+	// If this script is under a virtual directory or symlink it will detect the problem and stop
+	return GetRootPath() . $path ;
+}
+
+function IsAllowedExt( $sExtension, $resourceType )
+{
+	global $Config ;
+	// Get the allowed and denied extensions arrays.
+	$arAllowed	= $Config['AllowedExtensions'][$resourceType] ;
+	$arDenied	= $Config['DeniedExtensions'][$resourceType] ;
+
+	if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) 
+		return false ;
+
+	if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) 
+		return false ;
+
+	return true ;
+}
+
+function IsAllowedType( $resourceType )
+{
+	global $Config ;
+	if ( !in_array( $resourceType, $Config['ConfigAllowedTypes'] ) )
+		return false ;
+	
+	return true ;
+}
+
+function IsAllowedCommand( $sCommand )
+{
+	global $Config ;
+
+	if ( !in_array( $sCommand, $Config['ConfigAllowedCommands'] ) )
+		return false ;
+	
+	return true ;
+}
+
+function GetCurrentFolder()
+{
+	$sCurrentFolder	= isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ;
+
+	// Check the current folder syntax (must begin and start with a slash).
+	if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
+	if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ;
+
+	// Ensure the folder path has no double-slashes
+	while ( strpos ($sCurrentFolder, '//') !== false ) {
+		$sCurrentFolder = str_replace ('//', '/', $sCurrentFolder) ;
+	}
+
+	// Check for invalid folder paths (..)
+	if ( strpos( $sCurrentFolder, '..' ) )
+		SendError( 102, '' ) ;
+
+	return $sCurrentFolder ;
+}
+
+// Do a cleanup of the folder name to avoid possible problems
+function SanitizeFolderName( $sNewFolderName )
+{
+	$sNewFolderName = stripslashes( $sNewFolderName ) ;
+
+	// Remove . \ / | : ? * " < >
+	$sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>/', '_', $sNewFolderName ) ;
+
+	return $sNewFolderName ;
+}
+
+// Do a cleanup of the file name to avoid possible problems
+function SanitizeFileName( $sNewFileName )
+{
+	global $Config ;
+
+	$sNewFileName = stripslashes( $sNewFileName ) ;
+
+	// Replace dots in the name with underscores (only one dot can be there... security issue).
+	if ( $Config['ForceSingleExtension'] )
+		$sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName ) ;
+
+	// Remove \ / | : ? * " < >
+	$sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>/', '_', $sNewFileName ) ;
+
+	return $sNewFileName ;
+}
+
+// This is the function that sends the results of the uploading process.
+function SendUploadResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' )
+{
+	echo '<script type="text/javascript">' ;
+	echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . str_replace( '"', '\\"', $fileUrl ) . '","' . str_replace( '"', '\\"', $fileName ) . '", "' . str_replace( '"', '\\"', $customMsg ) . '") ;' ;
+	echo '</script>' ;
+	exit ;
+}
+
+?>
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/upload.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/upload.php	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/upload.php	(revision 413)
@@ -0,0 +1,52 @@
+<?php
+/*
+ * 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 PHP.
+ */
+
+require('./config.php') ;
+require('./util.php') ;
+require('./io.php') ;
+require('./commands.php') ;
+
+// Check if this uploader has been enabled.
+if ( !$Config['Enabled'] )
+	SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ;
+
+$sCommand = 'QuickUpload' ;
+
+// The file type (from the QueryString, by default 'File').
+$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
+
+$sCurrentFolder	= GetCurrentFolder() ; 
+
+// Is enabled the upload?
+if ( ! IsAllowedCommand( $sCommand ) ) 
+	SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' ) ;
+
+// Check if it is an allowed type.
+if ( !IsAllowedType( $sType ) )
+    SendUploadResults( 1, '', '', 'Invalid type specified' ) ;
+
+
+FileUpload( $sType, $sCurrentFolder, $sCommand )
+
+?>
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/util.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/util.php	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/util.php	(revision 413)
@@ -0,0 +1,41 @@
+<?php
+/*
+ * 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 ==
+ *
+ * Utility functions for the File Manager Connector for PHP.
+ */
+
+function RemoveFromStart( $sourceString, $charToRemove )
+{
+	$sPattern = '|^' . $charToRemove . '+|' ;
+	return preg_replace( $sPattern, '', $sourceString ) ;
+}
+
+function RemoveFromEnd( $sourceString, $charToRemove )
+{
+	$sPattern = '|' . $charToRemove . '+$|' ;
+	return preg_replace( $sPattern, '', $sourceString ) ;
+}
+
+function ConvertToXmlAttribute( $value )
+{
+	return ( htmlspecialchars( $value ) ) ;
+}
+?>
Index: /FCKeditor/trunk/editor/filemanager/connectors/py/connector.py
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/py/connector.py	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/py/connector.py	(revision 413)
@@ -0,0 +1,785 @@
+#!/usr/bin/env python
+
+"""
+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 ==
+
+Connector for Python.
+
+Tested With:
+Standard:
+	Python 2.3.3
+Zope:
+	Zope Version: (Zope 2.8.1-final, python 2.3.5, linux2)
+	Python Version: 2.3.5 (#4, Mar 10 2005, 01:40:25)
+		[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)]
+	System Platform: linux2
+"""
+
+"""
+Author Notes (04 December 2005):
+This module has gone through quite a few phases of change.  Obviously,
+I am only supporting that part of the code that I use.  Initially
+I had the upload directory as a part of zope (ie. uploading files
+directly into Zope), before realising that there were too many
+complex intricacies within Zope to deal with.  Zope is one ugly piece
+of code.  So I decided to complement Zope by an Apache server (which
+I had running anyway, and doing nothing).  So I mapped all uploads
+from an arbitrary server directory to an arbitrary web directory.
+All the FCKeditor uploading occurred this way, and I didn't have to
+stuff around with fiddling with Zope objects and the like (which are
+terribly complex and something you don't want to do - trust me).
+
+Maybe a Zope expert can touch up the Zope components.  In the end,
+I had FCKeditor loaded in Zope (probably a bad idea as well), and
+I replaced the connector.py with an alias to a server module.
+Right now, all Zope components will simple remain as is because
+I've had enough of Zope.
+
+See notes right at the end of this file for how I aliased out of Zope.
+
+Anyway, most of you probably wont use Zope, so things are pretty
+simple in that regard.
+
+Typically, SERVER_DIR is the root of WEB_DIR (not necessarily).
+Most definitely, SERVER_USERFILES_DIR points to WEB_USERFILES_DIR.
+"""
+
+import cgi
+import re
+import os
+import string
+
+"""
+escape
+
+Converts the special characters '<', '>', and '&'.
+
+RFC 1866 specifies that these characters be represented
+in HTML as &lt; &gt; and &amp; respectively. In Python
+1.5 we use the new string.replace() function for speed.
+"""
+def escape(text, replace=string.replace):
+    text = replace(text, '&', '&amp;') # must be done 1st
+    text = replace(text, '<', '&lt;')
+    text = replace(text, '>', '&gt;')
+    text = replace(text, '"', '&quot;')
+    return text
+
+"""
+getFCKeditorConnector
+
+Creates a new instance of an FCKeditorConnector, and runs it
+"""
+def getFCKeditorConnector(context=None):
+	# Called from Zope.  Passes the context through
+	connector = FCKeditorConnector(context=context)
+	return connector.run()
+
+
+"""
+FCKeditorRequest
+
+A wrapper around the request object
+Can handle normal CGI request, or a Zope request
+Extend as required
+"""
+class FCKeditorRequest(object):
+	def __init__(self, context=None):
+		if (context is not None):
+			r = context.REQUEST
+		else:
+			r = cgi.FieldStorage()
+		self.context = context
+		self.request = r
+
+	def isZope(self):
+		if (self.context is not None):
+			return True
+		return False
+
+	def has_key(self, key):
+		return self.request.has_key(key)
+
+	def get(self, key, default=None):
+		value = None
+		if (self.isZope()):
+			value = self.request.get(key, default)
+		else:
+			if key in self.request.keys():
+				value = self.request[key].value
+			else:
+				value = default
+		return value
+
+"""
+FCKeditorConnector
+
+The connector class
+"""
+class FCKeditorConnector(object):
+	# Configuration for FCKEditor
+	# can point to another server here, if linked correctly
+	#WEB_HOST = "http://127.0.0.1/"
+	WEB_HOST = ""
+	SERVER_DIR = "/var/www/html/"
+
+	WEB_USERFILES_FOLDER = WEB_HOST + "upload/"
+	SERVER_USERFILES_FOLDER = SERVER_DIR + "upload/"
+
+	# Allow access (Zope)
+	__allow_access_to_unprotected_subobjects__ = 1
+	# Class Attributes
+	parentFolderRe = re.compile("[\/][^\/]+[\/]?$")
+
+	"""
+	Constructor
+	"""
+	def __init__(self, context=None):
+		# The given root path will NOT be shown to the user
+		# Only the userFilesPath will be shown
+
+		# Instance Attributes
+		self.context = context
+		self.request = FCKeditorRequest(context=context)
+		self.rootPath = self.SERVER_DIR
+		self.userFilesFolder = self.SERVER_USERFILES_FOLDER
+		self.webUserFilesFolder = self.WEB_USERFILES_FOLDER
+
+		# Enables / Disables the connector
+		self.enabled = False # Set to True to enable this connector
+
+		# These are instance variables
+		self.zopeRootContext = None
+		self.zopeUploadContext = None
+
+		# Copied from php module =)
+		self.allowedExtensions = {
+				"File": None,
+				"Image": None,
+				"Flash": None,
+				"Media": None
+				}
+		self.deniedExtensions = {
+				"File": [ "html","htm","php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess","asis","sh","shtml","shtm","phtm" ],
+				"Image": [ "html","htm","php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess","asis","sh","shtml","shtm","phtm" ],
+				"Flash": [ "html","htm","php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess","asis","sh","shtml","shtm","phtm" ],
+				"Media": [ "html","htm","php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess","asis","sh","shtml","shtm","phtm" ]
+				}
+
+	"""
+	Zope specific functions
+	"""
+	def isZope(self):
+		# The context object is the zope object
+		if (self.context is not None):
+			return True
+		return False
+
+	def getZopeRootContext(self):
+		if self.zopeRootContext is None:
+			self.zopeRootContext = self.context.getPhysicalRoot()
+		return self.zopeRootContext
+
+	def getZopeUploadContext(self):
+		if self.zopeUploadContext is None:
+			folderNames = self.userFilesFolder.split("/")
+			c = self.getZopeRootContext()
+			for folderName in folderNames:
+				if (folderName <> ""):
+					c = c[folderName]
+			self.zopeUploadContext = c
+		return self.zopeUploadContext
+
+	"""
+	Generic manipulation functions
+	"""
+	def getUserFilesFolder(self):
+		return self.userFilesFolder
+
+	def getWebUserFilesFolder(self):
+		return self.webUserFilesFolder
+
+	def getAllowedExtensions(self, resourceType):
+		return self.allowedExtensions[resourceType]
+
+	def getDeniedExtensions(self, resourceType):
+		return self.deniedExtensions[resourceType]
+
+	def removeFromStart(self, string, char):
+		return string.lstrip(char)
+
+	def removeFromEnd(self, string, char):
+		return string.rstrip(char)
+
+	def convertToXmlAttribute(self, value):
+		if (value is None):
+			value = ""
+		return escape(value)
+
+	def convertToPath(self, path):
+		if (path[-1] <> "/"):
+			return path + "/"
+		else:
+			return path
+
+	def getUrlFromPath(self, resourceType, path):
+		if (resourceType is None) or (resourceType == ''):
+			url = "%s%s" % (
+					self.removeFromEnd(self.getUserFilesFolder(), '/'),
+					path
+					)
+		else:
+			url = "%s%s%s" % (
+					self.getUserFilesFolder(),
+					resourceType,
+					path
+					)
+		return url
+
+	def getWebUrlFromPath(self, resourceType, path):
+		if (resourceType is None) or (resourceType == ''):
+			url = "%s%s" % (
+					self.removeFromEnd(self.getWebUserFilesFolder(), '/'),
+					path
+					)
+		else:
+			url = "%s%s%s" % (
+					self.getWebUserFilesFolder(),
+					resourceType,
+					path
+					)
+		return url
+
+	def removeExtension(self, fileName):
+		index = fileName.rindex(".")
+		newFileName = fileName[0:index]
+		return newFileName
+
+	def getExtension(self, fileName):
+		index = fileName.rindex(".") + 1
+		fileExtension = fileName[index:]
+		return fileExtension
+
+	def getParentFolder(self, folderPath):
+		parentFolderPath = self.parentFolderRe.sub('', folderPath)
+		return parentFolderPath
+
+	"""
+	serverMapFolder
+
+	Purpose: works out the folder map on the server
+	"""
+	def serverMapFolder(self, resourceType, folderPath):
+		# Get the resource type directory
+		resourceTypeFolder = "%s%s/" % (
+				self.getUserFilesFolder(),
+				resourceType
+				)
+		# Ensure that the directory exists
+		self.createServerFolder(resourceTypeFolder)
+
+		# Return the resource type directory combined with the
+		# required path
+		return "%s%s" % (
+				resourceTypeFolder,
+				self.removeFromStart(folderPath, '/')
+				)
+
+	"""
+	createServerFolder
+
+	Purpose: physically creates a folder on the server
+	"""
+	def createServerFolder(self, folderPath):
+		# Check if the parent exists
+		parentFolderPath = self.getParentFolder(folderPath)
+		if not(os.path.exists(parentFolderPath)):
+			errorMsg = self.createServerFolder(parentFolderPath)
+			if errorMsg is not None:
+				return errorMsg
+		# Check if this exists
+		if not(os.path.exists(folderPath)):
+			os.mkdir(folderPath)
+			os.chmod(folderPath, 0755)
+			errorMsg = None
+		else:
+			if os.path.isdir(folderPath):
+				errorMsg = None
+			else:
+				raise "createServerFolder: Non-folder of same name already exists"
+		return errorMsg
+
+
+	"""
+	getRootPath
+
+	Purpose: returns the root path on the server
+	"""
+	def getRootPath(self):
+		return self.rootPath
+
+	"""
+	setXmlHeaders
+
+	Purpose: to prepare the headers for the xml to return
+	"""
+	def setXmlHeaders(self):
+		#now = self.context.BS_get_now()
+		#yesterday = now - 1
+		self.setHeader("Content-Type", "text/xml")
+		#self.setHeader("Expires", yesterday)
+		#self.setHeader("Last-Modified", now)
+		#self.setHeader("Cache-Control", "no-store, no-cache, must-revalidate")
+		self.printHeaders()
+		return
+
+	def setHeader(self, key, value):
+		if (self.isZope()):
+			self.context.REQUEST.RESPONSE.setHeader(key, value)
+		else:
+			print "%s: %s" % (key, value)
+		return
+
+	def printHeaders(self):
+		# For non-Zope requests, we need to print an empty line
+		# to denote the end of headers
+		if (not(self.isZope())):
+			print ""
+
+	"""
+	createXmlFooter
+
+	Purpose: returns the xml header
+	"""
+	def createXmlHeader(self, command, resourceType, currentFolder):
+		self.setXmlHeaders()
+		s = ""
+		# Create the XML document header
+		s += """<?xml version="1.0" encoding="utf-8" ?>"""
+		# Create the main connector node
+		s += """<Connector command="%s" resourceType="%s">""" % (
+				command,
+				resourceType
+				)
+		# Add the current folder node
+		s += """<CurrentFolder path="%s" url="%s" />""" % (
+				self.convertToXmlAttribute(currentFolder),
+				self.convertToXmlAttribute(
+					self.getWebUrlFromPath(
+						resourceType,
+						currentFolder
+						)
+					),
+				)
+		return s
+
+	"""
+	createXmlFooter
+
+	Purpose: returns the xml footer
+	"""
+	def createXmlFooter(self):
+		s = """</Connector>"""
+		return s
+
+	"""
+	sendError
+
+	Purpose: in the event of an error, return an xml based error
+	"""
+	def sendError(self, number, text):
+		self.setXmlHeaders()
+		s = ""
+		# Create the XML document header
+		s += """<?xml version="1.0" encoding="utf-8" ?>"""
+		s += """<Connector>"""
+		s += """<Error number="%s" text="%s" />""" % (number, text)
+		s += """</Connector>"""
+		return s
+
+	"""
+	getFolders
+
+	Purpose: command to recieve a list of folders
+	"""
+	def getFolders(self, resourceType, currentFolder):
+		if (self.isZope()):
+			return self.getZopeFolders(resourceType, currentFolder)
+		else:
+			return self.getNonZopeFolders(resourceType, currentFolder)
+
+	def getZopeFolders(self, resourceType, currentFolder):
+		# Open the folders node
+		s = ""
+		s += """<Folders>"""
+		zopeFolder = self.findZopeFolder(resourceType, currentFolder)
+		for (name, o) in zopeFolder.objectItems(["Folder"]):
+			s += """<Folder name="%s" />""" % (
+					self.convertToXmlAttribute(name)
+					)
+		# Close the folders node
+		s += """</Folders>"""
+		return s
+
+	def getNonZopeFolders(self, resourceType, currentFolder):
+		# Map the virtual path to our local server
+		serverPath = self.serverMapFolder(resourceType, currentFolder)
+		# Open the folders node
+		s = ""
+		s += """<Folders>"""
+		for someObject in os.listdir(serverPath):
+			someObjectPath = os.path.join(serverPath, someObject)
+			if os.path.isdir(someObjectPath):
+				s += """<Folder name="%s" />""" % (
+						self.convertToXmlAttribute(someObject)
+						)
+		# Close the folders node
+		s += """</Folders>"""
+		return s
+
+	"""
+	getFoldersAndFiles
+
+	Purpose: command to recieve a list of folders and files
+	"""
+	def getFoldersAndFiles(self, resourceType, currentFolder):
+		if (self.isZope()):
+			return self.getZopeFoldersAndFiles(resourceType, currentFolder)
+		else:
+			return self.getNonZopeFoldersAndFiles(resourceType, currentFolder)
+
+	def getNonZopeFoldersAndFiles(self, resourceType, currentFolder):
+		# Map the virtual path to our local server
+		serverPath = self.serverMapFolder(resourceType, currentFolder)
+		# Open the folders / files node
+		folders = """<Folders>"""
+		files = """<Files>"""
+		for someObject in os.listdir(serverPath):
+			someObjectPath = os.path.join(serverPath, someObject)
+			if os.path.isdir(someObjectPath):
+				folders += """<Folder name="%s" />""" % (
+						self.convertToXmlAttribute(someObject)
+						)
+			elif os.path.isfile(someObjectPath):
+				size = os.path.getsize(someObjectPath)
+				files += """<File name="%s" size="%s" />""" % (
+						self.convertToXmlAttribute(someObject),
+						os.path.getsize(someObjectPath)
+						)
+		# Close the folders / files node
+		folders += """</Folders>"""
+		files += """</Files>"""
+		# Return it
+		s = folders + files
+		return s
+
+	def getZopeFoldersAndFiles(self, resourceType, currentFolder):
+		folders = self.getZopeFolders(resourceType, currentFolder)
+		files = self.getZopeFiles(resourceType, currentFolder)
+		s = folders + files
+		return s
+
+	def getZopeFiles(self, resourceType, currentFolder):
+		# Open the files node
+		s = ""
+		s += """<Files>"""
+		zopeFolder = self.findZopeFolder(resourceType, currentFolder)
+		for (name, o) in zopeFolder.objectItems(["File","Image"]):
+			s += """<File name="%s" size="%s" />""" % (
+					self.convertToXmlAttribute(name),
+					((o.get_size() / 1024) + 1)
+					)
+		# Close the files node
+		s += """</Files>"""
+		return s
+
+	def findZopeFolder(self, resourceType, folderName):
+		# returns the context of the resource / folder
+		zopeFolder = self.getZopeUploadContext()
+		folderName = self.removeFromStart(folderName, "/")
+		folderName = self.removeFromEnd(folderName, "/")
+		if (resourceType <> ""):
+			try:
+				zopeFolder = zopeFolder[resourceType]
+			except:
+				zopeFolder.manage_addProduct["OFSP"].manage_addFolder(id=resourceType, title=resourceType)
+				zopeFolder = zopeFolder[resourceType]
+		if (folderName <> ""):
+			folderNames = folderName.split("/")
+			for folderName in folderNames:
+				zopeFolder = zopeFolder[folderName]
+		return zopeFolder
+
+	"""
+	createFolder
+
+	Purpose: command to create a new folder
+	"""
+	def createFolder(self, resourceType, currentFolder):
+		if (self.isZope()):
+			return self.createZopeFolder(resourceType, currentFolder)
+		else:
+			return self.createNonZopeFolder(resourceType, currentFolder)
+
+	def createZopeFolder(self, resourceType, currentFolder):
+		# Find out where we are
+		zopeFolder = self.findZopeFolder(resourceType, currentFolder)
+		errorNo = 0
+		errorMsg = ""
+		if self.request.has_key("NewFolderName"):
+			newFolder = self.request.get("NewFolderName", None)
+			zopeFolder.manage_addProduct["OFSP"].manage_addFolder(id=newFolder, title=newFolder)
+		else:
+			errorNo = 102
+		error = """<Error number="%s" originalDescription="%s" />""" % (
+				errorNo,
+				self.convertToXmlAttribute(errorMsg)
+				)
+		return error
+
+	def createNonZopeFolder(self, resourceType, currentFolder):
+		errorNo = 0
+		errorMsg = ""
+		if self.request.has_key("NewFolderName"):
+			newFolder = self.request.get("NewFolderName", None)
+			currentFolderPath = self.serverMapFolder(
+					resourceType,
+					currentFolder
+					)
+			try:
+				newFolderPath = currentFolderPath + newFolder
+				errorMsg = self.createServerFolder(newFolderPath)
+				if (errorMsg is not None):
+					errorNo = 110
+			except:
+				errorNo = 103
+		else:
+			errorNo = 102
+		error = """<Error number="%s" originalDescription="%s" />""" % (
+				errorNo,
+				self.convertToXmlAttribute(errorMsg)
+				)
+		return error
+
+	"""
+	getFileName
+
+	Purpose: helper function to extrapolate the filename
+	"""
+	def getFileName(self, filename):
+		for splitChar in ["/", "\\"]:
+			array = filename.split(splitChar)
+			if (len(array) > 1):
+				filename = array[-1]
+		return filename
+
+	"""
+	fileUpload
+
+	Purpose: command to upload files to server
+	"""
+	def fileUpload(self, resourceType, currentFolder):
+		if (self.isZope()):
+			return self.zopeFileUpload(resourceType, currentFolder)
+		else:
+			return self.nonZopeFileUpload(resourceType, currentFolder)
+
+	def zopeFileUpload(self, resourceType, currentFolder, count=None):
+		zopeFolder = self.findZopeFolder(resourceType, currentFolder)
+		file = self.request.get("NewFile", None)
+		fileName = self.getFileName(file.filename)
+		fileNameOnly = self.removeExtension(fileName)
+		fileExtension = self.getExtension(fileName).lower()
+		if (count):
+			nid = "%s.%s.%s" % (fileNameOnly, count, fileExtension)
+		else:
+			nid = fileName
+		title = nid
+		try:
+			zopeFolder.manage_addProduct['OFSP'].manage_addFile(
+					id=nid,
+					title=title,
+					file=file.read()
+					)
+		except:
+			if (count):
+				count += 1
+			else:
+				count = 1
+			self.zopeFileUpload(resourceType, currentFolder, count)
+		return
+
+	def nonZopeFileUpload(self, resourceType, currentFolder):
+		errorNo = 0
+		errorMsg = ""
+		if self.request.has_key("NewFile"):
+			# newFile has all the contents we need
+			newFile = self.request.get("NewFile", "")
+			# Get the file name
+			newFileName = newFile.filename
+			newFileNameOnly = self.removeExtension(newFileName)
+			newFileExtension = self.getExtension(newFileName).lower()
+			allowedExtensions = self.getAllowedExtensions(resourceType)
+			deniedExtensions = self.getDeniedExtensions(resourceType)
+			if (allowedExtensions is not None):
+				# Check for allowed
+				isAllowed = False
+				if (newFileExtension in allowedExtensions):
+					isAllowed = True
+			elif (deniedExtensions is not None):
+				# Check for denied
+				isAllowed = True
+				if (newFileExtension in deniedExtensions):
+					isAllowed = False
+			else:
+				# No extension limitations
+				isAllowed = True
+
+			if (isAllowed):
+				if (self.isZope()):
+					# Upload into zope
+					self.zopeFileUpload(resourceType, currentFolder)
+				else:
+					# Upload to operating system
+					# Map the virtual path to the local server path
+					currentFolderPath = self.serverMapFolder(
+							resourceType,
+							currentFolder
+							)
+					i = 0
+					while (True):
+						newFilePath = "%s%s" % (
+								currentFolderPath,
+								newFileName
+								)
+						if os.path.exists(newFilePath):
+							i += 1
+							newFilePath = "%s%s(%s).%s" % (
+									currentFolderPath,
+									newFileNameOnly,
+									i,
+									newFileExtension
+									)
+							errorNo = 201
+							break
+						else:
+							fileHandle = open(newFilePath,'w')
+							linecount = 0
+							while (1):
+								#line = newFile.file.readline()
+								line = newFile.readline()
+								if not line: break
+								fileHandle.write("%s" % line)
+								linecount += 1
+							os.chmod(newFilePath, 0777)
+							break
+			else:
+				newFileName = "Extension not allowed"
+				errorNo = 203
+		else:
+			newFileName = "No File"
+			errorNo = 202
+
+		string = """
+<script type="text/javascript">
+window.parent.frames["frmUpload"].OnUploadCompleted(%s,"%s");
+</script>
+				""" % (
+						errorNo,
+						newFileName.replace('"',"'")
+						)
+		return string
+
+	def run(self):
+		s = ""
+		try:
+			# Check if this is disabled
+			if not(self.enabled):
+				return self.sendError(1, "This connector is disabled.  Please check the connector configurations and try again")
+			# Make sure we have valid inputs
+			if not(
+					(self.request.has_key("Command")) and
+					(self.request.has_key("Type")) and
+					(self.request.has_key("CurrentFolder"))
+					):
+				return
+			# Get command
+			command = self.request.get("Command", None)
+			# Get resource type
+			resourceType = self.request.get("Type", None)
+			# folder syntax must start and end with "/"
+			currentFolder = self.request.get("CurrentFolder", None)
+			if (currentFolder[-1] <> "/"):
+				currentFolder += "/"
+			if (currentFolder[0] <> "/"):
+				currentFolder = "/" + currentFolder
+			# Check for invalid paths
+			if (".." in currentFolder):
+				return self.sendError(102, "")
+			# File upload doesn't have to return XML, so intercept
+			# her:e
+			if (command == "FileUpload"):
+				return self.fileUpload(resourceType, currentFolder)
+			# Begin XML
+			s += self.createXmlHeader(command, resourceType, currentFolder)
+			# Execute the command
+			if (command == "GetFolders"):
+				f = self.getFolders
+			elif (command == "GetFoldersAndFiles"):
+				f = self.getFoldersAndFiles
+			elif (command == "CreateFolder"):
+				f = self.createFolder
+			else:
+				f = None
+			if (f is not None):
+				s += f(resourceType, currentFolder)
+			s += self.createXmlFooter()
+		except Exception, e:
+			s = "ERROR: %s" % e
+		return s
+
+# Running from command line
+if __name__ == '__main__':
+	# To test the output, uncomment the standard headers
+	#print "Content-Type: text/html"
+	#print ""
+	print getFCKeditorConnector()
+
+"""
+Running from zope, you will need to modify this connector.
+If you have uploaded the FCKeditor into Zope (like me), you need to
+move this connector out of Zope, and replace the "connector" with an
+alias as below.  The key to it is to pass the Zope context in, as
+we then have a like to the Zope context.
+
+## Script (Python) "connector.py"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=*args, **kws
+##title=ALIAS
+##
+import Products.connector as connector
+return connector.getFCKeditorConnector(context=context).run()
+"""
+
+
Index: /FCKeditor/trunk/editor/filemanager/connectors/test.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/test.html	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/test.html	(revision 413)
@@ -0,0 +1,177 @@
+<!--
+ * 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 ==
+ *
+ * Test page for the File Browser connectors.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>FCKeditor - Connectors Tests</title>
+	<script type="text/javascript">
+
+function BuildBaseUrl( command )
+{
+	var sUrl =
+		document.getElementById('cmbConnector').value +
+		'?Command=' + command +
+		'&Type=' + document.getElementById('cmbType').value +
+		'&CurrentFolder=' + encodeURIComponent(document.getElementById('txtFolder').value) ;
+
+	return sUrl ;
+}
+
+function SetFrameUrl( url )
+{
+	document.getElementById('eRunningFrame').src = url ;
+
+	document.getElementById('eUrl').innerHTML = url ;
+}
+
+function GetFolders()
+{
+	SetFrameUrl( BuildBaseUrl( 'GetFolders' ) ) ;
+	return false ;
+}
+
+function GetFoldersAndFiles()
+{
+	SetFrameUrl( BuildBaseUrl( 'GetFoldersAndFiles' ) ) ;
+	return false ;
+}
+
+function CreateFolder()
+{
+	var sFolder = prompt( 'Type the folder name:', 'Test Folder' ) ;
+
+	if ( ! sFolder )
+		return false ;
+
+	var sUrl = BuildBaseUrl( 'CreateFolder' ) ;
+	sUrl += '&NewFolderName=' + encodeURIComponent( sFolder ) ;
+
+	SetFrameUrl( sUrl ) ;
+	return false ;
+}
+
+function OnUploadCompleted( errorNumber, fileName )
+{
+	switch ( errorNumber )
+	{
+		case 0 :
+			alert( 'File uploaded with no errors' ) ;
+			break ;
+		case 201 :
+			GetFoldersAndFiles() ;
+			alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
+			break ;
+		case 202 :
+			alert( 'Invalid file' ) ;
+			break ;
+		default :
+			alert( 'Error on file upload. Error number: ' + errorNumber ) ;
+			break ;
+	}
+}
+
+this.frames.frmUpload = this ;
+
+function SetAction()
+{
+	var sUrl = BuildBaseUrl( 'FileUpload' ) ;
+	document.getElementById('eUrl').innerHTML = sUrl ;
+	document.getElementById('frmUpload').action = sUrl ;
+}
+
+	</script>
+</head>
+<body>
+	<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
+		<tr>
+			<td>
+				<table cellspacing="0" cellpadding="0" border="0">
+					<tr>
+						<td>
+							Connector:<br />
+							<select id="cmbConnector" name="cmbConnector">
+								<option value="asp/connector.asp" selected="selected">ASP</option>
+								<option value="aspx/connector.aspx">ASP.Net</option>
+								<option value="cfm/connector.cfm">ColdFusion</option>
+								<option value="lasso/connector.lasso">Lasso</option>
+								<option value="perl/connector.cgi">Perl</option>
+								<option value="php/connector.php">PHP</option>
+								<option value="py/connector.py">Python</option>
+							</select>
+						</td>
+						<td>
+							&nbsp;&nbsp;&nbsp;</td>
+						<td>
+							Current Folder<br />
+							<input id="txtFolder" type="text" value="/" name="txtFolder" /></td>
+						<td>
+							&nbsp;&nbsp;&nbsp;</td>
+						<td>
+							Resource Type<br />
+							<select id="cmbType" name="cmbType">
+								<option value="File" selected="selected">File</option>
+								<option value="Image">Image</option>
+								<option value="Flash">Flash</option>
+								<option value="Media">Media</option>
+								<option value="Invalid">Invalid Type (for testing)</option>
+							</select>
+						</td>
+					</tr>
+				</table>
+				<br />
+				<table cellspacing="0" cellpadding="0" border="0">
+					<tr>
+						<td valign="top">
+							<a href="#" onclick="GetFolders();">Get Folders</a></td>
+						<td>
+							&nbsp;&nbsp;&nbsp;</td>
+						<td valign="top">
+							<a href="#" onclick="GetFoldersAndFiles();">Get Folders and Files</a></td>
+						<td>
+							&nbsp;&nbsp;&nbsp;</td>
+						<td valign="top">
+							<a href="#" onclick="CreateFolder();">Create Folder</a></td>
+						<td>
+							&nbsp;&nbsp;&nbsp;</td>
+						<td valign="top">
+							<form id="frmUpload" action="" target="eRunningFrame" method="post" enctype="multipart/form-data">
+								File Upload<br />
+								<input id="txtFileUpload" type="file" name="NewFile" />
+								<input type="submit" value="Upload" onclick="SetAction();" />
+							</form>
+						</td>
+					</tr>
+				</table>
+				<br />
+				URL: <span id="eUrl"></span>
+			</td>
+		</tr>
+		<tr>
+			<td height="100%" valign="top">
+				<iframe id="eRunningFrame" src="javascript:void(0)" name="eRunningFrame" width="100%"
+					height="100%"></iframe>
+			</td>
+		</tr>
+	</table>
+</body>
+</html>
Index: /FCKeditor/trunk/editor/filemanager/connectors/uploadtest.html
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/uploadtest.html	(revision 413)
+++ /FCKeditor/trunk/editor/filemanager/connectors/uploadtest.html	(revision 413)
@@ -0,0 +1,134 @@
+<!--
+ * 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 ==
+ *
+ * Test page for the "File Uploaders".
+-->
+<html>
+	<head>
+		<title>FCKeditor - Uploaders Tests</title>
+		<script language="javascript">
+
+function SendFile()
+{
+	var sUploaderUrl = cmbUploaderUrl.value ;
+
+	if ( sUploaderUrl.length == 0 )
+		sUploaderUrl = txtCustomUrl.value ;
+
+	if ( sUploaderUrl.length == 0 )
+	{
+		alert( 'Please provide your custom URL or select a default one' ) ;
+		return ;
+	}
+
+	eURL.innerHTML = sUploaderUrl ;
+	txtUrl.value = '' ;
+
+	frmUpload.action = sUploaderUrl ;
+	frmUpload.submit() ;
+}
+
+function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
+{
+	switch ( errorNumber )
+	{
+		case 0 :	// No errors
+			txtUrl.value = fileUrl ;
+			alert( 'File uploaded with no errors' ) ;
+			break ;
+		case 1 :	// Custom error
+			alert( customMsg ) ;
+			break ;
+		case 10 :	// Custom warning
+			txtUrl.value = fileUrl ;
+			alert( customMsg ) ;
+			break ;
+		case 201 :
+			txtUrl.value = fileUrl ;
+			alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
+			break ;
+		case 202 :
+			alert( 'Invalid file' ) ;
+			break ;
+		case 203 :
+			alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
+			break ;
+		default :
+			alert( 'Error on file upload. Error number: ' + errorNumber ) ;
+			break ;
+	}
+}
+
+		</script>
+	</head>
+	<body>
+		<table cellSpacing="0" cellPadding="0" width="100%" border="0" height="100%">
+			<tr>
+				<td>
+					<table cellSpacing="0" cellPadding="0" width="100%" border="0">
+						<tr>
+							<td nowrap>
+								Select the "File Uploader" to use:<br>
+								<select id="cmbUploaderUrl">
+									<option selected value="asp/upload.asp">ASP</option>
+									<option value="aspx/upload.aspx">ASP.Net</option>
+									<option value="cfm/upload.cfm">ColdFusion</option>
+									<option value="lasso/upload.lasso">Lasso</option>
+									<option value="php/upload.php">PHP</option>
+									<option value="perl/upload.cgi">Perl</option>
+									<option value="">(Custom)</option>
+								</select>
+							</td>
+							<td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+							<td width="100%">
+								Custom Uploader URL:<BR>
+								<input id="txtCustomUrl" style="WIDTH: 100%; BACKGROUND-COLOR: #dcdcdc" disabled type="text">
+							</td>
+						</tr>
+					</table>
+					<br>
+					<table cellSpacing="0" cellPadding="0" width="100%" border="0">
+						<tr>
+							<td noWrap>
+								<form id="frmUpload" target="UploadWindow" enctype="multipart/form-data" action="" method="post">
+									Upload a new file:<br>
+									<input type="file" name="NewFile"><br>
+									<input type="button" value="Send it to the Server" onclick="SendFile();">
+								</form>
+							</td>
+							<td style="WIDTH: 16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+							<td vAlign="top" width="100%">
+								Uploaded File URL:<br>
+								<INPUT id="txtUrl" style="WIDTH: 100%" readonly type="text">
+							</td>
+						</tr>
+					</table>
+					<br>
+					Post URL: <span id="eURL">&nbsp;</span>
+				</td>
+			</tr>
+			<tr>
+				<td height="100%">
+					<iframe name="UploadWindow" width="100%" height="100%" src="javascript:void(0)"></iframe>
+				</td>
+			</tr>
+		</table>
+	</body>
+</html>
Index: /FCKeditor/trunk/fckconfig.js
===================================================================
--- /FCKeditor/trunk/fckconfig.js	(revision 412)
+++ /FCKeditor/trunk/fckconfig.js	(revision 413)
@@ -188,5 +188,5 @@
 // Custom implementations should just ignore it.
 var _FileBrowserLanguage	= 'asp' ;	// asp | aspx | cfm | lasso | perl | php | py
-var _QuickUploadLanguage	= 'asp' ;	// asp | aspx | cfm | lasso | php
+var _QuickUploadLanguage	= 'asp' ;	// asp | aspx | cfm | lasso | perl | php
 
 // @Packager.Remove.Start
@@ -201,30 +201,30 @@
 
 FCKConfig.LinkBrowser = true ;
-FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ;
+FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=../../connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ;
 FCKConfig.LinkBrowserWindowWidth	= FCKConfig.ScreenWidth * 0.7 ;		// 70%
 FCKConfig.LinkBrowserWindowHeight	= FCKConfig.ScreenHeight * 0.7 ;	// 70%
 
 FCKConfig.ImageBrowser = true ;
-FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector=connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ;
+FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector=../../connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ;
 FCKConfig.ImageBrowserWindowWidth  = FCKConfig.ScreenWidth * 0.7 ;	// 70% ;
 FCKConfig.ImageBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ;	// 70% ;
 
 FCKConfig.FlashBrowser = true ;
-FCKConfig.FlashBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ;
+FCKConfig.FlashBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Flash&Connector=../../connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ;
 FCKConfig.FlashBrowserWindowWidth  = FCKConfig.ScreenWidth * 0.7 ;	//70% ;
 FCKConfig.FlashBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ;	//70% ;
 
 FCKConfig.LinkUpload = true ;
-FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/upload/' + _QuickUploadLanguage + '/upload.' + _QuickUploadLanguage ;
+FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadLanguage ;
 FCKConfig.LinkUploadAllowedExtensions	= "" ;			// empty for all
 FCKConfig.LinkUploadDeniedExtensions	= ".(html|htm|php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|com|dll|vbs|js|reg|cgi|htaccess|asis|sh|shtml|shtm|phtm)$" ;	// empty for no one
 
 FCKConfig.ImageUpload = true ;
-FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/' + _QuickUploadLanguage + '/upload.' + _QuickUploadLanguage + '?Type=Image' ;
+FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadLanguage + '?Type=Image' ;
 FCKConfig.ImageUploadAllowedExtensions	= ".(jpg|gif|jpeg|png|bmp)$" ;		// empty for all
 FCKConfig.ImageUploadDeniedExtensions	= "" ;							// empty for no one
 
 FCKConfig.FlashUpload = true ;
-FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/upload/' + _QuickUploadLanguage + '/upload.' + _QuickUploadLanguage + '?Type=Flash' ;
+FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadLanguage + '?Type=Flash' ;
 FCKConfig.FlashUploadAllowedExtensions	= ".(swf|fla)$" ;		// empty for all
 FCKConfig.FlashUploadDeniedExtensions	= "" ;					// empty for no one
