Update of /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/asp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25920/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/asp Modified Files: basexml.asp class_upload.asp commands.asp connector.asp io.asp util.asp Log Message: Commiting file additions and modification from SVN revision 1841 to 1842... Changes made by vinicius on 2005-08-23 15:49:13 +0200 (Tue, 23 Aug 2005) corresponding to SVN revision 1842 with message: License file included in thyapi Index: class_upload.asp =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/asp/class_upload.asp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** class_upload.asp 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- class_upload.asp 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 10,166 **** * * File Name: class_upload.asp ! * Is are the classes used to handle ASP upload without using third * part components (OCX/DLL). * ! * Version: 2.0 RC2 ! * Modified: 2004-11-29 02:19:23 * * File Authors: ! * Frederico Caldeira Knabben (fr...@fc...) --> <% ! '*************************************** ! ' File: Upload.asp ! ' Author: Jacob "Beezle" Gilley ! ' Email: av...@ai... ! ' Date: 12/07/2000 ! ' Comments: The code for the Upload, CByteString, ! ' CWideString subroutines was originally ! ' written by Philippe Collignon...or so ! ' he claims. Also, I am not responsible ! ' for any ill effects this script may ! ' cause and provide this script "AS IS". ! ' Enjoy! ! '**************************************** - Class FileUploader - Public Files - Private mcolFormElem ! Private Sub Class_Initialize() ! Set Files = Server.CreateObject("Scripting.Dictionary") ! Set mcolFormElem = Server.CreateObject("Scripting.Dictionary") End Sub ! Private Sub Class_Terminate() ! If IsObject(Files) Then ! Files.RemoveAll() ! Set Files = Nothing ! End If ! If IsObject(mcolFormElem) Then ! mcolFormElem.RemoveAll() ! Set mcolFormElem = Nothing ! End If End Sub ! ! Public Property Get Form(sIndex) ! Form = "" ! If mcolFormElem.Exists(LCase(sIndex)) Then Form = mcolFormElem.Item(LCase(sIndex)) End Property ! Public Default Sub Upload() ! Dim biData, sInputName ! Dim nPosBegin, nPosEnd, nPos, vDataBounds, nDataBoundPos ! Dim nPosFile, nPosBound ! biData = Request.BinaryRead(Request.TotalBytes) ! nPosBegin = 1 ! nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13))) ! If (nPosEnd-nPosBegin) <= 0 Then Exit Sub ! ! vDataBounds = MidB(biData, nPosBegin, nPosEnd-nPosBegin) ! nDataBoundPos = InstrB(1, biData, vDataBounds) ! Do Until nDataBoundPos = InstrB(biData, vDataBounds & CByteString("--")) ! nPos = InstrB(nDataBoundPos, biData, CByteString("Content-Disposition")) ! nPos = InstrB(nPos, biData, CByteString("name=")) ! nPosBegin = nPos + 6 ! nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34))) ! sInputName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin)) ! nPosFile = InstrB(nDataBoundPos, biData, CByteString("filename=")) ! nPosBound = InstrB(nPosEnd, biData, vDataBounds) ! If nPosFile <> 0 And nPosFile < nPosBound Then ! Dim oUploadFile, sFileName ! Set oUploadFile = New UploadedFile ! ! nPosBegin = nPosFile + 10 ! nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34))) ! sFileName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin)) ! oUploadFile.FileName = Right(sFileName, Len(sFileName)-InStrRev(sFileName, "\")) ! ! nPos = InstrB(nPosEnd, biData, CByteString("Content-Type:")) ! nPosBegin = nPos + 14 ! nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13))) ! ! oUploadFile.ContentType = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin)) ! ! nPosBegin = nPosEnd+4 ! nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2 ! oUploadFile.FileData = MidB(biData, nPosBegin, nPosEnd-nPosBegin) ! ! If oUploadFile.FileSize > 0 Then Files.Add LCase(sInputName), oUploadFile Else ! nPos = InstrB(nPos, biData, CByteString(Chr(13))) ! nPosBegin = nPos + 4 ! nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2 ! If Not mcolFormElem.Exists(LCase(sInputName)) Then mcolFormElem.Add LCase(sInputName), CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin)) End If ! ! nDataBoundPos = InstrB(nDataBoundPos + LenB(vDataBounds), biData, vDataBounds) Loop End Sub ! 'String to byte string conversion ! Private Function CByteString(sString) ! Dim nIndex ! For nIndex = 1 to Len(sString) ! CByteString = CByteString & ChrB(AscB(Mid(sString,nIndex,1))) ! Next ! End Function ! ! 'Byte string to string conversion ! Private Function CWideString(bsString) ! Dim nIndex ! CWideString ="" ! For nIndex = 1 to LenB(bsString) ! CWideString = CWideString & Chr(AscB(MidB(bsString,nIndex,1))) ! Next ! End Function ! End Class ! ! Class UploadedFile ! Public ContentType ! Public FileName ! Public FileData ! ! Public Property Get FileSize() ! FileSize = LenB(FileData) ! End Property ! ! Public Sub SaveToDisk(sFilePath) ! Dim oFS, oFile ! Dim nIndex ! ! Set oFS = Server.CreateObject("Scripting.FileSystemObject") ! Set oFile = oFS.CreateTextFile(sFilePath, True) ! For nIndex = 1 to LenB(FileData) ! oFile.Write Chr(AscB(MidB(FileData,nIndex,1))) ! Next ! ! oFile.Close End Sub ! Public Sub SaveToDatabase(ByRef oField) ! If LenB(FileData) = 0 Then Exit Sub ! If IsObject(oField) Then ! oField.AppendChunk FileData End If ! End Sub End Class %> \ No newline at end of file --- 10,232 ---- * * File Name: class_upload.asp ! * These are the classes used to handle ASP upload without using third * part components (OCX/DLL). * ! * Version: 2.0 RC3 ! * Modified: 2005-03-01 12:13:29 * * File Authors: ! * NetRube (ne...@12...) --> <% ! '********************************************** ! ' File: NetRube_Upload.asp ! ' Version: NetRube Upload Class Version 2.1 Build 20050228 ! ' Author: NetRube ! ' Email: Ne...@12... ! ' Date: 02/28/2005 ! ' 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.1 Build 20050228 ! ' ä½è : NetRube(ç½ç»ä¹¡å·´ä½¬) ! ' çµåé®ä»¶: Ne...@12... ! ' æ¥æ: 2005å¹´02æ28æ¥ ! ' 声æ: æä»¶ä¸ä¼ ç±» ! ' æ¬ä¸ä¼ ç±»å¯ä»¥èªç±ä½¿ç¨ï¼ä½è¯·ä¿çæ¤çæå£°æä¿¡æ¯ ! ' 妿æ¨å¯¹æ¬ä¸ä¼ ç±»è¿è¡ä¿®æ¹å¢å¼ºï¼ ! ' 请åéä¸ä»½ç»ä¿ºã ! '********************************************** ! Class NetRube_Upload ! ! Public File, Form ! Private oSourceData ! Private nMaxSize, nErr, sAllowed, sDenied ! ! 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 1.0 Build 20041218" 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 Sub GetData ! Dim aCType ! aCType = Split(Request.ServerVariables("HTTP_CONTENT_TYPE"), ";") ! 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 ! oSourceData.Write Request.BinaryRead(nTotalSize) ! 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 = nPosEnd ! 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 ! ! 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 ! End Class + Class NetRube_FileInfo + Dim FormName, ClientPath, Path, Name, Ext, Content, Size, MIME, Start End Class %> \ No newline at end of file Index: basexml.asp =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/asp/basexml.asp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** basexml.asp 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- basexml.asp 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 12,17 **** * This file include the functions that create the base XML output. * ! * Version: 2.0 RC2 ! * Modified: 2004-12-10 17:00:56 * * File Authors: --- 12,17 ---- * This file include the functions that create the base XML output. * ! * Version: 2.0 RC3 ! * Modified: 2005-02-11 16:00:06 * * File Authors: Index: io.asp =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/asp/io.asp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** io.asp 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- io.asp 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 12,17 **** * This file include IO specific functions used by the ASP Connector. * ! * Version: 2.0 RC2 ! * Modified: 2004-11-29 02:16:56 * * File Authors: --- 12,17 ---- * This file include IO specific functions used by the ASP Connector. * ! * Version: 2.0 RC3 ! * Modified: 2005-02-28 18:49:54 * * File Authors: *************** *** 59,61 **** --- 59,86 ---- 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 %> \ No newline at end of file Index: connector.asp =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/asp/connector.asp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** connector.asp 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- connector.asp 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 16,25 **** * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC2 ! * Modified: 2004-12-10 16:43:33 * * File Authors: * Frederico Caldeira Knabben (fr...@fc...) --> <!--#include file="util.asp"--> <!--#include file="io.asp"--> --- 16,26 ---- * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC3 ! * Modified: 2005-02-11 16:04:56 * * File Authors: * Frederico Caldeira Knabben (fr...@fc...) --> + <!--#include file="config.asp"--> <!--#include file="util.asp"--> <!--#include file="io.asp"--> *************** *** 30,38 **** ' Get the "UserFiles" path. Dim sUserFilesPath - sUserFilesPath = Request.QueryString("ServerPath") ! If ( sUserFilesPath = "" ) Then sUserFilesPath = "/UserFiles/" ! ElseIf ( Right( sUserFilesPath, 1 ) <> "/" ) Then sUserFilesPath = sUserFilesPath & "/" End If --- 31,44 ---- ' Get the "UserFiles" path. Dim sUserFilesPath ! If ( Not IsEmpty( ConfigUserFilesPath ) ) Then ! sUserFilesPath = ConfigUserFilesPath ! ElseIf ( Request.QueryString("ServerPath") <> "" ) Then ! sUserFilesPath = Request.QueryString("ServerPath") ! Else sUserFilesPath = "/UserFiles/" ! End If ! ! If ( Right( sUserFilesPath, 1 ) <> "/" ) Then sUserFilesPath = sUserFilesPath & "/" End If Index: util.asp =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/asp/util.asp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** util.asp 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- util.asp 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 12,17 **** * This file include generic functions used by the ASP Connector. * ! * Version: 2.0 RC2 ! * Modified: 2004-12-10 17:02:49 * * File Authors: --- 12,17 ---- * This file include generic functions used by the ASP Connector. * ! * Version: 2.0 RC3 ! * Modified: 2005-02-11 16:00:27 * * File Authors: *************** *** 38,40 **** --- 38,52 ---- 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 + %> \ No newline at end of file Index: commands.asp =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/asp/commands.asp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** commands.asp 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- commands.asp 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 13,18 **** * in the ASP Connector. * ! * Version: 2.0 RC2 ! * Modified: 2004-12-10 17:00:56 * * File Authors: --- 13,18 ---- * in the ASP Connector. * ! * Version: 2.0 RC3 ! * Modified: 2005-03-01 12:09:38 * * File Authors: *************** *** 122,144 **** Sub FileUpload( resourceType, currentFolder ) Dim oUploader ! Set oUploader = New FileUploader ! oUploader.Upload ! ! Dim oFile ! ! If ( oUploader.Files.Count > 0 ) Then ! ' Get the first file (this was the only way it worked). ! For Each oFile in oUploader.Files.Items ! Exit For ! Next ! End If Dim sErrorNumber sErrorNumber = "0" ! Dim sFileName, sOriginalFileName sFileName = "" ! If ( IsEmpty( oFile ) = False ) Then ' Map the virtual path to the local server path. Dim sServerDir --- 122,140 ---- Sub FileUpload( resourceType, currentFolder ) Dim oUploader ! Set oUploader = New NetRube_Upload ! oUploader.MaxSize = 0 ! oUploader.Allowed = ConfigAllowedExtensions.Item( resourceType ) ! oUploader.Denied = ConfigDeniedExtensions.Item( resourceType ) ! oUploader.GetData Dim sErrorNumber sErrorNumber = "0" ! Dim sFileName, sOriginalFileName, sExtension sFileName = "" ! If oUploader.ErrNum > 1 Then ! sErrorNumber = "202" ! Else ' Map the virtual path to the local server path. Dim sServerDir *************** *** 149,153 **** ' Get the uploaded file name. ! sFileName = oFSO.GetFileName( oFile.FileName ) sOriginalFileName = sFileName --- 145,150 ---- ' Get the uploaded file name. ! sFileName = oUploader.File( "NewFile" ).Name ! sExtension = oUploader.File( "NewFile" ).Ext sOriginalFileName = sFileName *************** *** 161,175 **** If ( oFSO.FileExists( sFilePath ) ) Then iCounter = iCounter + 1 ! sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & oFSO.GetExtensionName( sFileName ) sErrorNumber = "201" Else ! oFile.SaveToDisk( sFilePath ) Exit Do End If Loop - Else - sErrorNumber = "202" End If Response.Clear --- 158,173 ---- 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 + Set oUploader = Nothing + Response.Clear |