io.asp
上传用户:wlfwy2004
上传日期:2016-12-12
资源大小:33978k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  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. <%
  18. Function GetUrlFromPath( resourceType, folderPath )
  19. If resourceType = "" Then
  20. GetUrlFromPath = RemoveFromEnd( sUserFilesPath, "/" ) & folderPath
  21. Else
  22. GetUrlFromPath = sUserFilesPath & resourceType & folderPath
  23. End If
  24. End Function
  25. Function RemoveExtension( fileName )
  26. RemoveExtension = Left( fileName, InStrRev( fileName, "." ) - 1 )
  27. End Function
  28. Function ServerMapFolder( resourceType, folderPath )
  29. ' Get the resource type directory.
  30. Dim sResourceTypePath
  31. sResourceTypePath = sUserFilesDirectory & resourceType & ""
  32. ' Ensure that the directory exists.
  33. CreateServerFolder sResourceTypePath
  34. ' Return the resource type directory combined with the required path.
  35. ServerMapFolder = sResourceTypePath & RemoveFromStart( folderPath, "/" )
  36. End Function
  37. Sub CreateServerFolder( folderPath )
  38. Dim oFSO
  39. Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
  40. Dim sParent
  41. sParent = oFSO.GetParentFolderName( folderPath )
  42. ' Check if the parent exists, or create it.
  43. If ( NOT oFSO.FolderExists( sParent ) ) Then CreateServerFolder( sParent )
  44. If ( oFSO.FolderExists( folderPath ) = False ) Then 
  45. oFSO.CreateFolder( folderPath )
  46. End If
  47. Set oFSO = Nothing
  48. End Sub
  49. Function IsAllowedExt( extension, resourceType )
  50. Dim oRE
  51. Set oRE = New RegExp
  52. oRE.IgnoreCase = True
  53. oRE.Global = True
  54. Dim sAllowed, sDenied
  55. sAllowed = ConfigAllowedExtensions.Item( resourceType )
  56. sDenied = ConfigDeniedExtensions.Item( resourceType )
  57. IsAllowedExt = True
  58. If sDenied <> "" Then
  59. oRE.Pattern = sDenied
  60. IsAllowedExt = Not oRE.Test( extension )
  61. End If 
  62. If IsAllowedExt And sAllowed <> "" Then
  63. oRE.Pattern = sAllowed
  64. IsAllowedExt = oRE.Test( extension )
  65. End If
  66. Set oRE = Nothing
  67. End Function
  68. %>