first commit
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: browser.css
|
||||
* CSS styles used by all pages that compose the File Browser.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
body
|
||||
{
|
||||
background-color: #f1f1e3;
|
||||
}
|
||||
|
||||
form
|
||||
{
|
||||
margin: 0px 0px 0px 0px ;
|
||||
padding: 0px 0px 0px 0px ;
|
||||
}
|
||||
|
||||
.Frame
|
||||
{
|
||||
background-color: #f1f1e3;
|
||||
border-color: #f1f1e3;
|
||||
border-right: thin inset;
|
||||
border-top: thin inset;
|
||||
border-left: thin inset;
|
||||
border-bottom: thin inset;
|
||||
}
|
||||
|
||||
body.FileArea
|
||||
{
|
||||
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
body, td, input, select
|
||||
{
|
||||
font-size: 11px;
|
||||
font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana;
|
||||
}
|
||||
|
||||
.ActualFolder
|
||||
{
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.PopupButtons
|
||||
{
|
||||
border-top: #d5d59d 1px solid;
|
||||
background-color: #e3e3c7;
|
||||
padding: 7px 10px 7px 10px;
|
||||
}
|
||||
|
||||
.Button, button
|
||||
{
|
||||
border-right: #737357 1px solid;
|
||||
border-top: #737357 1px solid;
|
||||
border-left: #737357 1px solid;
|
||||
color: #3b3b1f;
|
||||
border-bottom: #737357 1px solid;
|
||||
background-color: #c7c78f;
|
||||
}
|
||||
|
||||
.FolderListCurrentFolder img
|
||||
{
|
||||
background-image: url(images/FolderOpened.gif);
|
||||
}
|
||||
|
||||
.FolderListFolder img
|
||||
{
|
||||
background-image: url(images/Folder.gif);
|
||||
}
|
148
admin/FCKeditor/editor/filemanager/browser/default/browser.html
Normal file
@ -0,0 +1,148 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: browser.html
|
||||
* This page compose the File Browser dialog frameset.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>FCKeditor - Resources Browser</title>
|
||||
<link href="browser.css" type="text/css" rel="stylesheet">
|
||||
<script type="text/javascript" src="js/fckxml.js"></script>
|
||||
<script language="javascript">
|
||||
|
||||
function GetUrlParam( paramName )
|
||||
{
|
||||
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
|
||||
var oMatch = oRegex.exec( window.top.location.search ) ;
|
||||
|
||||
if ( oMatch && oMatch.length > 1 )
|
||||
return unescape( oMatch[1] ) ;
|
||||
else
|
||||
return '' ;
|
||||
}
|
||||
|
||||
var oConnector = new Object() ;
|
||||
oConnector.CurrentFolder = '/' ;
|
||||
|
||||
var sConnUrl = GetUrlParam( 'Connector' ) ;
|
||||
|
||||
// Gecko has some problems when using relative URLs (not starting with slash).
|
||||
if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )
|
||||
sConnUrl = window.location.href.replace( /browser.html.*$/, '' ) + sConnUrl ;
|
||||
|
||||
oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' ) ;
|
||||
|
||||
var sServerPath = GetUrlParam( 'ServerPath' ) ;
|
||||
if ( sServerPath.length > 0 )
|
||||
oConnector.ConnectorUrl += 'ServerPath=' + escape( sServerPath ) + '&' ;
|
||||
|
||||
oConnector.ResourceType = GetUrlParam( 'Type' ) ;
|
||||
oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 ) ;
|
||||
|
||||
if ( oConnector.ShowAllTypes )
|
||||
oConnector.ResourceType = 'File' ;
|
||||
|
||||
oConnector.SendCommand = function( command, params, callBackFunction )
|
||||
{
|
||||
var sUrl = this.ConnectorUrl + 'Command=' + command ;
|
||||
sUrl += '&Type=' + this.ResourceType ;
|
||||
sUrl += '&CurrentFolder=' + escape( this.CurrentFolder ) ;
|
||||
|
||||
if ( params ) sUrl += '&' + params ;
|
||||
|
||||
var oXML = new FCKXml() ;
|
||||
|
||||
if ( callBackFunction )
|
||||
oXML.LoadUrl( sUrl, callBackFunction ) ; // Asynchronous load.
|
||||
else
|
||||
return oXML.LoadUrl( sUrl ) ;
|
||||
}
|
||||
|
||||
oConnector.CheckError = function( responseXml )
|
||||
{
|
||||
var iErrorNumber = 0
|
||||
var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ) ;
|
||||
|
||||
if ( oErrorNode )
|
||||
{
|
||||
iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value ) ;
|
||||
|
||||
switch ( iErrorNumber )
|
||||
{
|
||||
case 0 :
|
||||
break ;
|
||||
case 1 : // Custom error. Message placed in the "text" attribute.
|
||||
alert( oErrorNode.attributes.getNamedItem('text').value ) ;
|
||||
break ;
|
||||
case 101 :
|
||||
alert( 'Folder already exists' ) ;
|
||||
break ;
|
||||
case 102 :
|
||||
alert( 'Invalid folder name' ) ;
|
||||
break ;
|
||||
case 103 :
|
||||
alert( 'You have no permissions to create the folder' ) ;
|
||||
break ;
|
||||
case 110 :
|
||||
alert( 'Unknown error creating folder' ) ;
|
||||
break ;
|
||||
default :
|
||||
alert( 'Error on your request. Error number: ' + iErrorNumber ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
return iErrorNumber ;
|
||||
}
|
||||
|
||||
var oIcons = new Object() ;
|
||||
|
||||
oIcons.AvailableIconsArray = [
|
||||
'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js',
|
||||
'mdb','mp3','pdf','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ;
|
||||
|
||||
oIcons.AvailableIcons = new Object() ;
|
||||
|
||||
for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ )
|
||||
oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ;
|
||||
|
||||
oIcons.GetIcon = function( fileName )
|
||||
{
|
||||
var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase() ;
|
||||
|
||||
if ( this.AvailableIcons[ sExtension ] == true )
|
||||
return sExtension ;
|
||||
else
|
||||
return 'default.icon' ;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<frameset cols="150,*" class="Frame" framespacing="3" bordercolor="#f1f1e3" frameborder="1">
|
||||
<frameset rows="50,*" framespacing="0">
|
||||
<frame src="frmresourcetype.html" scrolling="no" frameborder="0">
|
||||
<frame name="frmFolders" src="frmfolders.html" scrolling="auto" frameborder="1">
|
||||
</frameset>
|
||||
<frameset rows="50,*,50" framespacing="0">
|
||||
<frame name="frmActualFolder" src="frmactualfolder.html" scrolling="no" frameborder="0">
|
||||
<frame name="frmResourcesList" src="frmresourceslist.html" scrolling="auto" frameborder="1">
|
||||
<frameset cols="150,*,0" framespacing="0" frameborder="0">
|
||||
<frame name="frmCreateFolder" src="frmcreatefolder.html" scrolling="no" frameborder="0">
|
||||
<frame name="frmUpload" src="frmupload.html" scrolling="no" frameborder="0">
|
||||
<frame name="frmUploadWorker" src="../../../fckblank.html" scrolling="no" frameborder="0">
|
||||
</frameset>
|
||||
</frameset>
|
||||
</frameset>
|
||||
</html>
|
@ -0,0 +1,58 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: basexml.asp
|
||||
* This file include the functions that create the base XML output.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<%
|
||||
|
||||
Sub SetXmlHeaders()
|
||||
' Cleans the response buffer.
|
||||
Response.Clear()
|
||||
|
||||
' Prevent the browser from caching the result.
|
||||
Response.CacheControl = "no-cache"
|
||||
|
||||
' Set the response format.
|
||||
Response.CharSet = "UTF-8"
|
||||
Response.ContentType = "text/xml"
|
||||
End Sub
|
||||
|
||||
Sub CreateXmlHeader( command, resourceType, currentFolder )
|
||||
' Create the XML document header.
|
||||
Response.Write "<?xml version=""1.0"" encoding=""utf-8"" ?>"
|
||||
|
||||
' Create the main "Connector" node.
|
||||
Response.Write "<Connector command=""" & command & """ resourceType=""" & resourceType & """>"
|
||||
|
||||
' Add the current folder node.
|
||||
Response.Write "<CurrentFolder path=""" & ConvertToXmlAttribute( currentFolder ) & """ url=""" & ConvertToXmlAttribute( GetUrlFromPath( resourceType, currentFolder) ) & """ />"
|
||||
End Sub
|
||||
|
||||
Sub CreateXmlFooter()
|
||||
Response.Write "</Connector>"
|
||||
End Sub
|
||||
|
||||
Sub SendError( number, text )
|
||||
SetXmlHeaders
|
||||
|
||||
' Create the XML document header.
|
||||
Response.Write "<?xml version=""1.0"" encoding=""utf-8"" ?>"
|
||||
|
||||
Response.Write "<Connector><Error number=""" & number & """ text=""" & Server.HTMLEncode( text ) & """ /></Connector>"
|
||||
|
||||
Response.End
|
||||
End Sub
|
||||
%>
|
@ -0,0 +1,230 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: class_upload.asp
|
||||
* These are the classes used to handle ASP upload without using third
|
||||
* part components (OCX/DLL).
|
||||
*
|
||||
* File Authors:
|
||||
* NetRube (netrube@126.com)
|
||||
-->
|
||||
<%
|
||||
'**********************************************
|
||||
' File: NetRube_Upload.asp
|
||||
' Version: NetRube Upload Class Version 2.1 Build 20050228
|
||||
' Author: NetRube
|
||||
' Email: NetRube@126.com
|
||||
' Date: 02/28/2005
|
||||
' Comments: The code for the Upload.
|
||||
' This can free usage, but please
|
||||
' not to delete this copyright information.
|
||||
' If you have a modification version,
|
||||
' Please send out a duplicate to me.
|
||||
'**********************************************
|
||||
' 文件名: NetRube_Upload.asp
|
||||
' 版本: NetRube Upload Class Version 2.1 Build 20050228
|
||||
' 作者: NetRube(网络乡巴佬)
|
||||
' 电子邮件: NetRube@126.com
|
||||
' 日期: 2005年02月28日
|
||||
' 声明: 文件上传类
|
||||
' 本上传类可以自由使用,但请保留此版权声明信息
|
||||
' 如果您对本上传类进行修改增强,
|
||||
' 请发送一份给俺。
|
||||
'**********************************************
|
||||
|
||||
Class NetRube_Upload
|
||||
|
||||
Public File, Form
|
||||
Private oSourceData
|
||||
Private nMaxSize, nErr, sAllowed, sDenied
|
||||
|
||||
Private Sub Class_Initialize
|
||||
nErr = 0
|
||||
nMaxSize = 1048576
|
||||
|
||||
Set File = Server.CreateObject("Scripting.Dictionary")
|
||||
File.CompareMode = 1
|
||||
Set Form = Server.CreateObject("Scripting.Dictionary")
|
||||
Form.CompareMode = 1
|
||||
|
||||
Set oSourceData = Server.CreateObject("ADODB.Stream")
|
||||
oSourceData.Type = 1
|
||||
oSourceData.Mode = 3
|
||||
oSourceData.Open
|
||||
End Sub
|
||||
|
||||
Private Sub Class_Terminate
|
||||
Form.RemoveAll
|
||||
Set Form = Nothing
|
||||
File.RemoveAll
|
||||
Set File = Nothing
|
||||
|
||||
oSourceData.Close
|
||||
Set oSourceData = Nothing
|
||||
End Sub
|
||||
|
||||
Public Property Get Version
|
||||
Version = "NetRube Upload Class Version 1.0 Build 20041218"
|
||||
End Property
|
||||
|
||||
Public Property Get ErrNum
|
||||
ErrNum = nErr
|
||||
End Property
|
||||
|
||||
Public Property Let MaxSize(nSize)
|
||||
nMaxSize = nSize
|
||||
End Property
|
||||
|
||||
Public Property Let Allowed(sExt)
|
||||
sAllowed = sExt
|
||||
End Property
|
||||
|
||||
Public Property Let Denied(sExt)
|
||||
sDenied = sExt
|
||||
End Property
|
||||
|
||||
Public Sub GetData
|
||||
Dim aCType
|
||||
aCType = Split(Request.ServerVariables("HTTP_CONTENT_TYPE"), ";")
|
||||
If aCType(0) <> "multipart/form-data" Then
|
||||
nErr = 1
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim nTotalSize
|
||||
nTotalSize = Request.TotalBytes
|
||||
If nTotalSize < 1 Then
|
||||
nErr = 2
|
||||
Exit Sub
|
||||
End If
|
||||
If nMaxSize > 0 And nTotalSize > nMaxSize Then
|
||||
nErr = 3
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
oSourceData.Write Request.BinaryRead(nTotalSize)
|
||||
oSourceData.Position = 0
|
||||
|
||||
Dim oTotalData, oFormStream, sFormHeader, sFormName, bCrLf, nBoundLen, nFormStart, nFormEnd, nPosStart, nPosEnd, sBoundary
|
||||
|
||||
oTotalData = oSourceData.Read
|
||||
bCrLf = ChrB(13) & ChrB(10)
|
||||
sBoundary = MidB(oTotalData, 1, InStrB(1, oTotalData, bCrLf) - 1)
|
||||
nBoundLen = LenB(sBoundary) + 2
|
||||
nFormStart = nBoundLen
|
||||
|
||||
Set oFormStream = Server.CreateObject("ADODB.Stream")
|
||||
|
||||
Do While (nFormStart + 2) < nTotalSize
|
||||
nFormEnd = InStrB(nFormStart, oTotalData, bCrLf & bCrLf) + 3
|
||||
|
||||
With oFormStream
|
||||
.Type = 1
|
||||
.Mode = 3
|
||||
.Open
|
||||
oSourceData.Position = nFormStart
|
||||
oSourceData.CopyTo oFormStream, nFormEnd - nFormStart
|
||||
.Position = 0
|
||||
.Type = 2
|
||||
.CharSet = "UTF-8"
|
||||
sFormHeader = .ReadText
|
||||
.Close
|
||||
End With
|
||||
|
||||
nFormStart = InStrB(nFormEnd, oTotalData, sBoundary) - 1
|
||||
nPosStart = InStr(22, sFormHeader, " name=", 1) + 7
|
||||
nPosEnd = InStr(nPosStart, sFormHeader, """")
|
||||
sFormName = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
|
||||
|
||||
If InStr(45, sFormHeader, " filename=", 1) > 0 Then
|
||||
Set File(sFormName) = New NetRube_FileInfo
|
||||
File(sFormName).FormName = sFormName
|
||||
File(sFormName).Start = nFormEnd
|
||||
File(sFormName).Size = nFormStart - nFormEnd - 2
|
||||
nPosStart = InStr(nPosEnd, sFormHeader, " filename=", 1) + 11
|
||||
nPosEnd = InStr(nPosStart, sFormHeader, """")
|
||||
File(sFormName).ClientPath = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
|
||||
File(sFormName).Name = Mid(File(sFormName).ClientPath, InStrRev(File(sFormName).ClientPath, "\") + 1)
|
||||
File(sFormName).Ext = LCase(Mid(File(sFormName).Name, InStrRev(File(sFormName).Name, ".") + 1))
|
||||
nPosStart = InStr(nPosEnd, sFormHeader, "Content-Type: ", 1) + 14
|
||||
nPosEnd = InStr(nPosStart, sFormHeader, vbCr)
|
||||
File(sFormName).MIME = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
|
||||
Else
|
||||
With oFormStream
|
||||
.Type = 1
|
||||
.Mode = 3
|
||||
.Open
|
||||
oSourceData.Position = nPosEnd
|
||||
oSourceData.CopyTo oFormStream, nFormStart - nFormEnd - 2
|
||||
.Position = 0
|
||||
.Type = 2
|
||||
.CharSet = "UTF-8"
|
||||
Form(sFormName) = .ReadText
|
||||
.Close
|
||||
End With
|
||||
End If
|
||||
|
||||
nFormStart = nFormStart + nBoundLen
|
||||
Loop
|
||||
|
||||
oTotalData = ""
|
||||
Set oFormStream = Nothing
|
||||
End Sub
|
||||
|
||||
Public Sub SaveAs(sItem, sFileName)
|
||||
If File(sItem).Size < 1 Then
|
||||
nErr = 2
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not IsAllowed(File(sItem).Ext) Then
|
||||
nErr = 4
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oFileStream
|
||||
Set oFileStream = Server.CreateObject("ADODB.Stream")
|
||||
With oFileStream
|
||||
.Type = 1
|
||||
.Mode = 3
|
||||
.Open
|
||||
oSourceData.Position = File(sItem).Start
|
||||
oSourceData.CopyTo oFileStream, File(sItem).Size
|
||||
.Position = 0
|
||||
.SaveToFile sFileName, 2
|
||||
.Close
|
||||
End With
|
||||
Set oFileStream = Nothing
|
||||
End Sub
|
||||
|
||||
Private Function IsAllowed(sExt)
|
||||
Dim oRE
|
||||
Set oRE = New RegExp
|
||||
oRE.IgnoreCase = True
|
||||
oRE.Global = True
|
||||
|
||||
If sDenied = "" Then
|
||||
oRE.Pattern = sAllowed
|
||||
IsAllowed = (sAllowed = "") Or oRE.Test(sExt)
|
||||
Else
|
||||
oRE.Pattern = sDenied
|
||||
IsAllowed = Not oRE.Test(sExt)
|
||||
End If
|
||||
|
||||
Set oRE = Nothing
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Class NetRube_FileInfo
|
||||
Dim FormName, ClientPath, Path, Name, Ext, Content, Size, MIME, Start
|
||||
End Class
|
||||
%>
|
@ -0,0 +1,179 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: commands.asp
|
||||
* This file include the functions that handle the Command requests
|
||||
* in the ASP Connector.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<%
|
||||
Sub GetFolders( resourceType, currentFolder )
|
||||
' Map the virtual path to the local server path.
|
||||
Dim sServerDir
|
||||
sServerDir = ServerMapFolder( resourceType, currentFolder )
|
||||
|
||||
' Open the "Folders" node.
|
||||
Response.Write "<Folders>"
|
||||
|
||||
Dim oFSO, oCurrentFolder, oFolders, oFolder
|
||||
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
|
||||
Set oCurrentFolder = oFSO.GetFolder( sServerDir )
|
||||
Set oFolders = oCurrentFolder.SubFolders
|
||||
|
||||
For Each oFolder in oFolders
|
||||
Response.Write "<Folder name=""" & ConvertToXmlAttribute( oFolder.name ) & """ />"
|
||||
Next
|
||||
|
||||
Set oFSO = Nothing
|
||||
|
||||
' Close the "Folders" node.
|
||||
Response.Write "</Folders>"
|
||||
End Sub
|
||||
|
||||
Sub GetFoldersAndFiles( resourceType, currentFolder )
|
||||
' Map the virtual path to the local server path.
|
||||
Dim sServerDir
|
||||
sServerDir = ServerMapFolder( resourceType, currentFolder )
|
||||
|
||||
Dim oFSO, oCurrentFolder, oFolders, oFolder, oFiles, oFile
|
||||
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
|
||||
Set oCurrentFolder = oFSO.GetFolder( sServerDir )
|
||||
Set oFolders = oCurrentFolder.SubFolders
|
||||
Set oFiles = oCurrentFolder.Files
|
||||
|
||||
' Open the "Folders" node.
|
||||
Response.Write "<Folders>"
|
||||
|
||||
For Each oFolder in oFolders
|
||||
Response.Write "<Folder name=""" & ConvertToXmlAttribute( oFolder.name ) & """ />"
|
||||
Next
|
||||
|
||||
' Close the "Folders" node.
|
||||
Response.Write "</Folders>"
|
||||
|
||||
' Open the "Files" node.
|
||||
Response.Write "<Files>"
|
||||
|
||||
For Each oFile in oFiles
|
||||
Dim iFileSize
|
||||
iFileSize = Round( oFile.size / 1024 )
|
||||
If ( iFileSize < 1 AND oFile.size <> 0 ) Then iFileSize = 1
|
||||
|
||||
Response.Write "<File name=""" & ConvertToXmlAttribute( oFile.name ) & """ size=""" & iFileSize & """ />"
|
||||
Next
|
||||
|
||||
' Close the "Files" node.
|
||||
Response.Write "</Files>"
|
||||
End Sub
|
||||
|
||||
Sub CreateFolder( resourceType, currentFolder )
|
||||
Dim sErrorNumber
|
||||
|
||||
Dim sNewFolderName
|
||||
sNewFolderName = Request.QueryString( "NewFolderName" )
|
||||
|
||||
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, currentFolder & "/" & sNewFolderName )
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
CreateServerFolder sServerDir
|
||||
|
||||
Dim iErrNumber, sErrDescription
|
||||
iErrNumber = err.number
|
||||
sErrDescription = err.Description
|
||||
|
||||
On Error Goto 0
|
||||
|
||||
Select Case iErrNumber
|
||||
Case 0
|
||||
sErrorNumber = "0"
|
||||
Case 52
|
||||
sErrorNumber = "102" ' Invalid Folder Name.
|
||||
Case 70
|
||||
sErrorNumber = "103" ' Security Error.
|
||||
Case 76
|
||||
sErrorNumber = "102" ' Path too long.
|
||||
Case Else
|
||||
sErrorNumber = "110"
|
||||
End Select
|
||||
End If
|
||||
|
||||
' Create the "Error" node.
|
||||
Response.Write "<Error number=""" & sErrorNumber & """ originalNumber=""" & iErrNumber & """ originalDescription=""" & ConvertToXmlAttribute( sErrDescription ) & """ />"
|
||||
End Sub
|
||||
|
||||
Sub FileUpload( resourceType, currentFolder )
|
||||
Dim oUploader
|
||||
Set oUploader = New NetRube_Upload
|
||||
oUploader.MaxSize = 0
|
||||
oUploader.Allowed = ConfigAllowedExtensions.Item( resourceType )
|
||||
oUploader.Denied = ConfigDeniedExtensions.Item( resourceType )
|
||||
oUploader.GetData
|
||||
|
||||
Dim sErrorNumber
|
||||
sErrorNumber = "0"
|
||||
|
||||
Dim sFileName, sOriginalFileName, sExtension
|
||||
sFileName = ""
|
||||
|
||||
If oUploader.ErrNum > 1 Then
|
||||
sErrorNumber = "202"
|
||||
Else
|
||||
' Map the virtual path to the local server path.
|
||||
Dim sServerDir
|
||||
sServerDir = ServerMapFolder( resourceType, currentFolder )
|
||||
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
|
||||
|
||||
' Get the uploaded file name.
|
||||
sFileName = oUploader.File( "NewFile" ).Name
|
||||
sExtension = oUploader.File( "NewFile" ).Ext
|
||||
sOriginalFileName = sFileName
|
||||
|
||||
Dim iCounter
|
||||
iCounter = 0
|
||||
|
||||
Do While ( True )
|
||||
Dim sFilePath
|
||||
sFilePath = sServerDir & sFileName
|
||||
|
||||
If ( oFSO.FileExists( sFilePath ) ) Then
|
||||
iCounter = iCounter + 1
|
||||
sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
|
||||
sErrorNumber = "201"
|
||||
Else
|
||||
oUploader.SaveAs "NewFile", sFilePath
|
||||
If oUploader.ErrNum > 0 Then sErrorNumber = "202"
|
||||
Exit Do
|
||||
End If
|
||||
Loop
|
||||
End If
|
||||
|
||||
Set oUploader = Nothing
|
||||
|
||||
Response.Clear
|
||||
|
||||
Response.Write "<script type=""text/javascript"">"
|
||||
Response.Write "window.parent.frames['frmUpload'].OnUploadCompleted(" & sErrorNumber & ",'" & Replace( sFileName, "'", "\'" ) & "') ;"
|
||||
Response.Write "</script>"
|
||||
|
||||
Response.End
|
||||
End Sub
|
||||
%>
|
@ -0,0 +1,45 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: config.asp
|
||||
* Configuration file for the File Manager Connector for ASP.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<%
|
||||
|
||||
' SECURITY: You must explicitelly enable this "connector" (set it to "True").
|
||||
Dim ConfigIsEnabled
|
||||
ConfigIsEnabled = False
|
||||
|
||||
' Path to user files relative to the document root.
|
||||
Dim ConfigUserFilesPath
|
||||
ConfigUserFilesPath = "/UserFiles/"
|
||||
|
||||
Dim ConfigAllowedExtensions, ConfigDeniedExtensions
|
||||
Set ConfigAllowedExtensions = CreateObject( "Scripting.Dictionary" )
|
||||
Set ConfigDeniedExtensions = CreateObject( "Scripting.Dictionary" )
|
||||
|
||||
ConfigAllowedExtensions.Add "File", ""
|
||||
ConfigDeniedExtensions.Add "File", "php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|com|dll|vbs|js|reg|cgi|htaccess"
|
||||
|
||||
ConfigAllowedExtensions.Add "Image", "jpg|gif|jpeg|png|bmp"
|
||||
ConfigDeniedExtensions.Add "Image", ""
|
||||
|
||||
ConfigAllowedExtensions.Add "Flash", "swf|fla"
|
||||
ConfigDeniedExtensions.Add "Flash", ""
|
||||
|
||||
ConfigAllowedExtensions.Add "Media", "swf|fla|jpg|gif|jpeg|png|avi|mpg|mpeg|mp(1-4)|wma|wmv|wav|mid|midi|rmi|rm|ram|rmvb|mov|qt"
|
||||
ConfigDeniedExtensions.Add "Media", ""
|
||||
|
||||
%>
|
@ -0,0 +1,120 @@
|
||||
<%@ CodePage=65001 Language="VBScript"%>
|
||||
<%
|
||||
Option Explicit
|
||||
Response.Buffer = True
|
||||
%>
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: connector.asp
|
||||
* This is the File Manager Connector for ASP.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<!--#include file="config.asp"-->
|
||||
<!--#include file="util.asp"-->
|
||||
<!--#include file="io.asp"-->
|
||||
<!--#include file="basexml.asp"-->
|
||||
<!--#include file="commands.asp"-->
|
||||
<!--#include file="class_upload.asp"-->
|
||||
<%
|
||||
|
||||
If ( ConfigIsEnabled = False ) Then
|
||||
SendError 1, "This connector is disabled. Please check the ""editor/filemanager/browser/default/connectors/asp/config.asp"" file"
|
||||
End If
|
||||
|
||||
' Get the "UserFiles" path.
|
||||
Dim sUserFilesPath
|
||||
|
||||
If ( Not IsEmpty( ConfigUserFilesPath ) ) Then
|
||||
sUserFilesPath = ConfigUserFilesPath
|
||||
|
||||
If ( Right( sUserFilesPath, 1 ) <> "/" ) Then
|
||||
sUserFilesPath = sUserFilesPath & "/"
|
||||
End If
|
||||
Else
|
||||
sUserFilesPath = "/UserFiles/"
|
||||
End If
|
||||
|
||||
' Map the "UserFiles" path to a local directory.
|
||||
Dim sUserFilesDirectory
|
||||
sUserFilesDirectory = Server.MapPath( sUserFilesPath )
|
||||
|
||||
If ( Right( sUserFilesDirectory, 1 ) <> "\" ) Then
|
||||
sUserFilesDirectory = sUserFilesDirectory & "\"
|
||||
End If
|
||||
|
||||
DoResponse
|
||||
|
||||
Sub DoResponse()
|
||||
Dim sCommand, sResourceType, sCurrentFolder
|
||||
|
||||
' Get the main request information.
|
||||
sCommand = Request.QueryString("Command")
|
||||
If ( sCommand = "" ) Then Exit Sub
|
||||
|
||||
sResourceType = Request.QueryString("Type")
|
||||
If ( sResourceType = "" ) Then Exit Sub
|
||||
|
||||
sCurrentFolder = Request.QueryString("CurrentFolder")
|
||||
If ( sCurrentFolder = "" ) Then Exit Sub
|
||||
|
||||
' Check if it is an allower resource type.
|
||||
if ( Not IsAllowedType( sResourceType ) ) Then Exit Sub
|
||||
|
||||
' 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, sResourceType, ".." ) <> 0 ) Then
|
||||
SendError 102, ""
|
||||
End If
|
||||
|
||||
' File Upload doesn't have to Return XML, so it must be intercepted before anything.
|
||||
If ( sCommand = "FileUpload" ) Then
|
||||
FileUpload sResourceType, sCurrentFolder
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
SetXmlHeaders
|
||||
|
||||
CreateXmlHeader sCommand, sResourceType, sCurrentFolder
|
||||
|
||||
' 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
|
||||
|
||||
Function IsAllowedType( resourceType )
|
||||
Dim oRE
|
||||
Set oRE = New RegExp
|
||||
oRE.IgnoreCase = True
|
||||
oRE.Global = True
|
||||
oRE.Pattern = "^(File|Image|Flash|Media)$"
|
||||
|
||||
IsAllowedType = oRE.Test( resourceType )
|
||||
|
||||
Set oRE = Nothing
|
||||
End Function
|
||||
%>
|
@ -0,0 +1,85 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: io.asp
|
||||
* This file include IO specific functions used by the ASP Connector.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<%
|
||||
Function GetUrlFromPath( resourceType, folderPath )
|
||||
If resourceType = "" Then
|
||||
GetUrlFromPath = RemoveFromEnd( sUserFilesPath, "/" ) & folderPath
|
||||
Else
|
||||
GetUrlFromPath = sUserFilesPath & resourceType & folderPath
|
||||
End If
|
||||
End Function
|
||||
|
||||
Function RemoveExtension( fileName )
|
||||
RemoveExtension = Left( fileName, InStrRev( fileName, "." ) - 1 )
|
||||
End Function
|
||||
|
||||
Function ServerMapFolder( resourceType, folderPath )
|
||||
' Get the resource type directory.
|
||||
Dim sResourceTypePath
|
||||
sResourceTypePath = sUserFilesDirectory & resourceType & "\"
|
||||
|
||||
' Ensure that the directory exists.
|
||||
CreateServerFolder sResourceTypePath
|
||||
|
||||
' Return the resource type directory combined with the required path.
|
||||
ServerMapFolder = sResourceTypePath & RemoveFromStart( folderPath, "/" )
|
||||
End Function
|
||||
|
||||
Sub CreateServerFolder( folderPath )
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
|
||||
|
||||
Dim sParent
|
||||
sParent = oFSO.GetParentFolderName( folderPath )
|
||||
|
||||
' Check if the parent exists, or create it.
|
||||
If ( NOT oFSO.FolderExists( sParent ) ) Then CreateServerFolder( sParent )
|
||||
|
||||
If ( oFSO.FolderExists( folderPath ) = False ) Then
|
||||
oFSO.CreateFolder( folderPath )
|
||||
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
|
||||
%>
|
@ -0,0 +1,51 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: util.asp
|
||||
* This file include generic functions used by the ASP Connector.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<%
|
||||
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
|
||||
|
||||
%>
|
@ -0,0 +1,26 @@
|
||||
<%@ Page language="c#" Inherits="FredCK.FCKeditorV2.FileBrowserConnector" AutoEventWireup="false" %>
|
||||
<%--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: connector.aspx
|
||||
* 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 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
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
--%>
|
@ -0,0 +1,80 @@
|
||||
<cfsetting enablecfoutputonly="Yes">
|
||||
|
||||
<cfscript>
|
||||
config = structNew();
|
||||
|
||||
// SECURITY: You must explicitly enable this "connector". (Set enabled to "true")
|
||||
config.enabled = false;
|
||||
|
||||
config.userFilesPath = "/UserFiles/";
|
||||
|
||||
config.serverPath = ""; // 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
|
||||
|
||||
config.allowedExtensions = structNew();
|
||||
config.deniedExtensions = structNew();
|
||||
|
||||
// config.allowedExtensions["File"] = "doc,rtf,pdf,ppt,pps,xls,csv,vnd,zip";
|
||||
config.allowedExtensions["File"] = "";
|
||||
config.deniedExtensions["File"] = "php,php2,php3,php4,php5,phtml,pwml,inc,asp,aspx,ascx,jsp,cfm,cfc,pl,bat,exe,com,dll,vbs,js,reg,cgi,htaccess";
|
||||
|
||||
config.allowedExtensions["Image"] = "png,gif,jpg,jpeg,bmp";
|
||||
config.deniedExtensions["Image"] = "";
|
||||
|
||||
config.allowedExtensions["Flash"] = "swf,fla";
|
||||
config.deniedExtensions["Flash"] = "";
|
||||
|
||||
config.allowedExtensions["Media"] = "swf,fla,jpg,gif,jpeg,png,avi,mpg,mpeg,mp3,mp4,m4a,wma,wmv,wav,mid,midi,rmi,rm,ram,rmvb,mov,qt";
|
||||
config.deniedExtensions["Media"] = "";
|
||||
</cfscript>
|
||||
|
||||
<!--- code to maintain backwards compatibility with previous version of cfm connector --->
|
||||
<cfif isDefined("application.userFilesPath")>
|
||||
|
||||
<cflock scope="application" type="readonly" timeout="5">
|
||||
<cfset config.userFilesPath = application.userFilesPath>
|
||||
</cflock>
|
||||
|
||||
<cfelseif isDefined("server.userFilesPath")>
|
||||
|
||||
<cflock scope="server" type="readonly" timeout="5">
|
||||
<cfset config.userFilesPath = server.userFilesPath>
|
||||
</cflock>
|
||||
|
||||
</cfif>
|
||||
|
||||
<!--- look for config struct in request, application and server scopes --->
|
||||
<cfif isDefined("request.FCKeditor") and isStruct(request.FCKeditor)>
|
||||
|
||||
<cfset variables.FCKeditor = request.FCKeditor>
|
||||
|
||||
<cfelseif isDefined("application.FCKeditor") and isStruct(application.FCKeditor)>
|
||||
|
||||
<cflock scope="application" type="readonly" timeout="5">
|
||||
<cfset variables.FCKeditor = duplicate(application.FCKeditor)>
|
||||
</cflock>
|
||||
|
||||
<cfelseif isDefined("server.FCKeditor") and isStruct(server.FCKeditor)>
|
||||
|
||||
<cflock scope="server" type="readonly" timeout="5">
|
||||
<cfset variables.FCKeditor = duplicate(server.FCKeditor)>
|
||||
</cflock>
|
||||
|
||||
</cfif>
|
||||
|
||||
<cfif isDefined("FCKeditor")>
|
||||
|
||||
<!--- copy key values from external to local config (i.e. override default config as required) --->
|
||||
<cfscript>
|
||||
function structCopyKeys(stFrom, stTo) {
|
||||
for ( key in stFrom ) {
|
||||
if ( isStruct(stFrom[key]) ) {
|
||||
structCopyKeys(stFrom[key],stTo[key]);
|
||||
} else {
|
||||
stTo[key] = stFrom[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
structCopyKeys(FCKeditor, config);
|
||||
</cfscript>
|
||||
|
||||
</cfif>
|
@ -0,0 +1,364 @@
|
||||
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
|
||||
<!---
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: connector.cfm
|
||||
* File Browser connector for ColdFusion.
|
||||
* (based on the original CF connector by Hendrik Kramer - hk@lwd.de)
|
||||
*
|
||||
* Note:
|
||||
* FCKeditor requires that the connector responds with UTF-8 encoded XML.
|
||||
* As ColdFusion 5 does not fully support UTF-8 encoding, we force ASCII
|
||||
* file and folder names in this connector to allow CF5 send a UTF-8
|
||||
* encoded response - code points under 127 in UTF-8 are stored using a
|
||||
* single byte, using the same encoding as ASCII, which is damn handy.
|
||||
* This is all grand for the English speakers, like meself, but I dunno
|
||||
* how others are gonna take to it. Well, the previous version of this
|
||||
* connector already did this with file names and nobody seemed to mind,
|
||||
* so fingers-crossed nobody will mind their folder names being munged too.
|
||||
*
|
||||
*
|
||||
* File Authors:
|
||||
* Mark Woods (mark@thickpaddy.com)
|
||||
* Wim Lemmens (didgiman@gmail.com)
|
||||
--->
|
||||
|
||||
<cfparam name="url.command">
|
||||
<cfparam name="url.type">
|
||||
<cfparam name="url.currentFolder">
|
||||
<!--- note: no serverPath url parameter - see config.cfm if you need to set the serverPath manually --->
|
||||
|
||||
<cfinclude template="config.cfm">
|
||||
|
||||
<cfscript>
|
||||
userFilesPath = config.userFilesPath;
|
||||
lAllowedExtensions = config.allowedExtensions[url.type];
|
||||
lDeniedExtensions = config.deniedExtensions[url.type];
|
||||
|
||||
// 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;
|
||||
} else {
|
||||
serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),"");
|
||||
}
|
||||
|
||||
// map the user files path to a physical directory
|
||||
userFilesServerPath = serverPath & replace(userFilesPath,"/",fs,"all");
|
||||
|
||||
xmlContent = ""; // append to this string to build content
|
||||
</cfscript>
|
||||
|
||||
<cfif not config.enabled>
|
||||
|
||||
<cfset xmlContent = "<Error number=""1"" text=""This connector is disabled. Please check the 'editor/filemanager/browser/default/connectors/cfm/config.cfm' file"" />">
|
||||
|
||||
<cfelseif find("..",url.currentFolder)>
|
||||
|
||||
<cfset xmlContent = "<Error number=""102"" />">
|
||||
|
||||
</cfif>
|
||||
|
||||
<cfif not len(xmlContent)>
|
||||
|
||||
<!--- create directories in physical path if they don't already exist --->
|
||||
<cfset currentPath = serverPath>
|
||||
<cftry>
|
||||
|
||||
<cfloop list="#userFilesPath#" index="name" delimiters="/">
|
||||
|
||||
<cfif not directoryExists(currentPath & fs & name)>
|
||||
<cfdirectory action="create" directory="#currentPath##fs##name#" mode="755">
|
||||
</cfif>
|
||||
|
||||
<cfset currentPath = currentPath & fs & name>
|
||||
|
||||
</cfloop>
|
||||
|
||||
<!--- create sub-directory for file type if it doesn't already exist --->
|
||||
<cfif not directoryExists(userFilesServerPath & url.type)>
|
||||
<cfdirectory action="create" directory="#userFilesServerPath##url.type#" mode="755">
|
||||
</cfif>
|
||||
|
||||
<cfcatch>
|
||||
|
||||
<!--- this should only occur as a result of a permissions problem --->
|
||||
<cfset xmlContent = "<Error number=""103"" />">
|
||||
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
|
||||
</cfif>
|
||||
|
||||
<cfif not len(xmlContent)>
|
||||
|
||||
<!--- no errors thus far - run command --->
|
||||
|
||||
<!--- we need to know the physical path to the current folder for all commands --->
|
||||
<cfset currentFolderPath = userFilesServerPath & url.type & replace(url.currentFolder,"/",fs,"all")>
|
||||
|
||||
<cfswitch expression="#url.command#">
|
||||
|
||||
|
||||
<cfcase value="FileUpload">
|
||||
|
||||
<cfset fileName = "">
|
||||
<cfset fileExt = "">
|
||||
|
||||
<cftry>
|
||||
|
||||
<!--- TODO: upload to a temp directory and move file if extension is allowed --->
|
||||
|
||||
<!--- first upload the file with an unique filename --->
|
||||
<cffile action="upload"
|
||||
fileField="NewFile"
|
||||
destination="#currentFolderPath#"
|
||||
nameConflict="makeunique"
|
||||
mode="644"
|
||||
attributes="normal">
|
||||
|
||||
<cfif cffile.fileSize EQ 0>
|
||||
<cfthrow>
|
||||
</cfif>
|
||||
|
||||
<cfif ( len(lAllowedExtensions) and not listFindNoCase(lAllowedExtensions,cffile.ServerFileExt) )
|
||||
or ( len(lDeniedExtensions) and listFindNoCase(lDeniedExtensions,cffile.ServerFileExt) )>
|
||||
|
||||
<cfset errorNumber = "202">
|
||||
<cffile action="delete" file="#cffile.ServerDirectory##fs##cffile.ServerFile#">
|
||||
|
||||
<cfelse>
|
||||
|
||||
<cfscript>
|
||||
errorNumber = 0;
|
||||
fileName = cffile.ClientFileName;
|
||||
fileExt = cffile.ServerFileExt;
|
||||
|
||||
// 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");
|
||||
}
|
||||
|
||||
// When the original filename already exists, add numbers (0), (1), (2), ... at the end of the filename.
|
||||
if( compare( cffile.ServerFileName, fileName ) ) {
|
||||
counter = 0;
|
||||
tmpFileName = fileName;
|
||||
while( fileExists("#currentFolderPath##fileName#.#fileExt#") ) {
|
||||
counter = counter + 1;
|
||||
fileName = tmpFileName & '(#counter#)';
|
||||
}
|
||||
}
|
||||
</cfscript>
|
||||
|
||||
<!--- Rename the uploaded file, if neccessary --->
|
||||
<cfif compare(cffile.ServerFileName,fileName)>
|
||||
|
||||
<cfset errorNumber = "201">
|
||||
<cffile
|
||||
action="rename"
|
||||
source="#currentFolderPath##cffile.ServerFileName#.#cffile.ServerFileExt#"
|
||||
destination="#currentFolderPath##fileName#.#fileExt#"
|
||||
mode="644"
|
||||
attributes="normal">
|
||||
|
||||
</cfif>
|
||||
|
||||
</cfif>
|
||||
|
||||
<cfcatch type="Any">
|
||||
|
||||
<cfset errorNumber = "202">
|
||||
|
||||
</cfcatch>
|
||||
|
||||
</cftry>
|
||||
|
||||
|
||||
<cfif errorNumber eq 201>
|
||||
|
||||
<!--- file was changed (201), submit the new filename --->
|
||||
<cfoutput>
|
||||
<script type="text/javascript">
|
||||
window.parent.frames['frmUpload'].OnUploadCompleted(#errorNumber#,'#replace( fileName & "." & fileExt, "'", "\'", "ALL")#');
|
||||
</script>
|
||||
</cfoutput>
|
||||
|
||||
<cfelse>
|
||||
|
||||
<!--- file was uploaded succesfully(0) or an error occured(202). Submit only the error code. --->
|
||||
<cfoutput>
|
||||
<script type="text/javascript">
|
||||
window.parent.frames['frmUpload'].OnUploadCompleted(#errorNumber#);
|
||||
</script>
|
||||
</cfoutput>
|
||||
|
||||
</cfif>
|
||||
|
||||
<cfabort>
|
||||
|
||||
</cfcase>
|
||||
|
||||
|
||||
<cfcase value="GetFolders">
|
||||
|
||||
<!--- Sort directories first, name ascending --->
|
||||
<cfdirectory
|
||||
action="list"
|
||||
directory="#currentFolderPath#"
|
||||
name="qDir"
|
||||
sort="type,name">
|
||||
|
||||
<cfscript>
|
||||
i=1;
|
||||
folders = "";
|
||||
while( i lte qDir.recordCount ) {
|
||||
if( not compareNoCase( qDir.type[i], "FILE" ))
|
||||
break;
|
||||
if( not listFind(".,..", qDir.name[i]) )
|
||||
folders = folders & '<Folder name="#qDir.name[i]#" />';
|
||||
i=i+1;
|
||||
}
|
||||
|
||||
xmlContent = xmlContent & '<Folders>' & folders & '</Folders>';
|
||||
</cfscript>
|
||||
|
||||
</cfcase>
|
||||
|
||||
|
||||
<cfcase value="GetFoldersAndFiles">
|
||||
|
||||
<!--- Sort directories first, name ascending --->
|
||||
<cfdirectory
|
||||
action="list"
|
||||
directory="#currentFolderPath#"
|
||||
name="qDir"
|
||||
sort="type,name">
|
||||
|
||||
<cfscript>
|
||||
i=1;
|
||||
folders = "";
|
||||
files = "";
|
||||
while( i lte qDir.recordCount ) {
|
||||
if( not compareNoCase( qDir.type[i], "DIR" ) and not listFind(".,..", qDir.name[i]) ) {
|
||||
folders = folders & '<Folder name="#qDir.name[i]#" />';
|
||||
} else if( not compareNoCase( qDir.type[i], "FILE" ) ) {
|
||||
fileSizeKB = round(qDir.size[i] / 1024);
|
||||
files = files & '<File name="#qDir.name[i]#" size="#IIf( fileSizeKB GT 0, DE( fileSizeKB ), 1)#" />';
|
||||
}
|
||||
i=i+1;
|
||||
}
|
||||
|
||||
xmlContent = xmlContent & '<Folders>' & folders & '</Folders>';
|
||||
xmlContent = xmlContent & '<Files>' & files & '</Files>';
|
||||
</cfscript>
|
||||
|
||||
</cfcase>
|
||||
|
||||
|
||||
<cfcase value="CreateFolder">
|
||||
|
||||
<cfparam name="url.newFolderName" default="">
|
||||
|
||||
<cfscript>
|
||||
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");
|
||||
}
|
||||
</cfscript>
|
||||
|
||||
<cfif not len(newFolderName) or len(newFolderName) gt 255>
|
||||
<cfset errorNumber = 102>
|
||||
<cfelseif directoryExists(currentFolderPath & newFolderName)>
|
||||
<cfset errorNumber = 101>
|
||||
<cfelseif reFind("^\.\.",newFolderName)>
|
||||
<cfset errorNumber = 103>
|
||||
<cfelse>
|
||||
<cfset errorNumber = 0>
|
||||
|
||||
<cftry>
|
||||
<cfdirectory
|
||||
action="create"
|
||||
directory="#currentFolderPath##newFolderName#"
|
||||
mode="755">
|
||||
<cfcatch>
|
||||
<!---
|
||||
un-resolvable error numbers in ColdFusion:
|
||||
* 102 : Invalid folder name.
|
||||
* 103 : You have no permissions to create the folder.
|
||||
--->
|
||||
<cfset errorNumber = 110>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cfif>
|
||||
|
||||
<cfset xmlContent = xmlContent & '<Error number="#errorNumber#" />'>
|
||||
|
||||
</cfcase>
|
||||
|
||||
|
||||
<cfdefaultcase>
|
||||
|
||||
<cfthrow type="fckeditor.connector" message="Illegal command: #url.command#">
|
||||
|
||||
</cfdefaultcase>
|
||||
|
||||
|
||||
</cfswitch>
|
||||
|
||||
</cfif>
|
||||
|
||||
<cfscript>
|
||||
xmlHeader = '<?xml version="1.0" encoding="utf-8" ?><Connector command="#url.command#" resourceType="#url.type#">';
|
||||
xmlHeader = xmlHeader & '<CurrentFolder path="#url.currentFolder#" url="#userFilesPath##url.type##url.currentFolder#" />';
|
||||
xmlFooter = '</Connector>';
|
||||
</cfscript>
|
||||
|
||||
<cfheader name="Expires" value="#GetHttpTimeString(Now())#">
|
||||
<cfheader name="Pragma" value="no-cache">
|
||||
<cfheader name="Cache-Control" value="no-cache, no-store, must-revalidate">
|
||||
<cfcontent reset="true" type="text/xml; charset=UTF-8">
|
||||
<cfoutput>#xmlHeader##xmlContent##xmlFooter#</cfoutput>
|
@ -0,0 +1,61 @@
|
||||
[//lasso
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: config.lasso
|
||||
* Configuration file for the File Manager Connector for Lasso.
|
||||
*
|
||||
* File Authors:
|
||||
* Jason Huck (jason.huck@corefive.com)
|
||||
*/
|
||||
|
||||
/*.....................................................................
|
||||
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' = true,
|
||||
'UserFilesPath' = '/UserFiles/',
|
||||
'Subdirectories' = map(
|
||||
'File' = 'File/',
|
||||
'Image' = 'Image/',
|
||||
'Flash' = 'Flash/',
|
||||
'Media' = 'Media/'
|
||||
),
|
||||
'AllowedExtensions' = map(
|
||||
'File' = array(),
|
||||
'Image' = array('jpg','gif','jpeg','png'),
|
||||
'Flash' = array('swf','fla'),
|
||||
'Media' = array('swf','fla','jpg','gif','jpeg','png','avi','mpg','mpeg')
|
||||
),
|
||||
'DeniedExtensions' = map(
|
||||
'File' = array('php','php2','php3','php4','php5','phtml','pwml','inc','asp','aspx','ascx','jsp','cfm','cfc','pl','bat','exe','com','dll','vbs','js','reg','cgi','lasso','lassoapp','htaccess'),
|
||||
'Image' = array(),
|
||||
'Flash' = array(),
|
||||
'Media' = array()
|
||||
)
|
||||
);
|
||||
]
|
@ -0,0 +1,245 @@
|
||||
[//lasso
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: connector.lasso
|
||||
* This is the File Manager Connector for Lasso.
|
||||
*
|
||||
* File Authors:
|
||||
* Jason Huck (jason.huck@corefive.com)
|
||||
*/
|
||||
|
||||
/*.....................................................................
|
||||
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' = action_param('Command'),
|
||||
'Type' = 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<Folders>\n',
|
||||
'files' = '\t<Files>\n',
|
||||
'errorNumber' = integer,
|
||||
'responseType' = 'xml',
|
||||
'uploadResult' = '0'
|
||||
);
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Calculate the path to the current folder.
|
||||
*/
|
||||
$ServerPath == '' ? $ServerPath = $config->find('UserFilesPath');
|
||||
|
||||
var('currentFolderURL' = $ServerPath
|
||||
+ $config->find('Subdirectories')->find(action_param('Type'))
|
||||
+ action_param('CurrentFolder')
|
||||
);
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Build the appropriate response per the 'Command' parameter. Wrap the
|
||||
entire process in an inline for file tag permissions.
|
||||
*/
|
||||
inline($connection);
|
||||
select($Command);
|
||||
/*.............................................................
|
||||
List all subdirectories in the 'Current Folder' directory.
|
||||
*/
|
||||
case('GetFolders');
|
||||
$commandData += '\t<Folders>\n';
|
||||
|
||||
iterate(file_listdirectory($currentFolderURL), local('this'));
|
||||
#this->endswith('/') ? $commandData += '\t\t<Folder name="' + #this->removetrailing('/')& + '" />\n';
|
||||
/iterate;
|
||||
|
||||
$commandData += '\t</Folders>\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<Folder name="' + #this->removetrailing('/')& + '" />\n';
|
||||
else;
|
||||
local('size') = file_getsize($currentFolderURL + #this) / 1024;
|
||||
$files += '\t\t<File name="' + #this + '" size="' + #size + '" />\n';
|
||||
/if;
|
||||
/iterate;
|
||||
|
||||
$folders += '\t</Folders>\n';
|
||||
$files += '\t</Files>\n';
|
||||
|
||||
$commandData += $folders + $files;
|
||||
|
||||
|
||||
/*.............................................................
|
||||
Create a directory 'NewFolderName' within the 'Current Folder.'
|
||||
*/
|
||||
case('CreateFolder');
|
||||
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 += '<Error number="' + $errorNumber + '" />\n';
|
||||
|
||||
|
||||
/*.............................................................
|
||||
Process an uploaded file.
|
||||
*/
|
||||
case('FileUpload');
|
||||
/*.........................................................
|
||||
This is the only command that returns an HTML response.
|
||||
*/
|
||||
$responseType = 'html';
|
||||
|
||||
|
||||
/*.........................................................
|
||||
Was a file actually uploaded?
|
||||
*/
|
||||
file_uploads->size ? $NewFile = file_uploads->get(1) | $uploadResult = '202';
|
||||
|
||||
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');
|
||||
$OrigFilePath = $currentFolderURL + $NewFileName;
|
||||
$NewFilePath = $OrigFilePath;
|
||||
local('fileExtension') = '.' + $NewFile->find('OrigExtension');
|
||||
local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&;
|
||||
|
||||
|
||||
/*.....................................................
|
||||
Make sure the file extension is allowed.
|
||||
*/
|
||||
if($config->find('DeniedExtensions')->find($Type) >> $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, \'' + $NewFilePath->split('/')->last + '\'';
|
||||
case;
|
||||
$uploadResult = '202';
|
||||
/select;
|
||||
/if;
|
||||
/if;
|
||||
|
||||
|
||||
/*.........................................................
|
||||
Set the HTML response.
|
||||
*/
|
||||
$__html_reply__ = '\
|
||||
<script type="text/javascript">
|
||||
window.parent.frames[\'frmUpload\'].OnUploadCompleted(' + $uploadResult + ');
|
||||
</script>
|
||||
';
|
||||
/select;
|
||||
/inline;
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
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__ = '\
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Connector command="' + $Command + '" resourceType="' + $Type + '">
|
||||
<CurrentFolder path="' + $CurrentFolder + '" url="' + $currentFolderURL + '" />
|
||||
' + $commandData + '
|
||||
</Connector>
|
||||
';
|
||||
/if;
|
||||
]
|
@ -0,0 +1,59 @@
|
||||
#####
|
||||
# FCKeditor - The text editor for internet
|
||||
# Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
#
|
||||
# Licensed under the terms of the GNU Lesser General Public License:
|
||||
# http://www.opensource.org/licenses/lgpl-license.php
|
||||
#
|
||||
# For further information visit:
|
||||
# http://www.fckeditor.net/
|
||||
#
|
||||
# "Support Open Source software. What about a donation today?"
|
||||
#
|
||||
# File Name: basexml.pl
|
||||
# This is the File Manager Connector for Perl.
|
||||
#
|
||||
# File Authors:
|
||||
# Takashi Yamaguchi (jack@omakase.net)
|
||||
#####
|
||||
|
||||
sub CreateXmlHeader
|
||||
{
|
||||
local($command,$resourceType,$currentFolder) = @_;
|
||||
|
||||
# Create the XML document header.
|
||||
print '<?xml version="1.0" encoding="utf-8" ?>';
|
||||
|
||||
# Create the main "Connector" node.
|
||||
print '<Connector command="' . $command . '" resourceType="' . $resourceType . '">';
|
||||
|
||||
# Add the current folder node.
|
||||
print '<CurrentFolder path="' . ConvertToXmlAttribute($currentFolder) . '" url="' . ConvertToXmlAttribute(GetUrlFromPath($resourceType,$currentFolder)) . '" />';
|
||||
}
|
||||
|
||||
sub CreateXmlFooter
|
||||
{
|
||||
print '</Connector>';
|
||||
}
|
||||
|
||||
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 '<?xml version="1.0" encoding="utf-8" ?>' ;
|
||||
|
||||
print '<Connector><Error number="' . $number . '" text="' . &specialchar_cnv( $text ) . '" /></Connector>' ;
|
||||
|
||||
exit ;
|
||||
}
|
||||
|
||||
1;
|
@ -0,0 +1,154 @@
|
||||
#####
|
||||
# FCKeditor - The text editor for internet
|
||||
# Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
#
|
||||
# Licensed under the terms of the GNU Lesser General Public License:
|
||||
# http://www.opensource.org/licenses/lgpl-license.php
|
||||
#
|
||||
# For further information visit:
|
||||
# http://www.fckeditor.net/
|
||||
#
|
||||
# "Support Open Source software. What about a donation today?"
|
||||
#
|
||||
# File Name: commands.pl
|
||||
# This is the File Manager Connector for Perl.
|
||||
#
|
||||
# File Authors:
|
||||
# Takashi Yamaguchi (jack@omakase.net)
|
||||
#####
|
||||
|
||||
sub GetFolders
|
||||
{
|
||||
|
||||
local($resourceType, $currentFolder) = @_;
|
||||
|
||||
# Map the virtual path to the local server path.
|
||||
$sServerDir = &ServerMapFolder($resourceType, $currentFolder);
|
||||
print "<Folders>"; # 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 '<Folder name="' . $cnv_filename . '" />';
|
||||
}
|
||||
}
|
||||
print "</Folders>"; # 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 = '<Folders>';
|
||||
$sFiles = '<Files>';
|
||||
|
||||
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 .= '<Folder name="' . $cnv_filename . '" />' ;
|
||||
} 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 .= '<File name="' . $cnv_filename . '" size="' . $iFileSize . '" />' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
print $sFolders ;
|
||||
print '</Folders>'; # Close the "Folders" node.
|
||||
print $sFiles ;
|
||||
print '</Files>'; # Close the "Files" node.
|
||||
}
|
||||
|
||||
sub CreateFolder
|
||||
{
|
||||
|
||||
local($resourceType, $currentFolder) = @_;
|
||||
$sErrorNumber = '0' ;
|
||||
$sErrorMsg = '' ;
|
||||
|
||||
if($FORM{'NewFolderName'} ne "") {
|
||||
$sNewFolderName = $FORM{'NewFolderName'};
|
||||
# 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 '<Error number="' . $sErrorNumber . '" originalDescription="' . $cnv_errmsg . '" />';
|
||||
}
|
||||
|
||||
sub FileUpload
|
||||
{
|
||||
eval("use File::Copy;");
|
||||
|
||||
local($resourceType, $currentFolder) = @_;
|
||||
|
||||
$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;
|
||||
$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");
|
||||
chmod(0777,$sFilePath);
|
||||
unlink("$img_dir/$new_fname");
|
||||
last;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sErrorNumber = '202' ;
|
||||
}
|
||||
$sFileName =~ s/"/\\"/g;
|
||||
print "Content-type: text/html\n\n";
|
||||
print '<script type="text/javascript">';
|
||||
print 'window.parent.frames["frmUpload"].OnUploadCompleted(' . $sErrorNumber . ',"' . $sFileName . '") ;';
|
||||
print '</script>';
|
||||
exit ;
|
||||
}
|
||||
1;
|
@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
#####
|
||||
# FCKeditor - The text editor for internet
|
||||
# Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
#
|
||||
# Licensed under the terms of the GNU Lesser General Public License:
|
||||
# http://www.opensource.org/licenses/lgpl-license.php
|
||||
#
|
||||
# For further information visit:
|
||||
# http://www.fckeditor.net/
|
||||
#
|
||||
# "Support Open Source software. What about a donation today?"
|
||||
#
|
||||
# File Name: connector.cgi
|
||||
# This is the File Manager Connector for Perl.
|
||||
#
|
||||
# File Authors:
|
||||
# Takashi Yamaguchi (jack@omakase.net)
|
||||
# Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
#####
|
||||
|
||||
##
|
||||
# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file.
|
||||
##
|
||||
|
||||
## 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';
|
||||
|
||||
##
|
||||
# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR.
|
||||
##
|
||||
&SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/browser/default/connectors/perl/connector.cgi" file' ) ;
|
||||
|
||||
&read_input();
|
||||
|
||||
if($FORM{'ServerPath'} ne "") {
|
||||
$GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'};
|
||||
if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) {
|
||||
$GLOBALS{'UserFilesPath'} .= '/' ;
|
||||
}
|
||||
} else {
|
||||
$GLOBALS{'UserFilesPath'} = '/UserFiles/';
|
||||
}
|
||||
|
||||
# Map the "UserFiles" path to a local directory.
|
||||
$rootpath = &GetRootPath();
|
||||
$GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'};
|
||||
|
||||
&DoResponse();
|
||||
|
||||
sub DoResponse
|
||||
{
|
||||
|
||||
if($FORM{'Command'} eq "" || $FORM{'Type'} eq "" || $FORM{'CurrentFolder'} eq "") {
|
||||
return ;
|
||||
}
|
||||
# Get the main request informaiton.
|
||||
$sCommand = $FORM{'Command'};
|
||||
$sResourceType = $FORM{'Type'};
|
||||
$sCurrentFolder = $FORM{'CurrentFolder'};
|
||||
|
||||
# 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, "" ) ;
|
||||
}
|
||||
|
||||
# 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 ;
|
||||
}
|
||||
|
@ -0,0 +1,127 @@
|
||||
#####
|
||||
# FCKeditor - The text editor for internet
|
||||
# Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
#
|
||||
# Licensed under the terms of the GNU Lesser General Public License:
|
||||
# http://www.opensource.org/licenses/lgpl-license.php
|
||||
#
|
||||
# For further information visit:
|
||||
# http://www.fckeditor.net/
|
||||
#
|
||||
# "Support Open Source software. What about a donation today?"
|
||||
#
|
||||
# File Name: io.pl
|
||||
# This is the File Manager Connector for Perl.
|
||||
#
|
||||
# File Authors:
|
||||
# Takashi Yamaguchi (jack@omakase.net)
|
||||
#####
|
||||
|
||||
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)) {
|
||||
umask(000);
|
||||
mkdir("$folderPath",0777);
|
||||
chmod(0777,"$folderPath");
|
||||
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;
|
@ -0,0 +1,663 @@
|
||||
#####
|
||||
# FCKeditor - The text editor for internet
|
||||
# Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
#
|
||||
# Licensed under the terms of the GNU Lesser General Public License:
|
||||
# http://www.opensource.org/licenses/lgpl-license.php
|
||||
#
|
||||
# For further information visit:
|
||||
# http://www.fckeditor.net/
|
||||
#
|
||||
# "Support Open Source software. What about a donation today?"
|
||||
#
|
||||
# File Name: upload_fck.pl
|
||||
# This is the File Manager Connector for Perl.
|
||||
#
|
||||
# File Authors:
|
||||
# Takashi Yamaguchi (jack@omakase.net)
|
||||
#####
|
||||
|
||||
# image data save dir
|
||||
$img_dir = './temp/';
|
||||
|
||||
|
||||
# File size max(unit KB)
|
||||
$MAX_CONTENT_SIZE = 30000;
|
||||
|
||||
# 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) = @_;
|
||||
|
||||
|
||||
mkdir($img_dir,0777);
|
||||
chmod(0777,$img_dir);
|
||||
|
||||
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 <strong>%d KB</strong> Now Size <strong>%d KB</strong>(<strong>%d bytes</strong> 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 = <STDIN>;
|
||||
$Boundary =~ s/\x0D\x0A//;
|
||||
$Boundary = quotemeta($Boundary);
|
||||
while(<STDIN>) {
|
||||
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(<STDIN>) {
|
||||
last if(! /\w/);
|
||||
if(/^\s*Content-Type:\s*"([^"]+)"/i || /^\s*Content-Type:\s*([^\s:;]+)/i) {
|
||||
$ContentType = $1;
|
||||
}
|
||||
}
|
||||
# body read
|
||||
$value = "";
|
||||
while(<STDIN>) {
|
||||
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;
|
||||
$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)<BR>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<<EOF;
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Error Message</TITLE></HEAD>
|
||||
<BODY>
|
||||
<table border="1" cellspacing="10" cellpadding="10">
|
||||
<TR bgcolor="#0000B0">
|
||||
<TD bgcolor="#0000B0" NOWRAP><font size="-1" color="white"><B>Error Message</B></font></TD>
|
||||
</TR>
|
||||
</table>
|
||||
<UL>
|
||||
<H4> $error_message </H4>
|
||||
$error_message2 <BR>
|
||||
</UL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
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;
|
@ -0,0 +1,56 @@
|
||||
#####
|
||||
# FCKeditor - The text editor for internet
|
||||
# Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
#
|
||||
# Licensed under the terms of the GNU Lesser General Public License:
|
||||
# http://www.opensource.org/licenses/lgpl-license.php
|
||||
#
|
||||
# For further information visit:
|
||||
# http://www.fckeditor.net/
|
||||
#
|
||||
# "Support Open Source software. What about a donation today?"
|
||||
#
|
||||
# File Name: util.pl
|
||||
# This is the File Manager Connector for Perl.
|
||||
#
|
||||
# File Authors:
|
||||
# Takashi Yamaguchi (jack@omakase.net)
|
||||
#####
|
||||
|
||||
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 $value;
|
||||
# return utf8_encode(htmlspecialchars($value));
|
||||
|
||||
}
|
||||
|
||||
sub specialchar_cnv
|
||||
{
|
||||
local($ch) = @_;
|
||||
|
||||
$ch =~ s/&/&/g; # &
|
||||
$ch =~ s/\"/"/g; #"
|
||||
$ch =~ s/\'/'/g; # '
|
||||
$ch =~ s/</</g; # <
|
||||
$ch =~ s/>/>/g; # >
|
||||
return($ch);
|
||||
}
|
||||
|
||||
1;
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: basexml.php
|
||||
* These functions define the base of the XML response sent by the PHP
|
||||
* connector.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
function SetXmlHeaders()
|
||||
{
|
||||
ob_end_clean() ;
|
||||
|
||||
// Prevent the browser from caching the result.
|
||||
// Date in the past
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
|
||||
// always modified
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
|
||||
// HTTP/1.1
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate') ;
|
||||
header('Cache-Control: post-check=0, pre-check=0', false) ;
|
||||
// HTTP/1.0
|
||||
header('Pragma: no-cache') ;
|
||||
|
||||
// Set the response format.
|
||||
header( 'Content-Type:text/xml; charset=utf-8' ) ;
|
||||
}
|
||||
|
||||
function CreateXmlHeader( $command, $resourceType, $currentFolder )
|
||||
{
|
||||
SetXmlHeaders() ;
|
||||
|
||||
// Create the XML document header.
|
||||
echo '<?xml version="1.0" encoding="utf-8" ?>' ;
|
||||
|
||||
// Create the main "Connector" node.
|
||||
echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
|
||||
|
||||
// Add the current folder node.
|
||||
echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder ) ) . '" />' ;
|
||||
}
|
||||
|
||||
function CreateXmlFooter()
|
||||
{
|
||||
echo '</Connector>' ;
|
||||
}
|
||||
|
||||
function SendError( $number, $text )
|
||||
{
|
||||
SetXmlHeaders() ;
|
||||
|
||||
// Create the XML document header
|
||||
echo '<?xml version="1.0" encoding="utf-8" ?>' ;
|
||||
|
||||
echo '<Connector><Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" /></Connector>' ;
|
||||
|
||||
exit ;
|
||||
}
|
||||
?>
|
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: commands.php
|
||||
* This is the File Manager Connector for PHP.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
function GetFolders( $resourceType, $currentFolder )
|
||||
{
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
|
||||
|
||||
// Array that will hold the folders names.
|
||||
$aFolders = array() ;
|
||||
|
||||
$oCurrentFolder = opendir( $sServerDir ) ;
|
||||
|
||||
while ( $sFile = readdir( $oCurrentFolder ) )
|
||||
{
|
||||
if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
|
||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
|
||||
}
|
||||
|
||||
closedir( $oCurrentFolder ) ;
|
||||
|
||||
// Open the "Folders" node.
|
||||
echo "<Folders>" ;
|
||||
|
||||
natcasesort( $aFolders ) ;
|
||||
foreach ( $aFolders as $sFolder )
|
||||
echo $sFolder ;
|
||||
|
||||
// Close the "Folders" node.
|
||||
echo "</Folders>" ;
|
||||
}
|
||||
|
||||
function GetFoldersAndFiles( $resourceType, $currentFolder )
|
||||
{
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
|
||||
|
||||
// Arrays that will hold the folders and files names.
|
||||
$aFolders = array() ;
|
||||
$aFiles = array() ;
|
||||
|
||||
$oCurrentFolder = opendir( $sServerDir ) ;
|
||||
|
||||
while ( $sFile = readdir( $oCurrentFolder ) )
|
||||
{
|
||||
if ( $sFile != '.' && $sFile != '..' )
|
||||
{
|
||||
if ( is_dir( $sServerDir . $sFile ) )
|
||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
|
||||
else
|
||||
{
|
||||
$iFileSize = filesize( $sServerDir . $sFile ) ;
|
||||
if ( $iFileSize > 0 )
|
||||
{
|
||||
$iFileSize = round( $iFileSize / 1024 ) ;
|
||||
if ( $iFileSize < 1 ) $iFileSize = 1 ;
|
||||
}
|
||||
|
||||
$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send the folders
|
||||
natcasesort( $aFolders ) ;
|
||||
echo '<Folders>' ;
|
||||
|
||||
foreach ( $aFolders as $sFolder )
|
||||
echo $sFolder ;
|
||||
|
||||
echo '</Folders>' ;
|
||||
|
||||
// Send the files
|
||||
natcasesort( $aFiles ) ;
|
||||
echo '<Files>' ;
|
||||
|
||||
foreach ( $aFiles as $sFiles )
|
||||
echo $sFiles ;
|
||||
|
||||
echo '</Files>' ;
|
||||
}
|
||||
|
||||
function CreateFolder( $resourceType, $currentFolder )
|
||||
{
|
||||
$sErrorNumber = '0' ;
|
||||
$sErrorMsg = '' ;
|
||||
|
||||
if ( isset( $_GET['NewFolderName'] ) )
|
||||
{
|
||||
$sNewFolderName = $_GET['NewFolderName'] ;
|
||||
|
||||
if ( strpos( $sNewFolderName, '..' ) !== FALSE )
|
||||
$sErrorNumber = '102' ; // Invalid folder name.
|
||||
else
|
||||
{
|
||||
// Map the virtual path to the local server path of the current folder.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
|
||||
|
||||
if ( is_writable( $sServerDir ) )
|
||||
{
|
||||
$sServerDir .= $sNewFolderName ;
|
||||
|
||||
$sErrorMsg = CreateServerFolder( $sServerDir ) ;
|
||||
|
||||
switch ( $sErrorMsg )
|
||||
{
|
||||
case '' :
|
||||
$sErrorNumber = '0' ;
|
||||
break ;
|
||||
case 'Invalid argument' :
|
||||
case 'No such file or directory' :
|
||||
$sErrorNumber = '102' ; // Path too long.
|
||||
break ;
|
||||
default :
|
||||
$sErrorNumber = '110' ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else
|
||||
$sErrorNumber = '103' ;
|
||||
}
|
||||
}
|
||||
else
|
||||
$sErrorNumber = '102' ;
|
||||
|
||||
// Create the "Error" node.
|
||||
echo '<Error number="' . $sErrorNumber . '" originalDescription="' . ConvertToXmlAttribute( $sErrorMsg ) . '" />' ;
|
||||
}
|
||||
|
||||
function FileUpload( $resourceType, $currentFolder )
|
||||
{
|
||||
$sErrorNumber = '0' ;
|
||||
$sFileName = '' ;
|
||||
|
||||
if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) )
|
||||
{
|
||||
global $Config ;
|
||||
|
||||
$oFile = $_FILES['NewFile'] ;
|
||||
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
|
||||
|
||||
// Get the uploaded file name.
|
||||
$sFileName = $oFile['name'] ;
|
||||
|
||||
// Replace dots in the name with underscores (only one dot can be there... security issue).
|
||||
if ( $Config['ForceSingleExtension'] )
|
||||
$sFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sFileName ) ;
|
||||
|
||||
$sOriginalFileName = $sFileName ;
|
||||
|
||||
// Get the extension.
|
||||
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
|
||||
$sExtension = strtolower( $sExtension ) ;
|
||||
|
||||
$arAllowed = $Config['AllowedExtensions'][$resourceType] ;
|
||||
$arDenied = $Config['DeniedExtensions'][$resourceType] ;
|
||||
|
||||
if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) )
|
||||
{
|
||||
$iCounter = 0 ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
$sFilePath = $sServerDir . $sFileName ;
|
||||
|
||||
if ( is_file( $sFilePath ) )
|
||||
{
|
||||
$iCounter++ ;
|
||||
$sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
|
||||
$sErrorNumber = '201' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
|
||||
|
||||
if ( is_file( $sFilePath ) )
|
||||
{
|
||||
$oldumask = umask(0) ;
|
||||
chmod( $sFilePath, 0777 ) ;
|
||||
umask( $oldumask ) ;
|
||||
}
|
||||
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
$sErrorNumber = '202' ;
|
||||
}
|
||||
else
|
||||
$sErrorNumber = '202' ;
|
||||
|
||||
echo '<script type="text/javascript">' ;
|
||||
echo 'window.parent.frames["frmUpload"].OnUploadCompleted(' . $sErrorNumber . ',"' . str_replace( '"', '\\"', $sFileName ) . '") ;' ;
|
||||
echo '</script>' ;
|
||||
|
||||
exit ;
|
||||
}
|
||||
?>
|
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: config.php
|
||||
* Configuration file for the File Manager Connector for PHP.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
global $Config ;
|
||||
|
||||
// SECURITY: You must explicitelly enable this "connector". (Set it to "true").
|
||||
$Config['Enabled'] = false ;
|
||||
|
||||
// Path to user files relative to the document root.
|
||||
$Config['UserFilesPath'] = '/UserFiles/' ;
|
||||
|
||||
// Fill the following value it you prefer to specify the absolute path for the
|
||||
// user files directory. Usefull 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.
|
||||
$Config['UserFilesAbsolutePath'] = '' ;
|
||||
|
||||
// Due to security issues with Apache modules, it is reccomended to leave the
|
||||
// following setting enabled.
|
||||
$Config['ForceSingleExtension'] = true ;
|
||||
|
||||
$Config['AllowedExtensions']['File'] = array() ;
|
||||
$Config['DeniedExtensions']['File'] = array('php','php2','php3','php4','php5','phtml','pwml','inc','asp','aspx','ascx','jsp','cfm','cfc','pl','bat','exe','com','dll','vbs','js','reg','cgi','htaccess') ;
|
||||
|
||||
$Config['AllowedExtensions']['Image'] = array('jpg','gif','jpeg','png') ;
|
||||
$Config['DeniedExtensions']['Image'] = array() ;
|
||||
|
||||
$Config['AllowedExtensions']['Flash'] = array('swf','fla') ;
|
||||
$Config['DeniedExtensions']['Flash'] = array() ;
|
||||
|
||||
$Config['AllowedExtensions']['Media'] = array('swf','fla','jpg','gif','jpeg','png','avi','mpg','mpeg') ;
|
||||
$Config['DeniedExtensions']['Media'] = array() ;
|
||||
|
||||
?>
|
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: connector.php
|
||||
* This is the File Manager Connector for PHP.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
ob_start() ;
|
||||
|
||||
include('config.php') ;
|
||||
include('util.php') ;
|
||||
include('io.php') ;
|
||||
include('basexml.php') ;
|
||||
include('commands.php') ;
|
||||
|
||||
if ( !$Config['Enabled'] )
|
||||
SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/browser/default/connectors/php/config.php" file' ) ;
|
||||
|
||||
// Get the "UserFiles" path.
|
||||
$GLOBALS["UserFilesPath"] = '' ;
|
||||
|
||||
if ( isset( $Config['UserFilesPath'] ) )
|
||||
$GLOBALS["UserFilesPath"] = $Config['UserFilesPath'] ;
|
||||
else if ( isset( $_GET['ServerPath'] ) )
|
||||
$GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ;
|
||||
else
|
||||
$GLOBALS["UserFilesPath"] = '/UserFiles/' ;
|
||||
|
||||
if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) )
|
||||
$GLOBALS["UserFilesPath"] .= '/' ;
|
||||
|
||||
if ( strlen( $Config['UserFilesAbsolutePath'] ) > 0 )
|
||||
{
|
||||
$GLOBALS["UserFilesDirectory"] = $Config['UserFilesAbsolutePath'] ;
|
||||
|
||||
if ( ! ereg( '/$', $GLOBALS["UserFilesDirectory"] ) )
|
||||
$GLOBALS["UserFilesDirectory"] .= '/' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Map the "UserFiles" path to a local directory.
|
||||
$GLOBALS["UserFilesDirectory"] = GetRootPath() . $GLOBALS["UserFilesPath"] ;
|
||||
}
|
||||
|
||||
DoResponse() ;
|
||||
|
||||
function DoResponse()
|
||||
{
|
||||
if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
|
||||
return ;
|
||||
|
||||
// Get the main request informaiton.
|
||||
$sCommand = $_GET['Command'] ;
|
||||
$sResourceType = $_GET['Type'] ;
|
||||
$sCurrentFolder = $_GET['CurrentFolder'] ;
|
||||
|
||||
// Check if it is an allowed type.
|
||||
if ( !in_array( $sResourceType, array('File','Image','Flash','Media') ) )
|
||||
return ;
|
||||
|
||||
// Check the current folder syntax (must begin and start with a slash).
|
||||
if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
|
||||
if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ;
|
||||
|
||||
// Check for invalid folder paths (..)
|
||||
if ( strpos( $sCurrentFolder, '..' ) )
|
||||
SendError( 102, "" ) ;
|
||||
|
||||
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
|
||||
if ( $sCommand == 'FileUpload' )
|
||||
{
|
||||
FileUpload( $sResourceType, $sCurrentFolder ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
|
||||
|
||||
// Execute the required command.
|
||||
switch ( $sCommand )
|
||||
{
|
||||
case 'GetFolders' :
|
||||
GetFolders( $sResourceType, $sCurrentFolder ) ;
|
||||
break ;
|
||||
case 'GetFoldersAndFiles' :
|
||||
GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
|
||||
break ;
|
||||
case 'CreateFolder' :
|
||||
CreateFolder( $sResourceType, $sCurrentFolder ) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
CreateXmlFooter() ;
|
||||
|
||||
exit ;
|
||||
}
|
||||
?>
|
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: io.php
|
||||
* This is the File Manager Connector for ASP.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
function GetUrlFromPath( $resourceType, $folderPath )
|
||||
{
|
||||
if ( $resourceType == '' )
|
||||
return RemoveFromEnd( $GLOBALS["UserFilesPath"], '/' ) . $folderPath ;
|
||||
else
|
||||
return $GLOBALS["UserFilesPath"] . $resourceType . $folderPath ;
|
||||
}
|
||||
|
||||
function RemoveExtension( $fileName )
|
||||
{
|
||||
return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ;
|
||||
}
|
||||
|
||||
function ServerMapFolder( $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.
|
||||
return $sResourceTypePath . RemoveFromStart( $folderPath, '/' ) ;
|
||||
}
|
||||
|
||||
function GetParentFolder( $folderPath )
|
||||
{
|
||||
$sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ;
|
||||
return preg_replace( $sPattern, '', $folderPath ) ;
|
||||
}
|
||||
|
||||
function CreateServerFolder( $folderPath )
|
||||
{
|
||||
$sParent = GetParentFolder( $folderPath ) ;
|
||||
|
||||
// Check if the parent exists, or create it.
|
||||
if ( !file_exists( $sParent ) )
|
||||
{
|
||||
$sErrorMsg = CreateServerFolder( $sParent ) ;
|
||||
if ( $sErrorMsg != '' )
|
||||
return $sErrorMsg ;
|
||||
}
|
||||
|
||||
if ( !file_exists( $folderPath ) )
|
||||
{
|
||||
// Turn off all error reporting.
|
||||
error_reporting( 0 ) ;
|
||||
// Enable error tracking to catch the error.
|
||||
ini_set( 'track_errors', '1' ) ;
|
||||
|
||||
// To create the folder with 0777 permissions, we need to set umask to zero.
|
||||
$oldumask = umask(0) ;
|
||||
mkdir( $folderPath, 0777 ) ;
|
||||
umask( $oldumask ) ;
|
||||
|
||||
$sErrorMsg = $php_errormsg ;
|
||||
|
||||
// Restore the configurations.
|
||||
ini_restore( 'track_errors' ) ;
|
||||
ini_restore( 'error_reporting' ) ;
|
||||
|
||||
return $sErrorMsg ;
|
||||
}
|
||||
else
|
||||
return '' ;
|
||||
}
|
||||
|
||||
function GetRootPath()
|
||||
{
|
||||
$sRealPath = realpath( './' ) ;
|
||||
|
||||
$sSelfPath = $_SERVER['PHP_SELF'] ;
|
||||
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ;
|
||||
|
||||
return substr( $sRealPath, 0, strlen( $sRealPath ) - strlen( $sSelfPath ) ) ;
|
||||
}
|
||||
?>
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: util.php
|
||||
* This is the File Manager Connector for ASP.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
function RemoveFromStart( $sourceString, $charToRemove )
|
||||
{
|
||||
$sPattern = '|^' . $charToRemove . '+|' ;
|
||||
return preg_replace( $sPattern, '', $sourceString ) ;
|
||||
}
|
||||
|
||||
function RemoveFromEnd( $sourceString, $charToRemove )
|
||||
{
|
||||
$sPattern = '|' . $charToRemove . '+$|' ;
|
||||
return preg_replace( $sPattern, '', $sourceString ) ;
|
||||
}
|
||||
|
||||
function ConvertToXmlAttribute( $value )
|
||||
{
|
||||
return utf8_encode( htmlspecialchars( $value ) ) ;
|
||||
}
|
||||
?>
|
@ -0,0 +1,781 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
FCKeditor - The text editor for internet
|
||||
Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
|
||||
Licensed under the terms of the GNU Lesser General Public License:
|
||||
http://www.opensource.org/licenses/lgpl-license.php
|
||||
|
||||
For further information visit:
|
||||
http://www.fckeditor.net/
|
||||
|
||||
"Support Open Source software. What about a donation today?"
|
||||
|
||||
File Name: connector.py
|
||||
Connector for Python.
|
||||
|
||||
Tested With:
|
||||
Standard:
|
||||
Python 2.3.3
|
||||
Zope:
|
||||
Zope Version: (Zope 2.8.1-final, python 2.3.5, linux2)
|
||||
Python Version: 2.3.5 (#4, Mar 10 2005, 01:40:25)
|
||||
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)]
|
||||
System Platform: linux2
|
||||
|
||||
File Authors:
|
||||
Andrew Liu (andrew@liuholdings.com)
|
||||
"""
|
||||
|
||||
"""
|
||||
Author Notes (04 December 2005):
|
||||
This module has gone through quite a few phases of change. Obviously,
|
||||
I am only supporting that part of the code that I use. Initially
|
||||
I had the upload directory as a part of zope (ie. uploading files
|
||||
directly into Zope), before realising that there were too many
|
||||
complex intricacies within Zope to deal with. Zope is one ugly piece
|
||||
of code. So I decided to complement Zope by an Apache server (which
|
||||
I had running anyway, and doing nothing). So I mapped all uploads
|
||||
from an arbitrary server directory to an arbitrary web directory.
|
||||
All the FCKeditor uploading occurred this way, and I didn't have to
|
||||
stuff around with fiddling with Zope objects and the like (which are
|
||||
terribly complex and something you don't want to do - trust me).
|
||||
|
||||
Maybe a Zope expert can touch up the Zope components. In the end,
|
||||
I had FCKeditor loaded in Zope (probably a bad idea as well), and
|
||||
I replaced the connector.py with an alias to a server module.
|
||||
Right now, all Zope components will simple remain as is because
|
||||
I've had enough of Zope.
|
||||
|
||||
See notes right at the end of this file for how I aliased out of Zope.
|
||||
|
||||
Anyway, most of you probably wont use Zope, so things are pretty
|
||||
simple in that regard.
|
||||
|
||||
Typically, SERVER_DIR is the root of WEB_DIR (not necessarily).
|
||||
Most definitely, SERVER_USERFILES_DIR points to WEB_USERFILES_DIR.
|
||||
"""
|
||||
|
||||
import cgi
|
||||
import re
|
||||
import os
|
||||
import string
|
||||
|
||||
"""
|
||||
escape
|
||||
|
||||
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.
|
||||
"""
|
||||
def escape(text, replace=string.replace):
|
||||
text = replace(text, '&', '&') # must be done 1st
|
||||
text = replace(text, '<', '<')
|
||||
text = replace(text, '>', '>')
|
||||
text = replace(text, '"', '"')
|
||||
return text
|
||||
|
||||
"""
|
||||
getFCKeditorConnector
|
||||
|
||||
Creates a new instance of an FCKeditorConnector, and runs it
|
||||
"""
|
||||
def getFCKeditorConnector(context=None):
|
||||
# Called from Zope. Passes the context through
|
||||
connector = FCKeditorConnector(context=context)
|
||||
return connector.run()
|
||||
|
||||
|
||||
"""
|
||||
FCKeditorRequest
|
||||
|
||||
A wrapper around the request object
|
||||
Can handle normal CGI request, or a Zope request
|
||||
Extend as required
|
||||
"""
|
||||
class FCKeditorRequest(object):
|
||||
def __init__(self, context=None):
|
||||
if (context is not None):
|
||||
r = context.REQUEST
|
||||
else:
|
||||
r = cgi.FieldStorage()
|
||||
self.context = context
|
||||
self.request = r
|
||||
|
||||
def isZope(self):
|
||||
if (self.context is not None):
|
||||
return True
|
||||
return False
|
||||
|
||||
def has_key(self, key):
|
||||
return self.request.has_key(key)
|
||||
|
||||
def get(self, key, default=None):
|
||||
value = None
|
||||
if (self.isZope()):
|
||||
value = self.request.get(key, default)
|
||||
else:
|
||||
if key in self.request.keys():
|
||||
value = self.request[key].value
|
||||
else:
|
||||
value = default
|
||||
return value
|
||||
|
||||
"""
|
||||
FCKeditorConnector
|
||||
|
||||
The connector class
|
||||
"""
|
||||
class FCKeditorConnector(object):
|
||||
# Configuration for FCKEditor
|
||||
# can point to another server here, if linked correctly
|
||||
#WEB_HOST = "http://127.0.0.1/"
|
||||
WEB_HOST = ""
|
||||
SERVER_DIR = "/var/www/html/"
|
||||
|
||||
WEB_USERFILES_FOLDER = WEB_HOST + "upload/"
|
||||
SERVER_USERFILES_FOLDER = SERVER_DIR + "upload/"
|
||||
|
||||
# Allow access (Zope)
|
||||
__allow_access_to_unprotected_subobjects__ = 1
|
||||
# Class Attributes
|
||||
parentFolderRe = re.compile("[\/][^\/]+[\/]?$")
|
||||
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
def __init__(self, context=None):
|
||||
# The given root path will NOT be shown to the user
|
||||
# Only the userFilesPath will be shown
|
||||
|
||||
# Instance Attributes
|
||||
self.context = context
|
||||
self.request = FCKeditorRequest(context=context)
|
||||
self.rootPath = self.SERVER_DIR
|
||||
self.userFilesFolder = self.SERVER_USERFILES_FOLDER
|
||||
self.webUserFilesFolder = self.WEB_USERFILES_FOLDER
|
||||
|
||||
# Enables / Disables the connector
|
||||
self.enabled = False # Set to True to enable this connector
|
||||
|
||||
# These are instance variables
|
||||
self.zopeRootContext = None
|
||||
self.zopeUploadContext = None
|
||||
|
||||
# Copied from php module =)
|
||||
self.allowedExtensions = {
|
||||
"File": None,
|
||||
"Image": None,
|
||||
"Flash": None,
|
||||
"Media": None
|
||||
}
|
||||
self.deniedExtensions = {
|
||||
"File": [ "php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess" ],
|
||||
"Image": [ "php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess" ],
|
||||
"Flash": [ "php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess" ],
|
||||
"Media": [ "php","php2","php3","php4","php5","phtml","pwml","inc","asp","aspx","ascx","jsp","cfm","cfc","pl","bat","exe","com","dll","vbs","js","reg","cgi","htaccess" ]
|
||||
}
|
||||
|
||||
"""
|
||||
Zope specific functions
|
||||
"""
|
||||
def isZope(self):
|
||||
# The context object is the zope object
|
||||
if (self.context is not None):
|
||||
return True
|
||||
return False
|
||||
|
||||
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
|
||||
|
||||
"""
|
||||
Generic manipulation functions
|
||||
"""
|
||||
def getUserFilesFolder(self):
|
||||
return self.userFilesFolder
|
||||
|
||||
def getWebUserFilesFolder(self):
|
||||
return self.webUserFilesFolder
|
||||
|
||||
def getAllowedExtensions(self, resourceType):
|
||||
return self.allowedExtensions[resourceType]
|
||||
|
||||
def getDeniedExtensions(self, resourceType):
|
||||
return self.deniedExtensions[resourceType]
|
||||
|
||||
def removeFromStart(self, string, char):
|
||||
return string.lstrip(char)
|
||||
|
||||
def removeFromEnd(self, string, char):
|
||||
return string.rstrip(char)
|
||||
|
||||
def convertToXmlAttribute(self, value):
|
||||
if (value is None):
|
||||
value = ""
|
||||
return escape(value)
|
||||
|
||||
def convertToPath(self, path):
|
||||
if (path[-1] <> "/"):
|
||||
return path + "/"
|
||||
else:
|
||||
return path
|
||||
|
||||
def getUrlFromPath(self, resourceType, path):
|
||||
if (resourceType is None) or (resourceType == ''):
|
||||
url = "%s%s" % (
|
||||
self.removeFromEnd(self.getUserFilesFolder(), '/'),
|
||||
path
|
||||
)
|
||||
else:
|
||||
url = "%s%s%s" % (
|
||||
self.getUserFilesFolder(),
|
||||
resourceType,
|
||||
path
|
||||
)
|
||||
return url
|
||||
|
||||
def getWebUrlFromPath(self, resourceType, path):
|
||||
if (resourceType is None) or (resourceType == ''):
|
||||
url = "%s%s" % (
|
||||
self.removeFromEnd(self.getWebUserFilesFolder(), '/'),
|
||||
path
|
||||
)
|
||||
else:
|
||||
url = "%s%s%s" % (
|
||||
self.getWebUserFilesFolder(),
|
||||
resourceType,
|
||||
path
|
||||
)
|
||||
return url
|
||||
|
||||
def removeExtension(self, fileName):
|
||||
index = fileName.rindex(".")
|
||||
newFileName = fileName[0:index]
|
||||
return newFileName
|
||||
|
||||
def getExtension(self, fileName):
|
||||
index = fileName.rindex(".") + 1
|
||||
fileExtension = fileName[index:]
|
||||
return fileExtension
|
||||
|
||||
def getParentFolder(self, folderPath):
|
||||
parentFolderPath = self.parentFolderRe.sub('', folderPath)
|
||||
return parentFolderPath
|
||||
|
||||
"""
|
||||
serverMapFolder
|
||||
|
||||
Purpose: works out the folder map on the server
|
||||
"""
|
||||
def serverMapFolder(self, resourceType, folderPath):
|
||||
# Get the resource type directory
|
||||
resourceTypeFolder = "%s%s/" % (
|
||||
self.getUserFilesFolder(),
|
||||
resourceType
|
||||
)
|
||||
# Ensure that the directory exists
|
||||
self.createServerFolder(resourceTypeFolder)
|
||||
|
||||
# Return the resource type directory combined with the
|
||||
# required path
|
||||
return "%s%s" % (
|
||||
resourceTypeFolder,
|
||||
self.removeFromStart(folderPath, '/')
|
||||
)
|
||||
|
||||
"""
|
||||
createServerFolder
|
||||
|
||||
Purpose: physically creates a folder on the server
|
||||
"""
|
||||
def createServerFolder(self, folderPath):
|
||||
# Check if the parent exists
|
||||
parentFolderPath = self.getParentFolder(folderPath)
|
||||
if not(os.path.exists(parentFolderPath)):
|
||||
errorMsg = self.createServerFolder(parentFolderPath)
|
||||
if errorMsg is not None:
|
||||
return errorMsg
|
||||
# Check if this exists
|
||||
if not(os.path.exists(folderPath)):
|
||||
os.mkdir(folderPath)
|
||||
os.chmod(folderPath, 0755)
|
||||
errorMsg = None
|
||||
else:
|
||||
if os.path.isdir(folderPath):
|
||||
errorMsg = None
|
||||
else:
|
||||
raise "createServerFolder: Non-folder of same name already exists"
|
||||
return errorMsg
|
||||
|
||||
|
||||
"""
|
||||
getRootPath
|
||||
|
||||
Purpose: returns the root path on the server
|
||||
"""
|
||||
def getRootPath(self):
|
||||
return self.rootPath
|
||||
|
||||
"""
|
||||
setXmlHeaders
|
||||
|
||||
Purpose: to prepare the headers for the xml to return
|
||||
"""
|
||||
def setXmlHeaders(self):
|
||||
#now = self.context.BS_get_now()
|
||||
#yesterday = now - 1
|
||||
self.setHeader("Content-Type", "text/xml")
|
||||
#self.setHeader("Expires", yesterday)
|
||||
#self.setHeader("Last-Modified", now)
|
||||
#self.setHeader("Cache-Control", "no-store, no-cache, must-revalidate")
|
||||
self.printHeaders()
|
||||
return
|
||||
|
||||
def setHeader(self, key, value):
|
||||
if (self.isZope()):
|
||||
self.context.REQUEST.RESPONSE.setHeader(key, value)
|
||||
else:
|
||||
print "%s: %s" % (key, value)
|
||||
return
|
||||
|
||||
def printHeaders(self):
|
||||
# For non-Zope requests, we need to print an empty line
|
||||
# to denote the end of headers
|
||||
if (not(self.isZope())):
|
||||
print ""
|
||||
|
||||
"""
|
||||
createXmlFooter
|
||||
|
||||
Purpose: returns the xml header
|
||||
"""
|
||||
def createXmlHeader(self, command, resourceType, currentFolder):
|
||||
self.setXmlHeaders()
|
||||
s = ""
|
||||
# Create the XML document header
|
||||
s += """<?xml version="1.0" encoding="utf-8" ?>"""
|
||||
# Create the main connector node
|
||||
s += """<Connector command="%s" resourceType="%s">""" % (
|
||||
command,
|
||||
resourceType
|
||||
)
|
||||
# Add the current folder node
|
||||
s += """<CurrentFolder path="%s" url="%s" />""" % (
|
||||
self.convertToXmlAttribute(currentFolder),
|
||||
self.convertToXmlAttribute(
|
||||
self.getWebUrlFromPath(
|
||||
resourceType,
|
||||
currentFolder
|
||||
)
|
||||
),
|
||||
)
|
||||
return s
|
||||
|
||||
"""
|
||||
createXmlFooter
|
||||
|
||||
Purpose: returns the xml footer
|
||||
"""
|
||||
def createXmlFooter(self):
|
||||
s = """</Connector>"""
|
||||
return s
|
||||
|
||||
"""
|
||||
sendError
|
||||
|
||||
Purpose: in the event of an error, return an xml based error
|
||||
"""
|
||||
def sendError(self, number, text):
|
||||
self.setXmlHeaders()
|
||||
s = ""
|
||||
# Create the XML document header
|
||||
s += """<?xml version="1.0" encoding="utf-8" ?>"""
|
||||
s += """<Connector>"""
|
||||
s += """<Error number="%s" text="%s" />""" % (number, text)
|
||||
s += """</Connector>"""
|
||||
return s
|
||||
|
||||
"""
|
||||
getFolders
|
||||
|
||||
Purpose: command to recieve a list of folders
|
||||
"""
|
||||
def getFolders(self, resourceType, currentFolder):
|
||||
if (self.isZope()):
|
||||
return self.getZopeFolders(resourceType, currentFolder)
|
||||
else:
|
||||
return self.getNonZopeFolders(resourceType, currentFolder)
|
||||
|
||||
def getZopeFolders(self, resourceType, currentFolder):
|
||||
# Open the folders node
|
||||
s = ""
|
||||
s += """<Folders>"""
|
||||
zopeFolder = self.findZopeFolder(resourceType, currentFolder)
|
||||
for (name, o) in zopeFolder.objectItems(["Folder"]):
|
||||
s += """<Folder name="%s" />""" % (
|
||||
self.convertToXmlAttribute(name)
|
||||
)
|
||||
# Close the folders node
|
||||
s += """</Folders>"""
|
||||
return s
|
||||
|
||||
def getNonZopeFolders(self, resourceType, currentFolder):
|
||||
# Map the virtual path to our local server
|
||||
serverPath = self.serverMapFolder(resourceType, currentFolder)
|
||||
# Open the folders node
|
||||
s = ""
|
||||
s += """<Folders>"""
|
||||
for someObject in os.listdir(serverPath):
|
||||
someObjectPath = os.path.join(serverPath, someObject)
|
||||
if os.path.isdir(someObjectPath):
|
||||
s += """<Folder name="%s" />""" % (
|
||||
self.convertToXmlAttribute(someObject)
|
||||
)
|
||||
# Close the folders node
|
||||
s += """</Folders>"""
|
||||
return s
|
||||
|
||||
"""
|
||||
getFoldersAndFiles
|
||||
|
||||
Purpose: command to recieve a list of folders and files
|
||||
"""
|
||||
def getFoldersAndFiles(self, resourceType, currentFolder):
|
||||
if (self.isZope()):
|
||||
return self.getZopeFoldersAndFiles(resourceType, currentFolder)
|
||||
else:
|
||||
return self.getNonZopeFoldersAndFiles(resourceType, currentFolder)
|
||||
|
||||
def getNonZopeFoldersAndFiles(self, resourceType, currentFolder):
|
||||
# Map the virtual path to our local server
|
||||
serverPath = self.serverMapFolder(resourceType, currentFolder)
|
||||
# Open the folders / files node
|
||||
folders = """<Folders>"""
|
||||
files = """<Files>"""
|
||||
for someObject in os.listdir(serverPath):
|
||||
someObjectPath = os.path.join(serverPath, someObject)
|
||||
if os.path.isdir(someObjectPath):
|
||||
folders += """<Folder name="%s" />""" % (
|
||||
self.convertToXmlAttribute(someObject)
|
||||
)
|
||||
elif os.path.isfile(someObjectPath):
|
||||
size = os.path.getsize(someObjectPath)
|
||||
files += """<File name="%s" size="%s" />""" % (
|
||||
self.convertToXmlAttribute(someObject),
|
||||
os.path.getsize(someObjectPath)
|
||||
)
|
||||
# Close the folders / files node
|
||||
folders += """</Folders>"""
|
||||
files += """</Files>"""
|
||||
# Return it
|
||||
s = folders + files
|
||||
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 += """<Files>"""
|
||||
zopeFolder = self.findZopeFolder(resourceType, currentFolder)
|
||||
for (name, o) in zopeFolder.objectItems(["File","Image"]):
|
||||
s += """<File name="%s" size="%s" />""" % (
|
||||
self.convertToXmlAttribute(name),
|
||||
((o.get_size() / 1024) + 1)
|
||||
)
|
||||
# Close the files node
|
||||
s += """</Files>"""
|
||||
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
|
||||
|
||||
"""
|
||||
createFolder
|
||||
|
||||
Purpose: command to create a new folder
|
||||
"""
|
||||
def createFolder(self, resourceType, currentFolder):
|
||||
if (self.isZope()):
|
||||
return self.createZopeFolder(resourceType, currentFolder)
|
||||
else:
|
||||
return self.createNonZopeFolder(resourceType, currentFolder)
|
||||
|
||||
def createZopeFolder(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
|
||||
error = """<Error number="%s" originalDescription="%s" />""" % (
|
||||
errorNo,
|
||||
self.convertToXmlAttribute(errorMsg)
|
||||
)
|
||||
return error
|
||||
|
||||
def createNonZopeFolder(self, resourceType, currentFolder):
|
||||
errorNo = 0
|
||||
errorMsg = ""
|
||||
if self.request.has_key("NewFolderName"):
|
||||
newFolder = self.request.get("NewFolderName", None)
|
||||
currentFolderPath = self.serverMapFolder(
|
||||
resourceType,
|
||||
currentFolder
|
||||
)
|
||||
try:
|
||||
newFolderPath = currentFolderPath + newFolder
|
||||
errorMsg = self.createServerFolder(newFolderPath)
|
||||
if (errorMsg is not None):
|
||||
errorNo = 110
|
||||
except:
|
||||
errorNo = 103
|
||||
else:
|
||||
errorNo = 102
|
||||
error = """<Error number="%s" originalDescription="%s" />""" % (
|
||||
errorNo,
|
||||
self.convertToXmlAttribute(errorMsg)
|
||||
)
|
||||
return error
|
||||
|
||||
"""
|
||||
getFileName
|
||||
|
||||
Purpose: helper function to extrapolate the filename
|
||||
"""
|
||||
def getFileName(self, filename):
|
||||
for splitChar in ["/", "\\"]:
|
||||
array = filename.split(splitChar)
|
||||
if (len(array) > 1):
|
||||
filename = array[-1]
|
||||
return filename
|
||||
|
||||
"""
|
||||
fileUpload
|
||||
|
||||
Purpose: command to upload files to server
|
||||
"""
|
||||
def fileUpload(self, resourceType, currentFolder):
|
||||
if (self.isZope()):
|
||||
return self.zopeFileUpload(resourceType, currentFolder)
|
||||
else:
|
||||
return self.nonZopeFileUpload(resourceType, currentFolder)
|
||||
|
||||
def zopeFileUpload(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
|
||||
self.zopeFileUpload(resourceType, currentFolder, count)
|
||||
return
|
||||
|
||||
def nonZopeFileUpload(self, resourceType, currentFolder):
|
||||
errorNo = 0
|
||||
errorMsg = ""
|
||||
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
|
||||
newFileNameOnly = self.removeExtension(newFileName)
|
||||
newFileExtension = self.getExtension(newFileName).lower()
|
||||
allowedExtensions = self.getAllowedExtensions(resourceType)
|
||||
deniedExtensions = self.getDeniedExtensions(resourceType)
|
||||
if (allowedExtensions is not None):
|
||||
# Check for allowed
|
||||
isAllowed = False
|
||||
if (newFileExtension in allowedExtensions):
|
||||
isAllowed = True
|
||||
elif (deniedExtensions is not None):
|
||||
# Check for denied
|
||||
isAllowed = True
|
||||
if (newFileExtension in deniedExtensions):
|
||||
isAllowed = False
|
||||
else:
|
||||
# No extension limitations
|
||||
isAllowed = True
|
||||
|
||||
if (isAllowed):
|
||||
if (self.isZope()):
|
||||
# Upload into zope
|
||||
self.zopeFileUpload(resourceType, currentFolder)
|
||||
else:
|
||||
# Upload to operating system
|
||||
# Map the virtual path to the local server path
|
||||
currentFolderPath = self.serverMapFolder(
|
||||
resourceType,
|
||||
currentFolder
|
||||
)
|
||||
i = 0
|
||||
while (True):
|
||||
newFilePath = "%s%s" % (
|
||||
currentFolderPath,
|
||||
newFileName
|
||||
)
|
||||
if os.path.exists(newFilePath):
|
||||
i += 1
|
||||
newFilePath = "%s%s(%s).%s" % (
|
||||
currentFolderPath,
|
||||
newFileNameOnly,
|
||||
i,
|
||||
newFileExtension
|
||||
)
|
||||
errorNo = 201
|
||||
break
|
||||
else:
|
||||
fileHandle = open(newFilePath,'w')
|
||||
linecount = 0
|
||||
while (1):
|
||||
#line = newFile.file.readline()
|
||||
line = newFile.readline()
|
||||
if not line: break
|
||||
fileHandle.write("%s" % line)
|
||||
linecount += 1
|
||||
os.chmod(newFilePath, 0777)
|
||||
break
|
||||
else:
|
||||
newFileName = "Extension not allowed"
|
||||
errorNo = 203
|
||||
else:
|
||||
newFileName = "No File"
|
||||
errorNo = 202
|
||||
|
||||
string = """
|
||||
<script type="text/javascript">
|
||||
window.parent.frames["frmUpload"].OnUploadCompleted(%s,"%s");
|
||||
</script>
|
||||
""" % (
|
||||
errorNo,
|
||||
newFileName.replace('"',"'")
|
||||
)
|
||||
return string
|
||||
|
||||
def run(self):
|
||||
s = ""
|
||||
try:
|
||||
# Check if this is disabled
|
||||
if not(self.enabled):
|
||||
return self.sendError(1, "This connector is disabled. Please check the connector configurations and try again")
|
||||
# Make sure we have valid inputs
|
||||
if not(
|
||||
(self.request.has_key("Command")) and
|
||||
(self.request.has_key("Type")) and
|
||||
(self.request.has_key("CurrentFolder"))
|
||||
):
|
||||
return
|
||||
# Get command
|
||||
command = self.request.get("Command", None)
|
||||
# Get resource type
|
||||
resourceType = self.request.get("Type", None)
|
||||
# folder syntax must start and end with "/"
|
||||
currentFolder = self.request.get("CurrentFolder", None)
|
||||
if (currentFolder[-1] <> "/"):
|
||||
currentFolder += "/"
|
||||
if (currentFolder[0] <> "/"):
|
||||
currentFolder = "/" + currentFolder
|
||||
# Check for invalid paths
|
||||
if (".." in currentFolder):
|
||||
return self.sendError(102, "")
|
||||
# File upload doesn't have to return XML, so intercept
|
||||
# her:e
|
||||
if (command == "FileUpload"):
|
||||
return self.fileUpload(resourceType, currentFolder)
|
||||
# Begin XML
|
||||
s += self.createXmlHeader(command, resourceType, currentFolder)
|
||||
# Execute the command
|
||||
if (command == "GetFolders"):
|
||||
f = self.getFolders
|
||||
elif (command == "GetFoldersAndFiles"):
|
||||
f = self.getFoldersAndFiles
|
||||
elif (command == "CreateFolder"):
|
||||
f = self.createFolder
|
||||
else:
|
||||
f = None
|
||||
if (f is not None):
|
||||
s += f(resourceType, currentFolder)
|
||||
s += self.createXmlFooter()
|
||||
except Exception, e:
|
||||
s = "ERROR: %s" % e
|
||||
return s
|
||||
|
||||
# Running from command line
|
||||
if __name__ == '__main__':
|
||||
# To test the output, uncomment the standard headers
|
||||
#print "Content-Type: text/html"
|
||||
#print ""
|
||||
print getFCKeditorConnector()
|
||||
|
||||
"""
|
||||
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.connector as connector
|
||||
return connector.getFCKeditorConnector(context=context).run()
|
||||
"""
|
||||
|
||||
|
@ -0,0 +1,177 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: test.html
|
||||
* Test page for the File Browser connectors.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>FCKeditor - Connectors Tests</title>
|
||||
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
|
||||
<script type="text/javascript">
|
||||
|
||||
function BuildBaseUrl( command )
|
||||
{
|
||||
var sUrl =
|
||||
document.getElementById('cmbConnector').value +
|
||||
'?Command=' + command +
|
||||
'&Type=' + document.getElementById('cmbType').value +
|
||||
'&CurrentFolder=' + document.getElementById('txtFolder').value ;
|
||||
|
||||
return sUrl ;
|
||||
}
|
||||
|
||||
function SetFrameUrl( url )
|
||||
{
|
||||
if ( document.all )
|
||||
eRunningFrame.document.location = url ;
|
||||
else
|
||||
document.getElementById('eRunningFrame').src = url ;
|
||||
|
||||
document.getElementById('eUrl').innerHTML = url ;
|
||||
}
|
||||
|
||||
function GetFolders()
|
||||
{
|
||||
SetFrameUrl( BuildBaseUrl( 'GetFolders' ) ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
function GetFoldersAndFiles()
|
||||
{
|
||||
SetFrameUrl( BuildBaseUrl( 'GetFoldersAndFiles' ) ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
function CreateFolder()
|
||||
{
|
||||
var sFolder = prompt( 'Type the folder name:', 'Test Folder' ) ;
|
||||
|
||||
if ( ! sFolder )
|
||||
return ;
|
||||
|
||||
var sUrl = BuildBaseUrl( 'CreateFolder' ) ;
|
||||
sUrl += '&NewFolderName=' + escape( sFolder ) ;
|
||||
|
||||
SetFrameUrl( sUrl ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
function OnUploadCompleted( errorNumber, fileName )
|
||||
{
|
||||
switch ( errorNumber )
|
||||
{
|
||||
case 0 :
|
||||
alert( 'File uploaded with no errors' ) ;
|
||||
break ;
|
||||
case 201 :
|
||||
GetFoldersAndFiles()
|
||||
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
|
||||
break ;
|
||||
case 202 :
|
||||
alert( 'Invalid file' ) ;
|
||||
break ;
|
||||
default :
|
||||
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
this.frames.frmUpload = this ;
|
||||
|
||||
function SetAction()
|
||||
{
|
||||
var sUrl = BuildBaseUrl( 'FileUpload' ) ;
|
||||
document.getElementById('eUrl').innerHTML = sUrl ;
|
||||
document.getElementById('frmUpload').action = sUrl ;
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
Connector:<br />
|
||||
<select id="cmbConnector" name="cmbConnector">
|
||||
<option value="asp/connector.asp" selected="selected">ASP</option>
|
||||
<option value="aspx/connector.aspx">ASP.Net</option>
|
||||
<option value="cfm/connector.cfm">ColdFusion</option>
|
||||
<option value="lasso/connector.lasso">Lasso</option>
|
||||
<option value="perl/connector.cgi">Perl</option>
|
||||
<option value="php/connector.php">PHP</option>
|
||||
<option value="py/connector.py">Python</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Current Folder<br />
|
||||
<input id="txtFolder" type="text" value="/" name="txtFolder" /></td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Resource Type<br />
|
||||
<select id="cmbType" name="cmbType">
|
||||
<option value="File" selected="selected">File</option>
|
||||
<option value="Image">Image</option>
|
||||
<option value="Flash">Flash</option>
|
||||
<option value="Media">Media</option>
|
||||
<option value="Invalid">Invalid Type (for testing)</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<a href="#" onclick="GetFolders();">Get Folders</a></td>
|
||||
<td>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<a href="#" onclick="GetFoldersAndFiles();">Get Folders and Files</a></td>
|
||||
<td>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<a href="#" onclick="CreateFolder();">Create Folder</a></td>
|
||||
<td>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<form id="frmUpload" action="" target="eRunningFrame" method="post" enctype="multipart/form-data">
|
||||
File Upload<br />
|
||||
<input id="txtFileUpload" type="file" name="NewFile" />
|
||||
<input type="submit" value="Upload" onclick="SetAction();" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
URL: <span id="eUrl"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="100%" valign="top">
|
||||
<iframe id="eRunningFrame" src="../../../../fckblank.html" name="eRunningFrame" width="100%"
|
||||
height="100%"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,63 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: frmactualfolder.html
|
||||
* This page shows the actual folder path.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<link href="browser.css" type="text/css" rel="stylesheet">
|
||||
<script type="text/javascript">
|
||||
|
||||
function OnResize()
|
||||
{
|
||||
divName.style.width = "1px" ;
|
||||
divName.style.width = tdName.offsetWidth + "px" ;
|
||||
}
|
||||
|
||||
function SetCurrentFolder( resourceType, folderPath )
|
||||
{
|
||||
document.getElementById('tdName').innerHTML = folderPath ;
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedActualFolder = true ;
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body bottomMargin="0" topMargin="0">
|
||||
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<button style="WIDTH: 100%" type="button">
|
||||
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td><img height="32" alt="" src="images/FolderOpened32.gif" width="32"></td>
|
||||
<td> </td>
|
||||
<td id="tdName" width="100%" nowrap class="ActualFolder">/</td>
|
||||
<td> </td>
|
||||
<td><img height="8" src="images/ButtonArrow.gif" width="12"></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,109 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: frmcreatefolder.html
|
||||
* Page used to create new folders in the current folder.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="browser.css" type="text/css" rel="stylesheet">
|
||||
<script type="text/javascript" src="js/common.js"></script>
|
||||
<script language="javascript">
|
||||
|
||||
function SetCurrentFolder( resourceType, folderPath )
|
||||
{
|
||||
oConnector.ResourceType = resourceType ;
|
||||
oConnector.CurrentFolder = folderPath
|
||||
}
|
||||
|
||||
function CreateFolder()
|
||||
{
|
||||
var sFolderName ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
sFolderName = prompt( 'Type the name of the new folder:', '' ) ;
|
||||
|
||||
if ( sFolderName == null )
|
||||
return ;
|
||||
else if ( sFolderName.length == 0 )
|
||||
alert( 'Please type the folder name' ) ;
|
||||
else
|
||||
break ;
|
||||
}
|
||||
|
||||
oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + escape( sFolderName) , CreateFolderCallBack ) ;
|
||||
}
|
||||
|
||||
function CreateFolderCallBack( fckXml )
|
||||
{
|
||||
if ( oConnector.CheckError( fckXml ) == 0 )
|
||||
window.parent.frames['frmResourcesList'].Refresh() ;
|
||||
|
||||
/*
|
||||
// Get the current folder path.
|
||||
var oNode = fckXml.SelectSingleNode( 'Connector/Error' ) ;
|
||||
var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value ) ;
|
||||
|
||||
switch ( iErrorNumber )
|
||||
{
|
||||
case 0 :
|
||||
window.parent.frames['frmResourcesList'].Refresh() ;
|
||||
break ;
|
||||
case 101 :
|
||||
alert( 'Folder already exists' ) ;
|
||||
break ;
|
||||
case 102 :
|
||||
alert( 'Invalid folder name' ) ;
|
||||
break ;
|
||||
case 103 :
|
||||
alert( 'You have no permissions to create the folder' ) ;
|
||||
break ;
|
||||
case 110 :
|
||||
alert( 'Unknown error creating folder' ) ;
|
||||
break ;
|
||||
default :
|
||||
alert( 'Error creating folder. Error number: ' + iErrorNumber ) ;
|
||||
break ;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedCreateFolder = true ;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body bottomMargin="0" topMargin="0">
|
||||
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" style="WIDTH: 100%" onclick="CreateFolder();">
|
||||
<table cellSpacing="0" cellPadding="0" border="0">
|
||||
<tr>
|
||||
<td><img height="16" alt="" src="images/Folder.gif" width="16"></td>
|
||||
<td> </td>
|
||||
<td nowrap>Create New Folder</td>
|
||||
</tr>
|
||||
</table>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,192 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: frmfolders.html
|
||||
* This page shows the list of folders available in the parent folder
|
||||
* of the current folder.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<link href="browser.css" type="text/css" rel="stylesheet">
|
||||
<script type="text/javascript" src="js/common.js"></script>
|
||||
<script language="javascript">
|
||||
|
||||
var sActiveFolder ;
|
||||
|
||||
var bIsLoaded = false ;
|
||||
var iIntervalId ;
|
||||
|
||||
var oListManager = new Object() ;
|
||||
|
||||
oListManager.Init = function()
|
||||
{
|
||||
this.Table = document.getElementById('tableFiles') ;
|
||||
this.UpRow = document.getElementById('trUp') ;
|
||||
|
||||
this.TableRows = new Object() ;
|
||||
}
|
||||
|
||||
oListManager.Clear = function()
|
||||
{
|
||||
// Remove all other rows available.
|
||||
while ( this.Table.rows.length > 1 )
|
||||
this.Table.deleteRow(1) ;
|
||||
|
||||
// Reset the TableRows collection.
|
||||
this.TableRows = new Object() ;
|
||||
}
|
||||
|
||||
oListManager.AddItem = function( folderName, folderPath )
|
||||
{
|
||||
// Create the new row.
|
||||
var oRow = this.Table.insertRow(-1) ;
|
||||
oRow.className = 'FolderListFolder' ;
|
||||
|
||||
// Build the link to view the folder.
|
||||
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
|
||||
|
||||
// Add the folder icon cell.
|
||||
var oCell = oRow.insertCell(-1) ;
|
||||
oCell.width = 16 ;
|
||||
oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"></a>' ;
|
||||
|
||||
// Add the folder name cell.
|
||||
oCell = oRow.insertCell(-1) ;
|
||||
oCell.noWrap = true ;
|
||||
oCell.innerHTML = ' ' + sLink + folderName + '</a>' ;
|
||||
|
||||
this.TableRows[ folderPath ] = oRow ;
|
||||
}
|
||||
|
||||
oListManager.ShowUpFolder = function( upFolderPath )
|
||||
{
|
||||
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
|
||||
|
||||
if ( upFolderPath != null )
|
||||
{
|
||||
document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
|
||||
{
|
||||
LoadFolders( upFolderPath ) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CheckLoaded()
|
||||
{
|
||||
if ( window.top.IsLoadedActualFolder
|
||||
&& window.top.IsLoadedCreateFolder
|
||||
&& window.top.IsLoadedUpload
|
||||
&& window.top.IsLoadedResourcesList )
|
||||
{
|
||||
window.clearInterval( iIntervalId ) ;
|
||||
bIsLoaded = true ;
|
||||
OpenFolder( sActiveFolder ) ;
|
||||
}
|
||||
}
|
||||
|
||||
function OpenFolder( folderPath )
|
||||
{
|
||||
sActiveFolder = folderPath ;
|
||||
|
||||
if ( ! bIsLoaded )
|
||||
{
|
||||
if ( ! iIntervalId )
|
||||
iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
// Change the style for the select row (to show the opened folder).
|
||||
for ( var sFolderPath in oListManager.TableRows )
|
||||
{
|
||||
oListManager.TableRows[ sFolderPath ].className =
|
||||
( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
|
||||
}
|
||||
|
||||
// Set the current folder in all frames.
|
||||
window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
||||
window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
||||
window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
||||
|
||||
// Load the resources list for this folder.
|
||||
window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
|
||||
}
|
||||
|
||||
function LoadFolders( folderPath )
|
||||
{
|
||||
// Clear the folders list.
|
||||
oListManager.Clear() ;
|
||||
|
||||
// Get the parent folder path.
|
||||
var sParentFolderPath ;
|
||||
if ( folderPath != '/' )
|
||||
sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
|
||||
|
||||
// Show/Hide the Up Folder.
|
||||
oListManager.ShowUpFolder( sParentFolderPath ) ;
|
||||
|
||||
if ( folderPath != '/' )
|
||||
{
|
||||
sActiveFolder = folderPath ;
|
||||
oConnector.CurrentFolder = sParentFolderPath
|
||||
oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
|
||||
}
|
||||
else
|
||||
OpenFolder( '/' ) ;
|
||||
}
|
||||
|
||||
function GetFoldersCallBack( fckXml )
|
||||
{
|
||||
if ( oConnector.CheckError( fckXml ) != 0 )
|
||||
return ;
|
||||
|
||||
// Get the current folder path.
|
||||
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
|
||||
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
|
||||
|
||||
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
|
||||
|
||||
for ( var i = 0 ; i < oNodes.length ; i++ )
|
||||
{
|
||||
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
|
||||
oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ;
|
||||
}
|
||||
|
||||
OpenFolder( sActiveFolder ) ;
|
||||
}
|
||||
|
||||
function SetResourceType( type )
|
||||
{
|
||||
oConnector.ResourceType = type ;
|
||||
LoadFolders( '/' ) ;
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
oListManager.Init() ;
|
||||
LoadFolders( '/' ) ;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body class="FileArea" bottomMargin="10" leftMargin="10" topMargin="10" rightMargin="10">
|
||||
<table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr id="trUp" style="DISPLAY: none">
|
||||
<td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
|
||||
<td nowrap width="100%"> <a id="linkUp" href="#">..</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,150 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: frmresourceslist.html
|
||||
* This page shows all resources available in a folder in the File Browser.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link href="browser.css" type="text/css" rel="stylesheet" />
|
||||
<script type="text/javascript" src="js/common.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var oListManager = new Object() ;
|
||||
|
||||
oListManager.Clear = function()
|
||||
{
|
||||
document.body.innerHTML = '' ;
|
||||
}
|
||||
|
||||
oListManager.GetFolderRowHtml = function( folderName, folderPath )
|
||||
{
|
||||
// Build the link to view the folder.
|
||||
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath.replace( /'/g, '\\\'') + '\');return false;">' ;
|
||||
|
||||
return '<tr>' +
|
||||
'<td width="16">' +
|
||||
sLink +
|
||||
'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"></a>' +
|
||||
'</td><td nowrap colspan="2"> ' +
|
||||
sLink +
|
||||
folderName +
|
||||
'</a>' +
|
||||
'</td></tr>' ;
|
||||
}
|
||||
|
||||
oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
|
||||
{
|
||||
// Build the link to view the folder.
|
||||
var sLink = '<a href="#" onclick="OpenFile(\'' + fileUrl.replace( /'/g, '\\\'') + '\');return false;">' ;
|
||||
|
||||
// Get the file icon.
|
||||
var sIcon = oIcons.GetIcon( fileName ) ;
|
||||
|
||||
return '<tr>' +
|
||||
'<td width="16">' +
|
||||
sLink +
|
||||
'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"></a>' +
|
||||
'</td><td> ' +
|
||||
sLink +
|
||||
fileName +
|
||||
'</a>' +
|
||||
'</td><td align="right" nowrap> ' +
|
||||
fileSize +
|
||||
' KB' +
|
||||
'</td></tr>' ;
|
||||
}
|
||||
|
||||
function OpenFolder( folderPath )
|
||||
{
|
||||
// Load the resources list for this folder.
|
||||
window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
|
||||
}
|
||||
|
||||
function OpenFile( fileUrl )
|
||||
{
|
||||
window.top.opener.SetUrl( fileUrl ) ;
|
||||
window.top.close() ;
|
||||
window.top.opener.focus() ;
|
||||
}
|
||||
|
||||
function LoadResources( resourceType, folderPath )
|
||||
{
|
||||
oListManager.Clear() ;
|
||||
oConnector.ResourceType = resourceType ;
|
||||
oConnector.CurrentFolder = folderPath ;
|
||||
oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
|
||||
}
|
||||
|
||||
function Refresh()
|
||||
{
|
||||
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
|
||||
}
|
||||
|
||||
function GetFoldersAndFilesCallBack( fckXml )
|
||||
{
|
||||
if ( oConnector.CheckError( fckXml ) != 0 )
|
||||
return ;
|
||||
|
||||
// Get the current folder path.
|
||||
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
|
||||
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
|
||||
var sCurrentFolderUrl = oNode.attributes.getNamedItem('url').value ;
|
||||
|
||||
// var dTimer = new Date() ;
|
||||
|
||||
var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;
|
||||
|
||||
// Add the Folders.
|
||||
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
|
||||
for ( var i = 0 ; i < oNodes.length ; i++ )
|
||||
{
|
||||
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
|
||||
oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
|
||||
}
|
||||
|
||||
// Add the Files.
|
||||
var oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
|
||||
for ( var i = 0 ; i < oNodes.length ; i++ )
|
||||
{
|
||||
var oNode = oNodes[i] ;
|
||||
var sFileName = oNode.attributes.getNamedItem('name').value ;
|
||||
var sFileSize = oNode.attributes.getNamedItem('size').value ;
|
||||
|
||||
// Get the optional "url" attribute. If not available, build the url.
|
||||
var oFileUrlAtt = oNodes[i].attributes.getNamedItem('url') ;
|
||||
var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : sCurrentFolderUrl + sFileName ;
|
||||
|
||||
oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;
|
||||
}
|
||||
|
||||
oHtml.Append( '</table>' ) ;
|
||||
|
||||
document.body.innerHTML = oHtml.ToString() ;
|
||||
|
||||
// window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
|
||||
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedResourcesList = true ;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body class="FileArea" bottommargin="10" leftmargin="10" topmargin="10" rightmargin="10">
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,61 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: frmresourcetype.html
|
||||
* This page shows the list of available resource types.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="browser.css" type="text/css" rel="stylesheet">
|
||||
<script type="text/javascript" src="js/common.js"></script>
|
||||
<script language="javascript">
|
||||
|
||||
function SetResourceType( type )
|
||||
{
|
||||
window.parent.frames["frmFolders"].SetResourceType( type ) ;
|
||||
}
|
||||
|
||||
var aTypes = [
|
||||
['File','File'],
|
||||
['Image','Image'],
|
||||
['Flash','Flash'],
|
||||
['Media','Media']
|
||||
] ;
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
for ( var i = 0 ; i < aTypes.length ; i++ )
|
||||
{
|
||||
if ( oConnector.ShowAllTypes || aTypes[i][0] == oConnector.ResourceType )
|
||||
AddSelectOption( document.getElementById('cmbType'), aTypes[i][1], aTypes[i][0] ) ;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body bottomMargin="0" topMargin="0">
|
||||
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td nowrap>
|
||||
Resource Type<BR>
|
||||
<select id="cmbType" style="WIDTH: 100%" onchange="SetResourceType(this.value);">
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,109 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: frmupload.html
|
||||
* Page used to upload new files in the current folder.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link href="browser.css" type="text/css" rel="stylesheet" />
|
||||
<script type="text/javascript" src="js/common.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function SetCurrentFolder( resourceType, folderPath )
|
||||
{
|
||||
var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ;
|
||||
sUrl += '&Type=' + resourceType ;
|
||||
sUrl += '&CurrentFolder=' + escape( folderPath ) ;
|
||||
|
||||
document.getElementById('frmUpload').action = sUrl ;
|
||||
}
|
||||
|
||||
function OnSubmit()
|
||||
{
|
||||
if ( document.getElementById('NewFile').value.length == 0 )
|
||||
{
|
||||
alert( 'Please select a file from your computer' ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Set the interface elements.
|
||||
document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder (Upload in progress, please wait...)' ;
|
||||
document.getElementById('btnUpload').disabled = true ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
function OnUploadCompleted( errorNumber, data )
|
||||
{
|
||||
// Reset the Upload Worker Frame.
|
||||
window.parent.frames['frmUploadWorker'].location = '../../../../../fckblank.html' ;
|
||||
|
||||
// Reset the upload form (On IE we must do a little trick to avout problems).
|
||||
if ( document.all )
|
||||
document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
|
||||
else
|
||||
document.getElementById('frmUpload').reset() ;
|
||||
|
||||
// Reset the interface elements.
|
||||
document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ;
|
||||
document.getElementById('btnUpload').disabled = false ;
|
||||
|
||||
switch ( errorNumber )
|
||||
{
|
||||
case 0 :
|
||||
window.parent.frames['frmResourcesList'].Refresh() ;
|
||||
break ;
|
||||
case 1 : // Custom error.
|
||||
alert( data ) ;
|
||||
break ;
|
||||
case 201 :
|
||||
window.parent.frames['frmResourcesList'].Refresh() ;
|
||||
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ) ;
|
||||
break ;
|
||||
case 202 :
|
||||
alert( 'Invalid file' ) ;
|
||||
break ;
|
||||
default :
|
||||
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedUpload = true ;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body bottommargin="0" topmargin="0">
|
||||
<form id="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();">
|
||||
<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td nowrap="nowrap">
|
||||
<span id="eUploadMessage">Upload a new file in this folder</span><br>
|
||||
<table cellspacing="0" cellpadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td width="100%"><input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file"></td>
|
||||
<td nowrap="nowrap"> <input id="btnUpload" type="submit" value="Upload"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 128 B |
After Width: | Height: | Size: 281 B |
After Width: | Height: | Size: 132 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 132 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 454 B |
After Width: | Height: | Size: 709 B |
After Width: | Height: | Size: 224 B |
After Width: | Height: | Size: 177 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 260 B |
After Width: | Height: | Size: 170 B |
After Width: | Height: | Size: 946 B |
After Width: | Height: | Size: 704 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 463 B |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 454 B |
After Width: | Height: | Size: 567 B |
After Width: | Height: | Size: 254 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 725 B |
After Width: | Height: | Size: 724 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 277 B |
After Width: | Height: | Size: 271 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 368 B |
After Width: | Height: | Size: 403 B |
After Width: | Height: | Size: 249 B |
After Width: | Height: | Size: 126 B |
After Width: | Height: | Size: 128 B |
After Width: | Height: | Size: 113 B |
After Width: | Height: | Size: 132 B |
After Width: | Height: | Size: 140 B |
After Width: | Height: | Size: 109 B |
After Width: | Height: | Size: 382 B |
After Width: | Height: | Size: 125 B |
After Width: | Height: | Size: 621 B |
After Width: | Height: | Size: 621 B |
After Width: | Height: | Size: 125 B |
After Width: | Height: | Size: 139 B |
After Width: | Height: | Size: 146 B |
After Width: | Height: | Size: 249 B |
After Width: | Height: | Size: 230 B |
After Width: | Height: | Size: 139 B |
After Width: | Height: | Size: 606 B |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 122 B |
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 235 B |
After Width: | Height: | Size: 43 B |
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: common.js
|
||||
* Common objects and functions shared by all pages that compose the
|
||||
* File Browser dialog window.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
function AddSelectOption( selectElement, optionText, optionValue )
|
||||
{
|
||||
var oOption = document.createElement("OPTION") ;
|
||||
|
||||
oOption.text = optionText ;
|
||||
oOption.value = optionValue ;
|
||||
|
||||
selectElement.options.add(oOption) ;
|
||||
|
||||
return oOption ;
|
||||
}
|
||||
|
||||
var oConnector = window.parent.oConnector ;
|
||||
var oIcons = window.parent.oIcons ;
|
||||
|
||||
|
||||
function StringBuilder( value )
|
||||
{
|
||||
this._Strings = new Array( value || '' ) ;
|
||||
}
|
||||
|
||||
StringBuilder.prototype.Append = function( value )
|
||||
{
|
||||
if ( value )
|
||||
this._Strings.push( value ) ;
|
||||
}
|
||||
|
||||
StringBuilder.prototype.ToString = function()
|
||||
{
|
||||
return this._Strings.join( '' ) ;
|
||||
}
|
116
admin/FCKeditor/editor/filemanager/browser/default/js/fckxml.js
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: fckxml.js
|
||||
* Defines the FCKXml object that is used for XML data calls
|
||||
* and XML processing.
|
||||
* This script is shared by almost all pages that compose the
|
||||
* File Browser frameset.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
var FCKXml = function()
|
||||
{}
|
||||
|
||||
FCKXml.prototype.GetHttpRequest = function()
|
||||
{
|
||||
// Gecko / IE7
|
||||
if ( typeof(XMLHttpRequest) != 'undefined' )
|
||||
return new XMLHttpRequest() ;
|
||||
|
||||
// IE6
|
||||
try { return new ActiveXObject("Msxml2.XMLHTTP") ; }
|
||||
catch(e) {}
|
||||
|
||||
// IE5
|
||||
try { return new ActiveXObject("Microsoft.XMLHTTP") ; }
|
||||
catch(e) {}
|
||||
}
|
||||
|
||||
FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer )
|
||||
{
|
||||
var oFCKXml = this ;
|
||||
|
||||
var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ;
|
||||
|
||||
var oXmlHttp = this.GetHttpRequest() ;
|
||||
|
||||
oXmlHttp.open( "GET", urlToCall, bAsync ) ;
|
||||
|
||||
if ( bAsync )
|
||||
{
|
||||
oXmlHttp.onreadystatechange = function()
|
||||
{
|
||||
if ( oXmlHttp.readyState == 4 )
|
||||
{
|
||||
oFCKXml.DOMDocument = oXmlHttp.responseXML ;
|
||||
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
|
||||
asyncFunctionPointer( oFCKXml ) ;
|
||||
else
|
||||
alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oXmlHttp.send( null ) ;
|
||||
|
||||
if ( ! bAsync )
|
||||
{
|
||||
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
|
||||
this.DOMDocument = oXmlHttp.responseXML ;
|
||||
else
|
||||
{
|
||||
alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectNodes = function( xpath )
|
||||
{
|
||||
if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE
|
||||
return this.DOMDocument.selectNodes( xpath ) ;
|
||||
else // Gecko
|
||||
{
|
||||
var aNodeArray = new Array();
|
||||
|
||||
var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
|
||||
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
|
||||
if ( xPathResult )
|
||||
{
|
||||
var oNode = xPathResult.iterateNext() ;
|
||||
while( oNode )
|
||||
{
|
||||
aNodeArray[aNodeArray.length] = oNode ;
|
||||
oNode = xPathResult.iterateNext();
|
||||
}
|
||||
}
|
||||
return aNodeArray ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectSingleNode = function( xpath )
|
||||
{
|
||||
if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE
|
||||
return this.DOMDocument.selectSingleNode( xpath ) ;
|
||||
else // Gecko
|
||||
{
|
||||
var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
|
||||
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
|
||||
|
||||
if ( xPathResult && xPathResult.singleNodeValue )
|
||||
return xPathResult.singleNodeValue ;
|
||||
else
|
||||
return null ;
|
||||
}
|
||||
}
|
230
admin/FCKeditor/editor/filemanager/upload/asp/class_upload.asp
Normal file
@ -0,0 +1,230 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: class_upload.asp
|
||||
* These are the classes used to handle ASP upload without using third
|
||||
* part components (OCX/DLL).
|
||||
*
|
||||
* File Authors:
|
||||
* NetRube (netrube@126.com)
|
||||
-->
|
||||
<%
|
||||
'**********************************************
|
||||
' File: NetRube_Upload.asp
|
||||
' Version: NetRube Upload Class Version 2.1 Build 20050228
|
||||
' Author: NetRube
|
||||
' Email: NetRube@126.com
|
||||
' Date: 02/28/2005
|
||||
' Comments: The code for the Upload.
|
||||
' This can free usage, but please
|
||||
' not to delete this copyright information.
|
||||
' If you have a modification version,
|
||||
' Please send out a duplicate to me.
|
||||
'**********************************************
|
||||
' 文件名: NetRube_Upload.asp
|
||||
' 版本: NetRube Upload Class Version 2.1 Build 20050228
|
||||
' 作者: NetRube(网络乡巴佬)
|
||||
' 电子邮件: NetRube@126.com
|
||||
' 日期: 2005年02月28日
|
||||
' 声明: 文件上传类
|
||||
' 本上传类可以自由使用,但请保留此版权声明信息
|
||||
' 如果您对本上传类进行修改增强,
|
||||
' 请发送一份给俺。
|
||||
'**********************************************
|
||||
|
||||
Class NetRube_Upload
|
||||
|
||||
Public File, Form
|
||||
Private oSourceData
|
||||
Private nMaxSize, nErr, sAllowed, sDenied
|
||||
|
||||
Private Sub Class_Initialize
|
||||
nErr = 0
|
||||
nMaxSize = 1048576
|
||||
|
||||
Set File = Server.CreateObject("Scripting.Dictionary")
|
||||
File.CompareMode = 1
|
||||
Set Form = Server.CreateObject("Scripting.Dictionary")
|
||||
Form.CompareMode = 1
|
||||
|
||||
Set oSourceData = Server.CreateObject("ADODB.Stream")
|
||||
oSourceData.Type = 1
|
||||
oSourceData.Mode = 3
|
||||
oSourceData.Open
|
||||
End Sub
|
||||
|
||||
Private Sub Class_Terminate
|
||||
Form.RemoveAll
|
||||
Set Form = Nothing
|
||||
File.RemoveAll
|
||||
Set File = Nothing
|
||||
|
||||
oSourceData.Close
|
||||
Set oSourceData = Nothing
|
||||
End Sub
|
||||
|
||||
Public Property Get Version
|
||||
Version = "NetRube Upload Class Version 1.0 Build 20041218"
|
||||
End Property
|
||||
|
||||
Public Property Get ErrNum
|
||||
ErrNum = nErr
|
||||
End Property
|
||||
|
||||
Public Property Let MaxSize(nSize)
|
||||
nMaxSize = nSize
|
||||
End Property
|
||||
|
||||
Public Property Let Allowed(sExt)
|
||||
sAllowed = sExt
|
||||
End Property
|
||||
|
||||
Public Property Let Denied(sExt)
|
||||
sDenied = sExt
|
||||
End Property
|
||||
|
||||
Public Sub GetData
|
||||
Dim aCType
|
||||
aCType = Split(Request.ServerVariables("HTTP_CONTENT_TYPE"), ";")
|
||||
If aCType(0) <> "multipart/form-data" Then
|
||||
nErr = 1
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim nTotalSize
|
||||
nTotalSize = Request.TotalBytes
|
||||
If nTotalSize < 1 Then
|
||||
nErr = 2
|
||||
Exit Sub
|
||||
End If
|
||||
If nMaxSize > 0 And nTotalSize > nMaxSize Then
|
||||
nErr = 3
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
oSourceData.Write Request.BinaryRead(nTotalSize)
|
||||
oSourceData.Position = 0
|
||||
|
||||
Dim oTotalData, oFormStream, sFormHeader, sFormName, bCrLf, nBoundLen, nFormStart, nFormEnd, nPosStart, nPosEnd, sBoundary
|
||||
|
||||
oTotalData = oSourceData.Read
|
||||
bCrLf = ChrB(13) & ChrB(10)
|
||||
sBoundary = MidB(oTotalData, 1, InStrB(1, oTotalData, bCrLf) - 1)
|
||||
nBoundLen = LenB(sBoundary) + 2
|
||||
nFormStart = nBoundLen
|
||||
|
||||
Set oFormStream = Server.CreateObject("ADODB.Stream")
|
||||
|
||||
Do While (nFormStart + 2) < nTotalSize
|
||||
nFormEnd = InStrB(nFormStart, oTotalData, bCrLf & bCrLf) + 3
|
||||
|
||||
With oFormStream
|
||||
.Type = 1
|
||||
.Mode = 3
|
||||
.Open
|
||||
oSourceData.Position = nFormStart
|
||||
oSourceData.CopyTo oFormStream, nFormEnd - nFormStart
|
||||
.Position = 0
|
||||
.Type = 2
|
||||
.CharSet = "UTF-8"
|
||||
sFormHeader = .ReadText
|
||||
.Close
|
||||
End With
|
||||
|
||||
nFormStart = InStrB(nFormEnd, oTotalData, sBoundary) - 1
|
||||
nPosStart = InStr(22, sFormHeader, " name=", 1) + 7
|
||||
nPosEnd = InStr(nPosStart, sFormHeader, """")
|
||||
sFormName = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
|
||||
|
||||
If InStr(45, sFormHeader, " filename=", 1) > 0 Then
|
||||
Set File(sFormName) = New NetRube_FileInfo
|
||||
File(sFormName).FormName = sFormName
|
||||
File(sFormName).Start = nFormEnd
|
||||
File(sFormName).Size = nFormStart - nFormEnd - 2
|
||||
nPosStart = InStr(nPosEnd, sFormHeader, " filename=", 1) + 11
|
||||
nPosEnd = InStr(nPosStart, sFormHeader, """")
|
||||
File(sFormName).ClientPath = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
|
||||
File(sFormName).Name = Mid(File(sFormName).ClientPath, InStrRev(File(sFormName).ClientPath, "\") + 1)
|
||||
File(sFormName).Ext = LCase(Mid(File(sFormName).Name, InStrRev(File(sFormName).Name, ".") + 1))
|
||||
nPosStart = InStr(nPosEnd, sFormHeader, "Content-Type: ", 1) + 14
|
||||
nPosEnd = InStr(nPosStart, sFormHeader, vbCr)
|
||||
File(sFormName).MIME = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
|
||||
Else
|
||||
With oFormStream
|
||||
.Type = 1
|
||||
.Mode = 3
|
||||
.Open
|
||||
oSourceData.Position = nPosEnd
|
||||
oSourceData.CopyTo oFormStream, nFormStart - nFormEnd - 2
|
||||
.Position = 0
|
||||
.Type = 2
|
||||
.CharSet = "UTF-8"
|
||||
Form(sFormName) = .ReadText
|
||||
.Close
|
||||
End With
|
||||
End If
|
||||
|
||||
nFormStart = nFormStart + nBoundLen
|
||||
Loop
|
||||
|
||||
oTotalData = ""
|
||||
Set oFormStream = Nothing
|
||||
End Sub
|
||||
|
||||
Public Sub SaveAs(sItem, sFileName)
|
||||
If File(sItem).Size < 1 Then
|
||||
nErr = 2
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not IsAllowed(File(sItem).Ext) Then
|
||||
nErr = 4
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oFileStream
|
||||
Set oFileStream = Server.CreateObject("ADODB.Stream")
|
||||
With oFileStream
|
||||
.Type = 1
|
||||
.Mode = 3
|
||||
.Open
|
||||
oSourceData.Position = File(sItem).Start
|
||||
oSourceData.CopyTo oFileStream, File(sItem).Size
|
||||
.Position = 0
|
||||
.SaveToFile sFileName, 2
|
||||
.Close
|
||||
End With
|
||||
Set oFileStream = Nothing
|
||||
End Sub
|
||||
|
||||
Private Function IsAllowed(sExt)
|
||||
Dim oRE
|
||||
Set oRE = New RegExp
|
||||
oRE.IgnoreCase = True
|
||||
oRE.Global = True
|
||||
|
||||
If sDenied = "" Then
|
||||
oRE.Pattern = sAllowed
|
||||
IsAllowed = (sAllowed = "") Or oRE.Test(sExt)
|
||||
Else
|
||||
oRE.Pattern = sDenied
|
||||
IsAllowed = Not oRE.Test(sExt)
|
||||
End If
|
||||
|
||||
Set oRE = Nothing
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Class NetRube_FileInfo
|
||||
Dim FormName, ClientPath, Path, Name, Ext, Content, Size, MIME, Start
|
||||
End Class
|
||||
%>
|
48
admin/FCKeditor/editor/filemanager/upload/asp/config.asp
Normal file
@ -0,0 +1,48 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: config.asp
|
||||
* Configuration file for the File Manager Connector for ASP.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<%
|
||||
|
||||
' SECURITY: You must explicitelly enable this "uploader" (set it to "True").
|
||||
Dim ConfigIsEnabled
|
||||
ConfigIsEnabled = False
|
||||
|
||||
' Set if the file type must be considere in the target path.
|
||||
' Ex: /UserFiles/Image/ or /UserFiles/File/
|
||||
Dim ConfigUseFileType
|
||||
ConfigUseFileType = False
|
||||
|
||||
' Path to user files relative to the document root.
|
||||
Dim ConfigUserFilesPath
|
||||
ConfigUserFilesPath = "/UserFiles/"
|
||||
|
||||
' Allowed and Denied extensions configurations.
|
||||
Dim ConfigAllowedExtensions, ConfigDeniedExtensions
|
||||
Set ConfigAllowedExtensions = CreateObject( "Scripting.Dictionary" )
|
||||
Set ConfigDeniedExtensions = CreateObject( "Scripting.Dictionary" )
|
||||
|
||||
ConfigAllowedExtensions.Add "File", ""
|
||||
ConfigDeniedExtensions.Add "File", "php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|com|dll|vbs|js|reg|cgi"
|
||||
|
||||
ConfigAllowedExtensions.Add "Image", "jpg|gif|jpeg|png|bmp"
|
||||
ConfigDeniedExtensions.Add "Image", ""
|
||||
|
||||
ConfigAllowedExtensions.Add "Flash", "swf|fla"
|
||||
ConfigDeniedExtensions.Add "Flash", ""
|
||||
|
||||
%>
|
25
admin/FCKeditor/editor/filemanager/upload/asp/io.asp
Normal file
@ -0,0 +1,25 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: io.asp
|
||||
* This file include IO specific functions used by the ASP Uploader.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<%
|
||||
|
||||
Function RemoveExtension( fileName )
|
||||
RemoveExtension = Left( fileName, InStrRev( fileName, "." ) - 1 )
|
||||
End Function
|
||||
|
||||
%>
|
117
admin/FCKeditor/editor/filemanager/upload/asp/upload.asp
Normal file
@ -0,0 +1,117 @@
|
||||
<%@ CodePage=65001 Language="VBScript"%>
|
||||
<%
|
||||
Option Explicit
|
||||
Response.Buffer = True
|
||||
%>
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: upload.asp
|
||||
* This is the "File Uploader" for ASP.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<!--#include file="config.asp"-->
|
||||
<!--#include file="io.asp"-->
|
||||
<!--#include file="class_upload.asp"-->
|
||||
<%
|
||||
|
||||
' This is the function that sends the results of the uploading process.
|
||||
Function SendResults( errorNumber, fileUrl, fileName, customMsg )
|
||||
Response.Write "<script type=""text/javascript"">"
|
||||
Response.Write "window.parent.OnUploadCompleted(" & errorNumber & ",""" & Replace( fileUrl, """", "\""" ) & """,""" & Replace( fileName, """", "\""" ) & """,""" & Replace( customMsg , """", "\""" ) & """) ;"
|
||||
Response.Write "</script>"
|
||||
Response.End
|
||||
End Function
|
||||
|
||||
%>
|
||||
<%
|
||||
|
||||
' Check if this uploader has been enabled.
|
||||
If ( ConfigIsEnabled = False ) Then
|
||||
SendResults "1", "", "", "This file uploader is disabled. Please check the ""editor/filemanager/upload/asp/config.asp"" file"
|
||||
End If
|
||||
|
||||
' The the file type (from the QueryString, by default 'File').
|
||||
Dim resourceType
|
||||
If ( Request.QueryString("Type") <> "" ) Then
|
||||
resourceType = Request.QueryString("Type")
|
||||
Else
|
||||
resourceType = "File"
|
||||
End If
|
||||
|
||||
' Create the Uploader object.
|
||||
Dim oUploader
|
||||
Set oUploader = New NetRube_Upload
|
||||
oUploader.MaxSize = 0
|
||||
oUploader.Allowed = ConfigAllowedExtensions.Item( resourceType )
|
||||
oUploader.Denied = ConfigDeniedExtensions.Item( resourceType )
|
||||
oUploader.GetData
|
||||
|
||||
If oUploader.ErrNum > 1 Then
|
||||
SendResults "202", "", "", ""
|
||||
Else
|
||||
Dim sFileName, sFileUrl, sErrorNumber, sOriginalFileName, sExtension
|
||||
sFileName = ""
|
||||
sFileUrl = ""
|
||||
sErrorNumber = "0"
|
||||
|
||||
' Map the virtual path to the local server path.
|
||||
Dim sServerDir
|
||||
sServerDir = Server.MapPath( ConfigUserFilesPath )
|
||||
If ( Right( sServerDir, 1 ) <> "\" ) Then
|
||||
sServerDir = sServerDir & "\"
|
||||
End If
|
||||
|
||||
If ( ConfigUseFileType = True ) Then
|
||||
sServerDir = sServerDir & resourceType & "\"
|
||||
End If
|
||||
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
|
||||
|
||||
' Get the uploaded file name.
|
||||
sFileName = oUploader.File( "NewFile" ).Name
|
||||
sExtension = oUploader.File( "NewFile" ).Ext
|
||||
sOriginalFileName = sFileName
|
||||
|
||||
Dim iCounter
|
||||
iCounter = 0
|
||||
|
||||
Do While ( True )
|
||||
Dim sFilePath
|
||||
sFilePath = sServerDir & sFileName
|
||||
|
||||
If ( oFSO.FileExists( sFilePath ) ) Then
|
||||
iCounter = iCounter + 1
|
||||
sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
|
||||
sErrorNumber = "201"
|
||||
Else
|
||||
oUploader.SaveAs "NewFile", sFilePath
|
||||
If oUploader.ErrNum > 0 Then SendResults "202", "", "", ""
|
||||
Exit Do
|
||||
End If
|
||||
Loop
|
||||
|
||||
If ( ConfigUseFileType = True ) Then
|
||||
sFileUrl = ConfigUserFilesPath & resourceType & "/" & sFileName
|
||||
Else
|
||||
sFileUrl = ConfigUserFilesPath & sFileName
|
||||
End If
|
||||
|
||||
SendResults sErrorNumber, sFileUrl, sFileName, ""
|
||||
|
||||
End If
|
||||
|
||||
Set oUploader = Nothing
|
||||
%>
|
26
admin/FCKeditor/editor/filemanager/upload/aspx/upload.aspx
Normal file
@ -0,0 +1,26 @@
|
||||
<%@ Page language="c#" Inherits="FredCK.FCKeditorV2.Uploader" AutoEventWireup="false" %>
|
||||
<%--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: upload.aspx
|
||||
* 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
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
--%>
|