initial commit
This commit is contained in:
commit
252dac3143
1516 changed files with 694271 additions and 0 deletions
62
FCKeditor/editor/filemanager/connectors/asp/basexml.asp
Normal file
62
FCKeditor/editor/filemanager/connectors/asp/basexml.asp
Normal file
|
@ -0,0 +1,62 @@
|
|||
<%
|
||||
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
' Copyright (C) 2003-2007 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 file include the functions that create the base XML output.
|
||||
%>
|
||||
<%
|
||||
|
||||
Sub SetXmlHeaders()
|
||||
' Cleans the response buffer.
|
||||
Response.Clear()
|
||||
|
||||
' Prevent the browser from caching the result.
|
||||
Response.CacheControl = "no-cache"
|
||||
|
||||
' Set the response format.
|
||||
Response.CharSet = "UTF-8"
|
||||
Response.ContentType = "text/xml"
|
||||
End Sub
|
||||
|
||||
Sub CreateXmlHeader( command, resourceType, currentFolder, url )
|
||||
' Create the XML document header.
|
||||
Response.Write "<?xml version=""1.0"" encoding=""utf-8"" ?>"
|
||||
|
||||
' Create the main "Connector" node.
|
||||
Response.Write "<Connector command=""" & command & """ resourceType=""" & resourceType & """>"
|
||||
|
||||
' Add the current folder node.
|
||||
Response.Write "<CurrentFolder path=""" & ConvertToXmlAttribute( currentFolder ) & """ url=""" & ConvertToXmlAttribute( url ) & """ />"
|
||||
End Sub
|
||||
|
||||
Sub CreateXmlFooter()
|
||||
Response.Write "</Connector>"
|
||||
End Sub
|
||||
|
||||
Sub SendError( number, text )
|
||||
SetXmlHeaders
|
||||
|
||||
' Create the XML document header.
|
||||
Response.Write "<?xml version=""1.0"" encoding=""utf-8"" ?>"
|
||||
|
||||
Response.Write "<Connector><Error number=""" & number & """ text=""" & Server.HTMLEncode( text ) & """ /></Connector>"
|
||||
|
||||
Response.End
|
||||
End Sub
|
||||
%>
|
353
FCKeditor/editor/filemanager/connectors/asp/class_upload.asp
Normal file
353
FCKeditor/editor/filemanager/connectors/asp/class_upload.asp
Normal file
|
@ -0,0 +1,353 @@
|
|||
<%
|
||||
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
' Copyright (C) 2003-2007 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 ==
|
||||
'
|
||||
' These are the classes used to handle ASP upload without using third
|
||||
' part components (OCX/DLL).
|
||||
%>
|
||||
<%
|
||||
'**********************************************
|
||||
' File: NetRube_Upload.asp
|
||||
' Version: NetRube Upload Class Version 2.3 Build 20070528
|
||||
' Author: NetRube
|
||||
' Email: NetRube@126.com
|
||||
' Date: 05/28/2007
|
||||
' Comments: The code for the Upload.
|
||||
' This can free usage, but please
|
||||
' not to delete this copyright information.
|
||||
' If you have a modification version,
|
||||
' Please send out a duplicate to me.
|
||||
'**********************************************
|
||||
' 文件名: NetRube_Upload.asp
|
||||
' 版本: NetRube Upload Class Version 2.3 Build 20070528
|
||||
' 作者: NetRube(网络乡巴佬)
|
||||
' 电子邮件: NetRube@126.com
|
||||
' 日期: 2007年05月28日
|
||||
' 声明: 文件上传类
|
||||
' 本上传类可以自由使用,但请保留此版权声明信息
|
||||
' 如果您对本上传类进行修改增强,
|
||||
' 请发送一份给俺。
|
||||
'**********************************************
|
||||
|
||||
Class NetRube_Upload
|
||||
|
||||
Public File, Form
|
||||
Private oSourceData
|
||||
Private nMaxSize, nErr, sAllowed, sDenied, sHtmlExtensions
|
||||
|
||||
Private Sub Class_Initialize
|
||||
nErr = 0
|
||||
nMaxSize = 1048576
|
||||
|
||||
Set File = Server.CreateObject("Scripting.Dictionary")
|
||||
File.CompareMode = 1
|
||||
Set Form = Server.CreateObject("Scripting.Dictionary")
|
||||
Form.CompareMode = 1
|
||||
|
||||
Set oSourceData = Server.CreateObject("ADODB.Stream")
|
||||
oSourceData.Type = 1
|
||||
oSourceData.Mode = 3
|
||||
oSourceData.Open
|
||||
End Sub
|
||||
|
||||
Private Sub Class_Terminate
|
||||
Form.RemoveAll
|
||||
Set Form = Nothing
|
||||
File.RemoveAll
|
||||
Set File = Nothing
|
||||
|
||||
oSourceData.Close
|
||||
Set oSourceData = Nothing
|
||||
End Sub
|
||||
|
||||
Public Property Get Version
|
||||
Version = "NetRube Upload Class Version 2.3 Build 20070528"
|
||||
End Property
|
||||
|
||||
Public Property Get ErrNum
|
||||
ErrNum = nErr
|
||||
End Property
|
||||
|
||||
Public Property Let MaxSize(nSize)
|
||||
nMaxSize = nSize
|
||||
End Property
|
||||
|
||||
Public Property Let Allowed(sExt)
|
||||
sAllowed = sExt
|
||||
End Property
|
||||
|
||||
Public Property Let Denied(sExt)
|
||||
sDenied = sExt
|
||||
End Property
|
||||
|
||||
Public Property Let HtmlExtensions(sExt)
|
||||
sHtmlExtensions = sExt
|
||||
End Property
|
||||
|
||||
Public Sub GetData
|
||||
Dim aCType
|
||||
aCType = Split(Request.ServerVariables("HTTP_CONTENT_TYPE"), ";")
|
||||
if ( uBound(aCType) < 0 ) then
|
||||
nErr = 1
|
||||
Exit Sub
|
||||
end if
|
||||
If aCType(0) <> "multipart/form-data" Then
|
||||
nErr = 1
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim nTotalSize
|
||||
nTotalSize = Request.TotalBytes
|
||||
If nTotalSize < 1 Then
|
||||
nErr = 2
|
||||
Exit Sub
|
||||
End If
|
||||
If nMaxSize > 0 And nTotalSize > nMaxSize Then
|
||||
nErr = 3
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'Thankful long(yrl031715@163.com)
|
||||
'Fix upload large file.
|
||||
'**********************************************
|
||||
' 修正作者:long
|
||||
' 联系邮件: yrl031715@163.com
|
||||
' 修正时间:2007年5月6日
|
||||
' 修正说明:由于iis6的Content-Length 头信息中包含的请求长度超过了 AspMaxRequestEntityAllowed 的值(默认200K), IIS 将返回一个 403 错误信息.
|
||||
' 直接导致在iis6下调试FCKeditor上传功能时,一旦文件超过200K,上传文件时文件管理器失去响应,受此影响,文件的快速上传功能也存在在缺陷。
|
||||
' 在参考 宝玉 的 Asp无组件上传带进度条 演示程序后作出如下修改,以修正在iis6下的错误。
|
||||
|
||||
Dim nTotalBytes, nPartBytes, ReadBytes
|
||||
ReadBytes = 0
|
||||
nTotalBytes = Request.TotalBytes
|
||||
'循环分块读取
|
||||
Do While ReadBytes < nTotalBytes
|
||||
'分块读取
|
||||
nPartBytes = 64 * 1024 '分成每块64k
|
||||
If nPartBytes + ReadBytes > nTotalBytes Then
|
||||
nPartBytes = nTotalBytes - ReadBytes
|
||||
End If
|
||||
oSourceData.Write Request.BinaryRead(nPartBytes)
|
||||
ReadBytes = ReadBytes + nPartBytes
|
||||
Loop
|
||||
'**********************************************
|
||||
oSourceData.Position = 0
|
||||
|
||||
Dim oTotalData, oFormStream, sFormHeader, sFormName, bCrLf, nBoundLen, nFormStart, nFormEnd, nPosStart, nPosEnd, sBoundary
|
||||
|
||||
oTotalData = oSourceData.Read
|
||||
bCrLf = ChrB(13) & ChrB(10)
|
||||
sBoundary = MidB(oTotalData, 1, InStrB(1, oTotalData, bCrLf) - 1)
|
||||
nBoundLen = LenB(sBoundary) + 2
|
||||
nFormStart = nBoundLen
|
||||
|
||||
Set oFormStream = Server.CreateObject("ADODB.Stream")
|
||||
|
||||
Do While (nFormStart + 2) < nTotalSize
|
||||
nFormEnd = InStrB(nFormStart, oTotalData, bCrLf & bCrLf) + 3
|
||||
|
||||
With oFormStream
|
||||
.Type = 1
|
||||
.Mode = 3
|
||||
.Open
|
||||
oSourceData.Position = nFormStart
|
||||
oSourceData.CopyTo oFormStream, nFormEnd - nFormStart
|
||||
.Position = 0
|
||||
.Type = 2
|
||||
.CharSet = "UTF-8"
|
||||
sFormHeader = .ReadText
|
||||
.Close
|
||||
End With
|
||||
|
||||
nFormStart = InStrB(nFormEnd, oTotalData, sBoundary) - 1
|
||||
nPosStart = InStr(22, sFormHeader, " name=", 1) + 7
|
||||
nPosEnd = InStr(nPosStart, sFormHeader, """")
|
||||
sFormName = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
|
||||
|
||||
If InStr(45, sFormHeader, " filename=", 1) > 0 Then
|
||||
Set File(sFormName) = New NetRube_FileInfo
|
||||
File(sFormName).FormName = sFormName
|
||||
File(sFormName).Start = nFormEnd
|
||||
File(sFormName).Size = nFormStart - nFormEnd - 2
|
||||
nPosStart = InStr(nPosEnd, sFormHeader, " filename=", 1) + 11
|
||||
nPosEnd = InStr(nPosStart, sFormHeader, """")
|
||||
File(sFormName).ClientPath = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
|
||||
File(sFormName).Name = Mid(File(sFormName).ClientPath, InStrRev(File(sFormName).ClientPath, "\") + 1)
|
||||
File(sFormName).Ext = LCase(Mid(File(sFormName).Name, InStrRev(File(sFormName).Name, ".") + 1))
|
||||
nPosStart = InStr(nPosEnd, sFormHeader, "Content-Type: ", 1) + 14
|
||||
nPosEnd = InStr(nPosStart, sFormHeader, vbCr)
|
||||
File(sFormName).MIME = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
|
||||
Else
|
||||
With oFormStream
|
||||
.Type = 1
|
||||
.Mode = 3
|
||||
.Open
|
||||
oSourceData.Position = nFormEnd
|
||||
oSourceData.CopyTo oFormStream, nFormStart - nFormEnd - 2
|
||||
.Position = 0
|
||||
.Type = 2
|
||||
.CharSet = "UTF-8"
|
||||
Form(sFormName) = .ReadText
|
||||
.Close
|
||||
End With
|
||||
End If
|
||||
|
||||
nFormStart = nFormStart + nBoundLen
|
||||
Loop
|
||||
|
||||
oTotalData = ""
|
||||
Set oFormStream = Nothing
|
||||
End Sub
|
||||
|
||||
Public Sub SaveAs(sItem, sFileName)
|
||||
If File(sItem).Size < 1 Then
|
||||
nErr = 2
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not IsAllowed(File(sItem).Ext) Then
|
||||
nErr = 4
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If InStr( LCase( sFileName ), "::$data" ) > 0 Then
|
||||
nErr = 4
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim sFileExt, iFileSize
|
||||
sFileExt = File(sItem).Ext
|
||||
iFileSize = File(sItem).Size
|
||||
|
||||
' Check XSS.
|
||||
If Not IsHtmlExtension( sFileExt ) Then
|
||||
' Calculate the size of data to load (max 1Kb).
|
||||
Dim iXSSSize
|
||||
iXSSSize = iFileSize
|
||||
|
||||
If iXSSSize > 1024 Then
|
||||
iXSSSize = 1024
|
||||
End If
|
||||
|
||||
' Read the data.
|
||||
Dim sData
|
||||
oSourceData.Position = File(sItem).Start
|
||||
sData = oSourceData.Read( iXSSSize ) ' Byte Array
|
||||
sData = ByteArray2Text( sData ) ' String
|
||||
|
||||
' Sniff HTML data.
|
||||
If SniffHtml( sData ) Then
|
||||
nErr = 4
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim oFileStream
|
||||
Set oFileStream = Server.CreateObject("ADODB.Stream")
|
||||
With oFileStream
|
||||
.Type = 1
|
||||
.Mode = 3
|
||||
.Open
|
||||
oSourceData.Position = File(sItem).Start
|
||||
oSourceData.CopyTo oFileStream, File(sItem).Size
|
||||
.Position = 0
|
||||
.SaveToFile sFileName, 2
|
||||
.Close
|
||||
End With
|
||||
Set oFileStream = Nothing
|
||||
End Sub
|
||||
|
||||
Private Function IsAllowed(sExt)
|
||||
Dim oRE
|
||||
Set oRE = New RegExp
|
||||
oRE.IgnoreCase = True
|
||||
oRE.Global = True
|
||||
|
||||
If sDenied = "" Then
|
||||
oRE.Pattern = sAllowed
|
||||
IsAllowed = (sAllowed = "") Or oRE.Test(sExt)
|
||||
Else
|
||||
oRE.Pattern = sDenied
|
||||
IsAllowed = Not oRE.Test(sExt)
|
||||
End If
|
||||
|
||||
Set oRE = Nothing
|
||||
End Function
|
||||
|
||||
Private Function IsHtmlExtension( sExt )
|
||||
If sHtmlExtensions = "" Then
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Dim oRE
|
||||
Set oRE = New RegExp
|
||||
oRE.IgnoreCase = True
|
||||
oRE.Global = True
|
||||
oRE.Pattern = sHtmlExtensions
|
||||
|
||||
IsHtmlExtension = oRE.Test(sExt)
|
||||
|
||||
Set oRE = Nothing
|
||||
End Function
|
||||
|
||||
Private Function SniffHtml( sData )
|
||||
|
||||
Dim oRE
|
||||
Set oRE = New RegExp
|
||||
oRE.IgnoreCase = True
|
||||
oRE.Global = True
|
||||
|
||||
Dim aPatterns
|
||||
aPatterns = Array( "<!DOCTYPE\W*X?HTML", "<(body|head|html|img|pre|script|table|title)", "type\s*=\s*[\'""]?\s*(?:\w*/)?(?:ecma|java)", "(?:href|src|data)\s*=\s*[\'""]?\s*(?:ecma|java)script:", "url\s*\(\s*[\'""]?\s*(?:ecma|java)script:" )
|
||||
|
||||
Dim i
|
||||
For i = 0 to UBound( aPatterns )
|
||||
oRE.Pattern = aPatterns( i )
|
||||
If oRE.Test( sData ) Then
|
||||
SniffHtml = True
|
||||
Exit Function
|
||||
End If
|
||||
Next
|
||||
|
||||
SniffHtml = False
|
||||
|
||||
End Function
|
||||
|
||||
' Thanks to http://www.ericphelps.com/q193998/index.htm
|
||||
Private Function ByteArray2Text(varByteArray)
|
||||
Dim strData, strBuffer, lngCounter
|
||||
strData = ""
|
||||
strBuffer = ""
|
||||
For lngCounter = 0 to UBound(varByteArray)
|
||||
strBuffer = strBuffer & Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1, 1)))
|
||||
'Keep strBuffer at 1k bytes maximum
|
||||
If lngCounter Mod 1024 = 0 Then
|
||||
strData = strData & strBuffer
|
||||
strBuffer = ""
|
||||
End If
|
||||
Next
|
||||
ByteArray2Text = strData & strBuffer
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Class NetRube_FileInfo
|
||||
Dim FormName, ClientPath, Path, Name, Ext, Content, Size, MIME, Start
|
||||
End Class
|
||||
%>
|
198
FCKeditor/editor/filemanager/connectors/asp/commands.asp
Normal file
198
FCKeditor/editor/filemanager/connectors/asp/commands.asp
Normal file
|
@ -0,0 +1,198 @@
|
|||
<%
|
||||
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
' Copyright (C) 2003-2007 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 file include the functions that handle the Command requests
|
||||
' in the ASP Connector.
|
||||
%>
|
||||
<%
|
||||
Sub GetFolders( resourceType, currentFolder )
|
||||
' Map the virtual path to the local server path.
|
||||
Dim sServerDir
|
||||
sServerDir = ServerMapFolder( resourceType, currentFolder, "GetFolders" )
|
||||
|
||||
' Open the "Folders" node.
|
||||
Response.Write "<Folders>"
|
||||
|
||||
Dim oFSO, oCurrentFolder, oFolders, oFolder
|
||||
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
|
||||
if not (oFSO.FolderExists( sServerDir ) ) then
|
||||
Set oFSO = Nothing
|
||||
SendError 102, currentFolder
|
||||
end if
|
||||
|
||||
Set oCurrentFolder = oFSO.GetFolder( sServerDir )
|
||||
Set oFolders = oCurrentFolder.SubFolders
|
||||
|
||||
For Each oFolder in oFolders
|
||||
Response.Write "<Folder name=""" & ConvertToXmlAttribute( oFolder.name ) & """ />"
|
||||
Next
|
||||
|
||||
Set oFSO = Nothing
|
||||
|
||||
' Close the "Folders" node.
|
||||
Response.Write "</Folders>"
|
||||
End Sub
|
||||
|
||||
Sub GetFoldersAndFiles( resourceType, currentFolder )
|
||||
' Map the virtual path to the local server path.
|
||||
Dim sServerDir
|
||||
sServerDir = ServerMapFolder( resourceType, currentFolder, "GetFoldersAndFiles" )
|
||||
|
||||
Dim oFSO, oCurrentFolder, oFolders, oFolder, oFiles, oFile
|
||||
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
|
||||
if not (oFSO.FolderExists( sServerDir ) ) then
|
||||
Set oFSO = Nothing
|
||||
SendError 102, currentFolder
|
||||
end if
|
||||
|
||||
Set oCurrentFolder = oFSO.GetFolder( sServerDir )
|
||||
Set oFolders = oCurrentFolder.SubFolders
|
||||
Set oFiles = oCurrentFolder.Files
|
||||
|
||||
' Open the "Folders" node.
|
||||
Response.Write "<Folders>"
|
||||
|
||||
For Each oFolder in oFolders
|
||||
Response.Write "<Folder name=""" & ConvertToXmlAttribute( oFolder.name ) & """ />"
|
||||
Next
|
||||
|
||||
' Close the "Folders" node.
|
||||
Response.Write "</Folders>"
|
||||
|
||||
' Open the "Files" node.
|
||||
Response.Write "<Files>"
|
||||
|
||||
For Each oFile in oFiles
|
||||
Dim iFileSize
|
||||
iFileSize = Round( oFile.size / 1024 )
|
||||
If ( iFileSize < 1 AND oFile.size <> 0 ) Then iFileSize = 1
|
||||
|
||||
Response.Write "<File name=""" & ConvertToXmlAttribute( oFile.name ) & """ size=""" & iFileSize & """ />"
|
||||
Next
|
||||
|
||||
' Close the "Files" node.
|
||||
Response.Write "</Files>"
|
||||
End Sub
|
||||
|
||||
Sub CreateFolder( resourceType, currentFolder )
|
||||
Dim sErrorNumber
|
||||
|
||||
Dim sNewFolderName
|
||||
sNewFolderName = Request.QueryString( "NewFolderName" )
|
||||
sNewFolderName = SanitizeFolderName( sNewFolderName )
|
||||
|
||||
If ( sNewFolderName = "" OR InStr( 1, sNewFolderName, ".." ) > 0 ) Then
|
||||
sErrorNumber = "102"
|
||||
Else
|
||||
' Map the virtual path to the local server path of the current folder.
|
||||
Dim sServerDir
|
||||
sServerDir = ServerMapFolder( resourceType, CombinePaths(currentFolder, sNewFolderName), "CreateFolder" )
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
CreateServerFolder sServerDir
|
||||
|
||||
Dim iErrNumber, sErrDescription
|
||||
iErrNumber = err.number
|
||||
sErrDescription = err.Description
|
||||
|
||||
On Error Goto 0
|
||||
|
||||
Select Case iErrNumber
|
||||
Case 0
|
||||
sErrorNumber = "0"
|
||||
Case 52
|
||||
sErrorNumber = "102" ' Invalid Folder Name.
|
||||
Case 70
|
||||
sErrorNumber = "103" ' Security Error.
|
||||
Case 76
|
||||
sErrorNumber = "102" ' Path too long.
|
||||
Case Else
|
||||
sErrorNumber = "110"
|
||||
End Select
|
||||
End If
|
||||
|
||||
' Create the "Error" node.
|
||||
Response.Write "<Error number=""" & sErrorNumber & """ originalNumber=""" & iErrNumber & """ originalDescription=""" & ConvertToXmlAttribute( sErrDescription ) & """ />"
|
||||
End Sub
|
||||
|
||||
Sub FileUpload( resourceType, currentFolder, sCommand )
|
||||
Dim oUploader
|
||||
Set oUploader = New NetRube_Upload
|
||||
oUploader.MaxSize = 0
|
||||
oUploader.Allowed = ConfigAllowedExtensions.Item( resourceType )
|
||||
oUploader.Denied = ConfigDeniedExtensions.Item( resourceType )
|
||||
oUploader.HtmlExtensions = ConfigHtmlExtensions
|
||||
oUploader.GetData
|
||||
|
||||
Dim sErrorNumber
|
||||
sErrorNumber = "0"
|
||||
|
||||
Dim sFileName, sOriginalFileName, sExtension
|
||||
sFileName = ""
|
||||
|
||||
If oUploader.ErrNum > 0 Then
|
||||
sErrorNumber = "202"
|
||||
Else
|
||||
' Map the virtual path to the local server path.
|
||||
Dim sServerDir
|
||||
sServerDir = ServerMapFolder( resourceType, currentFolder, sCommand )
|
||||
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
|
||||
if not (oFSO.FolderExists( sServerDir ) ) then
|
||||
sErrorNumber = "102"
|
||||
else
|
||||
' Get the uploaded file name.
|
||||
sFileName = oUploader.File( "NewFile" ).Name
|
||||
sExtension = oUploader.File( "NewFile" ).Ext
|
||||
sFileName = SanitizeFileName( sFileName )
|
||||
sOriginalFileName = sFileName
|
||||
|
||||
Dim iCounter
|
||||
iCounter = 0
|
||||
|
||||
Do While ( True )
|
||||
Dim sFilePath
|
||||
sFilePath = sServerDir & sFileName
|
||||
|
||||
If ( oFSO.FileExists( sFilePath ) ) Then
|
||||
iCounter = iCounter + 1
|
||||
sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
|
||||
sErrorNumber = "201"
|
||||
Else
|
||||
oUploader.SaveAs "NewFile", sFilePath
|
||||
If oUploader.ErrNum > 0 Then sErrorNumber = "202"
|
||||
Exit Do
|
||||
End If
|
||||
Loop
|
||||
end if
|
||||
End If
|
||||
|
||||
Set oUploader = Nothing
|
||||
|
||||
dim sFileUrl
|
||||
sFileUrl = CombinePaths( GetResourceTypePath( resourceType, sCommand ) , currentFolder )
|
||||
sFileUrl = CombinePaths( sFileUrl, sFileName )
|
||||
|
||||
SendUploadResults sErrorNumber, sFileUrl, sFileName, ""
|
||||
End Sub
|
||||
|
||||
%>
|
128
FCKeditor/editor/filemanager/connectors/asp/config.asp
Normal file
128
FCKeditor/editor/filemanager/connectors/asp/config.asp
Normal file
|
@ -0,0 +1,128 @@
|
|||
<%
|
||||
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
' Copyright (C) 2003-2007 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 ==
|
||||
'
|
||||
' Configuration file for the File Manager Connector for ASP.
|
||||
%>
|
||||
<%
|
||||
|
||||
' SECURITY: You must explicitly enable this "connector" (set it to "True").
|
||||
' WARNING: don't just set "ConfigIsEnabled = true", you must be sure that only
|
||||
' authenticated users can access this file or use some kind of session checking.
|
||||
Dim ConfigIsEnabled
|
||||
ConfigIsEnabled = False
|
||||
|
||||
' Path to user files relative to the document root.
|
||||
' This setting is preserved only for backward compatibility.
|
||||
' You should look at the settings for each resource type to get the full potential
|
||||
Dim ConfigUserFilesPath
|
||||
ConfigUserFilesPath = "/userfiles/"
|
||||
|
||||
' Due to security issues with Apache modules, it is recommended to leave the
|
||||
' following setting enabled.
|
||||
Dim ConfigForceSingleExtension
|
||||
ConfigForceSingleExtension = true
|
||||
|
||||
' What the user can do with this connector
|
||||
Dim ConfigAllowedCommands
|
||||
ConfigAllowedCommands = "QuickUpload|FileUpload|GetFolders|GetFoldersAndFiles|CreateFolder"
|
||||
|
||||
' Allowed Resource Types
|
||||
Dim ConfigAllowedTypes
|
||||
ConfigAllowedTypes = "File|Image|Flash|Media"
|
||||
|
||||
' For security, HTML is allowed in the first Kb of data for files having the
|
||||
' following extensions only.
|
||||
Dim ConfigHtmlExtensions
|
||||
ConfigHtmlExtensions = "html|htm|xml|xsd|txt|js"
|
||||
'
|
||||
' Configuration settings for each Resource Type
|
||||
'
|
||||
' - AllowedExtensions: the possible extensions that can be allowed.
|
||||
' If it is empty then any file type can be uploaded.
|
||||
'
|
||||
' - DeniedExtensions: The extensions that won't be allowed.
|
||||
' If it is empty then no restrictions are done here.
|
||||
'
|
||||
' For a file to be uploaded it has to fulfill both the AllowedExtensions
|
||||
' and DeniedExtensions (that's it: not being denied) conditions.
|
||||
'
|
||||
' - FileTypesPath: the virtual folder relative to the document root where
|
||||
' these resources will be located.
|
||||
' Attention: It must start and end with a slash: '/'
|
||||
'
|
||||
' - FileTypesAbsolutePath: the physical path to the above folder. It must be
|
||||
' an absolute path.
|
||||
' If it's an empty string then it will be autocalculated.
|
||||
' Useful if you are using a virtual directory, symbolic link or alias.
|
||||
' Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
|
||||
' Attention: The above 'FileTypesPath' must point to the same directory.
|
||||
' Attention: It must end with a slash: '/'
|
||||
'
|
||||
' - QuickUploadPath: the virtual folder relative to the document root where
|
||||
' these resources will be uploaded using the Upload tab in the resources
|
||||
' dialogs.
|
||||
' Attention: It must start and end with a slash: '/'
|
||||
'
|
||||
' - QuickUploadAbsolutePath: the physical path to the above folder. It must be
|
||||
' an absolute path.
|
||||
' If it's an empty string then it will be autocalculated.
|
||||
' Useful if you are using a virtual directory, symbolic link or alias.
|
||||
' Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
|
||||
' Attention: The above 'QuickUploadPath' must point to the same directory.
|
||||
' Attention: It must end with a slash: '/'
|
||||
'
|
||||
|
||||
Dim ConfigAllowedExtensions, ConfigDeniedExtensions, ConfigFileTypesPath, ConfigFileTypesAbsolutePath, ConfigQuickUploadPath, ConfigQuickUploadAbsolutePath
|
||||
Set ConfigAllowedExtensions = CreateObject( "Scripting.Dictionary" )
|
||||
Set ConfigDeniedExtensions = CreateObject( "Scripting.Dictionary" )
|
||||
Set ConfigFileTypesPath = CreateObject( "Scripting.Dictionary" )
|
||||
Set ConfigFileTypesAbsolutePath = CreateObject( "Scripting.Dictionary" )
|
||||
Set ConfigQuickUploadPath = CreateObject( "Scripting.Dictionary" )
|
||||
Set ConfigQuickUploadAbsolutePath = CreateObject( "Scripting.Dictionary" )
|
||||
|
||||
ConfigAllowedExtensions.Add "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"
|
||||
ConfigDeniedExtensions.Add "File", ""
|
||||
ConfigFileTypesPath.Add "File", ConfigUserFilesPath & "file/"
|
||||
ConfigFileTypesAbsolutePath.Add "File", ""
|
||||
ConfigQuickUploadPath.Add "File", ConfigUserFilesPath
|
||||
ConfigQuickUploadAbsolutePath.Add "File", ""
|
||||
|
||||
ConfigAllowedExtensions.Add "Image", "bmp|gif|jpeg|jpg|png"
|
||||
ConfigDeniedExtensions.Add "Image", ""
|
||||
ConfigFileTypesPath.Add "Image", ConfigUserFilesPath & "image/"
|
||||
ConfigFileTypesAbsolutePath.Add "Image", ""
|
||||
ConfigQuickUploadPath.Add "Image", ConfigUserFilesPath
|
||||
ConfigQuickUploadAbsolutePath.Add "Image", ""
|
||||
|
||||
ConfigAllowedExtensions.Add "Flash", "swf|flv"
|
||||
ConfigDeniedExtensions.Add "Flash", ""
|
||||
ConfigFileTypesPath.Add "Flash", ConfigUserFilesPath & "flash/"
|
||||
ConfigFileTypesAbsolutePath.Add "Flash", ""
|
||||
ConfigQuickUploadPath.Add "Flash", ConfigUserFilesPath
|
||||
ConfigQuickUploadAbsolutePath.Add "Flash", ""
|
||||
|
||||
ConfigAllowedExtensions.Add "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"
|
||||
ConfigDeniedExtensions.Add "Media", ""
|
||||
ConfigFileTypesPath.Add "Media", ConfigUserFilesPath & "media/"
|
||||
ConfigFileTypesAbsolutePath.Add "Media", ""
|
||||
ConfigQuickUploadPath.Add "Media", ConfigUserFilesPath
|
||||
ConfigQuickUploadAbsolutePath.Add "Media", ""
|
||||
|
||||
%>
|
88
FCKeditor/editor/filemanager/connectors/asp/connector.asp
Normal file
88
FCKeditor/editor/filemanager/connectors/asp/connector.asp
Normal file
|
@ -0,0 +1,88 @@
|
|||
<%@ CodePage=65001 Language="VBScript"%>
|
||||
<%
|
||||
Option Explicit
|
||||
Response.Buffer = True
|
||||
%>
|
||||
<%
|
||||
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
' Copyright (C) 2003-2007 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 ASP.
|
||||
%>
|
||||
<!--#include file="config.asp"-->
|
||||
<!--#include file="util.asp"-->
|
||||
<!--#include file="io.asp"-->
|
||||
<!--#include file="basexml.asp"-->
|
||||
<!--#include file="commands.asp"-->
|
||||
<!--#include file="class_upload.asp"-->
|
||||
<%
|
||||
|
||||
If ( ConfigIsEnabled = False ) Then
|
||||
SendError 1, "This connector is disabled. Please check the ""editor/filemanager/connectors/asp/config.asp"" file"
|
||||
End If
|
||||
|
||||
DoResponse
|
||||
|
||||
Sub DoResponse()
|
||||
Dim sCommand, sResourceType, sCurrentFolder
|
||||
|
||||
' Get the main request information.
|
||||
sCommand = Request.QueryString("Command")
|
||||
|
||||
sResourceType = Request.QueryString("Type")
|
||||
If ( sResourceType = "" ) Then sResourceType = "File"
|
||||
|
||||
sCurrentFolder = GetCurrentFolder()
|
||||
|
||||
' Check if it is an allowed command
|
||||
if ( Not IsAllowedCommand( sCommand ) ) then
|
||||
SendError 1, "The """ & sCommand & """ command isn't allowed"
|
||||
end if
|
||||
|
||||
' Check if it is an allowed resource type.
|
||||
if ( Not IsAllowedType( sResourceType ) ) Then
|
||||
SendError 1, "The """ & sResourceType & """ resource type isn't allowed"
|
||||
end if
|
||||
|
||||
' File Upload doesn't have to Return XML, so it must be intercepted before anything.
|
||||
If ( sCommand = "FileUpload" ) Then
|
||||
FileUpload sResourceType, sCurrentFolder, sCommand
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
SetXmlHeaders
|
||||
|
||||
CreateXmlHeader sCommand, sResourceType, sCurrentFolder, GetUrlFromPath( sResourceType, sCurrentFolder, sCommand)
|
||||
|
||||
' Execute the required command.
|
||||
Select Case sCommand
|
||||
Case "GetFolders"
|
||||
GetFolders sResourceType, sCurrentFolder
|
||||
Case "GetFoldersAndFiles"
|
||||
GetFoldersAndFiles sResourceType, sCurrentFolder
|
||||
Case "CreateFolder"
|
||||
CreateFolder sResourceType, sCurrentFolder
|
||||
End Select
|
||||
|
||||
CreateXmlFooter
|
||||
|
||||
Response.End
|
||||
End Sub
|
||||
|
||||
%>
|
222
FCKeditor/editor/filemanager/connectors/asp/io.asp
Normal file
222
FCKeditor/editor/filemanager/connectors/asp/io.asp
Normal file
|
@ -0,0 +1,222 @@
|
|||
<%
|
||||
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
' Copyright (C) 2003-2007 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 file include IO specific functions used by the ASP Connector.
|
||||
%>
|
||||
<%
|
||||
function CombinePaths( sBasePath, sFolder)
|
||||
CombinePaths = RemoveFromEnd( sBasePath, "/" ) & "/" & RemoveFromStart( sFolder, "/" )
|
||||
end function
|
||||
|
||||
Function GetResourceTypePath( resourceType, sCommand )
|
||||
if ( sCommand = "QuickUpload") then
|
||||
GetResourceTypePath = ConfigQuickUploadPath.Item( resourceType )
|
||||
else
|
||||
GetResourceTypePath = ConfigFileTypesPath.Item( resourceType )
|
||||
end if
|
||||
end Function
|
||||
|
||||
Function GetResourceTypeDirectory( resourceType, sCommand )
|
||||
if ( sCommand = "QuickUpload") then
|
||||
|
||||
if ( ConfigQuickUploadAbsolutePath.Item( resourceType ) <> "" ) then
|
||||
GetResourceTypeDirectory = ConfigQuickUploadAbsolutePath.Item( resourceType )
|
||||
else
|
||||
' Map the "UserFiles" path to a local directory.
|
||||
GetResourceTypeDirectory = Server.MapPath( ConfigQuickUploadPath.Item( resourceType ) )
|
||||
end if
|
||||
else
|
||||
if ( ConfigFileTypesAbsolutePath.Item( resourceType ) <> "" ) then
|
||||
GetResourceTypeDirectory = ConfigFileTypesAbsolutePath.Item( resourceType )
|
||||
else
|
||||
' Map the "UserFiles" path to a local directory.
|
||||
GetResourceTypeDirectory = Server.MapPath( ConfigFileTypesPath.Item( resourceType ) )
|
||||
end if
|
||||
end if
|
||||
end Function
|
||||
|
||||
Function GetUrlFromPath( resourceType, folderPath, sCommand )
|
||||
GetUrlFromPath = CombinePaths( GetResourceTypePath( resourceType, sCommand ), folderPath )
|
||||
End Function
|
||||
|
||||
Function RemoveExtension( fileName )
|
||||
RemoveExtension = Left( fileName, InStrRev( fileName, "." ) - 1 )
|
||||
End Function
|
||||
|
||||
Function ServerMapFolder( resourceType, folderPath, sCommand )
|
||||
Dim sResourceTypePath
|
||||
' Get the resource type directory.
|
||||
sResourceTypePath = GetResourceTypeDirectory( resourceType, sCommand )
|
||||
|
||||
' Ensure that the directory exists.
|
||||
CreateServerFolder sResourceTypePath
|
||||
|
||||
' Return the resource type directory combined with the required path.
|
||||
ServerMapFolder = CombinePaths( sResourceTypePath, folderPath )
|
||||
End Function
|
||||
|
||||
Sub CreateServerFolder( folderPath )
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
|
||||
|
||||
Dim sParent
|
||||
sParent = oFSO.GetParentFolderName( folderPath )
|
||||
|
||||
' Check if the parent exists, or create it.
|
||||
If ( NOT oFSO.FolderExists( sParent ) ) Then CreateServerFolder( sParent )
|
||||
|
||||
If ( oFSO.FolderExists( folderPath ) = False ) Then
|
||||
On Error resume next
|
||||
oFSO.CreateFolder( folderPath )
|
||||
|
||||
if err.number<>0 then
|
||||
dim sErrorNumber
|
||||
Dim iErrNumber, sErrDescription
|
||||
iErrNumber = err.number
|
||||
sErrDescription = err.Description
|
||||
|
||||
On Error Goto 0
|
||||
|
||||
Select Case iErrNumber
|
||||
Case 52
|
||||
sErrorNumber = "102" ' Invalid Folder Name.
|
||||
Case 70
|
||||
sErrorNumber = "103" ' Security Error.
|
||||
Case 76
|
||||
sErrorNumber = "102" ' Path too long.
|
||||
Case Else
|
||||
sErrorNumber = "110"
|
||||
End Select
|
||||
|
||||
SendError sErrorNumber, "CreateServerFolder(" & folderPath & ") : " & sErrDescription
|
||||
end if
|
||||
|
||||
End If
|
||||
|
||||
Set oFSO = Nothing
|
||||
End Sub
|
||||
|
||||
Function IsAllowedExt( extension, resourceType )
|
||||
Dim oRE
|
||||
Set oRE = New RegExp
|
||||
oRE.IgnoreCase = True
|
||||
oRE.Global = True
|
||||
|
||||
Dim sAllowed, sDenied
|
||||
sAllowed = ConfigAllowedExtensions.Item( resourceType )
|
||||
sDenied = ConfigDeniedExtensions.Item( resourceType )
|
||||
|
||||
IsAllowedExt = True
|
||||
|
||||
If sDenied <> "" Then
|
||||
oRE.Pattern = sDenied
|
||||
IsAllowedExt = Not oRE.Test( extension )
|
||||
End If
|
||||
|
||||
If IsAllowedExt And sAllowed <> "" Then
|
||||
oRE.Pattern = sAllowed
|
||||
IsAllowedExt = oRE.Test( extension )
|
||||
End If
|
||||
|
||||
Set oRE = Nothing
|
||||
End Function
|
||||
|
||||
Function IsAllowedType( resourceType )
|
||||
Dim oRE
|
||||
Set oRE = New RegExp
|
||||
oRE.IgnoreCase = True
|
||||
oRE.Global = True
|
||||
oRE.Pattern = "^(" & ConfigAllowedTypes & ")$"
|
||||
|
||||
IsAllowedType = oRE.Test( resourceType )
|
||||
|
||||
Set oRE = Nothing
|
||||
End Function
|
||||
|
||||
Function IsAllowedCommand( sCommand )
|
||||
Dim oRE
|
||||
Set oRE = New RegExp
|
||||
oRE.IgnoreCase = True
|
||||
oRE.Global = True
|
||||
oRE.Pattern = "^(" & ConfigAllowedCommands & ")$"
|
||||
|
||||
IsAllowedCommand = oRE.Test( sCommand )
|
||||
|
||||
Set oRE = Nothing
|
||||
End Function
|
||||
|
||||
function GetCurrentFolder()
|
||||
dim sCurrentFolder
|
||||
sCurrentFolder = Request.QueryString("CurrentFolder")
|
||||
If ( sCurrentFolder = "" ) Then sCurrentFolder = "/"
|
||||
|
||||
' Check the current folder syntax (must begin and start with a slash).
|
||||
If ( Right( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = sCurrentFolder & "/"
|
||||
If ( Left( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = "/" & sCurrentFolder
|
||||
|
||||
' Check for invalid folder paths (..)
|
||||
If ( InStr( 1, sCurrentFolder, ".." ) <> 0 ) Then
|
||||
SendError 102, ""
|
||||
End If
|
||||
|
||||
GetCurrentFolder = sCurrentFolder
|
||||
end function
|
||||
|
||||
' Do a cleanup of the folder name to avoid possible problems
|
||||
function SanitizeFolderName( sNewFolderName )
|
||||
Dim oRegex
|
||||
Set oRegex = New RegExp
|
||||
oRegex.Global = True
|
||||
|
||||
' remove . \ / | : ? * " < >
|
||||
oRegex.Pattern = "(\.|\\|\/|\||:|\?|\*|""|\<|\>)"
|
||||
SanitizeFolderName = oRegex.Replace( sNewFolderName, "_" )
|
||||
|
||||
Set oRegex = Nothing
|
||||
end function
|
||||
|
||||
' Do a cleanup of the file name to avoid possible problems
|
||||
function SanitizeFileName( sNewFileName )
|
||||
Dim oRegex
|
||||
Set oRegex = New RegExp
|
||||
oRegex.Global = True
|
||||
|
||||
if ( ConfigForceSingleExtension = True ) then
|
||||
oRegex.Pattern = "\.(?![^.]*$)"
|
||||
sNewFileName = oRegex.Replace( sNewFileName, "_" )
|
||||
end if
|
||||
|
||||
' remove \ / | : ? * " < >
|
||||
oRegex.Pattern = "(\\|\/|\||:|\?|\*|""|\<|\>)"
|
||||
SanitizeFileName = oRegex.Replace( sNewFileName, "_" )
|
||||
|
||||
Set oRegex = Nothing
|
||||
end function
|
||||
|
||||
' This is the function that sends the results of the uploading process.
|
||||
Sub SendUploadResults( errorNumber, fileUrl, fileName, customMsg )
|
||||
Response.Clear
|
||||
Response.Write "<script type=""text/javascript"">"
|
||||
Response.Write "window.parent.OnUploadCompleted(" & errorNumber & ",""" & Replace( fileUrl, """", "\""" ) & """,""" & Replace( fileName, """", "\""" ) & """,""" & Replace( customMsg , """", "\""" ) & """) ;"
|
||||
Response.Write "</script>"
|
||||
Response.End
|
||||
End Sub
|
||||
|
||||
%>
|
61
FCKeditor/editor/filemanager/connectors/asp/upload.asp
Normal file
61
FCKeditor/editor/filemanager/connectors/asp/upload.asp
Normal file
|
@ -0,0 +1,61 @@
|
|||
<%@ CodePage=65001 Language="VBScript"%>
|
||||
<%
|
||||
Option Explicit
|
||||
Response.Buffer = True
|
||||
%>
|
||||
<%
|
||||
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
' Copyright (C) 2003-2007 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 Uploader" for ASP.
|
||||
%>
|
||||
<!--#include file="config.asp"-->
|
||||
<!--#include file="util.asp"-->
|
||||
<!--#include file="io.asp"-->
|
||||
<!--#include file="commands.asp"-->
|
||||
<!--#include file="class_upload.asp"-->
|
||||
<%
|
||||
|
||||
' Check if this uploader has been enabled.
|
||||
If ( ConfigIsEnabled = False ) Then
|
||||
SendUploadResults "1", "", "", "This file uploader is disabled. Please check the ""editor/filemanager/connectors/asp/config.asp"" file"
|
||||
End If
|
||||
|
||||
Dim sCommand, sResourceType, sCurrentFolder
|
||||
|
||||
sCommand = "QuickUpload"
|
||||
|
||||
sResourceType = Request.QueryString("Type")
|
||||
If ( sResourceType = "" ) Then sResourceType = "File"
|
||||
|
||||
sCurrentFolder = GetCurrentFolder()
|
||||
|
||||
' Is Upload enabled?
|
||||
if ( Not IsAllowedCommand( sCommand ) ) then
|
||||
SendUploadResults "1", "", "", "The """ & sCommand & """ command isn't allowed"
|
||||
end if
|
||||
|
||||
' Check if it is an allowed resource type.
|
||||
if ( Not IsAllowedType( sResourceType ) ) Then
|
||||
SendUploadResults "1", "", "", "The " & sResourceType & " resource type isn't allowed"
|
||||
end if
|
||||
|
||||
FileUpload sResourceType, sCurrentFolder, sCommand
|
||||
|
||||
%>
|
55
FCKeditor/editor/filemanager/connectors/asp/util.asp
Normal file
55
FCKeditor/editor/filemanager/connectors/asp/util.asp
Normal file
|
@ -0,0 +1,55 @@
|
|||
<%
|
||||
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
' Copyright (C) 2003-2007 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 file include generic functions used by the ASP Connector.
|
||||
%>
|
||||
<%
|
||||
Function RemoveFromStart( sourceString, charToRemove )
|
||||
Dim oRegex
|
||||
Set oRegex = New RegExp
|
||||
oRegex.Pattern = "^" & charToRemove & "+"
|
||||
|
||||
RemoveFromStart = oRegex.Replace( sourceString, "" )
|
||||
End Function
|
||||
|
||||
Function RemoveFromEnd( sourceString, charToRemove )
|
||||
Dim oRegex
|
||||
Set oRegex = New RegExp
|
||||
oRegex.Pattern = charToRemove & "+$"
|
||||
|
||||
RemoveFromEnd = oRegex.Replace( sourceString, "" )
|
||||
End Function
|
||||
|
||||
Function ConvertToXmlAttribute( value )
|
||||
ConvertToXmlAttribute = Replace( value, "&", "&" )
|
||||
End Function
|
||||
|
||||
Function InArray( value, sourceArray )
|
||||
Dim i
|
||||
For i = 0 to UBound( sourceArray )
|
||||
If sourceArray(i) = value Then
|
||||
InArray = True
|
||||
Exit Function
|
||||
End If
|
||||
Next
|
||||
InArray = False
|
||||
End Function
|
||||
|
||||
%>
|
Loading…
Add table
Add a link
Reference in a new issue