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