1<!-- 2 * FCKeditor - The text editor for internet 3 * Copyright (C) 2003-2005 Frederico Caldeira Knabben 4 * 5 * Licensed under the terms of the GNU Lesser General Public License: 6 * http://www.opensource.org/licenses/lgpl-license.php 7 * 8 * For further information visit: 9 * http://www.fckeditor.net/ 10 * 11 * File Name: io.asp 12 * This file include IO specific functions used by the ASP Connector. 13 * 14 * File Authors: 15 * Frederico Caldeira Knabben (fredck@fckeditor.net) 16--> 17<% 18Function GetUrlFromPath( resourceType, folderPath ) 19 If resourceType = "" Then 20 GetUrlFromPath = RemoveFromEnd( sUserFilesPath, "/" ) & folderPath 21 Else 22 GetUrlFromPath = sUserFilesPath & resourceType & folderPath 23 End If 24End Function 25 26Function RemoveExtension( fileName ) 27 RemoveExtension = Left( fileName, InStrRev( fileName, "." ) - 1 ) 28End Function 29 30Function ServerMapFolder( resourceType, folderPath ) 31 ' Get the resource type directory. 32 Dim sResourceTypePath 33 sResourceTypePath = sUserFilesDirectory & resourceType & "\" 34 35 ' Ensure that the directory exists. 36 CreateServerFolder sResourceTypePath 37 38 ' Return the resource type directory combined with the required path. 39 ServerMapFolder = sResourceTypePath & RemoveFromStart( folderPath, "/" ) 40End Function 41 42Sub CreateServerFolder( folderPath ) 43 Dim oFSO 44 Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) 45 46 Dim sParent 47 sParent = oFSO.GetParentFolderName( folderPath ) 48 49 ' Check if the parent exists, or create it. 50 If ( NOT oFSO.FolderExists( sParent ) ) Then CreateServerFolder( sParent ) 51 52 If ( oFSO.FolderExists( folderPath ) = False ) Then 53 oFSO.CreateFolder( folderPath ) 54 End If 55 56 Set oFSO = Nothing 57End Sub 58 59Function IsAllowedExt( extension, resourceType ) 60 Dim oRE 61 Set oRE = New RegExp 62 oRE.IgnoreCase = True 63 oRE.Global = True 64 65 Dim sAllowed, sDenied 66 sAllowed = ConfigAllowedExtensions.Item( resourceType ) 67 sDenied = ConfigDeniedExtensions.Item( resourceType ) 68 69 IsAllowedExt = True 70 71 If sDenied <> "" Then 72 oRE.Pattern = sDenied 73 IsAllowedExt = Not oRE.Test( extension ) 74 End If 75 76 If IsAllowedExt And sAllowed <> "" Then 77 oRE.Pattern = sAllowed 78 IsAllowedExt = oRE.Test( extension ) 79 End If 80 81 Set oRE = Nothing 82End Function 83%>