Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_connector.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_connector.cfm	(revision 839)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_connector.cfm	(revision 842)
@@ -101,19 +101,21 @@
 	}
 
+	rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ;
 	xmlContent = ""; // append to this string to build content
 </cfscript>
+
+<cfset resourceTypeUrl = rereplace( replace( Config.FileTypesPath[url.type], fs, "/", "all"), "/$", "") >
 
 <cfif isDefined( "Config.FileTypesAbsolutePath" )
 		and structkeyexists( Config.FileTypesAbsolutePath, url.type )
 		and Len( Config.FileTypesAbsolutePath[url.type] )>
-			<cfset resourceTypeUrl = Config.FileTypesPath[url.type]>
+
 			<cfset userFilesServerPath = Config.FileTypesAbsolutePath[url.type] & url.currentFolder>
 <cfelse>
 	<cftry>
-	<cfset resourceTypeUrl = Config.FileTypesPath[url.type]>
 	<cfset userFilesServerPath = expandpath( resourceTypeUrl ) & url.currentFolder>
 	<!--- Catch: Parameter 1 of function ExpandPath must be a relative path --->
 	<cfcatch type="any">
-		<cfset userFilesServerPath = serverPath & Config.FileTypesPath[url.type] & url.currentFolder>
+		<cfset userFilesServerPath = rootPath & Config.FileTypesPath[url.type] & url.currentFolder>
 	</cfcatch>
 	</cftry>
@@ -132,11 +134,21 @@
 	<cfset xmlContent = "<Error number=""102"" />">
 
+<cfelseif isDefined("Config.ConfigAllowedCommands") and not ListFind(Config.ConfigAllowedCommands, url.command)>
+
+	<cfset xmlContent = '<Error number="1" text="The &quot;' & url.command & '&quot; command isn''t allowed" />'>
+
+<cfelseif isDefined("Config.ConfigAllowedTypes") and not ListFind(Config.ConfigAllowedTypes, url.type)>
+
+	<cfset xmlContent = '<Error number="1" text="The &quot;' & url.type & '&quot; type isn''t allowed" />'>
+
 </cfif>
 
-<cfif not len(xmlContent) and not directoryexists(userFilesServerPath)>
+<cfset resourceTypeDirectory = left( userFilesServerPath, Len(userFilesServerPath) - Len(url.currentFolder) )>
+
+<cfif not len(xmlContent) and not directoryexists(resourceTypeDirectory)>
 	<!--- create directories in physical path if they don't already exist --->
 	<cfset currentPath = "">
 	<cftry>
-		<cfloop list="#userFilesServerPath#" index="name" delimiters="#fs#">
+		<cfloop list="#resourceTypeDirectory#" index="name" delimiters="#fs#">
 			<cfif currentPath eq "" and fs eq "\">
 				<!--- Without checking this, we would have in Windows \C:\ --->
@@ -159,8 +171,9 @@
 	<cfcatch type="any">
 
-	<!--- this should only occur as a result of a permissions problem --->
-	<cfset xmlContent = "<Error number=""103"" />">
+		<!--- this should only occur as a result of a permissions problem --->
+		<cfset xmlContent = "<Error number=""103"" />">
 
 	</cfcatch>
+
 	</cftry>
 </cfif>
@@ -174,5 +187,4 @@
 
 	<cfswitch expression="#url.command#">
-
 
 		<cfcase value="FileUpload">
@@ -284,14 +296,9 @@
 		</cfcase>
 
-
 		<cfdefaultcase>
-
 			<cfthrow type="fckeditor.connector" message="Illegal command: #url.command#">
-
 		</cfdefaultcase>
 
-
 	</cfswitch>
-
 </cfif>
 
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_upload.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_upload.cfm	(revision 839)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_upload.cfm	(revision 842)
@@ -58,4 +58,18 @@
 </cfif>
 
+<cfif isDefined("Config.ConfigAllowedCommands") and not ListFind(Config.ConfigAllowedCommands, url.command)>
+	<cfset SendUploadResults(1, "", "", "The """ & url.command & """ command isn't allowed")>
+	<cfabort>
+</cfif>
+
+<cfif isDefined("Config.ConfigAllowedTypes") and not ListFind(Config.ConfigAllowedTypes, url.type)>
+	<cfset SendUploadResults(1, "", "", "The """ & url.type &  """ type isn't allowed")>
+	<cfabort>
+</cfif>
+
+<cfif find( "..", url.currentFolder)>
+	<cfset SendUploadResults(102)>
+	<cfabort>
+</cfif>
 
 <cfscript>
@@ -105,35 +119,33 @@
 	}
 
+	rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ;
 </cfscript>
-
 <cfif url.command eq "QuickUpload">
+	<cfset resourceTypeUrl = rereplace( replace( Config.QuickUploadPath[url.type], fs, "/", "all"), "/$", "") >
 	<cfif isDefined( "Config.QuickUploadAbsolutePath" )
 			and structkeyexists( Config.QuickUploadAbsolutePath, url.type )
 			and Len( Config.QuickUploadAbsolutePath[url.type] )>
-				<cfset resourceTypeUrl = Config.QuickUploadPath[url.type]>
 				<cfset userFilesServerPath = Config.QuickUploadAbsolutePath[url.type] & url.currentFolder>
 	<cfelse>
 		<cftry>
-		<cfset resourceTypeUrl = Config.QuickUploadPath[url.type]>
 		<cfset userFilesServerPath = expandpath( resourceTypeUrl ) & url.currentFolder>
 		<!--- Catch: Parameter 1 of function ExpandPath must be a relative path --->
 		<cfcatch type="any">
-			<cfset userFilesServerPath = serverPath & Config.QuickUploadPath[url.type] & url.currentFolder>
+			<cfset userFilesServerPath = rootPath & Config.QuickUploadPath[url.type] & url.currentFolder>
 		</cfcatch>
 		</cftry>
 	</cfif>
 <cfelse>
+	<cfset resourceTypeUrl = rereplace( replace( Config.FileTypesPath[url.type], fs, "/", "all"), "/$", "") >
 	<cfif isDefined( "Config.FileTypesAbsolutePath" )
 			and structkeyexists( Config.FileTypesAbsolutePath, url.type )
 			and Len( Config.FileTypesAbsolutePath[url.type] )>
-				<cfset resourceTypeUrl = Config.FileTypesPath[url.type]>
 				<cfset userFilesServerPath = Config.FileTypesAbsolutePath[url.type] & url.currentFolder>
 	<cfelse>
 		<cftry>
-		<cfset resourceTypeUrl = Config.FileTypesPath[url.type]>
 		<cfset userFilesServerPath = expandpath( resourceTypeUrl ) & url.currentFolder>
 		<!--- Catch: Parameter 1 of function ExpandPath must be a relative path --->
 		<cfcatch type="any">
-			<cfset userFilesServerPath = serverPath & Config.FileTypesPath[url.type] & url.currentFolder>
+			<cfset userFilesServerPath = rootPath & Config.FileTypesPath[url.type] & url.currentFolder>
 		</cfcatch>
 		</cftry>
@@ -145,4 +157,41 @@
 <cfset userFilesServerPath = replace( userFilesServerPath, fs & fs, fs, "all") >
 
+<!--- create resource type directory if not exists --->
+<cfset resourceTypeDirectory = left( userFilesServerPath, Len(userFilesServerPath) - Len(url.currentFolder) )>
+
+<cfif not directoryexists( resourceTypeDirectory )>
+
+	<cfset currentPath = "">
+	<cftry>
+		<cfloop list="#resourceTypeDirectory#" index="name" delimiters="#fs#">
+			<cfif currentPath eq "" and fs eq "\">
+				<!--- Without checking this, we would have in Windows \C:\ --->
+				<cfif not directoryExists(name)>
+					<cfdirectory action="create" directory="#name#" mode="755">
+				</cfif>
+			<cfelse>
+				<cfif not directoryExists(currentPath & fs & name)>
+					<cfdirectory action="create" directory="#currentPath##fs##name#" mode="755">
+				</cfif>
+			</cfif>
+
+			<cfif fs eq "\" and currentPath eq "">
+				<cfset currentPath = name>
+			<cfelse>
+				<cfset currentPath = currentPath & fs & name>
+			</cfif>
+		</cfloop>
+
+	<cfcatch type="any">
+
+		<!--- this should only occur as a result of a permissions problem --->
+		<cfset SendUploadResults(103)>
+		<cfabort>
+
+	</cfcatch>
+
+	</cftry>
+</cfif>
+
 <cfset currentFolderPath = userFilesServerPath>
 <cfset resourceType = url.type>
@@ -155,5 +204,4 @@
 
 <cftry>
-
 	<!--- first upload the file with an unique filename --->
 	<cffile action="upload"
@@ -181,6 +229,7 @@
 		<cfscript>
 		errorNumber = 0;
-		fileName = cffile.ClientFileName;
-		fileExt = cffile.ServerFileExt;
+		fileName = cffile.ClientFileName ;
+		fileExt = cffile.ServerFileExt ;
+		fileExisted = false ;
 
 		// munge filename for html download. Only a-z, 0-9, _, - and . are allowed
@@ -192,4 +241,8 @@
 		}
 
+		// remove additional dots from file name
+		if( isDefined("Config.ForceSingleExtension") and Config.ForceSingleExtension )
+			fileName = replace( fileName, '.', "_", "all" ) ;
+
 		// When the original filename already exists, add numbers (0), (1), (2), ... at the end of the filename.
 		if( compare( cffile.ServerFileName, fileName ) ) {
@@ -197,6 +250,7 @@
 			tmpFileName = fileName;
 			while( fileExists("#currentFolderPath##fileName#.#fileExt#") ) {
-				counter = counter + 1;
-				fileName = tmpFileName & '(#counter#)';
+				fileExisted = true ;
+				counter = counter + 1 ;
+				fileName = tmpFileName & '(#counter#)' ;
 			}
 		}
@@ -206,5 +260,7 @@
 		<cfif compare(cffile.ServerFileName,fileName)>
 
-			<cfset errorNumber = "201">
+			<cfif fileExisted>
+				<cfset errorNumber = "201">
+			</cfif>
 			<cffile
 				action="rename"
@@ -224,15 +280,13 @@
 
 	</cfcatch>
-
 </cftry>
-
 
 <cfif errorNumber EQ 0>
 	<!--- file was uploaded succesfully --->
-	<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##fileName#.#fileExt#', "", "")>
+	<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##url.currentFolder##fileName#.#fileExt#', "", "")>
 	<cfabort>
 <cfelseif errorNumber EQ 201>
 	<!--- file was changed (201), submit the new filename --->
-	<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##fileName#.#fileExt#', replace( fileName & "." & fileExt, "'", "\'", "ALL"), customMsg)>
+	<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##url.currentFolder##fileName#.#fileExt#', replace( fileName & "." & fileExt, "'", "\'", "ALL"), customMsg)>
 	<cfabort>
 <cfelse>
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_commands.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_commands.cfm	(revision 839)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_commands.cfm	(revision 842)
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/config.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/config.cfm	(revision 839)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/config.cfm	(revision 842)
@@ -40,5 +40,4 @@
 	// Due to security issues with Apache modules, it is reccomended to leave the
 	// following setting enabled.
-	// (This feature works in MX 6.0 and above)
 	Config.ForceSingleExtension = true ;
 
@@ -53,9 +52,7 @@
 
 	// What the user can do with this connector
-	// (This feature works in MX 6.0 and above)
 	Config.ConfigAllowedCommands 			= "QuickUpload,FileUpload,GetFolders,GetFoldersAndFiles,CreateFolder" ;
 
 	//Allowed Resource Types
-	// (This feature works in MX 6.0 and above)
 	Config.ConfigAllowedTypes 				= "File,Image,Flash,Media" ;
 
@@ -64,8 +61,6 @@
 //	- AllowedExtensions: the possible extensions that can be allowed.
 //		If it is empty then any file type can be uploaded.
-//		(This feature works in MX 6.0 and above)
 //	- DeniedExtensions: The extensions that won't be allowed.
 //		If it is empty then no restrictions are done here.
-//		(This feature works in MX 6.0 and above)
 //
 //	For a file to be uploaded it has to fullfil both the AllowedExtensions
