Index: FCKeditor/trunk/editor/filemanager/connectors/asp/basexml.asp
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/asp/basexml.asp	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/asp/basexml.asp	(revision 3815)
@@ -57,5 +57,9 @@
 	Response.Write "<?xml version=""1.0"" encoding=""utf-8"" ?>"
 
+	If text <> "" then
 	Response.Write "<Connector><Error number=""" & number & """ text=""" & Server.HTMLEncode( text ) & """ /></Connector>"
+	else
+	Response.Write "<Connector><Error number=""" & number & """ /></Connector>"
+	end if
 
 	Response.End
Index: FCKeditor/trunk/editor/filemanager/connectors/asp/commands.asp
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/asp/commands.asp	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/asp/commands.asp	(revision 3815)
@@ -131,5 +131,5 @@
 
 	' Create the "Error" node.
-	Response.Write "<Error number=""" & sErrorNumber & """ originalNumber=""" & iErrNumber & """ originalDescription=""" & ConvertToXmlAttribute( sErrDescription ) & """ />"
+	Response.Write "<Error number=""" & sErrorNumber & """ />"
 End Sub
 
@@ -193,5 +193,9 @@
 	sFileUrl = CombinePaths( sFileUrl, sFileName )
 
-	SendUploadResults sErrorNumber, sFileUrl, sFileName, ""
+	If ( sErrorNumber = "0" or sErrorNumber = "201" ) then
+		SendUploadResults sErrorNumber, sFileUrl, sFileName, ""
+	Else
+		SendUploadResults sErrorNumber, "", "", ""
+	End If
 End Sub
 
Index: FCKeditor/trunk/editor/filemanager/connectors/asp/connector.asp
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/asp/connector.asp	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/asp/connector.asp	(revision 3815)
@@ -58,5 +58,5 @@
 	' Check if it is an allowed resource type.
 	if ( Not IsAllowedType( sResourceType ) ) Then
-		SendError 1, "The """ & sResourceType & """ resource type isn't allowed"
+		SendError 1, "Invalid type specified"
 	end if
 
Index: FCKeditor/trunk/editor/filemanager/connectors/asp/io.asp
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/asp/io.asp	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/asp/io.asp	(revision 3815)
@@ -176,4 +176,6 @@
 function GetCurrentFolder()
 	dim sCurrentFolder
+	dim oRegex
+
 	sCurrentFolder = Request.QueryString("CurrentFolder")
 	If ( sCurrentFolder = "" ) Then sCurrentFolder = "/"
@@ -185,4 +187,12 @@
 	' Check for invalid folder paths (..)
 	If ( InStr( 1, sCurrentFolder, ".." ) <> 0 OR InStr( 1, sCurrentFolder, "\" ) <> 0) Then
+		SendError 102, ""
+	End If
+
+	Set oRegex = New RegExp
+	oRegex.Global		= True
+	oRegex.Pattern = "(/\.)|(//)|([\\:\*\?\""\<\>\|]|[\u0000-\u001F]|\u007F)"
+
+	if (oRegex.Test(sCurrentFolder)) Then
 		SendError 102, ""
 	End If
Index: FCKeditor/trunk/editor/filemanager/connectors/asp/upload.asp
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/asp/upload.asp	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/asp/upload.asp	(revision 3815)
@@ -49,5 +49,5 @@
 	If ( sResourceType = "" ) Then sResourceType = "File"
 
-	sCurrentFolder = GetCurrentFolder()
+	sCurrentFolder = "/"
 
 	' Is Upload enabled?
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_connector.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_connector.cfm	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_connector.cfm	(revision 3815)
@@ -103,6 +103,31 @@
 	rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ;
 	xmlContent = ""; // append to this string to build content
+	invalidName = false;
 </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) or find("\",url.currentFolder) or REFind('(/\.)|(//)|[[:cntrl:]]|([\\:\*\?\"<>])', url.currentFolder)>
+
+	<cfset invalidName = true>
+	<cfset xmlContent = "<Error number=""102"" />">
+
+<cfelseif isDefined("Config.ConfigAllowedCommands") and not ListFind(Config.ConfigAllowedCommands, url.command)>
+
+	<cfset invalidName = true>
+	<cfset xmlContent = '<Error number="1" text="The &quot;' & HTMLEditFormat(url.command) & '&quot; command isn''t allowed" />'>
+
+<cfelseif isDefined("Config.ConfigAllowedTypes") and not ListFind(Config.ConfigAllowedTypes, url.type)>
+
+	<cfset invalidName = true>
+	<cfset xmlContent = '<Error number="1" text="Invalid type specified" />'>
+
+</cfif>
+
+<cfset resourceTypeUrl = "">
+<cfif not len(xmlContent)>
 <cfset resourceTypeUrl = rereplace( replace( Config.FileTypesPath[url.type], fs, "/", "all"), "/$", "") >
 
@@ -126,23 +151,6 @@
 <cfset userFilesServerPath = replace( userFilesServerPath, fs & fs, fs, "all") >
 
-<cfif not config.enabled>
-
-	<cfset xmlContent = "<Error number=""1"" text=""This connector is disabled. Please check the 'editor/filemanager/connectors/cfm/config.cfm' file"" />">
-
-<cfelseif find("..",url.currentFolder) or find("\",url.currentFolder)>
-
-	<cfset xmlContent = "<Error number=""102"" />">
-
-<cfelseif isDefined("Config.ConfigAllowedCommands") and not ListFind(Config.ConfigAllowedCommands, url.command)>
-
-	<cfset xmlContent = '<Error number="1" text="The &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>
-
 <cfset resourceTypeDirectory = left( userFilesServerPath, Len(userFilesServerPath) - Len(url.currentFolder) )>
+</cfif>
 
 <cfif not len(xmlContent) and not directoryexists(resourceTypeDirectory)>
@@ -264,4 +272,5 @@
 					newFolderName = reReplace(newFolderName, "([^_]+)_+$", "\1", "all");
 					newFolderName = reReplace(newFolderName, "$_([^_]+)$", "\1", "all");
+					newFolderName = reReplace(newFolderName, '\.+', "_", "all" );
 				}
 			</cfscript>
@@ -272,5 +281,5 @@
 				<cfset errorNumber = 101>
 			<cfelseif reFind("^\.\.",newFolderName)>
-				<cfset errorNumber = 103>
+				<cfset errorNumber = 102>
 			<cfelse>
 				<cfset errorNumber = 0>
@@ -304,6 +313,12 @@
 
 <cfscript>
-	xmlHeader = '<?xml version="1.0" encoding="utf-8" ?><Connector command="#url.command#" resourceType="#url.type#">';
-	xmlHeader = xmlHeader & '<CurrentFolder path="#url.currentFolder#" url="#resourceTypeUrl##url.currentFolder#" />';
+	xmlHeader = '<?xml version="1.0" encoding="utf-8" ?>';
+	if (invalidName) {
+		xmlHeader = xmlHeader & '<Connector>';
+	}
+	else {
+		xmlHeader = xmlHeader & '<Connector command="#url.command#" resourceType="#url.type#">';
+		xmlHeader = xmlHeader & '<CurrentFolder path="#url.currentFolder#" url="#resourceTypeUrl##url.currentFolder#" />';
+	}
 	xmlFooter = '</Connector>';
 </cfscript>
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_upload.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_upload.cfm	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/cf5_upload.cfm	(revision 3815)
@@ -40,4 +40,8 @@
 <cfparam name="url.currentFolder" default="/">
 
+<cfif url.command eq "QuickUpload">
+	<cfset url.currentFolder = "/">
+</cfif>
+
 <cfif not isDefined("config_included")>
 	<cfinclude template="config.cfm">
@@ -75,4 +79,10 @@
 	<cfabort>
 </cfif>
+
+<cfif REFind('(/\.)|(//)|[[:cntrl:]]|([\\:\*\?\"<>])', url.currentFolder)>
+	<cfset SendUploadResults(102)>
+	<cfabort>
+</cfif>
+
 
 <cfscript>
@@ -139,5 +149,5 @@
 		</cftry>
 	</cfif>
-<cfelse>
+<cfelseif url.command eq "FileUpload">
 	<cfset resourceTypeUrl = rereplace( replace( Config.FileTypesPath[url.type], fs, "/", "all"), "/$", "") >
 	<cfif isDefined( "Config.FileTypesAbsolutePath" )
@@ -287,5 +297,5 @@
 <cfif errorNumber EQ 0>
 	<!--- file was uploaded succesfully --->
-	<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##url.currentFolder##fileName#.#fileExt#', "", "")>
+	<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##url.currentFolder##fileName#.#fileExt#', replace( fileName & "." & fileExt, "'", "\'", "ALL"), "")>
 	<cfabort>
 <cfelseif errorNumber EQ 201>
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_basexml.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_basexml.cfm	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_basexml.cfm	(revision 3815)
@@ -65,4 +65,8 @@
 	<cfargument name="number" required="true" type="Numeric">
 	<cfargument name="text" required="true">
-	<cfoutput><Error number="#ARGUMENTS.number#" text="#htmleditformat(ARGUMENTS.text)#" /></cfoutput>
+	<cfif Len(ARGUMENTS.text)>
+		<cfoutput><Error number="#ARGUMENTS.number#" text="#htmleditformat(ARGUMENTS.text)#" /></cfoutput>
+	<cfelse>
+		<cfoutput><Error number="#ARGUMENTS.number#" /></cfoutput>
+	</cfif>
 </cffunction>
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_commands.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_commands.cfm	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_commands.cfm	(revision 3815)
@@ -36,5 +36,5 @@
 	<cfset var sTempFilePath = "">
 	<cfset var errorNumber = 0>
-	<cfset var customMsg = 0>
+	<cfset var customMsg = "">
 	<cfset var counter = 0>
 	<cfset var destination = "">
@@ -227,4 +227,4 @@
 	</cfif>
 
-	<cfoutput><Error number="#errorNumber#" originalDescription="#HTMLEditFormat(sErrorMsg)#" /></cfoutput>
-</cffunction>
+	<cfoutput><Error number="#errorNumber#" /></cfoutput>
+</cffunction>
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_io.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_io.cfm	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_io.cfm	(revision 3815)
@@ -194,6 +194,10 @@
 	<cfset sCurrentFolder = rereplace( sCurrentFolder, "//+", "/", "all" )>
 
-	<cfif find( "..", sCurrentFolder) or find( "\", sCurrentFolder) >
-		<cfset SendError( 102, "" )>
+	<cfif find( "..", sCurrentFolder) or find( "\", sCurrentFolder) or REFind('(/\.)|(//)|[[:cntrl:]]|([\\:\*\?\"<>])', sCurrentFolder)>
+		<cfif URL.Command eq "FileUpload" or URL.Command eq "QuickUpload">
+			<cfset SendUploadResults( 102, "", "", "") >
+		<cfelse>
+			<cfset SendError( 102, "" )>
+		</cfif>
 	</cfif>
 
@@ -266,4 +270,8 @@
 	<cfargument name="customMsg" required="false" type="String" default="">
 
+	<cfif errorNumber and errorNumber neq 201>
+		<cfset fileUrl = "">
+		<cfset fileName = "">
+	</cfif>
 	<!--- Minified version of the document.domain automatic fix script (#1919).
 	The original script can be found at _dev/domain_fix_template.js --->
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_upload.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_upload.cfm	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/cf_upload.cfm	(revision 3815)
@@ -25,5 +25,4 @@
 
 <cfparam name="url.type" default="File">
-<cfparam name="url.currentFolder" default="/">
 
 <!--- note: no serverPath url parameter - see config.cfm if you need to set the serverPath manually --->
@@ -37,5 +36,5 @@
 	<cfargument name="number" required="true" type="Numeric">
 	<cfargument name="text" required="true">
-	<cfreturn SendUploadResults( "#ARGUMENTS.number#", "", "", "ARGUMENTS.text" )>
+	<cfreturn SendUploadResults( "#ARGUMENTS.number#", "", "", "#ARGUMENTS.text#" )>
 </cffunction>
 
@@ -58,5 +57,5 @@
 </cfif>
 
-<cfset sCurrentFolder = GetCurrentFolder()>
+<cfset sCurrentFolder = "/">
 
 <!--- Is enabled the upload? --->
Index: FCKeditor/trunk/editor/filemanager/connectors/cfm/config.cfm
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/cfm/config.cfm	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/cfm/config.cfm	(revision 3815)
@@ -28,9 +28,4 @@
 	// SECURITY: You must explicitly enable this "connector". (Set enabled to "true")
 	Config.Enabled = false ;
-
-	// @Packager.Remove.Start
-	// Attention: In the development version (SVN) the ColdFusion connector is enabled by default.
-	Config.Enabled = true ;
-	// @Packager.Remove.End
 
 	// Path to uploaded files relative to the document root.
Index: FCKeditor/trunk/editor/filemanager/connectors/lasso/connector.lasso
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/lasso/connector.lasso	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/lasso/connector.lasso	(revision 3815)
@@ -39,6 +39,6 @@
     */
 	var(
-		'Command'		=	action_param('Command'),
-		'Type'			=	action_param('Type'),
+		'Command'		=	(Encode_HTML: action_param('Command')),
+		'Type'			=	(Encode_HTML: action_param('Type')),
 		'CurrentFolder'	=	action_param('CurrentFolder'),
 		'ServerPath'	=	action_param('ServerPath'),
@@ -71,43 +71,14 @@
 		$__html_reply__ = '\
 <script type="text/javascript">
-(function()
-{
-	var d = document.domain ;
-
-	while ( true )
-	{
-		// Test if we can access a parent property.
-		try
-		{
-			var test = window.top.opener.document.domain ;
-			break ;
-		}
-		catch( e ) {}
-
-		// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
-		d = d.replace( /.*?(?:\\.|$)/, "" ) ;
-
-		if ( d.length == 0 )
-			break ;		// It was not able to detect the domain.
-
-		try
-		{
-			document.domain = d ;
-		}
-		catch (e)
-		{
-			break ;
-		}
-	}
-})() ;
+(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,\'\');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();
 ';
 			if($uploadResult == '0' || $uploadResult == '201');
 			$__html_reply__ = $__html_reply__ + '\
-	window.parent.OnUploadCompleted(' + $uploadResult + ',\'' + $NewFilePath + '\',\'' + $NewFilePath->split('/')->last + '\');
+	window.parent.OnUploadCompleted(' + $uploadResult + ',"' + $NewFilePath + '","' + $NewFilePath->split('/')->last + '");
 </script>
 			';
 			else;
 			$__html_reply__ = $__html_reply__ + '\
-	window.parent.OnUploadCompleted(' + $uploadResult + ');
+	window.parent.OnUploadCompleted(' + $uploadResult + ',"","");
 </script>
 			';
@@ -126,5 +97,18 @@
 	);
 
-	if($CurrentFolder->(Find: '..') || $CurrentFolder->(Find: '\\'));
+	$currentFolderURL = string_replace($currentFolderURL, -find='//', -replace='/');
+
+	if (!$config->find('Subdirectories')->find(action_param('Type')));
+		if($Command == 'FileUpload');
+			$responseType = 'html';
+			$uploadResult = '1';
+			fck_htmlreply(
+				-uploadResult=$uploadResult
+			);
+		else;
+			$errorNumber = 1;
+			$commandData += '<Error number="' + $errorNumber + '" text="Invalid type specified" />\n';
+		/if;
+	else if($CurrentFolder->(Find: '..') || (String_FindRegExp: $CurrentFolder, -Find='(/\\.)|(//)|[\\\\:\\*\\?\\""\\<\\>\\|]|\\000|[\u007F]|[\u0001-\u001F]'));
 		if($Command == 'FileUpload');
 			$responseType = 'html';
@@ -143,5 +127,6 @@
     entire process in an inline for file tag permissions.
     */
-	inline($connection);
+		if($config->find('Enabled'));
+		inline($connection);
 		select($Command);
             /*.............................................................
@@ -167,5 +152,11 @@
 						$folders += '\t\t<Folder name="' + #this->removetrailing('/')& + '" />\n';
 					else;
-						local('size') = file_getsize($currentFolderURL + #this) / 1024;
+						local('size') = file_getsize($currentFolderURL + #this);
+						if($size>0);
+							$size = $size/1024;
+							if ($size==0);
+								$size = 1;
+							/if;
+						/if;
 						$files += '\t\t<File name="' + #this + '" size="' + #size + '" />\n';
 					/if;
@@ -182,5 +173,5 @@
             */
 			case('CreateFolder');
-				$NewFolderName = (String_ReplaceRegExp: $NewFolderName, -find='\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>', -replace='_');
+				$NewFolderName = (String_ReplaceRegExp: $NewFolderName, -find='\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|\\000|[\u007F]|[\u0001-\u001F]', -replace='_');
 				var('newFolder' = $currentFolderURL + $NewFolderName + '/');
 				file_create($newFolder);
@@ -234,9 +225,10 @@
                     */
 					$NewFileName = $NewFile->find('OrigName');
-					$NewFileName = (String_ReplaceRegExp: $NewFileName, -find='\\\\|\\/|\\||\\:|\\?|\\*|"|<|>', -replace='_');
+					$NewFileName = (String_ReplaceRegExp: $NewFileName, -find='\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|\\000|[\u007F]|[\u0001-\u001F]', -replace='_');
+					$NewFileName = (String_ReplaceRegExp: $NewFileName, -find='\\.(?![^.]*$)', -replace='_');
 					$OrigFilePath = $currentFolderURL + $NewFileName;
 					$NewFilePath = $OrigFilePath;
 					local('fileExtension') = '.' + $NewFile->find('OrigExtension');
-					#fileExtension = (String_ReplaceRegExp: #fileExtension, -find='\\\\|\\/|\\||\\:|\\?|\\*|"|<|>', -replace='_');
+					#fileExtension = (String_ReplaceRegExp: #fileExtension, -find='\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|\\000|[\u007F]|[\u0001-\u001F]', -replace='_');
 					local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&;
 
@@ -245,5 +237,9 @@
                     Make sure the file extension is allowed.
                     */
-					if($config->find('DeniedExtensions')->find($Type) >> $NewFile->find('OrigExtension'));
+					local('allowedExt') = $config->find('AllowedExtensions')->find($Type);
+					local('deniedExt') = $config->find('DeniedExtensions')->find($Type);
+					if($allowedExt->Size > 0 && $allowedExt !>> $NewFile->find('OrigExtension'));
+						$uploadResult = '202';
+					else($deniedExt->Size > 0 && $deniedExt >> $NewFile->find('OrigExtension'));
 						$uploadResult = '202';
 					else;
@@ -278,6 +274,13 @@
 					-NewFilePath=$NewFilePath
 				);
+			case;
+				$errorNumber = 1;
+				$commandData += '<Error number="' + $errorNumber + '" text="Command isn\'t allowed" />\n';
 		/select;
-	/inline;
+		/inline;
+		else;
+			$errorNumber = 1;
+			$commandData += '<Error number="' + $errorNumber + '" text="This file uploader is disabled. Please check the editor/filemanager/upload/lasso/config.lasso file." />\n';
+		/if;
 	/if;
 
@@ -310,9 +313,14 @@
 		*/
 		$__html_reply__ = '\
-<?xml version="1.0" encoding="utf-8" ?>
-<Connector command="' + $Command + '" resourceType="' + $Type + '">';
+<?xml version="1.0" encoding="utf-8" ?>';
 
 		if($errorNumber != '102');
-			$__html_reply__ += '<CurrentFolder path="' + $CurrentFolder + '" url="' + $currentFolderURL + '" />';
+			$__html_reply__ += '<Connector command="' + (Encode_HTML: $Command) + '" resourceType="' + (Encode_HTML: $Type) + '">';
+		else;
+			$__html_reply__ += '<Connector>';
+		/if;
+
+		if($errorNumber != '102');
+			$__html_reply__ += '<CurrentFolder path="' + (Encode_HTML: $CurrentFolder) + '" url="' + (Encode_HTML: $currentFolderURL) + '" />';
 		/if;
 
Index: FCKeditor/trunk/editor/filemanager/connectors/lasso/upload.lasso
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/lasso/upload.lasso	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/lasso/upload.lasso	(revision 3815)
@@ -33,6 +33,6 @@
     */
 	var(
-		'Type'			=	action_param('Type'),
-		'CurrentFolder'	=	action_param('CurrentFolder'),
+		'Type'			=	(Encode_HTML: action_param('Type')),
+		'CurrentFolder'	=	"/",
 		'ServerPath'	=	action_param('ServerPath'),
 		'NewFile'		=	null,
@@ -54,6 +54,8 @@
 	var('currentFolderURL' = $ServerPath
 		+ $config->find('Subdirectories')->find(action_param('Type'))
-		+ action_param('CurrentFolder')
+		+ $CurrentFolder
 	);
+
+	$currentFolderURL = string_replace($currentFolderURL, -find='//', -replace='/');
 
 	/*.....................................................................
@@ -85,12 +87,12 @@
 		$__html_reply__ = $__html_reply__ + '\
 	window.parent.OnUploadCompleted(' + #errorNumber + ',"'
-		+ string_replace(#fileUrl, -find='"', -replace='\\"') + '","'
-		+ string_replace(#fileName, -find='"', -replace='\\"') + '","'
-		+ string_replace(#customMsg, -find='"', -replace='\\"') + '");
+		+ string_replace((Encode_HTML: #fileUrl), -find='"', -replace='\\"') + '","'
+		+ string_replace((Encode_HTML: #fileUrl->split('/')->last), -find='"', -replace='\\"') + '","'
+		+ string_replace((Encode_HTML: #customMsg), -find='"', -replace='\\"') + '");
 </script>
 		';
 	/define_tag;
 
-	if($CurrentFolder->(Find: '..') || $CurrentFolder->(Find: '\\'));
+	if($CurrentFolder->(Find: '..') || (String_FindRegExp: $CurrentFolder, -Find='(/\\.)|(//)|[\\\\:\\*\\?\\""\\<\\>\\|]|\\000|[\u007F]|[\u0001-\u001F]'));
 		$errorNumber = 102;
 	/if;
@@ -115,4 +117,6 @@
 				*/
 				$NewFileName = $NewFile->find('OrigName');
+				$NewFileName = (String_ReplaceRegExp: $NewFileName, -find='\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|\\000|[\u007F]|[\u0001-\u001F]', -replace='_');
+				$NewFileName = (String_ReplaceRegExp: $NewFileName, -find='\\.(?![^.]*$)', -replace='_');
 				$OrigFilePath = $currentFolderURL + $NewFileName;
 				$NewFilePath = $OrigFilePath;
@@ -125,5 +129,9 @@
 				*/
 
-				if($config->find('DeniedExtensions')->find($Type) >> $NewFile->find('OrigExtension'));
+				local('allowedExt') = $config->find('AllowedExtensions')->find($Type);
+				local('deniedExt') = $config->find('DeniedExtensions')->find($Type);
+				if($allowedExt->Size > 0 && $allowedExt !>> $NewFile->find('OrigExtension'));
+					$errorNumber = 202;
+				else($deniedExt->Size > 0 && $deniedExt >> $NewFile->find('OrigExtension'));
 					$errorNumber = 202;
 				else;
@@ -154,4 +162,7 @@
 				/if;
 			/if;
+			if ($errorNumber != 0 && $errorNumber != 201);
+				$NewFilePath = "";
+			/if;
 		/inline;
 	else;
@@ -163,5 +174,4 @@
 		-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 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/perl/basexml.pl	(revision 3815)
@@ -56,5 +56,10 @@
 	print '<?xml version="1.0" encoding="utf-8" ?>' ;
 
-	print '<Connector><Error number="' . $number . '" text="' . &specialchar_cnv( $text ) . '" /></Connector>' ;
+	if ($text) {
+		print '<Connector><Error number="' . $number . '" text="' . &specialchar_cnv( $text ) . '" /></Connector>' ;
+	}
+	else {
+		print '<Connector><Error number="' . $number . '" /></Connector>' ;
+	}
 
 	exit ;
Index: FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/perl/commands.pl	(revision 3815)
@@ -113,5 +113,5 @@
 	# Create the "Error" node.
 	$cnv_errmsg = &ConvertToXmlAttribute($sErrorMsg);
-	print '<Error number="' . $sErrorNumber . '" originalDescription="' . $cnv_errmsg . '" />';
+	print '<Error number="' . $sErrorNumber . '" />';
 }
 
@@ -121,4 +121,5 @@
 
 	local($resourceType, $currentFolder) = @_;
+	$allowedExtensions = $allowedExtensions{$resourceType};
 
 	$sErrorNumber = '0' ;
@@ -131,4 +132,16 @@
 		$sFileName = $new_fname;
 		$sFileName =~ s/\\|\/|\||\:|\?|\*|\"|<|>|[[:cntrl:]]/_/g;
+		$sFileName =~ s/\.(?![^.]*$)/_/g;
+
+		$ext = '';
+		if($sFileName =~ /([^\\\/]*)\.(.*)$/) {
+			$ext  = $2;
+		}
+
+		$allowedRegex = qr/^($allowedExtensions)$/i;
+		if (!($ext =~ $allowedRegex)) {
+			SendUploadResults('202', '', '', '');
+		}
+
 		$sOriginalFileName = $sFileName;
 
@@ -162,5 +175,5 @@
 	$sFileName	=~ s/"/\\"/g;
 
-	SendUploadResults($sErrorNumber, $resourceType.$currentFolder.$sFileName, $sFileName, '');
+	SendUploadResults($sErrorNumber, $GLOBALS{'UserFilesPath'}.$resourceType.$currentFolder.$sFileName, $sFileName, '');
 }
 
Index: FCKeditor/trunk/editor/filemanager/connectors/perl/config.pl
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/perl/config.pl	(revision 3815)
+++ FCKeditor/trunk/editor/filemanager/connectors/perl/config.pl	(revision 3815)
@@ -0,0 +1,40 @@
+#####
+#  FCKeditor - The text editor for Internet - http://www.fckeditor.net
+#  Copyright (C) 2003-2009 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.
+#####
+
+##
+# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR.
+##
+&SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/perl/config.cgi" file' ) ;
+
+$GLOBALS{'UserFilesPath'} = '/userfiles/';
+
+# Map the "UserFiles" path to a local directory.
+$rootpath = &GetRootPath();
+$GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'};
+
+%allowedExtensions =  ("File", "7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip",
+"Image", "bmp|gif|jpeg|jpg|png",
+"Flash", "swf|flv",
+"Media", "aiff|asf|avi|bmp|fla|flv|gif|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|png|qt|ram|rm|rmi|rmvb|swf|tif|tiff|wav|wma|wmv"
+);
+
Index: FCKeditor/trunk/editor/filemanager/connectors/perl/connector.cgi
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/perl/connector.cgi	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/perl/connector.cgi	(revision 3815)
@@ -25,5 +25,5 @@
 
 ##
-# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file.
+# ATTENTION: To enable this connector, look for the "SECURITY" comment in config.pl.
 ##
 
@@ -59,26 +59,8 @@
 require 'commands.pl';
 require 'upload_fck.pl';
+require 'config.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();
+&read_input();
+&DoResponse();
 
 sub DoResponse
@@ -89,7 +71,15 @@
 	}
 	# Get the main request informaiton.
-	$sCommand		= $FORM{'Command'};
-	$sResourceType	= $FORM{'Type'};
+	$sCommand		= &specialchar_cnv($FORM{'Command'});
+	$sResourceType	= &specialchar_cnv($FORM{'Type'});
 	$sCurrentFolder	= $FORM{'CurrentFolder'};
+
+	if ( !($sCommand =~ /^(FileUpload|GetFolders|GetFoldersAndFiles|CreateFolder)$/) ) {
+		SendError( 1, "Command not allowed" ) ;
+	}
+
+	if ( !($sResourceType =~ /^(File|Image|Flash|Media)$/) ) {
+		SendError( 1, "Invalid type specified" ) ;
+	}
 
 	# Check the current folder syntax (must begin and start with a slash).
@@ -103,4 +93,7 @@
 	# Check for invalid folder paths (..)
 	if ( $sCurrentFolder =~ /(?:\.\.|\\)/ ) {
+		SendError( 102, "" ) ;
+	}
+	if ( $sCurrentFolder =~ /(\/\.)|[[:cntrl:]]|(\/\/)|(\\\\)|([\:\*\?\"\<\>\|])/ ) {
 		SendError( 102, "" ) ;
 	}
Index: FCKeditor/trunk/editor/filemanager/connectors/perl/upload.cgi
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/perl/upload.cgi	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/perl/upload.cgi	(revision 3815)
@@ -25,5 +25,5 @@
 
 ##
-# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file.
+# ATTENTION: To enable this connector, look for the "SECURITY" comment in config.pl.
 ##
 
@@ -59,52 +59,22 @@
 require 'commands.pl';
 require 'upload_fck.pl';
+require 'config.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();
+&read_input();
+&DoResponse();
 
 sub DoResponse
 {
 	# Get the main request information.
-	$sCommand		= 'FileUpload'; #$FORM{'Command'};
-	$sResourceType	= $FORM{'Type'};
-	$sCurrentFolder	= $FORM{'CurrentFolder'};
+	$sCommand		= 'FileUpload';
+	$sResourceType	= &specialchar_cnv($FORM{'Type'});
+	$sCurrentFolder	= "/";
 
 	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, "" ) ;
+	if ( !($sResourceType =~ /^(File|Image|Flash|Media)$/) ) {
+		SendError( 1, "Invalid type specified" ) ;
 	}
 
Index: FCKeditor/trunk/editor/filemanager/connectors/perl/util.pl
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/perl/util.pl	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/perl/util.pl	(revision 3815)
@@ -41,7 +41,5 @@
 {
 	local($value) = @_;
-	return $value;
-#	return utf8_encode(htmlspecialchars($value));
-
+	return(&specialchar_cnv($value));
 }
 
Index: FCKeditor/trunk/editor/filemanager/connectors/php/basexml.php
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/php/basexml.php	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/php/basexml.php	(revision 3815)
@@ -66,4 +66,7 @@
 function SendError( $number, $text )
 {
+	if ( $_GET['Command'] == 'FileUpload' )
+		SendUploadResults( $number, "", "", $text ) ;
+
 	if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
 	{
@@ -89,5 +92,8 @@
 function SendErrorNode(  $number, $text )
 {
-	echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;
+	if ($text)
+		echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;
+	else
+		echo '<Error number="' . $number . '" />' ;
 }
 ?>
Index: FCKeditor/trunk/editor/filemanager/connectors/php/commands.php
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/php/commands.php	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/php/commands.php	(revision 3815)
@@ -31,13 +31,15 @@
 	$aFolders	= array() ;
 
-	$oCurrentFolder = opendir( $sServerDir ) ;
-
-	while ( $sFile = readdir( $oCurrentFolder ) )
-	{
-		if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
-			$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
-	}
-
-	closedir( $oCurrentFolder ) ;
+	$oCurrentFolder = @opendir( $sServerDir ) ;
+
+	if ($oCurrentFolder !== false)
+	{
+		while ( $sFile = readdir( $oCurrentFolder ) )
+		{
+			if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
+				$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
+		}
+		closedir( $oCurrentFolder ) ;
+	}
 
 	// Open the "Folders" node.
@@ -61,27 +63,32 @@
 	$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 ) {
-					$iFileSize = 0 ;
-				}
-				if ( $iFileSize > 0 )
-				{
-					$iFileSize = round( $iFileSize / 1024 ) ;
-					if ( $iFileSize < 1 ) $iFileSize = 1 ;
-				}
-
-				$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
-			}
-		}
+	$oCurrentFolder = @opendir( $sServerDir ) ;
+
+	if ($oCurrentFolder !== false)
+	{
+		while ( $sFile = readdir( $oCurrentFolder ) )
+		{
+			if ( $sFile != '.' && $sFile != '..' )
+			{
+				if ( is_dir( $sServerDir . $sFile ) )
+					$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
+				else
+				{
+					$iFileSize = @filesize( $sServerDir . $sFile ) ;
+					if ( !$iFileSize ) {
+						$iFileSize = 0 ;
+					}
+					if ( $iFileSize > 0 )
+					{
+						$iFileSize = round( $iFileSize / 1024 ) ;
+						if ( $iFileSize < 1 )
+							$iFileSize = 1 ;
+					}
+
+					$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
+				}
+			}
+		}
+		closedir( $oCurrentFolder ) ;
 	}
 
@@ -153,5 +160,5 @@
 
 	// Create the "Error" node.
-	echo '<Error number="' . $sErrorNumber . '" originalDescription="' . ConvertToXmlAttribute( $sErrorMsg ) . '" />' ;
+	echo '<Error number="' . $sErrorNumber . '" />' ;
 }
 
Index: FCKeditor/trunk/editor/filemanager/connectors/php/config.php
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/php/config.php	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/php/config.php	(revision 3815)
@@ -29,9 +29,4 @@
 //		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.
Index: FCKeditor/trunk/editor/filemanager/connectors/php/io.php
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/php/io.php	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/php/io.php	(revision 3815)
@@ -246,4 +246,7 @@
 		SendError( 102, '' ) ;
 
+	if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder))
+		SendError( 102, '' ) ;
+
 	return $sCurrentFolder ;
 }
@@ -287,4 +290,9 @@
 EOF;
 
+	if ($errorNumber && $errorNumber != 201) {
+		$fileUrl = "";
+		$fileName = "";
+	}
+
 	$rpl = array( '\\' => '\\\\', '"' => '\\"' ) ;
 	echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '") ;' ;
Index: FCKeditor/trunk/editor/filemanager/connectors/php/upload.php
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/php/upload.php	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/php/upload.php	(revision 3815)
@@ -44,5 +44,5 @@
 $sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
 
-$sCurrentFolder	= GetCurrentFolder() ;
+$sCurrentFolder	= "/" ;
 
 // Is enabled the upload?
Index: FCKeditor/trunk/editor/filemanager/connectors/py/connector.py
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/py/connector.py	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/py/connector.py	(revision 3815)
@@ -57,5 +57,8 @@
 		# Check for invalid paths
 		if currentFolder is None:
-			return self.sendError(102, "")
+			if (command == "FileUpload"):
+				return self.sendUploadResults( errorNo = 102, customMsg = "" )
+			else:
+				return self.sendError(102, "")
 
 		# Check if it is an allowed command
@@ -80,5 +83,5 @@
 		if not os.path.exists(self.userFilesFolder):
 			try:
-				self.createServerFoldercreateServerFolder( self.userFilesFolder )
+				self.createServerFolder( self.userFilesFolder )
 			except:
 				return self.sendError(1, "This connector couldn\'t access to local user\'s files directories.  Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ")
Index: FCKeditor/trunk/editor/filemanager/connectors/py/fckcommands.py
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/py/fckcommands.py	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/py/fckcommands.py	(revision 3815)
@@ -72,7 +72,11 @@
 			elif os.path.isfile(someObjectPath):
 				size = os.path.getsize(someObjectPath)
-				files += """<File name="%s" size="%s" />""" % (
+				if size > 0:
+					size = round(size/1024)
+					if size < 1:
+						size = 1
+				files += """<File name="%s" size="%d" />""" % (
 						convertToXmlAttribute(someObject),
-						os.path.getsize(someObjectPath)
+						size
 						)
 		# Close the folders / files node
@@ -164,5 +168,5 @@
 					if os.path.exists(newFilePath):
 						i += 1
-						newFileName = "%s(%04d).%s" % (
+						newFileName = "%s(%d).%s" % (
 								newFileNameOnly, i, newFileExtension
 								)
@@ -190,9 +194,9 @@
 								os.umask( oldumask )
 
-						newFileUrl = self.webUserFilesFolder + currentFolder + newFileName
+						newFileUrl = combinePaths(self.webUserFilesFolder, currentFolder) + newFileName
 
 						return self.sendUploadResults( errorNo , newFileUrl, newFileName )
 			else:
-				return self.sendUploadResults( errorNo = 203, customMsg = "Extension not allowed" )
+				return self.sendUploadResults( errorNo = 202, customMsg = "" )
 		else:
 			return self.sendUploadResults( errorNo = 202, customMsg = "No File" )
Index: FCKeditor/trunk/editor/filemanager/connectors/py/fckoutput.py
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/py/fckoutput.py	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/py/fckoutput.py	(revision 3815)
@@ -96,5 +96,8 @@
 
 	def sendErrorNode(self, number, text):
-		return """<Error number="%s" text="%s" />""" % (number, convertToXmlAttribute(text))
+		if number != 1:
+			return """<Error number="%s" />""" % (number)
+		else:
+			return """<Error number="%s" text="%s" />""" % (number, convertToXmlAttribute(text))
 
 class BaseHtmlMixin(object):
Index: FCKeditor/trunk/editor/filemanager/connectors/py/fckutil.py
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/py/fckutil.py	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/py/fckutil.py	(revision 3815)
@@ -63,5 +63,5 @@
 	"Do a cleanup of the folder name to avoid possible problems"
 	# Remove . \ / | : ? * " < > and control characters
-	return re.sub( '(?u)\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[^\u0000-\u001f\u007f-\u009f]', '_', newFolderName )
+	return re.sub( '\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[\x00-\x1f\x7f-\x9f]', '_', newFolderName )
 
 def sanitizeFileName( newFileName ):
@@ -69,9 +69,9 @@
 	# Replace dots in the name with underscores (only one dot can be there... security issue).
 	if ( Config.ForceSingleExtension ): # remove dots
-		newFileName = re.sub ( '/\\.(?![^.]*$)/', '_', newFileName ) ;
+		newFileName = re.sub ( '\\.(?![^.]*$)', '_', newFileName ) ;
 	newFileName = newFileName.replace('\\','/')		# convert windows to unix path
 	newFileName = os.path.basename (newFileName)	# strip directories
 	# Remove \ / | : ? *
-	return re.sub ( '(?u)/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[^\u0000-\u001f\u007f-\u009f]/', '_', newFileName )
+	return re.sub ( '\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[\x00-\x1f\x7f-\x9f]/', '_', newFileName )
 
 def getCurrentFolder(currentFolder):
@@ -91,4 +91,8 @@
 	# Check for invalid folder paths (..)
 	if '..' in currentFolder or '\\' in currentFolder:
+		return None
+
+	# Check for invalid folder paths (..)
+	if re.search( '(/\\.)|(//)|([\\\\:\\*\\?\\""\\<\\>\\|]|[\x00-\x1F]|[\x7f-\x9f])', currentFolder ):
 		return None
 
Index: FCKeditor/trunk/editor/filemanager/connectors/py/upload.py
===================================================================
--- FCKeditor/trunk/editor/filemanager/connectors/py/upload.py	(revision 3272)
+++ FCKeditor/trunk/editor/filemanager/connectors/py/upload.py	(revision 3815)
@@ -42,5 +42,5 @@
 		# The file type (from the QueryString, by default 'File').
 		resourceType  = self.request.get('Type','File')
-		currentFolder = getCurrentFolder(self.request.get("CurrentFolder",""))
+		currentFolder = "/"
 		# Check for invalid paths
 		if currentFolder is None:
