diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/basexml.asp b/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/basexml.asp deleted file mode 100644 index e53e7333768..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/basexml.asp +++ /dev/null @@ -1,71 +0,0 @@ -<% - ' FCKeditor - The text editor for Internet - http://www.fckeditor.net - ' Copyright (C) 2003-2010 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. - on error resume next - ' The CodePage property isn't supported in Windows 2000. #2604 - Response.CodePage = 65001 - on error goto 0 - - Response.CharSet = "UTF-8" - Response.ContentType = "text/xml" -End Sub - -Sub CreateXmlHeader( command, resourceType, currentFolder, url ) - ' Create the XML document header. - Response.Write "" - - ' Create the main "Connector" node. - Response.Write "" - - ' Add the current folder node. - Response.Write "" -End Sub - -Sub CreateXmlFooter() - Response.Write "" -End Sub - -Sub SendError( number, text ) - SetXmlHeaders - - ' Create the XML document header. - Response.Write "" - - If text <> "" then - Response.Write "" - else - Response.Write "" - end if - - Response.End -End Sub -%> diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/class_upload.asp b/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/class_upload.asp deleted file mode 100644 index 5634598d18d..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/class_upload.asp +++ /dev/null @@ -1,353 +0,0 @@ -<% - ' FCKeditor - The text editor for Internet - http://www.fckeditor.net - ' Copyright (C) 2003-2010 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( " diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/commands.asp b/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/commands.asp deleted file mode 100644 index eba89a88f12..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/commands.asp +++ /dev/null @@ -1,202 +0,0 @@ -<% - ' FCKeditor - The text editor for Internet - http://www.fckeditor.net - ' Copyright (C) 2003-2010 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 "" - - 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 "" - Next - - Set oFSO = Nothing - - ' Close the "Folders" node. - Response.Write "" -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 "" - - For Each oFolder in oFolders - Response.Write "" - Next - - ' Close the "Folders" node. - Response.Write "" - - ' Open the "Files" node. - Response.Write "" - - For Each oFile in oFiles - Dim iFileSize - iFileSize = Round( oFile.size / 1024 ) - If ( iFileSize < 1 AND oFile.size <> 0 ) Then iFileSize = 1 - - Response.Write "" - Next - - ' Close the "Files" node. - Response.Write "" -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, CombineLocalPaths(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 "" -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 = CombineLocalPaths(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 ) - - If ( sErrorNumber = "0" or sErrorNumber = "201" ) then - SendUploadResults sErrorNumber, sFileUrl, sFileName, "" - Else - SendUploadResults sErrorNumber, "", "", "" - End If -End Sub - -%> diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/config.asp b/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/config.asp deleted file mode 100644 index 8ce4f2a0b3e..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/config.asp +++ /dev/null @@ -1,128 +0,0 @@ -<% - ' FCKeditor - The text editor for Internet - http://www.fckeditor.net - ' Copyright (C) 2003-2010 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", "" - -%> diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/connector.asp b/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/connector.asp deleted file mode 100644 index 4c44bda06da..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/connector.asp +++ /dev/null @@ -1,88 +0,0 @@ -<%@ CodePage=65001 Language="VBScript"%> -<% -Option Explicit -Response.Buffer = True -%> -<% - ' FCKeditor - The text editor for Internet - http://www.fckeditor.net - ' Copyright (C) 2003-2010 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. -%> - - - - - - -<% - -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, "Invalid type specified" - 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 - -%> diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/io.asp b/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/io.asp deleted file mode 100644 index 8f2f3f09fdf..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/io.asp +++ /dev/null @@ -1,247 +0,0 @@ -<% - ' FCKeditor - The text editor for Internet - http://www.fckeditor.net - ' Copyright (C) 2003-2010 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) - sFolder = replace(sFolder, "\", "/") - CombinePaths = RemoveFromEnd( sBasePath, "/" ) & "/" & RemoveFromStart( sFolder, "/" ) -end function - -function CombineLocalPaths( sBasePath, sFolder) - sFolder = replace(sFolder, "/", "\") - ' The RemoveFrom* functions use RegExp, so we must escape the \ - CombineLocalPaths = 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 = CombineLocalPaths( sResourceTypePath, folderPath ) -End Function - -Sub CreateServerFolder( folderPath ) - Dim oFSO - Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) - - Dim sParent - sParent = oFSO.GetParentFolderName( folderPath ) - - ' If folderPath is a network path (\\server\folder\) then sParent is an empty string. - ' Get out. - if (sParent = "") then exit sub - - ' 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 = False - 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 - dim oRegex - - 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 OR InStr( 1, sCurrentFolder, "\" ) <> 0) Then - SendError 102, "" - End If - - Set oRegex = New RegExp - oRegex.Global = True - oRegex.Pattern = "(/\.)|(//)|([\\:\*\?\""\<\>\|]|[\u0000-\u001F]|\u007F)" - - if (oRegex.Test(sCurrentFolder)) 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 . \ / | : ? * " < > and control characters - oRegex.Pattern = "(\.|\\|\/|\||:|\?|\*|""|\<|\>|[\u0000-\u001F]|\u007F)" - 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 \ / | : ? * " < > and control characters - oRegex.Pattern = "(\\|\/|\||:|\?|\*|""|\<|\>|[\u0000-\u001F]|\u007F)" - 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 "" - Response.End -End Sub - -%> diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/upload.asp b/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/upload.asp deleted file mode 100644 index 05ca3c4beb5..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/upload.asp +++ /dev/null @@ -1,65 +0,0 @@ -<%@ CodePage=65001 Language="VBScript"%> -<% -Option Explicit -Response.Buffer = True -%> -<% - ' FCKeditor - The text editor for Internet - http://www.fckeditor.net - ' Copyright (C) 2003-2010 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. -%> - - - - - -<% - -Sub SendError( number, text ) - SendUploadResults number, "", "", text -End Sub - -' 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 = "/" - - ' 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 - -%> diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/util.asp b/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/util.asp deleted file mode 100644 index 7c9190827c9..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/asp/util.asp +++ /dev/null @@ -1,55 +0,0 @@ -<% - ' FCKeditor - The text editor for Internet - http://www.fckeditor.net - ' Copyright (C) 2003-2010 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 - -%> diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/aspx/config.ascx b/htdocs/includes/fckeditor/editor/filemanager/connectors/aspx/config.ascx deleted file mode 100644 index 23ee5daa81a..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/aspx/config.ascx +++ /dev/null @@ -1,98 +0,0 @@ -<%@ Control Language="C#" EnableViewState="false" AutoEventWireup="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Config" %> -<%-- - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2010 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 Browser Connector for ASP.NET. ---%> - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/aspx/connector.aspx b/htdocs/includes/fckeditor/editor/filemanager/connectors/aspx/connector.aspx deleted file mode 100644 index 896359d7011..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/aspx/connector.aspx +++ /dev/null @@ -1,32 +0,0 @@ -<%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Connector" AutoEventWireup="false" %> -<%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %> -<%-- - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2010 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 Browser Connector for ASP.NET. - * - * The code of this page if included in the FCKeditor.Net package, - * in the FredCK.FCKeditorV2.dll assembly file. So to use it you must - * include that DLL in your "bin" directory. - * - * To download the FCKeditor.Net package, go to our official web site: - * http://www.fckeditor.net ---%> - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/aspx/upload.aspx b/htdocs/includes/fckeditor/editor/filemanager/connectors/aspx/upload.aspx deleted file mode 100644 index 37898b0aabb..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/aspx/upload.aspx +++ /dev/null @@ -1,32 +0,0 @@ -<%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Uploader" AutoEventWireup="false" %> -<%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %> -<%-- - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2010 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 Uploader for ASP.NET. - * - * The code of this page if included in the FCKeditor.Net package, - * in the FredCK.FCKeditorV2.dll assemblyfile. So to use it you must - * include that DLL in your "bin" directory. - * - * To download the FCKeditor.Net package, go to our official web site: - * http://www.fckeditor.net ---%> - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/ImageObject.cfc b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/ImageObject.cfc deleted file mode 100644 index b9b919c7704..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/ImageObject.cfc +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf5_connector.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf5_connector.cfm deleted file mode 100644 index b1769968d36..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf5_connector.cfm +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - - - - - userFilesPath = config.userFilesPath; - - if ( userFilesPath eq "" ) - { - userFilesPath = "/userfiles/"; - } - - // make sure the user files path is correctly formatted - userFilesPath = replace(userFilesPath, "\", "/", "ALL"); - userFilesPath = replace(userFilesPath, '//', '/', 'ALL'); - if ( right(userFilesPath,1) NEQ "/" ) - { - userFilesPath = userFilesPath & "/"; - } - if ( left(userFilesPath,1) NEQ "/" ) - { - userFilesPath = "/" & userFilesPath; - } - - // make sure the current folder is correctly formatted - url.currentFolder = replace(url.currentFolder, "\", "/", "ALL"); - url.currentFolder = replace(url.currentFolder, '//', '/', 'ALL'); - if ( right(url.currentFolder,1) neq "/" ) - { - url.currentFolder = url.currentFolder & "/"; - } - if ( left(url.currentFolder,1) neq "/" ) - { - url.currentFolder = "/" & url.currentFolder; - } - - if ( find("/",getBaseTemplatePath()) neq 0 ) - { - fs = "/"; - } - else - { - fs = "\"; - } - - // Get the base physical path to the web root for this application. The code to determine the path automatically assumes that - // the "FCKeditor" directory in the http request path is directly off the web root for the application and that it's not a - // virtual directory or a symbolic link / junction. Use the serverPath config setting to force a physical path if necessary. - if ( len(config.serverPath) ) - { - serverPath = config.serverPath; - - if ( right(serverPath,1) neq fs ) - { - serverPath = serverPath & fs; - } - } - else - { - serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),"") & replace(userFilesPath,"/",fs,"all"); - } - - rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ; - xmlContent = ""; // append to this string to build content - invalidName = false; - - - - - - "> - -])', url.currentFolder)> - - - "> - - - - - '> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - i=1; - folders = ""; - while( i lte qDir.recordCount ) { - if( not compareNoCase( qDir.type[i], "FILE" )) - break; - if( not listFind(".,..", qDir.name[i]) ) - folders = folders & ''; - i=i+1; - } - - xmlContent = xmlContent & '' & folders & ''; - - - - - - - - - - - - i=1; - folders = ""; - files = ""; - while( i lte qDir.recordCount ) { - if( not compareNoCase( qDir.type[i], "DIR" ) and not listFind(".,..", qDir.name[i]) ) { - folders = folders & ''; - } else if( not compareNoCase( qDir.type[i], "FILE" ) ) { - fileSizeKB = round(qDir.size[i] / 1024); - files = files & ''; - } - i=i+1; - } - - xmlContent = xmlContent & '' & folders & ''; - xmlContent = xmlContent & '' & files & ''; - - - - - - - - - - - newFolderName = url.newFolderName; - if( reFind("[^A-Za-z0-9_\-\.]", newFolderName) ) { - // Munge folder name same way as we do the filename - // This means folder names are always US-ASCII so we don't have to worry about CF5 and UTF-8 - newFolderName = reReplace(newFolderName, "[^A-Za-z0-9\-\.]", "_", "all"); - newFolderName = reReplace(newFolderName, "_{2,}", "_", "all"); - newFolderName = reReplace(newFolderName, "([^_]+)_+$", "\1", "all"); - newFolderName = reReplace(newFolderName, "$_([^_]+)$", "\1", "all"); - newFolderName = reReplace(newFolderName, '\.+', "_", "all" ); - } - - - - - - - - - - - - - - - - - - - - - '> - - - - - - - - - - - - xmlHeader = ''; - if (invalidName) { - xmlHeader = xmlHeader & ''; - } - else { - xmlHeader = xmlHeader & ''; - xmlHeader = xmlHeader & ''; - } - xmlFooter = ''; - - - - - - -#xmlHeader##xmlContent##xmlFooter# diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf5_upload.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf5_upload.cfm deleted file mode 100644 index cbf86df036f..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf5_upload.cfm +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - function SendUploadResults(errorNumber, fileUrl, fileName, customMsg) - { - WriteOutput(''); - } - - - - - - - - - - - - - - - - - - - - - - -])', url.currentFolder)> - - - - - - - userFilesPath = config.userFilesPath; - - if ( userFilesPath eq "" ) { - userFilesPath = "/userfiles/"; - } - - // make sure the user files path is correctly formatted - userFilesPath = replace(userFilesPath, "\", "/", "ALL"); - userFilesPath = replace(userFilesPath, '//', '/', 'ALL'); - if ( right(userFilesPath,1) NEQ "/" ) { - userFilesPath = userFilesPath & "/"; - } - if ( left(userFilesPath,1) NEQ "/" ) { - userFilesPath = "/" & userFilesPath; - } - - // make sure the current folder is correctly formatted - url.currentFolder = replace(url.currentFolder, "\", "/", "ALL"); - url.currentFolder = replace(url.currentFolder, '//', '/', 'ALL'); - if ( right(url.currentFolder,1) neq "/" ) { - url.currentFolder = url.currentFolder & "/"; - } - if ( left(url.currentFolder,1) neq "/" ) { - url.currentFolder = "/" & url.currentFolder; - } - - if (find("/",getBaseTemplatePath())) { - fs = "/"; - } else { - fs = "\"; - } - - // Get the base physical path to the web root for this application. The code to determine the path automatically assumes that - // the "FCKeditor" directory in the http request path is directly off the web root for the application and that it's not a - // virtual directory or a symbolic link / junction. Use the serverPath config setting to force a physical path if necessary. - if ( len(config.serverPath) ) { - serverPath = config.serverPath; - - if ( right(serverPath,1) neq fs ) { - serverPath = serverPath & fs; - } - } else { - serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),"") & replace(userFilesPath,"/",fs,"all"); - } - - rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - errorNumber = 0; - fileName = cffile.ClientFileName ; - fileExt = cffile.ServerFileExt ; - fileExisted = false ; - - // munge filename for html download. Only a-z, 0-9, _, - and . are allowed - if( reFind("[^A-Za-z0-9_\-\.]", fileName) ) { - fileName = reReplace(fileName, "[^A-Za-z0-9\-\.]", "_", "ALL"); - fileName = reReplace(fileName, "_{2,}", "_", "ALL"); - fileName = reReplace(fileName, "([^_]+)_+$", "\1", "ALL"); - fileName = reReplace(fileName, "$_([^_]+)$", "\1", "ALL"); - } - - // remove additional dots from file name - if( isDefined("Config.ForceSingleExtension") and Config.ForceSingleExtension ) - fileName = replace( fileName, '.', "_", "all" ) ; - - // When the original filename already exists, add numbers (0), (1), (2), ... at the end of the filename. - counter = 0; - tmpFileName = fileName; - while( fileExists("#currentFolderPath##fileName#.#fileExt#") ) { - fileExisted = true ; - counter = counter + 1 ; - fileName = tmpFileName & '(#counter#)' ; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_basexml.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_basexml.cfm deleted file mode 100644 index 0b67e17f488..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_basexml.cfm +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_commands.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_commands.cfm deleted file mode 100644 index ec126537ae6..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_commands.cfm +++ /dev/null @@ -1,240 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sFileExt = GetExtension( sFileName ) ; - sFilePart = RemoveExtension( sFileName ); - while( fileExists( sServerDir & sFileName ) ) - { - counter = counter + 1; - sFileName = sFilePart & '(#counter#).' & CFFILE.ClientFileExt; - errorNumber = 201; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - while( i lte qDir.recordCount ) - { - if( compareNoCase( qDir.type[i], "FILE" ) and not listFind( ".,..", qDir.name[i] ) ) - { - folders = folders & '' ; - } - i = i + 1; - } - - #folders# - - - - - - - - - - - - - - - - while( i lte qDir.recordCount ) - { - if( not compareNoCase( qDir.type[i], "DIR" ) and not listFind( ".,..", qDir.name[i] ) ) - { - folders = folders & '' ; - } - else if( not compareNoCase( qDir.type[i], "FILE" ) ) - { - fileSizeKB = round(qDir.size[i] / 1024) ; - files = files & '' ; - } - i = i + 1 ; - } - - #folders# - #files# - - - - - - - - - - - - - - - - sNewFolderName = SanitizeFolderName( sNewFolderName ) ; - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_connector.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_connector.cfm deleted file mode 100644 index fda24221319..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_connector.cfm +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_io.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_io.cfm deleted file mode 100644 index 3ba6bc29817..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_io.cfm +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ])', sCurrentFolder)> - - - - - - - - - - - - - - - - +|[[:cntrl:]]+', "_", "all" )> - - - - - - - - - - var chunk = ""; - var fileReaderClass = ""; - var fileReader = ""; - var file = ""; - var done = false; - var counter = 0; - var byteArray = ""; - - if( not fileExists( ARGUMENTS.fileName ) ) - { - return "" ; - } - - if (REQUEST.CFVersion gte 8) - { - file = FileOpen( ARGUMENTS.fileName, "readbinary" ) ; - byteArray = FileRead( file, 1024 ) ; - chunk = toString( toBinary( toBase64( byteArray ) ) ) ; - FileClose( file ) ; - } - else - { - fileReaderClass = createObject("java", "java.io.FileInputStream"); - fileReader = fileReaderClass.init(fileName); - - while(not done) - { - char = fileReader.read(); - counter = counter + 1; - if ( char eq -1 or counter eq ARGUMENTS.bytes) - { - done = true; - } - else - { - chunk = chunk & chr(char) ; - } - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +|[[:cntrl:]]+', "_", "all" )> - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_upload.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_upload.cfm deleted file mode 100644 index 53375515006..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_upload.cfm +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_util.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_util.cfm deleted file mode 100644 index 5d0bc4f6ef1..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/cf_util.cfm +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/config.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/config.cfm deleted file mode 100644 index 1f5ad20da87..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/config.cfm +++ /dev/null @@ -1,150 +0,0 @@ - - - - - Config = StructNew() ; - - // SECURITY: You must explicitly enable this "connector". (Set enabled to "true") - Config.Enabled = false ; - - // Path to uploaded files relative to the document root. - Config.UserFilesPath = "/userfiles/" ; - - // Use this to force the server path if FCKeditor is not running directly off - // the root of the application or the FCKeditor directory in the URL is a virtual directory - // or a symbolic link / junction - // Example: C:\inetpub\wwwroot\myDocs\ - Config.ServerPath = "" ; - - // Due to security issues with Apache modules, it is recommended to leave the - // following setting enabled. - Config.ForceSingleExtension = true ; - - // Perform additional checks for image files - if set to true, validate image size - // (This feature works in MX 6.0 and above) - Config.SecureImageUploads = true; - - // What the user can do with this connector - Config.ConfigAllowedCommands = "QuickUpload,FileUpload,GetFolders,GetFoldersAndFiles,CreateFolder" ; - - //Allowed Resource Types - Config.ConfigAllowedTypes = "File,Image,Flash,Media" ; - - // For security, HTML is allowed in the first Kb of data for files having the - // following extensions only. - // (This feature works in MX 6.0 and above)) - Config.HtmlExtensions = "html,htm,xml,xsd,txt,js" ; - - //Due to known issues with GetTempDirectory function, it is - //recommended to set this vairiable to a valid directory - //instead of using the GetTempDirectory function - //(used by MX 6.0 and above) - Config.TempDirectory = GetTempDirectory(); - - - - - - - - - - - - - - - - -// 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. -// Usefull 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. -// Usefull 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: '/' - - Config.AllowedExtensions = StructNew() ; - Config.DeniedExtensions = StructNew() ; - Config.FileTypesPath = StructNew() ; - Config.FileTypesAbsolutePath = StructNew() ; - Config.QuickUploadPath = StructNew() ; - Config.QuickUploadAbsolutePath = StructNew() ; - - Config.AllowedExtensions["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" ; - Config.DeniedExtensions["File"] = "" ; - Config.FileTypesPath["File"] = Config.UserFilesPath & 'file/' ; - Config.FileTypesAbsolutePath["File"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'file/') ) ; - Config.QuickUploadPath["File"] = Config.FileTypesPath["File"] ; - Config.QuickUploadAbsolutePath["File"] = Config.FileTypesAbsolutePath["File"] ; - - Config.AllowedExtensions["Image"] = "bmp,gif,jpeg,jpg,png" ; - Config.DeniedExtensions["Image"] = "" ; - Config.FileTypesPath["Image"] = Config.UserFilesPath & 'image/' ; - Config.FileTypesAbsolutePath["Image"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'image/') ) ; - Config.QuickUploadPath["Image"] = Config.FileTypesPath["Image"] ; - Config.QuickUploadAbsolutePath["Image"] = Config.FileTypesAbsolutePath["Image"] ; - - Config.AllowedExtensions["Flash"] = "swf,flv" ; - Config.DeniedExtensions["Flash"] = "" ; - Config.FileTypesPath["Flash"] = Config.UserFilesPath & 'flash/' ; - Config.FileTypesAbsolutePath["Flash"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'flash/') ) ; - Config.QuickUploadPath["Flash"] = Config.FileTypesPath["Flash"] ; - Config.QuickUploadAbsolutePath["Flash"] = Config.FileTypesAbsolutePath["Flash"] ; - - Config.AllowedExtensions["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" ; - Config.DeniedExtensions["Media"] = "" ; - Config.FileTypesPath["Media"] = Config.UserFilesPath & 'media/' ; - Config.FileTypesAbsolutePath["Media"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'media/') ) ; - Config.QuickUploadPath["Media"] = Config.FileTypesPath["Media"] ; - Config.QuickUploadAbsolutePath["Media"] = Config.FileTypesAbsolutePath["Media"] ; - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/connector.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/connector.cfm deleted file mode 100644 index a0de684b211..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/connector.cfm +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/image.cfc b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/image.cfc deleted file mode 100644 index 378c4b4b959..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/image.cfc +++ /dev/null @@ -1,1324 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - paths = arrayNew(1); - paths[1] = expandPath("metadata-extractor-2.3.1.jar"); - loader = createObject("component", "javaloader.JavaLoader").init(paths); - - //at this stage we only have access to the class, but we don't have an instance - JpegMetadataReader = loader.create("com.drew.imaging.jpeg.JpegMetadataReader"); - - myMetaData = JpegMetadataReader.readMetadata(inFile); - directories = myMetaData.getDirectoryIterator(); - while (directories.hasNext()) { - currentDirectory = directories.next(); - tags = currentDirectory.getTagIterator(); - while (tags.hasNext()) { - currentTag = tags.next(); - if (currentTag.getTagName() DOES NOT CONTAIN "Unknown") { //leave out the junk data - queryAddRow(retQry); - querySetCell(retQry,"dirName",replace(currentTag.getDirectoryName(),' ','_','ALL')); - tagName = replace(currentTag.getTagName(),' ','','ALL'); - tagName = replace(tagName,'/','','ALL'); - querySetCell(retQry,"tagName",tagName); - querySetCell(retQry,"tagValue",currentTag.getDescription()); - } - } - } - return retQry; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - resizedImage = CreateObject("java", "java.awt.image.BufferedImage"); - at = CreateObject("java", "java.awt.geom.AffineTransform"); - op = CreateObject("java", "java.awt.image.AffineTransformOp"); - - w = img.getWidth(); - h = img.getHeight(); - - if (preserveAspect and cropToExact and newHeight gt 0 and newWidth gt 0) - { - if (w / h gt newWidth / newHeight){ - newWidth = 0; - } else if (w / h lt newWidth / newHeight){ - newHeight = 0; - } - } else if (preserveAspect and newHeight gt 0 and newWidth gt 0) { - if (w / h gt newWidth / newHeight){ - newHeight = 0; - } else if (w / h lt newWidth / newHeight){ - newWidth = 0; - } - } - if (newWidth gt 0 and newHeight eq 0) { - scale = newWidth / w; - w = newWidth; - h = round(h*scale); - } else if (newHeight gt 0 and newWidth eq 0) { - scale = newHeight / h; - h = newHeight; - w = round(w*scale); - } else if (newHeight gt 0 and newWidth gt 0) { - w = newWidth; - h = newHeight; - } else { - retVal = throw( retVal.errorMessage); - return retVal; - } - resizedImage.init(javacast("int",w),javacast("int",h),img.getType()); - - w = w / img.getWidth(); - h = h / img.getHeight(); - - - - op.init(at.getScaleInstance(javacast("double",w),javacast("double",h)), rh); - // resizedImage = op.createCompatibleDestImage(img, img.getColorModel()); - op.filter(img, resizedImage); - - imgInfo = getimageinfo(resizedImage, ""); - if (imgInfo.errorCode gt 0) - { - return imgInfo; - } - - cropOffsetX = max( Int( (imgInfo.width/2) - (newWidth/2) ), 0 ); - cropOffsetY = max( Int( (imgInfo.height/2) - (newHeight/2) ), 0 ); - // There is a chance that the image is exactly the correct - // width and height and don't need to be cropped - if - ( - preserveAspect and cropToExact - and - (imgInfo.width IS NOT specifiedWidth OR imgInfo.height IS NOT specifiedHeight) - ) - { - // Get the correct offset to get the center of the image - cropOffsetX = max( Int( (imgInfo.width/2) - (specifiedWidth/2) ), 0 ); - cropOffsetY = max( Int( (imgInfo.height/2) - (specifiedHeight/2) ), 0 ); - - cropImageResult = crop( resizedImage, "", "", cropOffsetX, cropOffsetY, specifiedWidth, specifiedHeight ); - if ( cropImageResult.errorCode GT 0) - { - return cropImageResult; - } else { - resizedImage = cropImageResult.img; - } - } - if (outputFile eq "") - { - retVal.img = resizedImage; - return retVal; - } else { - saveImage = writeImage(outputFile, resizedImage, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (fromX + newWidth gt img.getWidth() - OR - fromY + newHeight gt img.getHeight() - ) - { - retval = throw( "The cropped image dimensions go beyond the original image dimensions."); - return retVal; - } - croppedImage = img.getSubimage(javaCast("int", fromX), javaCast("int", fromY), javaCast("int", newWidth), javaCast("int", newHeight) ); - if (outputFile eq "") - { - retVal.img = croppedImage; - return retVal; - } else { - saveImage = writeImage(outputFile, croppedImage, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rotatedImage = CreateObject("java", "java.awt.image.BufferedImage"); - at = CreateObject("java", "java.awt.geom.AffineTransform"); - op = CreateObject("java", "java.awt.image.AffineTransformOp"); - - iw = img.getWidth(); h = iw; - ih = img.getHeight(); w = ih; - - if(arguments.degrees eq 180) { w = iw; h = ih; } - - x = (w/2)-(iw/2); - y = (h/2)-(ih/2); - - rotatedImage.init(javacast("int",w),javacast("int",h),img.getType()); - - at.rotate(arguments.degrees * 0.0174532925,w/2,h/2); - at.translate(x,y); - op.init(at, rh); - - op.filter(img, rotatedImage); - - if (outputFile eq "") - { - retVal.img = rotatedImage; - return retVal; - } else { - saveImage = writeImage(outputFile, rotatedImage, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (outputFile eq "") - { - retVal = throw( "The convert method requires a valid output filename."); - return retVal; - } else { - saveImage = writeImage(outputFile, img, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* - JPEG output method handles compression - */ - out = createObject("java", "java.io.BufferedOutputStream"); - fos = createObject("java", "java.io.FileOutputStream"); - fos.init(tempOutputFile); - out.init(fos); - JPEGCodec = createObject("java", "com.sun.image.codec.jpeg.JPEGCodec"); - encoder = JPEGCodec.createJPEGEncoder(out); - param = encoder.getDefaultJPEGEncodeParam(img); - param.setQuality(quality, false); - encoder.setJPEGEncodeParam(param); - encoder.encode(img); - out.close(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - flippedImage = CreateObject("java", "java.awt.image.BufferedImage"); - at = CreateObject("java", "java.awt.geom.AffineTransform"); - op = CreateObject("java", "java.awt.image.AffineTransformOp"); - - flippedImage.init(img.getWidth(), img.getHeight(), img.getType()); - - if (direction eq "horizontal") { - at = at.getScaleInstance(-1, 1); - at.translate(-img.getWidth(), 0); - } else { - at = at.getScaleInstance(1,-1); - at.translate(0, -img.getHeight()); - } - op.init(at, rh); - op.filter(img, flippedImage); - - if (outputFile eq "") - { - retVal.img = flippedImage; - return retVal; - } else { - saveImage = writeImage(outputFile, flippedImage, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // initialize the blur filter - variables.blurFilter.init(arguments.blurAmount); - // move the source image into the destination image - // so we can repeatedly blur it. - destImage = srcImage; - - for (i=1; i lte iterations; i=i+1) - { - // do the blur i times - destImage = variables.blurFilter.filter(destImage); - } - - - if (outputFile eq "") - { - // return the image object - retVal.img = destImage; - return retVal; - } else { - // write the image object to the specified file. - saveImage = writeImage(outputFile, destImage, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // initialize the sharpen filter - variables.sharpenFilter.init(); - - destImage = variables.sharpenFilter.filter(srcImage); - - - if (outputFile eq "") - { - // return the image object - retVal.img = destImage; - return retVal; - } else { - // write the image object to the specified file. - saveImage = writeImage(outputFile, destImage, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // initialize the posterize filter - variables.posterizeFilter.init(arguments.amount); - - destImage = variables.posterizeFilter.filter(srcImage); - - - if (outputFile eq "") - { - // return the image object - retVal.img = destImage; - return retVal; - } else { - // write the image object to the specified file. - saveImage = writeImage(outputFile, destImage, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // load objects - bgImage = CreateObject("java", "java.awt.image.BufferedImage"); - fontImage = CreateObject("java", "java.awt.image.BufferedImage"); - overlayImage = CreateObject("java", "java.awt.image.BufferedImage"); - Color = CreateObject("java","java.awt.Color"); - font = createObject("java","java.awt.Font"); - font_stream = createObject("java","java.io.FileInputStream"); - ac = CreateObject("Java", "java.awt.AlphaComposite"); - - // set up basic needs - fontColor = Color.init(javacast("int", rgb.red), javacast("int", rgb.green), javacast("int", rgb.blue)); - - if (fontDetails.fontFile neq "") - { - font_stream.init(arguments.fontDetails.fontFile); - font = font.createFont(font.TRUETYPE_FONT, font_stream); - font = font.deriveFont(javacast("float",arguments.fontDetails.size)); - } else { - font.init(fontDetails.fontName, evaluate(fontDetails.style), fontDetails.size); - } - // get font metrics using a 1x1 bufferedImage - fontImage.init(1,1,img.getType()); - g2 = fontImage.createGraphics(); - g2.setRenderingHints(getRenderingHints()); - fc = g2.getFontRenderContext(); - bounds = font.getStringBounds(content,fc); - - g2 = img.createGraphics(); - g2.setRenderingHints(getRenderingHints()); - g2.setFont(font); - g2.setColor(fontColor); - // in case you want to change the alpha - // g2.setComposite(ac.getInstance(ac.SRC_OVER, 0.50)); - - // the location (arguments.fontDetails.size+y) doesn't really work - // the way I want it to. - g2.drawString(content,javacast("int",x),javacast("int",arguments.fontDetails.size+y)); - - if (outputFile eq "") - { - retVal.img = img; - return retVal; - } else { - saveImage = writeImage(outputFile, img, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - at = CreateObject("java", "java.awt.geom.AffineTransform"); - op = CreateObject("java", "java.awt.image.AffineTransformOp"); - ac = CreateObject("Java", "java.awt.AlphaComposite"); - gfx = originalImage.getGraphics(); - gfx.setComposite(ac.getInstance(ac.SRC_OVER, alpha)); - - at.init(); - // op.init(at,op.TYPE_BILINEAR); - op.init(at, rh); - - gfx.drawImage(wmImage, op, javaCast("int",arguments.placeAtX), javacast("int", arguments.placeAtY)); - - gfx.dispose(); - - if (outputFile eq "") - { - retVal.img = originalImage; - return retVal; - } else { - saveImage = writeImage(outputFile, originalImage, jpegCompression); - if (saveImage.errorCode gt 0) - { - return saveImage; - } else { - return retVal; - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // convert the image to a specified BufferedImage type and return it - - var width = bImage.getWidth(); - var height = bImage.getHeight(); - var newImage = createObject("java","java.awt.image.BufferedImage").init(javacast("int",width), javacast("int",height), javacast("int",type)); - // int[] rgbArray = new int[width*height]; - var rgbArray = variables.arrObj.newInstance(variables.intClass, javacast("int",width*height)); - - bImage.getRGB( - javacast("int",0), - javacast("int",0), - javacast("int",width), - javacast("int",height), - rgbArray, - javacast("int",0), - javacast("int",width) - ); - newImage.setRGB( - javacast("int",0), - javacast("int",0), - javacast("int",width), - javacast("int",height), - rgbArray, - javacast("int",0), - javacast("int",width) - ); - return newImage; - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/upload.cfm b/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/upload.cfm deleted file mode 100644 index 72fac0db1cb..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/cfm/upload.cfm +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/lasso/config.lasso b/htdocs/includes/fckeditor/editor/filemanager/connectors/lasso/config.lasso deleted file mode 100644 index d558dfa5dc6..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/lasso/config.lasso +++ /dev/null @@ -1,65 +0,0 @@ -[//lasso -/* - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2010 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 Lasso. - */ - - /*..................................................................... - The connector uses the file tags, which require authentication. Enter a - valid username and password from Lasso admin for a group with file tags - permissions for uploads and the path you define in UserFilesPath below. - */ - - var('connection') = array( - -username='xxxxxxxx', - -password='xxxxxxxx' - ); - - - /*..................................................................... - Set the base path for files that users can upload and browse (relative - to server root). - - Set which file extensions are allowed and/or denied for each file type. - */ - var('config') = map( - 'Enabled' = false, - 'UserFilesPath' = '/userfiles/', - 'Subdirectories' = map( - 'File' = 'File/', - 'Image' = 'Image/', - 'Flash' = 'Flash/', - 'Media' = 'Media/' - ), - 'AllowedExtensions' = map( - 'File' = array('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'), - 'Image' = array('bmp','gif','jpeg','jpg','png'), - 'Flash' = array('swf','flv'), - 'Media' = array('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') - ), - 'DeniedExtensions' = map( - 'File' = array(), - 'Image' = array(), - 'Flash' = array(), - 'Media' = array() - ) - ); -] diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/lasso/connector.lasso b/htdocs/includes/fckeditor/editor/filemanager/connectors/lasso/connector.lasso deleted file mode 100644 index 98e3e4f89ab..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/lasso/connector.lasso +++ /dev/null @@ -1,330 +0,0 @@ -[//lasso -/* - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2010 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 Lasso. - */ - - /*..................................................................... - Include global configuration. See config.lasso for details. - */ - include('config.lasso'); - - - /*..................................................................... - Translate current date/time to GMT for custom header. - */ - var('headerDate') = date_localtogmt(date)->format('%a, %d %b %Y %T GMT'); - - - /*..................................................................... - Convert query string parameters to variables and initialize output. - */ - var( - 'Command' = (Encode_HTML: action_param('Command')), - 'Type' = (Encode_HTML: action_param('Type')), - 'CurrentFolder' = action_param('CurrentFolder'), - 'ServerPath' = action_param('ServerPath'), - 'NewFolderName' = action_param('NewFolderName'), - 'NewFile' = null, - 'NewFileName' = string, - 'OrigFilePath' = string, - 'NewFilePath' = string, - 'commandData' = string, - 'folders' = '\t\n', - 'files' = '\t\n', - 'errorNumber' = integer, - 'responseType' = 'xml', - 'uploadResult' = '0' - ); - - /*..................................................................... - Custom tag sets the HTML response. - */ - - define_tag( - 'htmlreply', - -namespace='fck_', - -priority='replace', - -required='uploadResult', - -optional='NewFilePath', - -type='string', - -description='Sets the HTML response for the FCKEditor File Upload feature.' - ); - $__html_reply__ = '\ - - '; - else; - $__html_reply__ = $__html_reply__ + '\ - window.parent.OnUploadCompleted(' + $uploadResult + ',"",""); - - '; - /if; - /define_tag; - - - /*..................................................................... - Calculate the path to the current folder. - */ - $ServerPath == '' ? $ServerPath = $config->find('UserFilesPath'); - - var('currentFolderURL' = $ServerPath - + $config->find('Subdirectories')->find(action_param('Type')) - + $CurrentFolder - ); - - $currentFolderURL = string_replace($currentFolderURL, -find='//', -replace='/'); - - if (!$config->find('Subdirectories')->find(action_param('Type'))); - if($Command == 'FileUpload'); - $responseType = 'html'; - $uploadResult = '1'; - fck_htmlreply( - -uploadResult=$uploadResult - ); - else; - $errorNumber = 1; - $commandData += '\n'; - /if; - else if($CurrentFolder->(Find: '..') || (String_FindRegExp: $CurrentFolder, -Find='(/\\.)|(//)|[\\\\:\\*\\?\\""\\<\\>\\|]|\\000|[\u007F]|[\u0001-\u001F]')); - if($Command == 'FileUpload'); - $responseType = 'html'; - $uploadResult = '102'; - fck_htmlreply( - -uploadResult=$uploadResult - ); - else; - $errorNumber = 102; - $commandData += '\n'; - /if; - else; - - /*..................................................................... - Build the appropriate response per the 'Command' parameter. Wrap the - entire process in an inline for file tag permissions. - */ - if($config->find('Enabled')); - inline($connection); - select($Command); - /*............................................................. - List all subdirectories in the 'Current Folder' directory. - */ - case('GetFolders'); - $commandData += '\t\n'; - - iterate(file_listdirectory($currentFolderURL), local('this')); - #this->endswith('/') ? $commandData += '\t\t\n'; - /iterate; - - $commandData += '\t\n'; - - - /*............................................................. - List both files and folders in the 'Current Folder' directory. - Include the file sizes in kilobytes. - */ - case('GetFoldersAndFiles'); - iterate(file_listdirectory($currentFolderURL), local('this')); - if(#this->endswith('/')); - $folders += '\t\t\n'; - else; - local('size') = file_getsize($currentFolderURL + #this); - if($size>0); - $size = $size/1024; - if ($size==0); - $size = 1; - /if; - /if; - $files += '\t\t\n'; - /if; - /iterate; - - $folders += '\t\n'; - $files += '\t\n'; - - $commandData += $folders + $files; - - - /*............................................................. - Create a directory 'NewFolderName' within the 'Current Folder.' - */ - case('CreateFolder'); - $NewFolderName = (String_ReplaceRegExp: $NewFolderName, -find='\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|\\000|[\u007F]|[\u0001-\u001F]', -replace='_'); - var('newFolder' = $currentFolderURL + $NewFolderName + '/'); - file_create($newFolder); - - - /*......................................................... - Map Lasso's file error codes to FCKEditor's error codes. - */ - select(file_currenterror( -errorcode)); - case(0); - $errorNumber = 0; - case( -9983); - $errorNumber = 101; - case( -9976); - $errorNumber = 102; - case( -9977); - $errorNumber = 102; - case( -9961); - $errorNumber = 103; - case; - $errorNumber = 110; - /select; - - $commandData += '\n'; - - - /*............................................................. - Process an uploaded file. - */ - case('FileUpload'); - /*......................................................... - This is the only command that returns an HTML response. - */ - $responseType = 'html'; - - - /*......................................................... - Was a file actually uploaded? - */ - if(file_uploads->size); - $NewFile = file_uploads->get(1); - else; - $uploadResult = '202'; - /if; - - if($uploadResult == '0'); - /*..................................................... - Split the file's extension from the filename in order - to follow the API's naming convention for duplicate - files. (Test.txt, Test(1).txt, Test(2).txt, etc.) - */ - $NewFileName = $NewFile->find('OrigName'); - $NewFileName = (String_ReplaceRegExp: $NewFileName, -find='\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|\\000|[\u007F]|[\u0001-\u001F]', -replace='_'); - $NewFileName = (String_ReplaceRegExp: $NewFileName, -find='\\.(?![^.]*$)', -replace='_'); - $OrigFilePath = $currentFolderURL + $NewFileName; - $NewFilePath = $OrigFilePath; - local('fileExtension') = '.' + $NewFile->find('OrigExtension'); - #fileExtension = (String_ReplaceRegExp: #fileExtension, -find='\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|\\000|[\u007F]|[\u0001-\u001F]', -replace='_'); - local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&; - - - /*..................................................... - Make sure the file extension is allowed. - */ - local('allowedExt') = $config->find('AllowedExtensions')->find($Type); - local('deniedExt') = $config->find('DeniedExtensions')->find($Type); - if($allowedExt->Size > 0 && $allowedExt !>> $NewFile->find('OrigExtension')); - $uploadResult = '202'; - else($deniedExt->Size > 0 && $deniedExt >> $NewFile->find('OrigExtension')); - $uploadResult = '202'; - else; - /*................................................. - Rename the target path until it is unique. - */ - while(file_exists($NewFilePath)); - $NewFilePath = $currentFolderURL + #shortFileName + '(' + loop_count + ')' + #fileExtension; - /while; - - - /*................................................. - Copy the uploaded file to its final location. - */ - file_copy($NewFile->find('path'), $NewFilePath); - - - /*................................................. - Set the error code for the response. Note whether - the file had to be renamed. - */ - select(file_currenterror( -errorcode)); - case(0); - $OrigFilePath != $NewFilePath ? $uploadResult = 201; - case; - $uploadResult = file_currenterror( -errorcode); - /select; - /if; - /if; - fck_htmlreply( - -uploadResult=$uploadResult, - -NewFilePath=$NewFilePath - ); - case; - $errorNumber = 1; - $commandData += '\n'; - /select; - /inline; - else; - $errorNumber = 1; - $commandData += '\n'; - /if; - /if; - - /*..................................................................... - Send a custom header for xml responses. - */ - if($responseType == 'xml'); - header; -] -HTTP/1.0 200 OK -Date: [$headerDate] -Server: Lasso Professional [lasso_version( -lassoversion)] -Expires: Mon, 26 Jul 1997 05:00:00 GMT -Last-Modified: [$headerDate] -Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 -Pragma: no-cache -Keep-Alive: timeout=15, max=98 -Connection: Keep-Alive -Content-Type: text/xml; charset=utf-8 -[//lasso -/header; - - /* - Set the content type encoding for Lasso. - */ - content_type('text/xml; charset=utf-8'); - - /* - Wrap the response as XML and output. - */ - $__html_reply__ = '\ -'; - - if($errorNumber != '102'); - $__html_reply__ += ''; - else; - $__html_reply__ += ''; - /if; - - if($errorNumber != '102'); - $__html_reply__ += ''; - /if; - - $__html_reply__ += $commandData + ' -'; - /if; -] diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/lasso/upload.lasso b/htdocs/includes/fckeditor/editor/filemanager/connectors/lasso/upload.lasso deleted file mode 100644 index 66d563fdc1e..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/lasso/upload.lasso +++ /dev/null @@ -1,178 +0,0 @@ -[//lasso -/* - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2010 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 Lasso. - */ - - /*..................................................................... - Include global configuration. See config.lasso for details. - */ - include('config.lasso'); - - - /*..................................................................... - Convert query string parameters to variables and initialize output. - */ - var( - 'Type' = (Encode_HTML: action_param('Type')), - 'CurrentFolder' = "/", - 'ServerPath' = action_param('ServerPath'), - 'NewFile' = null, - 'NewFileName' = string, - 'OrigFilePath' = string, - 'NewFilePath' = string, - 'errorNumber' = 0, - 'customMsg' = '' - ); - - $Type == '' ? $Type = 'File'; - - - /*..................................................................... - Calculate the path to the current folder. - */ - $ServerPath == '' ? $ServerPath = $config->find('UserFilesPath'); - - var('currentFolderURL' = $ServerPath - + $config->find('Subdirectories')->find(action_param('Type')) - + $CurrentFolder - ); - - $currentFolderURL = string_replace($currentFolderURL, -find='//', -replace='/'); - - /*..................................................................... - Custom tag sets the HTML response. - */ - - define_tag( - 'sendresults', - -namespace='fck_', - -priority='replace', - -required='errorNumber', - -type='integer', - -optional='fileUrl', - -type='string', - -optional='fileName', - -type='string', - -optional='customMsg', - -type='string', - -description='Sets the HTML response for the FCKEditor Quick Upload feature.' - ); - - $__html_reply__ = ' - '; - /define_tag; - - if($CurrentFolder->(Find: '..') || (String_FindRegExp: $CurrentFolder, -Find='(/\\.)|(//)|[\\\\:\\*\\?\\""\\<\\>\\|]|\\000|[\u007F]|[\u0001-\u001F]')); - $errorNumber = 102; - /if; - - if($config->find('Enabled')); - /*................................................................. - Process an uploaded file. - */ - inline($connection); - /*............................................................. - Was a file actually uploaded? - */ - if($errorNumber != '102'); - file_uploads->size ? $NewFile = file_uploads->get(1) | $errorNumber = 202; - /if; - - if($errorNumber == 0); - /*......................................................... - Split the file's extension from the filename in order - to follow the API's naming convention for duplicate - files. (Test.txt, Test(1).txt, Test(2).txt, etc.) - */ - $NewFileName = $NewFile->find('OrigName'); - $NewFileName = (String_ReplaceRegExp: $NewFileName, -find='\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|\\000|[\u007F]|[\u0001-\u001F]', -replace='_'); - $NewFileName = (String_ReplaceRegExp: $NewFileName, -find='\\.(?![^.]*$)', -replace='_'); - $OrigFilePath = $currentFolderURL + $NewFileName; - $NewFilePath = $OrigFilePath; - local('fileExtension') = '.' + $NewFile->find('OrigExtension'); - local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&; - - - /*......................................................... - Make sure the file extension is allowed. - */ - - local('allowedExt') = $config->find('AllowedExtensions')->find($Type); - local('deniedExt') = $config->find('DeniedExtensions')->find($Type); - if($allowedExt->Size > 0 && $allowedExt !>> $NewFile->find('OrigExtension')); - $errorNumber = 202; - else($deniedExt->Size > 0 && $deniedExt >> $NewFile->find('OrigExtension')); - $errorNumber = 202; - else; - /*..................................................... - Rename the target path until it is unique. - */ - while(file_exists($NewFilePath)); - $NewFileName = #shortFileName + '(' + loop_count + ')' + #fileExtension; - $NewFilePath = $currentFolderURL + $NewFileName; - /while; - - - /*..................................................... - Copy the uploaded file to its final location. - */ - file_copy($NewFile->find('path'), $NewFilePath); - - - /*..................................................... - Set the error code for the response. - */ - select(file_currenterror( -errorcode)); - case(0); - $OrigFilePath != $NewFilePath ? $errorNumber = 201; - case; - $errorNumber = 202; - /select; - /if; - /if; - if ($errorNumber != 0 && $errorNumber != 201); - $NewFilePath = ""; - /if; - /inline; - else; - $errorNumber = 1; - $customMsg = 'This file uploader is disabled. Please check the "editor/filemanager/upload/lasso/config.lasso" file.'; - /if; - - fck_sendresults( - -errorNumber=$errorNumber, - -fileUrl=$NewFilePath, - -customMsg=$customMsg - ); -] diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/basexml.pl b/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/basexml.pl deleted file mode 100644 index e0835c3dd90..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/basexml.pl +++ /dev/null @@ -1,68 +0,0 @@ -##### -# FCKeditor - The text editor for Internet - http://www.fckeditor.net -# Copyright (C) 2003-2010 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 Perl. -##### - -sub CreateXmlHeader -{ - local($command,$resourceType,$currentFolder) = @_; - - # Create the XML document header. - print ''; - - # Create the main "Connector" node. - print ''; - - # Add the current folder node. - print ''; -} - -sub CreateXmlFooter -{ - print ''; -} - -sub SendError -{ - local( $number, $text ) = @_; - - print << "_HTML_HEAD_"; -Content-Type:text/xml; charset=utf-8 -Pragma: no-cache -Cache-Control: no-cache -Expires: Thu, 01 Dec 1994 16:00:00 GMT - -_HTML_HEAD_ - - # Create the XML document header - print '' ; - - if ($text) { - print '' ; - } - else { - print '' ; - } - - exit ; -} - -1; diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/commands.pl b/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/commands.pl deleted file mode 100644 index 66b4d6da0a7..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/commands.pl +++ /dev/null @@ -1,200 +0,0 @@ -##### -# FCKeditor - The text editor for Internet - http://www.fckeditor.net -# Copyright (C) 2003-2010 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 Perl. -##### - -sub GetFolders -{ - - local($resourceType, $currentFolder) = @_; - - # Map the virtual path to the local server path. - $sServerDir = &ServerMapFolder($resourceType, $currentFolder); - print ""; # Open the "Folders" node. - - opendir(DIR,"$sServerDir"); - @files = grep(!/^\.\.?$/,readdir(DIR)); - closedir(DIR); - - foreach $sFile (@files) { - if($sFile != '.' && $sFile != '..' && (-d "$sServerDir$sFile")) { - $cnv_filename = &ConvertToXmlAttribute($sFile); - print ''; - } - } - print ""; # Close the "Folders" node. -} - -sub GetFoldersAndFiles -{ - - local($resourceType, $currentFolder) = @_; - # Map the virtual path to the local server path. - $sServerDir = &ServerMapFolder($resourceType,$currentFolder); - - # Initialize the output buffers for "Folders" and "Files". - $sFolders = ''; - $sFiles = ''; - - opendir(DIR,"$sServerDir"); - @files = grep(!/^\.\.?$/,readdir(DIR)); - closedir(DIR); - - foreach $sFile (@files) { - if($sFile ne '.' && $sFile ne '..') { - if(-d "$sServerDir$sFile") { - $cnv_filename = &ConvertToXmlAttribute($sFile); - $sFolders .= '' ; - } else { - ($iFileSize,$refdate,$filedate,$fileperm) = (stat("$sServerDir$sFile"))[7,8,9,2]; - if($iFileSize > 0) { - $iFileSize = int($iFileSize / 1024); - if($iFileSize < 1) { - $iFileSize = 1; - } - } - $cnv_filename = &ConvertToXmlAttribute($sFile); - $sFiles .= '' ; - } - } - } - print $sFolders ; - print ''; # Close the "Folders" node. - print $sFiles ; - print ''; # Close the "Files" node. -} - -sub CreateFolder -{ - - local($resourceType, $currentFolder) = @_; - $sErrorNumber = '0' ; - $sErrorMsg = '' ; - - if($FORM{'NewFolderName'} ne "") { - $sNewFolderName = $FORM{'NewFolderName'}; - $sNewFolderName =~ s/\.|\\|\/|\||\:|\?|\*|\"|<|>|[[:cntrl:]]/_/g; - # Map the virtual path to the local server path of the current folder. - $sServerDir = &ServerMapFolder($resourceType, $currentFolder); - if(-w $sServerDir) { - $sServerDir .= $sNewFolderName; - $sErrorMsg = &CreateServerFolder($sServerDir); - if($sErrorMsg == 0) { - $sErrorNumber = '0'; - } elsif($sErrorMsg eq 'Invalid argument' || $sErrorMsg eq 'No such file or directory') { - $sErrorNumber = '102'; #// Path too long. - } else { - $sErrorNumber = '110'; - } - } else { - $sErrorNumber = '103'; - } - } else { - $sErrorNumber = '102' ; - } - # Create the "Error" node. - $cnv_errmsg = &ConvertToXmlAttribute($sErrorMsg); - print ''; -} - -sub FileUpload -{ -eval("use File::Copy;"); - - local($resourceType, $currentFolder) = @_; - $allowedExtensions = $allowedExtensions{$resourceType}; - - $sErrorNumber = '0' ; - $sFileName = '' ; - if($new_fname) { - # Map the virtual path to the local server path. - $sServerDir = &ServerMapFolder($resourceType,$currentFolder); - - # Get the uploaded file name. - $sFileName = $new_fname; - $sFileName =~ s/\\|\/|\||\:|\?|\*|\"|<|>|[[:cntrl:]]/_/g; - $sFileName =~ s/\.(?![^.]*$)/_/g; - - $ext = ''; - if($sFileName =~ /([^\\\/]*)\.(.*)$/) { - $ext = $2; - } - - $allowedRegex = qr/^($allowedExtensions)$/i; - if (!($ext =~ $allowedRegex)) { - SendUploadResults('202', '', '', ''); - } - - $sOriginalFileName = $sFileName; - - $iCounter = 0; - while(1) { - $sFilePath = $sServerDir . $sFileName; - if(-e $sFilePath) { - $iCounter++ ; - ($path,$BaseName,$ext) = &RemoveExtension($sOriginalFileName); - $sFileName = $BaseName . '(' . $iCounter . ').' . $ext; - $sErrorNumber = '201'; - } else { - copy("$img_dir/$new_fname","$sFilePath"); - if (defined $CHMOD_ON_UPLOAD) { - if ($CHMOD_ON_UPLOAD) { - umask(000); - chmod($CHMOD_ON_UPLOAD,$sFilePath); - } - } - else { - umask(000); - chmod(0777,$sFilePath); - } - unlink("$img_dir/$new_fname"); - last; - } - } - } else { - $sErrorNumber = '202' ; - } - $sFileName =~ s/"/\\"/g; - - SendUploadResults($sErrorNumber, $GLOBALS{'UserFilesPath'}.$resourceType.$currentFolder.$sFileName, $sFileName, ''); -} - -sub SendUploadResults -{ - - local($sErrorNumber, $sFileUrl, $sFileName, $customMsg) = @_; - - # Minified version of the document.domain automatic fix script (#1919). - # The original script can be found at _dev/domain_fix_template.js - # Note: in Perl replace \ with \\ and $ with \$ - print < -(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|\$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})(); - -EOF - print 'window.parent.OnUploadCompleted(' . $sErrorNumber . ',"' . JS_cnv($sFileUrl) . '","' . JS_cnv($sFileName) . '","' . JS_cnv($customMsg) . '") ;'; - print ''; - exit ; -} - -1; diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/config.pl b/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/config.pl deleted file mode 100644 index de85c7957d6..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/config.pl +++ /dev/null @@ -1,39 +0,0 @@ -##### -# FCKeditor - The text editor for Internet - http://www.fckeditor.net -# Copyright (C) 2003-2010 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 Perl. -##### - -## -# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR. -## -&SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/perl/config.cgi" file' ) ; - -$GLOBALS{'UserFilesPath'} = '/userfiles/'; - -# Map the "UserFiles" path to a local directory. -$rootpath = &GetRootPath(); -$GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'}; - -%allowedExtensions = ("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", -"Image", "bmp|gif|jpeg|jpg|png", -"Flash", "swf|flv", -"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" -); diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/connector.cgi b/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/connector.cgi deleted file mode 100644 index 990a92e6385..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/connector.cgi +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env perl - -##### -# FCKeditor - The text editor for Internet - http://www.fckeditor.net -# Copyright (C) 2003-2010 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 Perl. -##### - -## -# ATTENTION: To enable this connector, look for the "SECURITY" comment in config.pl. -## - -## START: Hack for Windows (Not important to understand the editor code... Perl specific). -if(Windows_check()) { - chdir(GetScriptPath($0)); -} - -sub Windows_check -{ - # IIS,PWS(NT/95) - $www_server_os = $^O; - # Win98 & NT(SP4) - if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; } - # AnHTTPd/Omni/IIS - if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; } - # Win Apache - if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; } - if($www_server_os=~ /win/i) { return(1); } - return(0); -} - -sub GetScriptPath { - local($path) = @_; - if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; } - $path; -} -## END: Hack for IIS - -require 'util.pl'; -require 'io.pl'; -require 'basexml.pl'; -require 'commands.pl'; -require 'upload_fck.pl'; -require 'config.pl'; - -&read_input(); -&DoResponse(); - -sub DoResponse -{ - - if($FORM{'Command'} eq "" || $FORM{'Type'} eq "" || $FORM{'CurrentFolder'} eq "") { - return ; - } - # Get the main request informaiton. - $sCommand = &specialchar_cnv($FORM{'Command'}); - $sResourceType = &specialchar_cnv($FORM{'Type'}); - $sCurrentFolder = $FORM{'CurrentFolder'}; - - if ( !($sCommand =~ /^(FileUpload|GetFolders|GetFoldersAndFiles|CreateFolder)$/) ) { - SendError( 1, "Command not allowed" ) ; - } - - if ( !($sResourceType =~ /^(File|Image|Flash|Media)$/) ) { - SendError( 1, "Invalid type specified" ) ; - } - - # Check the current folder syntax (must begin and start with a slash). - if(!($sCurrentFolder =~ /\/$/)) { - $sCurrentFolder .= '/'; - } - if(!($sCurrentFolder =~ /^\//)) { - $sCurrentFolder = '/' . $sCurrentFolder; - } - - # Check for invalid folder paths (..) - if ( $sCurrentFolder =~ /(?:\.\.|\\)/ ) { - SendError( 102, "" ) ; - } - if ( $sCurrentFolder =~ /(\/\.)|[[:cntrl:]]|(\/\/)|(\\\\)|([\:\*\?\"\<\>\|])/ ) { - SendError( 102, "" ) ; - } - - # File Upload doesn't have to Return XML, so it must be intercepted before anything. - if($sCommand eq 'FileUpload') { - FileUpload($sResourceType,$sCurrentFolder); - return ; - } - - print << "_HTML_HEAD_"; -Content-Type:text/xml; charset=utf-8 -Pragma: no-cache -Cache-Control: no-cache -Expires: Thu, 01 Dec 1994 16:00:00 GMT - -_HTML_HEAD_ - - &CreateXmlHeader($sCommand,$sResourceType,$sCurrentFolder); - - # Execute the required command. - if($sCommand eq 'GetFolders') { - &GetFolders($sResourceType,$sCurrentFolder); - } elsif($sCommand eq 'GetFoldersAndFiles') { - &GetFoldersAndFiles($sResourceType,$sCurrentFolder); - } elsif($sCommand eq 'CreateFolder') { - &CreateFolder($sResourceType,$sCurrentFolder); - } - - &CreateXmlFooter(); - - exit ; -} diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/io.pl b/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/io.pl deleted file mode 100644 index 56e54812b1c..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/io.pl +++ /dev/null @@ -1,141 +0,0 @@ -##### -# FCKeditor - The text editor for Internet - http://www.fckeditor.net -# Copyright (C) 2003-2010 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 Perl. -##### - -sub GetUrlFromPath -{ - local($resourceType, $folderPath) = @_; - - if($resourceType eq '') { - $rmpath = &RemoveFromEnd($GLOBALS{'UserFilesPath'},'/'); - return("$rmpath$folderPath"); - } else { - return("$GLOBALS{'UserFilesPath'}$resourceType$folderPath"); - } -} - -sub RemoveExtension -{ - local($fileName) = @_; - local($path, $base, $ext); - if($fileName !~ /\./) { - $fileName .= '.'; - } - if($fileName =~ /([^\\\/]*)\.(.*)$/) { - $base = $1; - $ext = $2; - if($fileName =~ /(.*)$base\.$ext$/) { - $path = $1; - } - } - return($path,$base,$ext); - -} - -sub ServerMapFolder -{ - local($resourceType,$folderPath) = @_; - - # Get the resource type directory. - $sResourceTypePath = $GLOBALS{'UserFilesDirectory'} . $resourceType . '/'; - - # Ensure that the directory exists. - &CreateServerFolder($sResourceTypePath); - - # Return the resource type directory combined with the required path. - $rmpath = &RemoveFromStart($folderPath,'/'); - return("$sResourceTypePath$rmpath"); -} - -sub GetParentFolder -{ - local($folderPath) = @_; - - $folderPath =~ s/[\/][^\/]+[\/]?$//g; - return $folderPath; -} - -sub CreateServerFolder -{ - local($folderPath) = @_; - - $sParent = &GetParentFolder($folderPath); - # Check if the parent exists, or create it. - if(!(-e $sParent)) { - $sErrorMsg = &CreateServerFolder($sParent); - if($sErrorMsg == 1) { - return(1); - } - } - if(!(-e $folderPath)) { - if (defined $CHMOD_ON_FOLDER_CREATE && !$CHMOD_ON_FOLDER_CREATE) { - mkdir("$folderPath"); - } - else { - umask(000); - if (defined $CHMOD_ON_FOLDER_CREATE) { - mkdir("$folderPath",$CHMOD_ON_FOLDER_CREATE); - } - else { - mkdir("$folderPath",0777); - } - } - - return(0); - } else { - return(1); - } -} - -sub GetRootPath -{ -#use Cwd; - -# my $dir = getcwd; -# print $dir; -# $dir =~ s/$ENV{'DOCUMENT_ROOT'}//g; -# print $dir; -# return($dir); - -# $wk = $0; -# $wk =~ s/\/connector\.cgi//g; -# if($wk) { -# $current_dir = $wk; -# } else { -# $current_dir = `pwd`; -# } -# return($current_dir); -use Cwd; - - if($ENV{'DOCUMENT_ROOT'}) { - $dir = $ENV{'DOCUMENT_ROOT'}; - } else { - my $dir = getcwd; - $workdir =~ s/\/connector\.cgi//g; - $dir =~ s/$workdir//g; - } - return($dir); - - - -} -1; diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/upload.cgi b/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/upload.cgi deleted file mode 100644 index 38c5ea55092..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/upload.cgi +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env perl - -##### -# FCKeditor - The text editor for Internet - http://www.fckeditor.net -# Copyright (C) 2003-2010 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 Perl. -##### - -## -# ATTENTION: To enable this connector, look for the "SECURITY" comment in config.pl. -## - -## START: Hack for Windows (Not important to understand the editor code... Perl specific). -if(Windows_check()) { - chdir(GetScriptPath($0)); -} - -sub Windows_check -{ - # IIS,PWS(NT/95) - $www_server_os = $^O; - # Win98 & NT(SP4) - if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; } - # AnHTTPd/Omni/IIS - if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; } - # Win Apache - if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; } - if($www_server_os=~ /win/i) { return(1); } - return(0); -} - -sub GetScriptPath { - local($path) = @_; - if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; } - $path; -} -## END: Hack for IIS - -require 'util.pl'; -require 'io.pl'; -require 'basexml.pl'; -require 'commands.pl'; -require 'upload_fck.pl'; -require 'config.pl'; - -&read_input(); -&DoResponse(); - -sub DoResponse -{ - # Get the main request information. - $sCommand = 'FileUpload'; - $sResourceType = &specialchar_cnv($FORM{'Type'}); - $sCurrentFolder = "/"; - - if ($sResourceType eq '') { - $sResourceType = 'File' ; - } - - if ( !($sResourceType =~ /^(File|Image|Flash|Media)$/) ) { - SendError( 1, "Invalid type specified" ) ; - } - - # File Upload doesn't have to Return XML, so it must be intercepted before anything. - if($sCommand eq 'FileUpload') { - FileUpload($sResourceType,$sCurrentFolder); - return ; - } - -} diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/upload_fck.pl b/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/upload_fck.pl deleted file mode 100644 index debdad639ef..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/upload_fck.pl +++ /dev/null @@ -1,686 +0,0 @@ -##### -# FCKeditor - The text editor for Internet - http://www.fckeditor.net -# Copyright (C) 2003-2010 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 Perl. -##### - -# image data save dir -$img_dir = './temp/'; - - -# File size max(unit KB) -$MAX_CONTENT_SIZE = 30000; - -# After file is uploaded, sometimes it is required to change its permissions -# so that it was possible to access it at the later time. -# If possible, it is recommended to set more restrictive permissions, like 0755. -# Set to 0 to disable this feature. -$CHMOD_ON_UPLOAD = 0777; - -# See comments above. -# Used when creating folders that does not exist. -$CHMOD_ON_FOLDER_CREATE = 0755; - -# Filelock (1=use,0=not use) -$PM{'flock'} = '1'; - - -# upload Content-Type list -my %UPLOAD_CONTENT_TYPE_LIST = ( - 'image/(x-)?png' => 'png', # PNG image - 'image/p?jpe?g' => 'jpg', # JPEG image - 'image/gif' => 'gif', # GIF image - 'image/x-xbitmap' => 'xbm', # XBM image - - 'image/(x-(MS-)?)?bmp' => 'bmp', # Windows BMP image - 'image/pict' => 'pict', # Macintosh PICT image - 'image/tiff' => 'tif', # TIFF image - 'application/pdf' => 'pdf', # PDF image - 'application/x-shockwave-flash' => 'swf', # Shockwave Flash - - 'video/(x-)?msvideo' => 'avi', # Microsoft Video - 'video/quicktime' => 'mov', # QuickTime Video - 'video/mpeg' => 'mpeg', # MPEG Video - 'video/x-mpeg2' => 'mpv2', # MPEG2 Video - - 'audio/(x-)?midi?' => 'mid', # MIDI Audio - 'audio/(x-)?wav' => 'wav', # WAV Audio - 'audio/basic' => 'au', # ULAW Audio - 'audio/mpeg' => 'mpga', # MPEG Audio - - 'application/(x-)?zip(-compressed)?' => 'zip', # ZIP Compress - - 'text/html' => 'html', # HTML - 'text/plain' => 'txt', # TEXT - '(?:application|text)/(?:rtf|richtext)' => 'rtf', # RichText - - 'application/msword' => 'doc', # Microsoft Word - 'application/vnd.ms-excel' => 'xls', # Microsoft Excel - - '' -); - -# Upload is permitted. -# A regular expression is possible. -my %UPLOAD_EXT_LIST = ( - 'png' => 'PNG image', - 'p?jpe?g|jpe|jfif|pjp' => 'JPEG image', - 'gif' => 'GIF image', - 'xbm' => 'XBM image', - - 'bmp|dib|rle' => 'Windows BMP image', - 'pi?ct' => 'Macintosh PICT image', - 'tiff?' => 'TIFF image', - 'pdf' => 'PDF image', - 'swf' => 'Shockwave Flash', - - 'avi' => 'Microsoft Video', - 'moo?v|qt' => 'QuickTime Video', - 'm(p(e?gv?|e|v)|1v)' => 'MPEG Video', - 'mp(v2|2v)' => 'MPEG2 Video', - - 'midi?|kar|smf|rmi|mff' => 'MIDI Audio', - 'wav' => 'WAVE Audio', - 'au|snd' => 'ULAW Audio', - 'mp(e?ga|2|a|3)|abs' => 'MPEG Audio', - - 'zip' => 'ZIP Compress', - 'lzh' => 'LZH Compress', - 'cab' => 'CAB Compress', - - 'd?html?' => 'HTML', - 'rtf|rtx' => 'RichText', - 'txt|text' => 'Text', - - '' -); - - -# sjis or euc -my $CHARCODE = 'sjis'; - -$TRANS_2BYTE_CODE = 0; - -############################################################################## -# Summary -# -# Form Read input -# -# Parameters -# Returns -# Memo -############################################################################## -sub read_input -{ -eval("use File::Copy;"); -eval("use File::Path;"); - - my ($FORM) = @_; - - if (defined $CHMOD_ON_FOLDER_CREATE && !$CHMOD_ON_FOLDER_CREATE) { - mkdir("$img_dir"); - } - else { - umask(000); - if (defined $CHMOD_ON_FOLDER_CREATE) { - mkdir("$img_dir",$CHMOD_ON_FOLDER_CREATE); - } - else { - mkdir("$img_dir",0777); - } - } - - undef $img_data_exists; - undef @NEWFNAMES; - undef @NEWFNAME_DATA; - - if($ENV{'CONTENT_LENGTH'} > 10000000 || $ENV{'CONTENT_LENGTH'} > $MAX_CONTENT_SIZE * 1024) { - &upload_error( - 'Size Error', - sprintf( - "Transmitting size is too large.MAX %d KB Now Size %d KB(%d bytes Over)", - $MAX_CONTENT_SIZE, - int($ENV{'CONTENT_LENGTH'} / 1024), - $ENV{'CONTENT_LENGTH'} - $MAX_CONTENT_SIZE * 1024 - ) - ); - } - - my $Buffer; - if($ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/) { - # METHOD POST only - return unless($ENV{'CONTENT_LENGTH'}); - - binmode(STDIN); - # STDIN A pause character is detected.'(MacIE3.0 boundary of $ENV{'CONTENT_TYPE'} cannot be trusted.) - my $Boundary = ; - $Boundary =~ s/\x0D\x0A//; - $Boundary = quotemeta($Boundary); - while() { - if(/^\s*Content-Disposition:/i) { - my($name,$ContentType,$FileName); - # form data get - if(/\bname="([^"]+)"/i || /\bname=([^\s:;]+)/i) { - $name = $1; - $name =~ tr/+/ /; - $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - &Encode(\$name); - } - if(/\bfilename="([^"]*)"/i || /\bfilename=([^\s:;]*)/i) { - $FileName = $1 || 'unknown'; - } - # head read - while() { - last if(! /\w/); - if(/^\s*Content-Type:\s*"([^"]+)"/i || /^\s*Content-Type:\s*([^\s:;]+)/i) { - $ContentType = $1; - } - } - # body read - $value = ""; - while() { - last if(/^$Boundary/o); - $value .= $_; - }; - $lastline = $_; - $value =~s /\x0D\x0A$//; - if($value ne '') { - if($FileName || $ContentType) { - $img_data_exists = 1; - ( - $FileName, # - $Ext, # - $Length, # - $ImageWidth, # - $ImageHeight, # - $ContentName # - ) = &CheckContentType(\$value,$FileName,$ContentType); - - $FORM{$name} = $FileName; - $new_fname = $FileName; - push(@NEWFNAME_DATA,"$FileName\t$Ext\t$Length\t$ImageWidth\t$ImageHeight\t$ContentName"); - - # Multi-upload correspondence - push(@NEWFNAMES,$new_fname); - open(OUT,">$img_dir/$new_fname"); - binmode(OUT); - eval "flock(OUT,2);" if($PM{'flock'} == 1); - print OUT $value; - eval "flock(OUT,8);" if($PM{'flock'} == 1); - close(OUT); - - } elsif($name) { - $value =~ tr/+/ /; - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - &Encode(\$value,'trans'); - $FORM{$name} .= "\0" if(defined($FORM{$name})); - $FORM{$name} .= $value; - } - } - }; - last if($lastline =~ /^$Boundary\-\-/o); - } - } elsif($ENV{'CONTENT_LENGTH'}) { - read(STDIN,$Buffer,$ENV{'CONTENT_LENGTH'}); - } - foreach(split(/&/,$Buffer),split(/&/,$ENV{'QUERY_STRING'})) { - my($name, $value) = split(/=/); - $name =~ tr/+/ /; - $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - $value =~ tr/+/ /; - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - - &Encode(\$name); - &Encode(\$value,'trans'); - $FORM{$name} .= "\0" if(defined($FORM{$name})); - $FORM{$name} .= $value; - - } - -} - -############################################################################## -# Summary -# -# CheckContentType -# -# Parameters -# Returns -# Memo -############################################################################## -sub CheckContentType -{ - - my($DATA,$FileName,$ContentType) = @_; - my($Ext,$ImageWidth,$ImageHeight,$ContentName,$Infomation); - my $DataLength = length($$DATA); - - # An unknown file type - - $_ = $ContentType; - my $UnknownType = ( - !$_ - || /^application\/(x-)?macbinary$/i - || /^application\/applefile$/i - || /^application\/octet-stream$/i - || /^text\/plane$/i - || /^x-unknown-content-type/i - ); - - # MacBinary(Mac Unnecessary data are deleted.) - if($UnknownType || $ENV{'HTTP_USER_AGENT'} =~ /Macintosh|Mac_/) { - if($DataLength > 128 && !unpack("C",substr($$DATA,0,1)) && !unpack("C",substr($$DATA,74,1)) && !unpack("C",substr($$DATA,82,1)) ) { - my $MacBinary_ForkLength = unpack("N", substr($$DATA, 83, 4)); # ForkLength Get - my $MacBinary_FileName = quotemeta(substr($$DATA, 2, unpack("C",substr($$DATA, 1, 1)))); - if($MacBinary_FileName && $MacBinary_ForkLength && $DataLength >= $MacBinary_ForkLength + 128 - && ($FileName =~ /$MacBinary_FileName/i || substr($$DATA,102,4) eq 'mBIN')) { # DATA TOP 128byte MacBinary!! - $$DATA = substr($$DATA,128,$MacBinary_ForkLength); - my $ResourceLength = $DataLength - $MacBinary_ForkLength - 128; - $DataLength = $MacBinary_ForkLength; - } - } - } - - # A file name is changed into EUC. -# &jcode::convert(\$FileName,'euc',$FormCodeDefault); -# &jcode::h2z_euc(\$FileName); - $FileName =~ s/^.*\\//; # Windows, Mac - $FileName =~ s/^.*\///; # UNIX - $FileName =~ s/&/&/g; - $FileName =~ s/"/"/g; - $FileName =~ s//>/g; -# -# if($CHARCODE ne 'euc') { -# &jcode::convert(\$FileName,$CHARCODE,'euc'); -# } - - # An extension is extracted and it changes into a small letter. - my $FileExt; - if($FileName =~ /\.(\w+)$/) { - $FileExt = $1; - $FileExt =~ tr/A-Z/a-z/; - } - - # Executable file detection (ban on upload) - if($$DATA =~ /^MZ/) { - $Ext = 'exe'; - } - # text - if(!$Ext && ($UnknownType || $ContentType =~ /^text\//i || $ContentType =~ /^application\/(?:rtf|richtext)$/i || $ContentType =~ /^image\/x-xbitmap$/i) - && ! $$DATA =~ /[\000-\006\177\377]/) { -# $$DATA =~ s/\x0D\x0A/\n/g; -# $$DATA =~ tr/\x0D\x0A/\n\n/; -# -# if( -# $$DATA =~ /<\s*SCRIPT(?:.|\n)*?>/i -# || $$DATA =~ /<\s*(?:.|\n)*?\bONLOAD\s*=(?:.|\n)*?>/i -# || $$DATA =~ /<\s*(?:.|\n)*?\bONCLICK\s*=(?:.|\n)*?>/i -# ) { -# $Infomation = '(JavaScript contains)'; -# } -# if($$DATA =~ /<\s*TABLE(?:.|\n)*?>/i -# || $$DATA =~ /<\s*BLINK(?:.|\n)*?>/i -# || $$DATA =~ /<\s*MARQUEE(?:.|\n)*?>/i -# || $$DATA =~ /<\s*OBJECT(?:.|\n)*?>/i -# || $$DATA =~ /<\s*EMBED(?:.|\n)*?>/i -# || $$DATA =~ /<\s*FRAME(?:.|\n)*?>/i -# || $$DATA =~ /<\s*APPLET(?:.|\n)*?>/i -# || $$DATA =~ /<\s*FORM(?:.|\n)*?>/i -# || $$DATA =~ /<\s*(?:.|\n)*?\bSRC\s*=(?:.|\n)*?>/i -# || $$DATA =~ /<\s*(?:.|\n)*?\bDYNSRC\s*=(?:.|\n)*?>/i -# ) { -# $Infomation = '(the HTML tag which is not safe is included)'; -# } - - if($FileExt =~ /^txt$/i || $FileExt =~ /^cgi$/i || $FileExt =~ /^pl$/i) { # Text File - $Ext = 'txt'; - } elsif($ContentType =~ /^text\/html$/i || $FileExt =~ /html?/i || $$DATA =~ /<\s*HTML(?:.|\n)*?>/i) { # HTML File - $Ext = 'html'; - } elsif($ContentType =~ /^image\/x-xbitmap$/i || $FileExt =~ /^xbm$/i) { # XBM(x-BitMap) Image - my $XbmName = $1; - my ($XbmWidth, $XbmHeight); - if($$DATA =~ /\#define\s*$XbmName\_width\s*(\d+)/i) { - $XbmWidth = $1; - } - if($$DATA =~ /\#define\s*$XbmName\_height\s*(\d+)/i) { - $XbmHeight = $1; - } - if($XbmWidth && $XbmHeight) { - $Ext = 'xbm'; - $ImageWidth = $XbmWidth; - $ImageHeight = $XbmHeight; - } - } else { # - $Ext = 'txt'; - } - } - - # image - if(!$Ext && ($UnknownType || $ContentType =~ /^image\//i)) { - # PNG - if($$DATA =~ /^\x89PNG\x0D\x0A\x1A\x0A/) { - if(substr($$DATA, 12, 4) eq 'IHDR') { - $Ext = 'png'; - ($ImageWidth, $ImageHeight) = unpack("N2", substr($$DATA, 16, 8)); - } - } elsif($$DATA =~ /^GIF8(?:9|7)a/) { # GIF89a(modified), GIF89a, GIF87a - $Ext = 'gif'; - ($ImageWidth, $ImageHeight) = unpack("v2", substr($$DATA, 6, 4)); - } elsif($$DATA =~ /^II\x2a\x00\x08\x00\x00\x00/ || $$DATA =~ /^MM\x00\x2a\x00\x00\x00\x08/) { # TIFF - $Ext = 'tif'; - } elsif($$DATA =~ /^BM/) { # BMP - $Ext = 'bmp'; - } elsif($$DATA =~ /^\xFF\xD8\xFF/ || $$DATA =~ /JFIF/) { # JPEG - my $HeaderPoint = index($$DATA, "\xFF\xD8\xFF", 0); - my $Point = $HeaderPoint + 2; - while($Point < $DataLength) { - my($Maker, $MakerType, $MakerLength) = unpack("C2n",substr($$DATA,$Point,4)); - if($Maker != 0xFF || $MakerType == 0xd9 || $MakerType == 0xda) { - last; - } elsif($MakerType >= 0xC0 && $MakerType <= 0xC3) { - $Ext = 'jpg'; - ($ImageHeight, $ImageWidth) = unpack("n2", substr($$DATA, $Point + 5, 4)); - if($HeaderPoint > 0) { - $$DATA = substr($$DATA, $HeaderPoint); - $DataLength = length($$DATA); - } - last; - } else { - $Point += $MakerLength + 2; - } - } - } - } - - # audio - if(!$Ext && ($UnknownType || $ContentType =~ /^audio\//i)) { - # MIDI Audio - if($$DATA =~ /^MThd/) { - $Ext = 'mid'; - } elsif($$DATA =~ /^\x2esnd/) { # ULAW Audio - $Ext = 'au'; - } elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) { - my $HeaderPoint = index($$DATA, "RIFF", 0); - $_ = substr($$DATA, $HeaderPoint + 8, 8); - if(/^WAVEfmt $/) { - # WAVE - if(unpack("V",substr($$DATA, $HeaderPoint + 16, 4)) == 16) { - $Ext = 'wav'; - } else { # RIFF WAVE MP3 - $Ext = 'mp3'; - } - } elsif(/^RMIDdata$/) { # RIFF MIDI - $Ext = 'rmi'; - } elsif(/^RMP3data$/) { # RIFF MP3 - $Ext = 'rmp'; - } - if($ContentType =~ /^audio\//i) { - $Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')'; - } - } - } - - # a binary file - unless ($Ext) { - # PDF image - if($$DATA =~ /^\%PDF/) { - # Picture size is not measured. - $Ext = 'pdf'; - } elsif($$DATA =~ /^FWS/) { # Shockwave Flash - $Ext = 'swf'; - } elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) { - my $HeaderPoint = index($$DATA, "RIFF", 0); - $_ = substr($$DATA,$HeaderPoint + 8, 8); - # AVI - if(/^AVI LIST$/) { - $Ext = 'avi'; - } - if($ContentType =~ /^video\//i) { - $Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')'; - } - } elsif($$DATA =~ /^PK/) { # ZIP Compress File - $Ext = 'zip'; - } elsif($$DATA =~ /^MSCF/) { # CAB Compress File - $Ext = 'cab'; - } elsif($$DATA =~ /^Rar\!/) { # RAR Compress File - $Ext = 'rar'; - } elsif(substr($$DATA, 2, 5) =~ /^\-lh(\d+|d)\-$/) { # LHA Compress File - $Infomation .= "(lh$1)"; - $Ext = 'lzh'; - } elsif(substr($$DATA, 325, 25) eq "Apple Video Media Handler" || substr($$DATA, 325, 30) eq "Apple \x83\x72\x83\x66\x83\x49\x81\x45\x83\x81\x83\x66\x83\x42\x83\x41\x83\x6E\x83\x93\x83\x68\x83\x89") { - # QuickTime - $Ext = 'mov'; - } - } - - # Header analysis failure - unless ($Ext) { - # It will be followed if it applies for the MIME type from the browser. - foreach (keys %UPLOAD_CONTENT_TYPE_LIST) { - next unless ($_); - if($ContentType =~ /^$_$/i) { - $Ext = $UPLOAD_CONTENT_TYPE_LIST{$_}; - $ContentName = &CheckContentExt($Ext); - if( - grep {$_ eq $Ext;} ( - 'png', - 'gif', - 'jpg', - 'xbm', - 'tif', - 'bmp', - 'pdf', - 'swf', - 'mov', - 'zip', - 'cab', - 'lzh', - 'rar', - 'mid', - 'rmi', - 'au', - 'wav', - 'avi', - 'exe' - ) - ) { - $Infomation .= ' / Header analysis failure'; - } - if($Ext ne $FileExt && &CheckContentExt($FileExt) eq $ContentName) { - $Ext = $FileExt; - } - last; - } - } - # a MIME type is unknown--It judges from an extension. - unless ($Ext) { - $ContentName = &CheckContentExt($FileExt); - if($ContentName) { - $Ext = $FileExt; - $Infomation .= ' / MIME type is unknown('. $ContentType. ')'; - last; - } - } - } - -# $ContentName = &CheckContentExt($Ext) unless($ContentName); -# if($Ext && $ContentName) { -# $ContentName .= $Infomation; -# } else { -# &upload_error( -# 'Extension Error', -# "$FileName A not corresponding extension ($Ext)
The extension which can be responded ". join(',', sort values(%UPLOAD_EXT_LIST)) -# ); -# } - -# # SSI Tag Deletion -# if($Ext =~ /.?html?/ && $$DATA =~ /<\!/) { -# foreach ( -# 'config', -# 'echo', -# 'exec', -# 'flastmod', -# 'fsize', -# 'include' -# ) { -# $$DATA =~ s/\#\s*$_/\&\#35\;$_/ig -# } -# } - - return ( - $FileName, - $Ext, - int($DataLength / 1024 + 1), - $ImageWidth, - $ImageHeight, - $ContentName - ); -} - -############################################################################## -# Summary -# -# Extension discernment -# -# Parameters -# Returns -# Memo -############################################################################## - -sub CheckContentExt -{ - - my($Ext) = @_; - my $ContentName; - foreach (keys %UPLOAD_EXT_LIST) { - next unless ($_); - if($_ && $Ext =~ /^$_$/) { - $ContentName = $UPLOAD_EXT_LIST{$_}; - last; - } - } - return $ContentName; - -} - -############################################################################## -# Summary -# -# Form decode -# -# Parameters -# Returns -# Memo -############################################################################## -sub Encode -{ - - my($value,$Trans) = @_; - -# my $FormCode = &jcode::getcode($value) || $FormCodeDefault; -# $FormCodeDefault ||= $FormCode; -# -# if($Trans && $TRANS_2BYTE_CODE) { -# if($FormCode ne 'euc') { -# &jcode::convert($value, 'euc', $FormCode); -# } -# &jcode::tr( -# $value, -# "\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA", -# '0-9A-Za-z' -# ); -# if($CHARCODE ne 'euc') { -# &jcode::convert($value,$CHARCODE,'euc'); -# } -# } else { -# if($CHARCODE ne $FormCode) { -# &jcode::convert($value,$CHARCODE,$FormCode); -# } -# } -# if($CHARCODE eq 'euc') { -# &jcode::h2z_euc($value); -# } elsif($CHARCODE eq 'sjis') { -# &jcode::h2z_sjis($value); -# } - -} - -############################################################################## -# Summary -# -# Error Msg -# -# Parameters -# Returns -# Memo -############################################################################## - -sub upload_error -{ - - local($error_message) = $_[0]; - local($error_message2) = $_[1]; - - print "Content-type: text/html\n\n"; - print< - -Error Message - - - - - -
Error Message
-
    -

    $error_message

    -$error_message2
    -
- - -EOF - &rm_tmp_uploaded_files; # Image Temporary deletion - exit; -} - -############################################################################## -# Summary -# -# Image Temporary deletion -# -# Parameters -# Returns -# Memo -############################################################################## - -sub rm_tmp_uploaded_files -{ - if($img_data_exists == 1){ - sleep 1; - foreach $fname_list(@NEWFNAMES) { - if(-e "$img_dir/$fname_list") { - unlink("$img_dir/$fname_list"); - } - } - } - -} -1; diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/util.pl b/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/util.pl deleted file mode 100644 index c245a040231..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/perl/util.pl +++ /dev/null @@ -1,66 +0,0 @@ -##### -# FCKeditor - The text editor for Internet - http://www.fckeditor.net -# Copyright (C) 2003-2010 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 Perl. -##### - -sub RemoveFromStart -{ - local($sourceString, $charToRemove) = @_; - $sPattern = '^' . $charToRemove . '+' ; - $sourceString =~ s/^$charToRemove+//g; - return $sourceString; -} - -sub RemoveFromEnd -{ - local($sourceString, $charToRemove) = @_; - $sPattern = $charToRemove . '+$' ; - $sourceString =~ s/$charToRemove+$//g; - return $sourceString; -} - -sub ConvertToXmlAttribute -{ - local($value) = @_; - return(&specialchar_cnv($value)); -} - -sub specialchar_cnv -{ - local($ch) = @_; - - $ch =~ s/&/&/g; # & - $ch =~ s/\"/"/g; #" - $ch =~ s/\'/'/g; # ' - $ch =~ s//>/g; # > - return($ch); -} - -sub JS_cnv -{ - local($ch) = @_; - - $ch =~ s/\"/\\\"/g; #" - return($ch); -} - -1; diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/config.py b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/config.py deleted file mode 100644 index 6ad1643395c..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/config.py +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env python -""" - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2010 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 Python -""" - -# INSTALLATION NOTE: You must set up your server environment accordingly to run -# python scripts. This connector requires Python 2.4 or greater. -# -# Supported operation modes: -# * WSGI (recommended): You'll need apache + mod_python + modpython_gateway -# or any web server capable of the WSGI python standard -# * Plain Old CGI: Any server capable of running standard python scripts -# (although mod_python is recommended for performance) -# This was the previous connector version operation mode -# -# If you're using Apache web server, replace the htaccess.txt to to .htaccess, -# and set the proper options and paths. -# For WSGI and mod_python, you may need to download modpython_gateway from: -# http://projects.amor.org/misc/svn/modpython_gateway.py and copy it in this -# directory. - - -# 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. -Enabled = False - -# Path to user files relative to the document root. -UserFilesPath = '/userfiles/' - -# Fill the following value it you prefer to specify the absolute path for the -# user files directory. Useful if you are using a virtual directory, symbolic -# link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. -# Attention: The above 'UserFilesPath' must point to the same directory. -# WARNING: GetRootPath may not work in virtual or mod_python configurations, and -# may not be thread safe. Use this configuration parameter instead. -UserFilesAbsolutePath = '' - -# Due to security issues with Apache modules, it is recommended to leave the -# following setting enabled. -ForceSingleExtension = True - -# What the user can do with this connector -ConfigAllowedCommands = [ 'QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder' ] - -# Allowed Resource Types -ConfigAllowedTypes = ['File', 'Image', 'Flash', 'Media'] - -# After file is uploaded, sometimes it is required to change its permissions -# so that it was possible to access it at the later time. -# If possible, it is recommended to set more restrictive permissions, like 0755. -# Set to 0 to disable this feature. -# Note: not needed on Windows-based servers. -ChmodOnUpload = 0755 - -# See comments above. -# Used when creating folders that does not exist. -ChmodOnFolderCreate = 0755 - -# Do not touch this 3 lines, see "Configuration settings for each Resource Type" -AllowedExtensions = {}; DeniedExtensions = {}; -FileTypesPath = {}; FileTypesAbsolutePath = {}; -QuickUploadPath = {}; QuickUploadAbsolutePath = {}; - -# 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: '/' - -AllowedExtensions['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'] -DeniedExtensions['File'] = [] -FileTypesPath['File'] = UserFilesPath + 'file/' -FileTypesAbsolutePath['File'] = (not UserFilesAbsolutePath == '') and (UserFilesAbsolutePath + 'file/') or '' -QuickUploadPath['File'] = FileTypesPath['File'] -QuickUploadAbsolutePath['File'] = FileTypesAbsolutePath['File'] - -AllowedExtensions['Image'] = ['bmp','gif','jpeg','jpg','png'] -DeniedExtensions['Image'] = [] -FileTypesPath['Image'] = UserFilesPath + 'image/' -FileTypesAbsolutePath['Image'] = (not UserFilesAbsolutePath == '') and UserFilesAbsolutePath + 'image/' or '' -QuickUploadPath['Image'] = FileTypesPath['Image'] -QuickUploadAbsolutePath['Image']= FileTypesAbsolutePath['Image'] - -AllowedExtensions['Flash'] = ['swf','flv'] -DeniedExtensions['Flash'] = [] -FileTypesPath['Flash'] = UserFilesPath + 'flash/' -FileTypesAbsolutePath['Flash'] = ( not UserFilesAbsolutePath == '') and UserFilesAbsolutePath + 'flash/' or '' -QuickUploadPath['Flash'] = FileTypesPath['Flash'] -QuickUploadAbsolutePath['Flash']= FileTypesAbsolutePath['Flash'] - -AllowedExtensions['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'] -DeniedExtensions['Media'] = [] -FileTypesPath['Media'] = UserFilesPath + 'media/' -FileTypesAbsolutePath['Media'] = ( not UserFilesAbsolutePath == '') and UserFilesAbsolutePath + 'media/' or '' -QuickUploadPath['Media'] = FileTypesPath['Media'] -QuickUploadAbsolutePath['Media']= FileTypesAbsolutePath['Media'] diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/connector.py b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/connector.py deleted file mode 100644 index fe989b90d83..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/connector.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python - -""" -FCKeditor - The text editor for Internet - http://www.fckeditor.net -Copyright (C) 2003-2010 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 == - -Connector for Python (CGI and WSGI). - -See config.py for configuration settings - -""" -import os - -from fckutil import * -from fckcommands import * # default command's implementation -from fckoutput import * # base http, xml and html output mixins -from fckconnector import FCKeditorConnectorBase # import base connector -import config as Config - -class FCKeditorConnector( FCKeditorConnectorBase, - GetFoldersCommandMixin, - GetFoldersAndFilesCommandMixin, - CreateFolderCommandMixin, - UploadFileCommandMixin, - BaseHttpMixin, BaseXmlMixin, BaseHtmlMixin ): - "The Standard connector class." - def doResponse(self): - "Main function. Process the request, set headers and return a string as response." - s = "" - # Check if this connector is disabled - if not(Config.Enabled): - return self.sendError(1, "This connector is disabled. Please check the connector configurations in \"editor/filemanager/connectors/py/config.py\" and try again.") - # Make sure we have valid inputs - for key in ("Command","Type","CurrentFolder"): - if not self.request.has_key (key): - return - # Get command, resource type and current folder - command = self.request.get("Command") - resourceType = self.request.get("Type") - currentFolder = getCurrentFolder(self.request.get("CurrentFolder")) - # Check for invalid paths - if currentFolder is None: - if (command == "FileUpload"): - return self.sendUploadResults( errorNo = 102, customMsg = "" ) - else: - return self.sendError(102, "") - - # Check if it is an allowed command - if ( not command in Config.ConfigAllowedCommands ): - return self.sendError( 1, 'The %s command isn\'t allowed' % command ) - - if ( not resourceType in Config.ConfigAllowedTypes ): - return self.sendError( 1, 'Invalid type specified' ) - - # Setup paths - if command == "QuickUpload": - self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType] - self.webUserFilesFolder = Config.QuickUploadPath[resourceType] - else: - self.userFilesFolder = Config.FileTypesAbsolutePath[resourceType] - self.webUserFilesFolder = Config.FileTypesPath[resourceType] - - if not self.userFilesFolder: # no absolute path given (dangerous...) - self.userFilesFolder = mapServerPath(self.environ, - self.webUserFilesFolder) - # Ensure that the directory exists. - if not os.path.exists(self.userFilesFolder): - try: - self.createServerFolder( self.userFilesFolder ) - except: - return self.sendError(1, "This connector couldn\'t access to local user\'s files directories. Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ") - - # File upload doesn't have to return XML, so intercept here - if (command == "FileUpload"): - return self.uploadFile(resourceType, currentFolder) - - # Create Url - url = combinePaths( self.webUserFilesFolder, currentFolder ) - - # Begin XML - s += self.createXmlHeader(command, resourceType, currentFolder, url) - # Execute the command - selector = {"GetFolders": self.getFolders, - "GetFoldersAndFiles": self.getFoldersAndFiles, - "CreateFolder": self.createFolder, - } - s += selector[command](resourceType, currentFolder) - s += self.createXmlFooter() - return s - -# Running from command line (plain old CGI) -if __name__ == '__main__': - try: - # Create a Connector Instance - conn = FCKeditorConnector() - data = conn.doResponse() - for header in conn.headers: - print '%s: %s' % header - print - print data - except: - print "Content-Type: text/plain" - print - import cgi - cgi.print_exception() diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckcommands.py b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckcommands.py deleted file mode 100644 index f9e7b824b65..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckcommands.py +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/env python - -""" -FCKeditor - The text editor for Internet - http://www.fckeditor.net -Copyright (C) 2003-2010 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 == - -Connector for Python (CGI and WSGI). - -""" - -import os -try: # Windows needs stdio set for binary mode for file upload to work. - import msvcrt - msvcrt.setmode (0, os.O_BINARY) # stdin = 0 - msvcrt.setmode (1, os.O_BINARY) # stdout = 1 -except ImportError: - pass - -from fckutil import * -from fckoutput import * -import config as Config - -class GetFoldersCommandMixin (object): - def getFolders(self, resourceType, currentFolder): - """ - Purpose: command to recieve a list of folders - """ - # Map the virtual path to our local server - serverPath = mapServerFolder(self.userFilesFolder,currentFolder) - s = """""" # Open the folders node - for someObject in os.listdir(serverPath): - someObjectPath = mapServerFolder(serverPath, someObject) - if os.path.isdir(someObjectPath): - s += """""" % ( - convertToXmlAttribute(someObject) - ) - s += """""" # Close the folders node - return s - -class GetFoldersAndFilesCommandMixin (object): - def getFoldersAndFiles(self, resourceType, currentFolder): - """ - Purpose: command to recieve a list of folders and files - """ - # Map the virtual path to our local server - serverPath = mapServerFolder(self.userFilesFolder,currentFolder) - # Open the folders / files node - folders = """""" - files = """""" - for someObject in os.listdir(serverPath): - someObjectPath = mapServerFolder(serverPath, someObject) - if os.path.isdir(someObjectPath): - folders += """""" % ( - convertToXmlAttribute(someObject) - ) - elif os.path.isfile(someObjectPath): - size = os.path.getsize(someObjectPath) - if size > 0: - size = round(size/1024) - if size < 1: - size = 1 - files += """""" % ( - convertToXmlAttribute(someObject), - size - ) - # Close the folders / files node - folders += """""" - files += """""" - return folders + files - -class CreateFolderCommandMixin (object): - def createFolder(self, resourceType, currentFolder): - """ - Purpose: command to create a new folder - """ - errorNo = 0; errorMsg =''; - if self.request.has_key("NewFolderName"): - newFolder = self.request.get("NewFolderName", None) - newFolder = sanitizeFolderName (newFolder) - try: - newFolderPath = mapServerFolder(self.userFilesFolder, combinePaths(currentFolder, newFolder)) - self.createServerFolder(newFolderPath) - except Exception, e: - errorMsg = str(e).decode('iso-8859-1').encode('utf-8') # warning with encodigns!!! - if hasattr(e,'errno'): - if e.errno==17: #file already exists - errorNo=0 - elif e.errno==13: # permission denied - errorNo = 103 - elif e.errno==36 or e.errno==2 or e.errno==22: # filename too long / no such file / invalid name - errorNo = 102 - else: - errorNo = 110 - else: - errorNo = 102 - return self.sendErrorNode ( errorNo, errorMsg ) - - def createServerFolder(self, folderPath): - "Purpose: physically creates a folder on the server" - # No need to check if the parent exists, just create all hierachy - - try: - permissions = Config.ChmodOnFolderCreate - if not permissions: - os.makedirs(folderPath) - except AttributeError: #ChmodOnFolderCreate undefined - permissions = 0755 - - if permissions: - oldumask = os.umask(0) - os.makedirs(folderPath,mode=0755) - os.umask( oldumask ) - -class UploadFileCommandMixin (object): - def uploadFile(self, resourceType, currentFolder): - """ - Purpose: command to upload files to server (same as FileUpload) - """ - errorNo = 0 - if self.request.has_key("NewFile"): - # newFile has all the contents we need - newFile = self.request.get("NewFile", "") - # Get the file name - newFileName = newFile.filename - newFileName = sanitizeFileName( newFileName ) - newFileNameOnly = removeExtension(newFileName) - newFileExtension = getExtension(newFileName).lower() - allowedExtensions = Config.AllowedExtensions[resourceType] - deniedExtensions = Config.DeniedExtensions[resourceType] - - if (allowedExtensions): - # Check for allowed - isAllowed = False - if (newFileExtension in allowedExtensions): - isAllowed = True - elif (deniedExtensions): - # Check for denied - isAllowed = True - if (newFileExtension in deniedExtensions): - isAllowed = False - else: - # No extension limitations - isAllowed = True - - if (isAllowed): - # Upload to operating system - # Map the virtual path to the local server path - currentFolderPath = mapServerFolder(self.userFilesFolder, currentFolder) - i = 0 - while (True): - newFilePath = os.path.join (currentFolderPath,newFileName) - if os.path.exists(newFilePath): - i += 1 - newFileName = "%s(%d).%s" % ( - newFileNameOnly, i, newFileExtension - ) - errorNo= 201 # file renamed - else: - # Read file contents and write to the desired path (similar to php's move_uploaded_file) - fout = file(newFilePath, 'wb') - while (True): - chunk = newFile.file.read(100000) - if not chunk: break - fout.write (chunk) - fout.close() - - if os.path.exists ( newFilePath ): - doChmod = False - try: - doChmod = Config.ChmodOnUpload - permissions = Config.ChmodOnUpload - except AttributeError: #ChmodOnUpload undefined - doChmod = True - permissions = 0755 - if ( doChmod ): - oldumask = os.umask(0) - os.chmod( newFilePath, permissions ) - os.umask( oldumask ) - - newFileUrl = combinePaths(self.webUserFilesFolder, currentFolder) + newFileName - - return self.sendUploadResults( errorNo , newFileUrl, newFileName ) - else: - return self.sendUploadResults( errorNo = 202, customMsg = "" ) - else: - return self.sendUploadResults( errorNo = 202, customMsg = "No File" ) diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckconnector.py b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckconnector.py deleted file mode 100644 index c439939d8dd..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckconnector.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python - -""" -FCKeditor - The text editor for Internet - http://www.fckeditor.net -Copyright (C) 2003-2010 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 == - -Base Connector for Python (CGI and WSGI). - -See config.py for configuration settings - -""" -import cgi, os - -from fckutil import * -from fckcommands import * # default command's implementation -from fckoutput import * # base http, xml and html output mixins -import config as Config - -class FCKeditorConnectorBase( object ): - "The base connector class. Subclass it to extend functionality (see Zope example)" - - def __init__(self, environ=None): - "Constructor: Here you should parse request fields, initialize variables, etc." - self.request = FCKeditorRequest(environ) # Parse request - self.headers = [] # Clean Headers - if environ: - self.environ = environ - else: - self.environ = os.environ - - # local functions - - def setHeader(self, key, value): - self.headers.append ((key, value)) - return - -class FCKeditorRequest(object): - "A wrapper around the request object" - def __init__(self, environ): - if environ: # WSGI - self.request = cgi.FieldStorage(fp=environ['wsgi.input'], - environ=environ, - keep_blank_values=1) - self.environ = environ - else: # plain old cgi - self.environ = os.environ - self.request = cgi.FieldStorage() - if 'REQUEST_METHOD' in self.environ and 'QUERY_STRING' in self.environ: - if self.environ['REQUEST_METHOD'].upper()=='POST': - # we are in a POST, but GET query_string exists - # cgi parses by default POST data, so parse GET QUERY_STRING too - self.get_request = cgi.FieldStorage(fp=None, - environ={ - 'REQUEST_METHOD':'GET', - 'QUERY_STRING':self.environ['QUERY_STRING'], - }, - ) - else: - self.get_request={} - - def has_key(self, key): - return self.request.has_key(key) or self.get_request.has_key(key) - - def get(self, key, default=None): - if key in self.request.keys(): - field = self.request[key] - elif key in self.get_request.keys(): - field = self.get_request[key] - else: - return default - if hasattr(field,"filename") and field.filename: #file upload, do not convert return value - return field - else: - return field.value diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckoutput.py b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckoutput.py deleted file mode 100644 index 3740a015540..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckoutput.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python - -""" -FCKeditor - The text editor for Internet - http://www.fckeditor.net -Copyright (C) 2003-2010 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 == - -Connector for Python (CGI and WSGI). - -""" - -from time import gmtime, strftime -import string - -def escape(text, replace=string.replace): - """ - Converts the special characters '<', '>', and '&'. - - RFC 1866 specifies that these characters be represented - in HTML as < > and & respectively. In Python - 1.5 we use the new string.replace() function for speed. - """ - text = replace(text, '&', '&') # must be done 1st - text = replace(text, '<', '<') - text = replace(text, '>', '>') - text = replace(text, '"', '"') - return text - -def convertToXmlAttribute(value): - if (value is None): - value = "" - return escape(value) - -class BaseHttpMixin(object): - def setHttpHeaders(self, content_type='text/xml'): - "Purpose: to prepare the headers for the xml to return" - # Prevent the browser from caching the result. - # Date in the past - self.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT') - # always modified - self.setHeader('Last-Modified',strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime())) - # HTTP/1.1 - self.setHeader('Cache-Control','no-store, no-cache, must-revalidate') - self.setHeader('Cache-Control','post-check=0, pre-check=0') - # HTTP/1.0 - self.setHeader('Pragma','no-cache') - - # Set the response format. - self.setHeader( 'Content-Type', content_type + '; charset=utf-8' ) - return - -class BaseXmlMixin(object): - def createXmlHeader(self, command, resourceType, currentFolder, url): - "Purpose: returns the xml header" - self.setHttpHeaders() - # Create the XML document header - s = """""" - # Create the main connector node - s += """""" % ( - command, - resourceType - ) - # Add the current folder node - s += """""" % ( - convertToXmlAttribute(currentFolder), - convertToXmlAttribute(url), - ) - return s - - def createXmlFooter(self): - "Purpose: returns the xml footer" - return """""" - - def sendError(self, number, text): - "Purpose: in the event of an error, return an xml based error" - self.setHttpHeaders() - return ("""""" + - """""" + - self.sendErrorNode (number, text) + - """""" ) - - def sendErrorNode(self, number, text): - if number != 1: - return """""" % (number) - else: - return """""" % (number, convertToXmlAttribute(text)) - -class BaseHtmlMixin(object): - def sendUploadResults( self, errorNo = 0, fileUrl = '', fileName = '', customMsg = '' ): - self.setHttpHeaders("text/html") - "This is the function that sends the results of the uploading process" - - "Minified version of the document.domain automatic fix script (#1919)." - "The original script can be found at _dev/domain_fix_template.js" - return """""" % { - 'errorNumber': errorNo, - 'fileUrl': fileUrl.replace ('"', '\\"'), - 'fileName': fileName.replace ( '"', '\\"' ) , - 'customMsg': customMsg.replace ( '"', '\\"' ), - } diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckutil.py b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckutil.py deleted file mode 100644 index b7528051400..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/fckutil.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python - -""" -FCKeditor - The text editor for Internet - http://www.fckeditor.net -Copyright (C) 2003-2010 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 == - -Utility functions for the File Manager Connector for Python - -""" - -import string, re -import os -import config as Config - -# Generic manipulation functions - -def removeExtension(fileName): - index = fileName.rindex(".") - newFileName = fileName[0:index] - return newFileName - -def getExtension(fileName): - index = fileName.rindex(".") + 1 - fileExtension = fileName[index:] - return fileExtension - -def removeFromStart(string, char): - return string.lstrip(char) - -def removeFromEnd(string, char): - return string.rstrip(char) - -# Path functions - -def combinePaths( basePath, folder ): - return removeFromEnd( basePath, '/' ) + '/' + removeFromStart( folder, '/' ) - -def getFileName(filename): - " Purpose: helper function to extrapolate the filename " - for splitChar in ["/", "\\"]: - array = filename.split(splitChar) - if (len(array) > 1): - filename = array[-1] - return filename - -def sanitizeFolderName( newFolderName ): - "Do a cleanup of the folder name to avoid possible problems" - # Remove . \ / | : ? * " < > and control characters - return re.sub( '\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[\x00-\x1f\x7f-\x9f]', '_', newFolderName ) - -def sanitizeFileName( newFileName ): - "Do a cleanup of the file name to avoid possible problems" - # Replace dots in the name with underscores (only one dot can be there... security issue). - if ( Config.ForceSingleExtension ): # remove dots - newFileName = re.sub ( '\\.(?![^.]*$)', '_', newFileName ) ; - newFileName = newFileName.replace('\\','/') # convert windows to unix path - newFileName = os.path.basename (newFileName) # strip directories - # Remove \ / | : ? * - return re.sub ( '\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[\x00-\x1f\x7f-\x9f]/', '_', newFileName ) - -def getCurrentFolder(currentFolder): - if not currentFolder: - currentFolder = '/' - - # Check the current folder syntax (must begin and end with a slash). - if (currentFolder[-1] <> "/"): - currentFolder += "/" - if (currentFolder[0] <> "/"): - currentFolder = "/" + currentFolder - - # Ensure the folder path has no double-slashes - while '//' in currentFolder: - currentFolder = currentFolder.replace('//','/') - - # Check for invalid folder paths (..) - if '..' in currentFolder or '\\' in currentFolder: - return None - - # Check for invalid folder paths (..) - if re.search( '(/\\.)|(//)|([\\\\:\\*\\?\\""\\<\\>\\|]|[\x00-\x1F]|[\x7f-\x9f])', currentFolder ): - return None - - return currentFolder - -def mapServerPath( environ, url): - " Emulate the asp Server.mapPath function. Given an url path return the physical directory that it corresponds to " - # This isn't correct but for the moment there's no other solution - # If this script is under a virtual directory or symlink it will detect the problem and stop - return combinePaths( getRootPath(environ), url ) - -def mapServerFolder(resourceTypePath, folderPath): - return combinePaths ( resourceTypePath , folderPath ) - -def getRootPath(environ): - "Purpose: returns the root path on the server" - # WARNING: this may not be thread safe, and doesn't work w/ VirtualServer/mod_python - # Use Config.UserFilesAbsolutePath instead - - if environ.has_key('DOCUMENT_ROOT'): - return environ['DOCUMENT_ROOT'] - else: - realPath = os.path.realpath( './' ) - selfPath = environ['SCRIPT_FILENAME'] - selfPath = selfPath [ : selfPath.rfind( '/' ) ] - selfPath = selfPath.replace( '/', os.path.sep) - - position = realPath.find(selfPath) - - # This can check only that this script isn't run from a virtual dir - # But it avoids the problems that arise if it isn't checked - raise realPath - if ( position < 0 or position <> len(realPath) - len(selfPath) or realPath[ : position ]==''): - raise Exception('Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/py/config.py".') - return realPath[ : position ] diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/htaccess.txt b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/htaccess.txt deleted file mode 100644 index 82374196a9d..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/htaccess.txt +++ /dev/null @@ -1,23 +0,0 @@ -# replace the name of this file to .htaccess (if using apache), -# and set the proper options and paths according your enviroment - -Allow from all - -# If using mod_python uncomment this: -PythonPath "[r'C:\Archivos de programa\Apache Software Foundation\Apache2.2\htdocs\fckeditor\editor\filemanager\connectors\py'] + sys.path" - - -# Recomended: WSGI application running with mod_python and modpython_gateway -SetHandler python-program -PythonHandler modpython_gateway::handler -PythonOption wsgi.application wsgi::App - - -# Emulated CGI with mod_python and cgihandler -#AddHandler mod_python .py -#PythonHandler mod_python.cgihandler - - -# Plain old CGI -#Options +ExecCGI -#AddHandler cgi-script py diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/upload.py b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/upload.py deleted file mode 100644 index 1a7aa009bb7..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/upload.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python - -""" -FCKeditor - The text editor for Internet - http://www.fckeditor.net -Copyright (C) 2003-2010 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 Python - -""" -import os - -from fckutil import * -from fckcommands import * # default command's implementation -from fckconnector import FCKeditorConnectorBase # import base connector -import config as Config - -class FCKeditorQuickUpload( FCKeditorConnectorBase, - UploadFileCommandMixin, - BaseHttpMixin, BaseHtmlMixin): - def doResponse(self): - "Main function. Process the request, set headers and return a string as response." - # Check if this connector is disabled - if not(Config.Enabled): - return self.sendUploadResults(1, "This file uploader is disabled. Please check the \"editor/filemanager/connectors/py/config.py\"") - command = 'QuickUpload' - # The file type (from the QueryString, by default 'File'). - resourceType = self.request.get('Type','File') - currentFolder = "/" - # Check for invalid paths - if currentFolder is None: - return self.sendUploadResults(102, '', '', "") - - # Check if it is an allowed command - if ( not command in Config.ConfigAllowedCommands ): - return self.sendUploadResults( 1, '', '', 'The %s command isn\'t allowed' % command ) - - if ( not resourceType in Config.ConfigAllowedTypes ): - return self.sendUploadResults( 1, '', '', 'Invalid type specified' ) - - # Setup paths - self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType] - self.webUserFilesFolder = Config.QuickUploadPath[resourceType] - if not self.userFilesFolder: # no absolute path given (dangerous...) - self.userFilesFolder = mapServerPath(self.environ, - self.webUserFilesFolder) - - # Ensure that the directory exists. - if not os.path.exists(self.userFilesFolder): - try: - self.createServerFoldercreateServerFolder( self.userFilesFolder ) - except: - return self.sendError(1, "This connector couldn\'t access to local user\'s files directories. Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ") - - # File upload doesn't have to return XML, so intercept here - return self.uploadFile(resourceType, currentFolder) - -# Running from command line (plain old CGI) -if __name__ == '__main__': - try: - # Create a Connector Instance - conn = FCKeditorQuickUpload() - data = conn.doResponse() - for header in conn.headers: - if not header is None: - print '%s: %s' % header - print - print data - except: - print "Content-Type: text/plain" - print - import cgi - cgi.print_exception() diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/wsgi.py b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/wsgi.py deleted file mode 100644 index 829ede6fa5e..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/wsgi.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -""" -FCKeditor - The text editor for Internet - http://www.fckeditor.net -Copyright (C) 2003-2010 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 == - -Connector/QuickUpload for Python (WSGI wrapper). - -See config.py for configuration settings - -""" - -from connector import FCKeditorConnector -from upload import FCKeditorQuickUpload - -import cgitb -from cStringIO import StringIO - -# Running from WSGI capable server (recomended) -def App(environ, start_response): - "WSGI entry point. Run the connector" - if environ['SCRIPT_NAME'].endswith("connector.py"): - conn = FCKeditorConnector(environ) - elif environ['SCRIPT_NAME'].endswith("upload.py"): - conn = FCKeditorQuickUpload(environ) - else: - start_response ("200 Ok", [('Content-Type','text/html')]) - yield "Unknown page requested: " - yield environ['SCRIPT_NAME'] - return - try: - # run the connector - data = conn.doResponse() - # Start WSGI response: - start_response ("200 Ok", conn.headers) - # Send response text - yield data - except: - start_response("500 Internal Server Error",[("Content-type","text/html")]) - file = StringIO() - cgitb.Hook(file = file).handle() - yield file.getvalue() diff --git a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/zope.py b/htdocs/includes/fckeditor/editor/filemanager/connectors/py/zope.py deleted file mode 100644 index 0b9a2bf2d1c..00000000000 --- a/htdocs/includes/fckeditor/editor/filemanager/connectors/py/zope.py +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env python - -""" -FCKeditor - The text editor for Internet - http://www.fckeditor.net -Copyright (C) 2003-2010 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 == - -Connector for Python and Zope. - -This code was not tested at all. -It just was ported from pre 2.5 release, so for further reference see -\editor\filemanager\browser\default\connectors\py\connector.py in previous -releases. - -""" - -from fckutil import * -from connector import * -import config as Config - -class FCKeditorConnectorZope(FCKeditorConnector): - """ - Zope versiof FCKeditorConnector - """ - # Allow access (Zope) - __allow_access_to_unprotected_subobjects__ = 1 - - def __init__(self, context=None): - """ - Constructor - """ - FCKeditorConnector.__init__(self, environ=None) # call superclass constructor - # Instance Attributes - self.context = context - self.request = FCKeditorRequest(context) - - def getZopeRootContext(self): - if self.zopeRootContext is None: - self.zopeRootContext = self.context.getPhysicalRoot() - return self.zopeRootContext - - def getZopeUploadContext(self): - if self.zopeUploadContext is None: - folderNames = self.userFilesFolder.split("/") - c = self.getZopeRootContext() - for folderName in folderNames: - if (folderName <> ""): - c = c[folderName] - self.zopeUploadContext = c - return self.zopeUploadContext - - def setHeader(self, key, value): - self.context.REQUEST.RESPONSE.setHeader(key, value) - - def getFolders(self, resourceType, currentFolder): - # Open the folders node - s = "" - s += """""" - zopeFolder = self.findZopeFolder(resourceType, currentFolder) - for (name, o) in zopeFolder.objectItems(["Folder"]): - s += """""" % ( - convertToXmlAttribute(name) - ) - # Close the folders node - s += """""" - return s - - def getZopeFoldersAndFiles(self, resourceType, currentFolder): - folders = self.getZopeFolders(resourceType, currentFolder) - files = self.getZopeFiles(resourceType, currentFolder) - s = folders + files - return s - - def getZopeFiles(self, resourceType, currentFolder): - # Open the files node - s = "" - s += """""" - zopeFolder = self.findZopeFolder(resourceType, currentFolder) - for (name, o) in zopeFolder.objectItems(["File","Image"]): - s += """""" % ( - convertToXmlAttribute(name), - ((o.get_size() / 1024) + 1) - ) - # Close the files node - s += """""" - return s - - def findZopeFolder(self, resourceType, folderName): - # returns the context of the resource / folder - zopeFolder = self.getZopeUploadContext() - folderName = self.removeFromStart(folderName, "/") - folderName = self.removeFromEnd(folderName, "/") - if (resourceType <> ""): - try: - zopeFolder = zopeFolder[resourceType] - except: - zopeFolder.manage_addProduct["OFSP"].manage_addFolder(id=resourceType, title=resourceType) - zopeFolder = zopeFolder[resourceType] - if (folderName <> ""): - folderNames = folderName.split("/") - for folderName in folderNames: - zopeFolder = zopeFolder[folderName] - return zopeFolder - - def createFolder(self, resourceType, currentFolder): - # Find out where we are - zopeFolder = self.findZopeFolder(resourceType, currentFolder) - errorNo = 0 - errorMsg = "" - if self.request.has_key("NewFolderName"): - newFolder = self.request.get("NewFolderName", None) - zopeFolder.manage_addProduct["OFSP"].manage_addFolder(id=newFolder, title=newFolder) - else: - errorNo = 102 - return self.sendErrorNode ( errorNo, errorMsg ) - - def uploadFile(self, resourceType, currentFolder, count=None): - zopeFolder = self.findZopeFolder(resourceType, currentFolder) - file = self.request.get("NewFile", None) - fileName = self.getFileName(file.filename) - fileNameOnly = self.removeExtension(fileName) - fileExtension = self.getExtension(fileName).lower() - if (count): - nid = "%s.%s.%s" % (fileNameOnly, count, fileExtension) - else: - nid = fileName - title = nid - try: - zopeFolder.manage_addProduct['OFSP'].manage_addFile( - id=nid, - title=title, - file=file.read() - ) - except: - if (count): - count += 1 - else: - count = 1 - return self.zopeFileUpload(resourceType, currentFolder, count) - return self.sendUploadResults( 0 ) - -class FCKeditorRequest(object): - "A wrapper around the request object" - def __init__(self, context=None): - r = context.REQUEST - self.request = r - - def has_key(self, key): - return self.request.has_key(key) - - def get(self, key, default=None): - return self.request.get(key, default) - -""" -Running from zope, you will need to modify this connector. -If you have uploaded the FCKeditor into Zope (like me), you need to -move this connector out of Zope, and replace the "connector" with an -alias as below. The key to it is to pass the Zope context in, as -we then have a like to the Zope context. - -## Script (Python) "connector.py" -##bind container=container -##bind context=context -##bind namespace= -##bind script=script -##bind subpath=traverse_subpath -##parameters=*args, **kws -##title=ALIAS -## - -import Products.zope as connector -return connector.FCKeditorConnectorZope(context=context).doResponse() -"""