initial commit

This commit is contained in:
Siwat Sirichai 2025-06-08 16:22:20 +07:00
commit 252dac3143
1516 changed files with 694271 additions and 0 deletions

View file

@ -0,0 +1,89 @@
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* CSS styles used by all pages that compose the File Browser.
*/
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;
margin: 10px;
}
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);
}

View file

@ -0,0 +1,163 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This page compose the File Browser dialog frameset.
-->
<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 decodeURIComponent( 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=' + encodeURIComponent( 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=' + encodeURIComponent( this.CurrentFolder ) ;
if ( params ) sUrl += '&' + params ;
// Add a random salt to avoid getting a cached version of the command execution
sUrl += '&uuid=' + new Date().getTime() ;
var oXML = new FCKXml() ;
if ( callBackFunction )
oXML.LoadUrl( sUrl, callBackFunction ) ; // Asynchronous load.
else
return oXML.LoadUrl( sUrl ) ;
return null ;
}
oConnector.CheckError = function( responseXml )
{
var iErrorNumber = 0 ;
var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ) ;
if ( oErrorNode )
{
iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 ) ;
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','png','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' ;
}
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
{
window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ) ;
}
</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="javascript:void(0)" scrolling="no" frameborder="0">
</frameset>
</frameset>
</frameset>
</html>

View file

@ -0,0 +1,67 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This page shows the actual folder path.
-->
<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>&nbsp;</td>
<td id="tdName" width="100%" nowrap class="ActualFolder">/</td>
<td>&nbsp;</td>
<td><img height="8" src="images/ButtonArrow.gif" width="12"></td>
<td>&nbsp;</td>
</tr>
</table>
</button>
</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,113 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Page used to create new folders in the current folder.
-->
<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=' + encodeURIComponent( 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>&nbsp;</td>
<td nowrap>Create New Folder</td>
</tr>
</table>
</button>
</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,196 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This page shows the list of folders available in the parent folder
* of the current folder.
-->
<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 = '&nbsp;' + 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%">&nbsp;<a id="linkUp" href="#">..</a></td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,167 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This page shows all resources available in a folder in the File Browser.
-->
<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 = '' ;
}
function ProtectPath(path)
{
path = path.replace( /\\/g, '\\\\') ;
path = path.replace( /'/g, '\\\'') ;
return path ;
}
oListManager.GetFolderRowHtml = function( folderName, folderPath )
{
// Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');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">&nbsp;' +
sLink +
folderName +
'<\/a>' +
'<\/td><\/tr>' ;
}
oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
{
// Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');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>&nbsp;' +
sLink +
fileName +
'<\/a>' +
'<\/td><td align="right" nowrap>&nbsp;' +
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( encodeURI( 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 oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
if ( oFolderNode == null )
{
alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;
return ;
}
var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
var sCurrentFolderUrl = oFolderNode.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 ;
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.
oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
for ( var j = 0 ; j < oNodes.length ; j++ )
{
var oNode = oNodes[j] ;
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[j].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">
</body>
</html>

View file

@ -0,0 +1,65 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This page shows the list of available resource types.
-->
<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>

View file

@ -0,0 +1,114 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Page used to upload new files in the current folder.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>File Upload</title>
<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=' + encodeURIComponent( 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 = 'javascript:void(0)' ;
// Reset the upload form (On IE we must do a little trick to avoid 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">&nbsp;<input id="btnUpload" type="submit" value="Upload"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

View file

@ -0,0 +1,55 @@
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Common objects and functions shared by all pages that compose the
* File Browser dialog window.
*/
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( '' ) ;
}

View file

@ -0,0 +1,129 @@
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* 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.
*/
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) {}
return null ;
}
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 )
{
if ( ( oXmlHttp.status != 200 && oXmlHttp.status != 304 ) || oXmlHttp.responseXML == null || oXmlHttp.responseXML.firstChild == null )
{
alert( 'The server didn\'t send back a proper XML response. Please contact your system administrator.\n\n' +
'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')\n\n' +
'Requested URL:\n' + urlToCall + '\n\n' +
'Response text:\n' + oXmlHttp.responseText ) ;
return ;
}
oFCKXml.DOMDocument = oXmlHttp.responseXML ;
asyncFunctionPointer( oFCKXml ) ;
}
}
}
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 ;
}
}

View file

@ -0,0 +1,62 @@
<%
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
' Copyright (C) 2003-2007 Frederico Caldeira Knabben
'
' == BEGIN LICENSE ==
'
' Licensed under the terms of any of the following licenses at your
' choice:
'
' - GNU General Public License Version 2 or later (the "GPL")
' http://www.gnu.org/licenses/gpl.html
'
' - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
' http://www.gnu.org/licenses/lgpl.html
'
' - Mozilla Public License Version 1.1 or later (the "MPL")
' http://www.mozilla.org/MPL/MPL-1.1.html
'
' == END LICENSE ==
'
' This file include the functions that create the base XML output.
%>
<%
Sub SetXmlHeaders()
' Cleans the response buffer.
Response.Clear()
' Prevent the browser from caching the result.
Response.CacheControl = "no-cache"
' Set the response format.
Response.CharSet = "UTF-8"
Response.ContentType = "text/xml"
End Sub
Sub CreateXmlHeader( command, resourceType, currentFolder, url )
' Create the XML document header.
Response.Write "<?xml version=""1.0"" encoding=""utf-8"" ?>"
' Create the main "Connector" node.
Response.Write "<Connector command=""" & command & """ resourceType=""" & resourceType & """>"
' Add the current folder node.
Response.Write "<CurrentFolder path=""" & ConvertToXmlAttribute( currentFolder ) & """ url=""" & ConvertToXmlAttribute( url ) & """ />"
End Sub
Sub CreateXmlFooter()
Response.Write "</Connector>"
End Sub
Sub SendError( number, text )
SetXmlHeaders
' Create the XML document header.
Response.Write "<?xml version=""1.0"" encoding=""utf-8"" ?>"
Response.Write "<Connector><Error number=""" & number & """ text=""" & Server.HTMLEncode( text ) & """ /></Connector>"
Response.End
End Sub
%>

View file

@ -0,0 +1,353 @@
<%
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
' Copyright (C) 2003-2007 Frederico Caldeira Knabben
'
' == BEGIN LICENSE ==
'
' Licensed under the terms of any of the following licenses at your
' choice:
'
' - GNU General Public License Version 2 or later (the "GPL")
' http://www.gnu.org/licenses/gpl.html
'
' - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
' http://www.gnu.org/licenses/lgpl.html
'
' - Mozilla Public License Version 1.1 or later (the "MPL")
' http://www.mozilla.org/MPL/MPL-1.1.html
'
' == END LICENSE ==
'
' These are the classes used to handle ASP upload without using third
' part components (OCX/DLL).
%>
<%
'**********************************************
' File: NetRube_Upload.asp
' Version: NetRube Upload Class Version 2.3 Build 20070528
' Author: NetRube
' Email: NetRube@126.com
' Date: 05/28/2007
' Comments: The code for the Upload.
' This can free usage, but please
' not to delete this copyright information.
' If you have a modification version,
' Please send out a duplicate to me.
'**********************************************
' 文件名: NetRube_Upload.asp
' 版本: NetRube Upload Class Version 2.3 Build 20070528
' 作者: NetRube(网络乡巴佬)
' 电子邮件: NetRube@126.com
' 日期: 2007年05月28日
' 声明: 文件上传类
' 本上传类可以自由使用,但请保留此版权声明信息
' 如果您对本上传类进行修改增强,
' 请发送一份给俺。
'**********************************************
Class NetRube_Upload
Public File, Form
Private oSourceData
Private nMaxSize, nErr, sAllowed, sDenied, sHtmlExtensions
Private Sub Class_Initialize
nErr = 0
nMaxSize = 1048576
Set File = Server.CreateObject("Scripting.Dictionary")
File.CompareMode = 1
Set Form = Server.CreateObject("Scripting.Dictionary")
Form.CompareMode = 1
Set oSourceData = Server.CreateObject("ADODB.Stream")
oSourceData.Type = 1
oSourceData.Mode = 3
oSourceData.Open
End Sub
Private Sub Class_Terminate
Form.RemoveAll
Set Form = Nothing
File.RemoveAll
Set File = Nothing
oSourceData.Close
Set oSourceData = Nothing
End Sub
Public Property Get Version
Version = "NetRube Upload Class Version 2.3 Build 20070528"
End Property
Public Property Get ErrNum
ErrNum = nErr
End Property
Public Property Let MaxSize(nSize)
nMaxSize = nSize
End Property
Public Property Let Allowed(sExt)
sAllowed = sExt
End Property
Public Property Let Denied(sExt)
sDenied = sExt
End Property
Public Property Let HtmlExtensions(sExt)
sHtmlExtensions = sExt
End Property
Public Sub GetData
Dim aCType
aCType = Split(Request.ServerVariables("HTTP_CONTENT_TYPE"), ";")
if ( uBound(aCType) < 0 ) then
nErr = 1
Exit Sub
end if
If aCType(0) <> "multipart/form-data" Then
nErr = 1
Exit Sub
End If
Dim nTotalSize
nTotalSize = Request.TotalBytes
If nTotalSize < 1 Then
nErr = 2
Exit Sub
End If
If nMaxSize > 0 And nTotalSize > nMaxSize Then
nErr = 3
Exit Sub
End If
'Thankful long(yrl031715@163.com)
'Fix upload large file.
'**********************************************
' 修正作者long
' 联系邮件: yrl031715@163.com
' 修正时间2007年5月6日
' 修正说明由于iis6的Content-Length 头信息中包含的请求长度超过了 AspMaxRequestEntityAllowed 的值默认200K, IIS 将返回一个 403 错误信息.
' 直接导致在iis6下调试FCKeditor上传功能时一旦文件超过200K,上传文件时文件管理器失去响应,受此影响,文件的快速上传功能也存在在缺陷。
' 在参考 宝玉 的 Asp无组件上传带进度条 演示程序后作出如下修改以修正在iis6下的错误。
Dim nTotalBytes, nPartBytes, ReadBytes
ReadBytes = 0
nTotalBytes = Request.TotalBytes
'循环分块读取
Do While ReadBytes < nTotalBytes
'分块读取
nPartBytes = 64 * 1024 '分成每块64k
If nPartBytes + ReadBytes > nTotalBytes Then
nPartBytes = nTotalBytes - ReadBytes
End If
oSourceData.Write Request.BinaryRead(nPartBytes)
ReadBytes = ReadBytes + nPartBytes
Loop
'**********************************************
oSourceData.Position = 0
Dim oTotalData, oFormStream, sFormHeader, sFormName, bCrLf, nBoundLen, nFormStart, nFormEnd, nPosStart, nPosEnd, sBoundary
oTotalData = oSourceData.Read
bCrLf = ChrB(13) & ChrB(10)
sBoundary = MidB(oTotalData, 1, InStrB(1, oTotalData, bCrLf) - 1)
nBoundLen = LenB(sBoundary) + 2
nFormStart = nBoundLen
Set oFormStream = Server.CreateObject("ADODB.Stream")
Do While (nFormStart + 2) < nTotalSize
nFormEnd = InStrB(nFormStart, oTotalData, bCrLf & bCrLf) + 3
With oFormStream
.Type = 1
.Mode = 3
.Open
oSourceData.Position = nFormStart
oSourceData.CopyTo oFormStream, nFormEnd - nFormStart
.Position = 0
.Type = 2
.CharSet = "UTF-8"
sFormHeader = .ReadText
.Close
End With
nFormStart = InStrB(nFormEnd, oTotalData, sBoundary) - 1
nPosStart = InStr(22, sFormHeader, " name=", 1) + 7
nPosEnd = InStr(nPosStart, sFormHeader, """")
sFormName = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
If InStr(45, sFormHeader, " filename=", 1) > 0 Then
Set File(sFormName) = New NetRube_FileInfo
File(sFormName).FormName = sFormName
File(sFormName).Start = nFormEnd
File(sFormName).Size = nFormStart - nFormEnd - 2
nPosStart = InStr(nPosEnd, sFormHeader, " filename=", 1) + 11
nPosEnd = InStr(nPosStart, sFormHeader, """")
File(sFormName).ClientPath = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
File(sFormName).Name = Mid(File(sFormName).ClientPath, InStrRev(File(sFormName).ClientPath, "\") + 1)
File(sFormName).Ext = LCase(Mid(File(sFormName).Name, InStrRev(File(sFormName).Name, ".") + 1))
nPosStart = InStr(nPosEnd, sFormHeader, "Content-Type: ", 1) + 14
nPosEnd = InStr(nPosStart, sFormHeader, vbCr)
File(sFormName).MIME = Mid(sFormHeader, nPosStart, nPosEnd - nPosStart)
Else
With oFormStream
.Type = 1
.Mode = 3
.Open
oSourceData.Position = nFormEnd
oSourceData.CopyTo oFormStream, nFormStart - nFormEnd - 2
.Position = 0
.Type = 2
.CharSet = "UTF-8"
Form(sFormName) = .ReadText
.Close
End With
End If
nFormStart = nFormStart + nBoundLen
Loop
oTotalData = ""
Set oFormStream = Nothing
End Sub
Public Sub SaveAs(sItem, sFileName)
If File(sItem).Size < 1 Then
nErr = 2
Exit Sub
End If
If Not IsAllowed(File(sItem).Ext) Then
nErr = 4
Exit Sub
End If
If InStr( LCase( sFileName ), "::$data" ) > 0 Then
nErr = 4
Exit Sub
End If
Dim sFileExt, iFileSize
sFileExt = File(sItem).Ext
iFileSize = File(sItem).Size
' Check XSS.
If Not IsHtmlExtension( sFileExt ) Then
' Calculate the size of data to load (max 1Kb).
Dim iXSSSize
iXSSSize = iFileSize
If iXSSSize > 1024 Then
iXSSSize = 1024
End If
' Read the data.
Dim sData
oSourceData.Position = File(sItem).Start
sData = oSourceData.Read( iXSSSize ) ' Byte Array
sData = ByteArray2Text( sData ) ' String
' Sniff HTML data.
If SniffHtml( sData ) Then
nErr = 4
Exit Sub
End If
End If
Dim oFileStream
Set oFileStream = Server.CreateObject("ADODB.Stream")
With oFileStream
.Type = 1
.Mode = 3
.Open
oSourceData.Position = File(sItem).Start
oSourceData.CopyTo oFileStream, File(sItem).Size
.Position = 0
.SaveToFile sFileName, 2
.Close
End With
Set oFileStream = Nothing
End Sub
Private Function IsAllowed(sExt)
Dim oRE
Set oRE = New RegExp
oRE.IgnoreCase = True
oRE.Global = True
If sDenied = "" Then
oRE.Pattern = sAllowed
IsAllowed = (sAllowed = "") Or oRE.Test(sExt)
Else
oRE.Pattern = sDenied
IsAllowed = Not oRE.Test(sExt)
End If
Set oRE = Nothing
End Function
Private Function IsHtmlExtension( sExt )
If sHtmlExtensions = "" Then
Exit Function
End If
Dim oRE
Set oRE = New RegExp
oRE.IgnoreCase = True
oRE.Global = True
oRE.Pattern = sHtmlExtensions
IsHtmlExtension = oRE.Test(sExt)
Set oRE = Nothing
End Function
Private Function SniffHtml( sData )
Dim oRE
Set oRE = New RegExp
oRE.IgnoreCase = True
oRE.Global = True
Dim aPatterns
aPatterns = Array( "<!DOCTYPE\W*X?HTML", "<(body|head|html|img|pre|script|table|title)", "type\s*=\s*[\'""]?\s*(?:\w*/)?(?:ecma|java)", "(?:href|src|data)\s*=\s*[\'""]?\s*(?:ecma|java)script:", "url\s*\(\s*[\'""]?\s*(?:ecma|java)script:" )
Dim i
For i = 0 to UBound( aPatterns )
oRE.Pattern = aPatterns( i )
If oRE.Test( sData ) Then
SniffHtml = True
Exit Function
End If
Next
SniffHtml = False
End Function
' Thanks to http://www.ericphelps.com/q193998/index.htm
Private Function ByteArray2Text(varByteArray)
Dim strData, strBuffer, lngCounter
strData = ""
strBuffer = ""
For lngCounter = 0 to UBound(varByteArray)
strBuffer = strBuffer & Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1, 1)))
'Keep strBuffer at 1k bytes maximum
If lngCounter Mod 1024 = 0 Then
strData = strData & strBuffer
strBuffer = ""
End If
Next
ByteArray2Text = strData & strBuffer
End Function
End Class
Class NetRube_FileInfo
Dim FormName, ClientPath, Path, Name, Ext, Content, Size, MIME, Start
End Class
%>

View file

@ -0,0 +1,198 @@
<%
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
' Copyright (C) 2003-2007 Frederico Caldeira Knabben
'
' == BEGIN LICENSE ==
'
' Licensed under the terms of any of the following licenses at your
' choice:
'
' - GNU General Public License Version 2 or later (the "GPL")
' http://www.gnu.org/licenses/gpl.html
'
' - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
' http://www.gnu.org/licenses/lgpl.html
'
' - Mozilla Public License Version 1.1 or later (the "MPL")
' http://www.mozilla.org/MPL/MPL-1.1.html
'
' == END LICENSE ==
'
' This file include the functions that handle the Command requests
' in the ASP Connector.
%>
<%
Sub GetFolders( resourceType, currentFolder )
' Map the virtual path to the local server path.
Dim sServerDir
sServerDir = ServerMapFolder( resourceType, currentFolder, "GetFolders" )
' Open the "Folders" node.
Response.Write "<Folders>"
Dim oFSO, oCurrentFolder, oFolders, oFolder
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
if not (oFSO.FolderExists( sServerDir ) ) then
Set oFSO = Nothing
SendError 102, currentFolder
end if
Set oCurrentFolder = oFSO.GetFolder( sServerDir )
Set oFolders = oCurrentFolder.SubFolders
For Each oFolder in oFolders
Response.Write "<Folder name=""" & ConvertToXmlAttribute( oFolder.name ) & """ />"
Next
Set oFSO = Nothing
' Close the "Folders" node.
Response.Write "</Folders>"
End Sub
Sub GetFoldersAndFiles( resourceType, currentFolder )
' Map the virtual path to the local server path.
Dim sServerDir
sServerDir = ServerMapFolder( resourceType, currentFolder, "GetFoldersAndFiles" )
Dim oFSO, oCurrentFolder, oFolders, oFolder, oFiles, oFile
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
if not (oFSO.FolderExists( sServerDir ) ) then
Set oFSO = Nothing
SendError 102, currentFolder
end if
Set oCurrentFolder = oFSO.GetFolder( sServerDir )
Set oFolders = oCurrentFolder.SubFolders
Set oFiles = oCurrentFolder.Files
' Open the "Folders" node.
Response.Write "<Folders>"
For Each oFolder in oFolders
Response.Write "<Folder name=""" & ConvertToXmlAttribute( oFolder.name ) & """ />"
Next
' Close the "Folders" node.
Response.Write "</Folders>"
' Open the "Files" node.
Response.Write "<Files>"
For Each oFile in oFiles
Dim iFileSize
iFileSize = Round( oFile.size / 1024 )
If ( iFileSize < 1 AND oFile.size <> 0 ) Then iFileSize = 1
Response.Write "<File name=""" & ConvertToXmlAttribute( oFile.name ) & """ size=""" & iFileSize & """ />"
Next
' Close the "Files" node.
Response.Write "</Files>"
End Sub
Sub CreateFolder( resourceType, currentFolder )
Dim sErrorNumber
Dim sNewFolderName
sNewFolderName = Request.QueryString( "NewFolderName" )
sNewFolderName = SanitizeFolderName( sNewFolderName )
If ( sNewFolderName = "" OR InStr( 1, sNewFolderName, ".." ) > 0 ) Then
sErrorNumber = "102"
Else
' Map the virtual path to the local server path of the current folder.
Dim sServerDir
sServerDir = ServerMapFolder( resourceType, CombinePaths(currentFolder, sNewFolderName), "CreateFolder" )
On Error Resume Next
CreateServerFolder sServerDir
Dim iErrNumber, sErrDescription
iErrNumber = err.number
sErrDescription = err.Description
On Error Goto 0
Select Case iErrNumber
Case 0
sErrorNumber = "0"
Case 52
sErrorNumber = "102" ' Invalid Folder Name.
Case 70
sErrorNumber = "103" ' Security Error.
Case 76
sErrorNumber = "102" ' Path too long.
Case Else
sErrorNumber = "110"
End Select
End If
' Create the "Error" node.
Response.Write "<Error number=""" & sErrorNumber & """ originalNumber=""" & iErrNumber & """ originalDescription=""" & ConvertToXmlAttribute( sErrDescription ) & """ />"
End Sub
Sub FileUpload( resourceType, currentFolder, sCommand )
Dim oUploader
Set oUploader = New NetRube_Upload
oUploader.MaxSize = 0
oUploader.Allowed = ConfigAllowedExtensions.Item( resourceType )
oUploader.Denied = ConfigDeniedExtensions.Item( resourceType )
oUploader.HtmlExtensions = ConfigHtmlExtensions
oUploader.GetData
Dim sErrorNumber
sErrorNumber = "0"
Dim sFileName, sOriginalFileName, sExtension
sFileName = ""
If oUploader.ErrNum > 0 Then
sErrorNumber = "202"
Else
' Map the virtual path to the local server path.
Dim sServerDir
sServerDir = ServerMapFolder( resourceType, currentFolder, sCommand )
Dim oFSO
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
if not (oFSO.FolderExists( sServerDir ) ) then
sErrorNumber = "102"
else
' Get the uploaded file name.
sFileName = oUploader.File( "NewFile" ).Name
sExtension = oUploader.File( "NewFile" ).Ext
sFileName = SanitizeFileName( sFileName )
sOriginalFileName = sFileName
Dim iCounter
iCounter = 0
Do While ( True )
Dim sFilePath
sFilePath = sServerDir & sFileName
If ( oFSO.FileExists( sFilePath ) ) Then
iCounter = iCounter + 1
sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
sErrorNumber = "201"
Else
oUploader.SaveAs "NewFile", sFilePath
If oUploader.ErrNum > 0 Then sErrorNumber = "202"
Exit Do
End If
Loop
end if
End If
Set oUploader = Nothing
dim sFileUrl
sFileUrl = CombinePaths( GetResourceTypePath( resourceType, sCommand ) , currentFolder )
sFileUrl = CombinePaths( sFileUrl, sFileName )
SendUploadResults sErrorNumber, sFileUrl, sFileName, ""
End Sub
%>

View file

@ -0,0 +1,128 @@
<%
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
' Copyright (C) 2003-2007 Frederico Caldeira Knabben
'
' == BEGIN LICENSE ==
'
' Licensed under the terms of any of the following licenses at your
' choice:
'
' - GNU General Public License Version 2 or later (the "GPL")
' http://www.gnu.org/licenses/gpl.html
'
' - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
' http://www.gnu.org/licenses/lgpl.html
'
' - Mozilla Public License Version 1.1 or later (the "MPL")
' http://www.mozilla.org/MPL/MPL-1.1.html
'
' == END LICENSE ==
'
' Configuration file for the File Manager Connector for ASP.
%>
<%
' SECURITY: You must explicitly enable this "connector" (set it to "True").
' WARNING: don't just set "ConfigIsEnabled = true", you must be sure that only
' authenticated users can access this file or use some kind of session checking.
Dim ConfigIsEnabled
ConfigIsEnabled = False
' Path to user files relative to the document root.
' This setting is preserved only for backward compatibility.
' You should look at the settings for each resource type to get the full potential
Dim ConfigUserFilesPath
ConfigUserFilesPath = "/userfiles/"
' Due to security issues with Apache modules, it is recommended to leave the
' following setting enabled.
Dim ConfigForceSingleExtension
ConfigForceSingleExtension = true
' What the user can do with this connector
Dim ConfigAllowedCommands
ConfigAllowedCommands = "QuickUpload|FileUpload|GetFolders|GetFoldersAndFiles|CreateFolder"
' Allowed Resource Types
Dim ConfigAllowedTypes
ConfigAllowedTypes = "File|Image|Flash|Media"
' For security, HTML is allowed in the first Kb of data for files having the
' following extensions only.
Dim ConfigHtmlExtensions
ConfigHtmlExtensions = "html|htm|xml|xsd|txt|js"
'
' Configuration settings for each Resource Type
'
' - AllowedExtensions: the possible extensions that can be allowed.
' If it is empty then any file type can be uploaded.
'
' - DeniedExtensions: The extensions that won't be allowed.
' If it is empty then no restrictions are done here.
'
' For a file to be uploaded it has to fulfill both the AllowedExtensions
' and DeniedExtensions (that's it: not being denied) conditions.
'
' - FileTypesPath: the virtual folder relative to the document root where
' these resources will be located.
' Attention: It must start and end with a slash: '/'
'
' - FileTypesAbsolutePath: the physical path to the above folder. It must be
' an absolute path.
' If it's an empty string then it will be autocalculated.
' Useful if you are using a virtual directory, symbolic link or alias.
' Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
' Attention: The above 'FileTypesPath' must point to the same directory.
' Attention: It must end with a slash: '/'
'
' - QuickUploadPath: the virtual folder relative to the document root where
' these resources will be uploaded using the Upload tab in the resources
' dialogs.
' Attention: It must start and end with a slash: '/'
'
' - QuickUploadAbsolutePath: the physical path to the above folder. It must be
' an absolute path.
' If it's an empty string then it will be autocalculated.
' Useful if you are using a virtual directory, symbolic link or alias.
' Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
' Attention: The above 'QuickUploadPath' must point to the same directory.
' Attention: It must end with a slash: '/'
'
Dim ConfigAllowedExtensions, ConfigDeniedExtensions, ConfigFileTypesPath, ConfigFileTypesAbsolutePath, ConfigQuickUploadPath, ConfigQuickUploadAbsolutePath
Set ConfigAllowedExtensions = CreateObject( "Scripting.Dictionary" )
Set ConfigDeniedExtensions = CreateObject( "Scripting.Dictionary" )
Set ConfigFileTypesPath = CreateObject( "Scripting.Dictionary" )
Set ConfigFileTypesAbsolutePath = CreateObject( "Scripting.Dictionary" )
Set ConfigQuickUploadPath = CreateObject( "Scripting.Dictionary" )
Set ConfigQuickUploadAbsolutePath = CreateObject( "Scripting.Dictionary" )
ConfigAllowedExtensions.Add "File", "7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip"
ConfigDeniedExtensions.Add "File", ""
ConfigFileTypesPath.Add "File", ConfigUserFilesPath & "file/"
ConfigFileTypesAbsolutePath.Add "File", ""
ConfigQuickUploadPath.Add "File", ConfigUserFilesPath
ConfigQuickUploadAbsolutePath.Add "File", ""
ConfigAllowedExtensions.Add "Image", "bmp|gif|jpeg|jpg|png"
ConfigDeniedExtensions.Add "Image", ""
ConfigFileTypesPath.Add "Image", ConfigUserFilesPath & "image/"
ConfigFileTypesAbsolutePath.Add "Image", ""
ConfigQuickUploadPath.Add "Image", ConfigUserFilesPath
ConfigQuickUploadAbsolutePath.Add "Image", ""
ConfigAllowedExtensions.Add "Flash", "swf|flv"
ConfigDeniedExtensions.Add "Flash", ""
ConfigFileTypesPath.Add "Flash", ConfigUserFilesPath & "flash/"
ConfigFileTypesAbsolutePath.Add "Flash", ""
ConfigQuickUploadPath.Add "Flash", ConfigUserFilesPath
ConfigQuickUploadAbsolutePath.Add "Flash", ""
ConfigAllowedExtensions.Add "Media", "aiff|asf|avi|bmp|fla|flv|gif|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|png|qt|ram|rm|rmi|rmvb|swf|tif|tiff|wav|wma|wmv"
ConfigDeniedExtensions.Add "Media", ""
ConfigFileTypesPath.Add "Media", ConfigUserFilesPath & "media/"
ConfigFileTypesAbsolutePath.Add "Media", ""
ConfigQuickUploadPath.Add "Media", ConfigUserFilesPath
ConfigQuickUploadAbsolutePath.Add "Media", ""
%>

View file

@ -0,0 +1,88 @@
<%@ CodePage=65001 Language="VBScript"%>
<%
Option Explicit
Response.Buffer = True
%>
<%
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
' Copyright (C) 2003-2007 Frederico Caldeira Knabben
'
' == BEGIN LICENSE ==
'
' Licensed under the terms of any of the following licenses at your
' choice:
'
' - GNU General Public License Version 2 or later (the "GPL")
' http://www.gnu.org/licenses/gpl.html
'
' - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
' http://www.gnu.org/licenses/lgpl.html
'
' - Mozilla Public License Version 1.1 or later (the "MPL")
' http://www.mozilla.org/MPL/MPL-1.1.html
'
' == END LICENSE ==
'
' This is the File Manager Connector for ASP.
%>
<!--#include file="config.asp"-->
<!--#include file="util.asp"-->
<!--#include file="io.asp"-->
<!--#include file="basexml.asp"-->
<!--#include file="commands.asp"-->
<!--#include file="class_upload.asp"-->
<%
If ( ConfigIsEnabled = False ) Then
SendError 1, "This connector is disabled. Please check the ""editor/filemanager/connectors/asp/config.asp"" file"
End If
DoResponse
Sub DoResponse()
Dim sCommand, sResourceType, sCurrentFolder
' Get the main request information.
sCommand = Request.QueryString("Command")
sResourceType = Request.QueryString("Type")
If ( sResourceType = "" ) Then sResourceType = "File"
sCurrentFolder = GetCurrentFolder()
' Check if it is an allowed command
if ( Not IsAllowedCommand( sCommand ) ) then
SendError 1, "The """ & sCommand & """ command isn't allowed"
end if
' Check if it is an allowed resource type.
if ( Not IsAllowedType( sResourceType ) ) Then
SendError 1, "The """ & sResourceType & """ resource type isn't allowed"
end if
' File Upload doesn't have to Return XML, so it must be intercepted before anything.
If ( sCommand = "FileUpload" ) Then
FileUpload sResourceType, sCurrentFolder, sCommand
Exit Sub
End If
SetXmlHeaders
CreateXmlHeader sCommand, sResourceType, sCurrentFolder, GetUrlFromPath( sResourceType, sCurrentFolder, sCommand)
' Execute the required command.
Select Case sCommand
Case "GetFolders"
GetFolders sResourceType, sCurrentFolder
Case "GetFoldersAndFiles"
GetFoldersAndFiles sResourceType, sCurrentFolder
Case "CreateFolder"
CreateFolder sResourceType, sCurrentFolder
End Select
CreateXmlFooter
Response.End
End Sub
%>

View file

@ -0,0 +1,222 @@
<%
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
' Copyright (C) 2003-2007 Frederico Caldeira Knabben
'
' == BEGIN LICENSE ==
'
' Licensed under the terms of any of the following licenses at your
' choice:
'
' - GNU General Public License Version 2 or later (the "GPL")
' http://www.gnu.org/licenses/gpl.html
'
' - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
' http://www.gnu.org/licenses/lgpl.html
'
' - Mozilla Public License Version 1.1 or later (the "MPL")
' http://www.mozilla.org/MPL/MPL-1.1.html
'
' == END LICENSE ==
'
' This file include IO specific functions used by the ASP Connector.
%>
<%
function CombinePaths( sBasePath, sFolder)
CombinePaths = RemoveFromEnd( sBasePath, "/" ) & "/" & RemoveFromStart( sFolder, "/" )
end function
Function GetResourceTypePath( resourceType, sCommand )
if ( sCommand = "QuickUpload") then
GetResourceTypePath = ConfigQuickUploadPath.Item( resourceType )
else
GetResourceTypePath = ConfigFileTypesPath.Item( resourceType )
end if
end Function
Function GetResourceTypeDirectory( resourceType, sCommand )
if ( sCommand = "QuickUpload") then
if ( ConfigQuickUploadAbsolutePath.Item( resourceType ) <> "" ) then
GetResourceTypeDirectory = ConfigQuickUploadAbsolutePath.Item( resourceType )
else
' Map the "UserFiles" path to a local directory.
GetResourceTypeDirectory = Server.MapPath( ConfigQuickUploadPath.Item( resourceType ) )
end if
else
if ( ConfigFileTypesAbsolutePath.Item( resourceType ) <> "" ) then
GetResourceTypeDirectory = ConfigFileTypesAbsolutePath.Item( resourceType )
else
' Map the "UserFiles" path to a local directory.
GetResourceTypeDirectory = Server.MapPath( ConfigFileTypesPath.Item( resourceType ) )
end if
end if
end Function
Function GetUrlFromPath( resourceType, folderPath, sCommand )
GetUrlFromPath = CombinePaths( GetResourceTypePath( resourceType, sCommand ), folderPath )
End Function
Function RemoveExtension( fileName )
RemoveExtension = Left( fileName, InStrRev( fileName, "." ) - 1 )
End Function
Function ServerMapFolder( resourceType, folderPath, sCommand )
Dim sResourceTypePath
' Get the resource type directory.
sResourceTypePath = GetResourceTypeDirectory( resourceType, sCommand )
' Ensure that the directory exists.
CreateServerFolder sResourceTypePath
' Return the resource type directory combined with the required path.
ServerMapFolder = CombinePaths( sResourceTypePath, folderPath )
End Function
Sub CreateServerFolder( folderPath )
Dim oFSO
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
Dim sParent
sParent = oFSO.GetParentFolderName( folderPath )
' Check if the parent exists, or create it.
If ( NOT oFSO.FolderExists( sParent ) ) Then CreateServerFolder( sParent )
If ( oFSO.FolderExists( folderPath ) = False ) Then
On Error resume next
oFSO.CreateFolder( folderPath )
if err.number<>0 then
dim sErrorNumber
Dim iErrNumber, sErrDescription
iErrNumber = err.number
sErrDescription = err.Description
On Error Goto 0
Select Case iErrNumber
Case 52
sErrorNumber = "102" ' Invalid Folder Name.
Case 70
sErrorNumber = "103" ' Security Error.
Case 76
sErrorNumber = "102" ' Path too long.
Case Else
sErrorNumber = "110"
End Select
SendError sErrorNumber, "CreateServerFolder(" & folderPath & ") : " & sErrDescription
end if
End If
Set oFSO = Nothing
End Sub
Function IsAllowedExt( extension, resourceType )
Dim oRE
Set oRE = New RegExp
oRE.IgnoreCase = True
oRE.Global = True
Dim sAllowed, sDenied
sAllowed = ConfigAllowedExtensions.Item( resourceType )
sDenied = ConfigDeniedExtensions.Item( resourceType )
IsAllowedExt = True
If sDenied <> "" Then
oRE.Pattern = sDenied
IsAllowedExt = Not oRE.Test( extension )
End If
If IsAllowedExt And sAllowed <> "" Then
oRE.Pattern = sAllowed
IsAllowedExt = oRE.Test( extension )
End If
Set oRE = Nothing
End Function
Function IsAllowedType( resourceType )
Dim oRE
Set oRE = New RegExp
oRE.IgnoreCase = True
oRE.Global = True
oRE.Pattern = "^(" & ConfigAllowedTypes & ")$"
IsAllowedType = oRE.Test( resourceType )
Set oRE = Nothing
End Function
Function IsAllowedCommand( sCommand )
Dim oRE
Set oRE = New RegExp
oRE.IgnoreCase = True
oRE.Global = True
oRE.Pattern = "^(" & ConfigAllowedCommands & ")$"
IsAllowedCommand = oRE.Test( sCommand )
Set oRE = Nothing
End Function
function GetCurrentFolder()
dim sCurrentFolder
sCurrentFolder = Request.QueryString("CurrentFolder")
If ( sCurrentFolder = "" ) Then sCurrentFolder = "/"
' Check the current folder syntax (must begin and start with a slash).
If ( Right( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = sCurrentFolder & "/"
If ( Left( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = "/" & sCurrentFolder
' Check for invalid folder paths (..)
If ( InStr( 1, sCurrentFolder, ".." ) <> 0 ) Then
SendError 102, ""
End If
GetCurrentFolder = sCurrentFolder
end function
' Do a cleanup of the folder name to avoid possible problems
function SanitizeFolderName( sNewFolderName )
Dim oRegex
Set oRegex = New RegExp
oRegex.Global = True
' remove . \ / | : ? * " < >
oRegex.Pattern = "(\.|\\|\/|\||:|\?|\*|""|\<|\>)"
SanitizeFolderName = oRegex.Replace( sNewFolderName, "_" )
Set oRegex = Nothing
end function
' Do a cleanup of the file name to avoid possible problems
function SanitizeFileName( sNewFileName )
Dim oRegex
Set oRegex = New RegExp
oRegex.Global = True
if ( ConfigForceSingleExtension = True ) then
oRegex.Pattern = "\.(?![^.]*$)"
sNewFileName = oRegex.Replace( sNewFileName, "_" )
end if
' remove \ / | : ? * " < >
oRegex.Pattern = "(\\|\/|\||:|\?|\*|""|\<|\>)"
SanitizeFileName = oRegex.Replace( sNewFileName, "_" )
Set oRegex = Nothing
end function
' This is the function that sends the results of the uploading process.
Sub SendUploadResults( errorNumber, fileUrl, fileName, customMsg )
Response.Clear
Response.Write "<script type=""text/javascript"">"
Response.Write "window.parent.OnUploadCompleted(" & errorNumber & ",""" & Replace( fileUrl, """", "\""" ) & """,""" & Replace( fileName, """", "\""" ) & """,""" & Replace( customMsg , """", "\""" ) & """) ;"
Response.Write "</script>"
Response.End
End Sub
%>

View file

@ -0,0 +1,61 @@
<%@ CodePage=65001 Language="VBScript"%>
<%
Option Explicit
Response.Buffer = True
%>
<%
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
' Copyright (C) 2003-2007 Frederico Caldeira Knabben
'
' == BEGIN LICENSE ==
'
' Licensed under the terms of any of the following licenses at your
' choice:
'
' - GNU General Public License Version 2 or later (the "GPL")
' http://www.gnu.org/licenses/gpl.html
'
' - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
' http://www.gnu.org/licenses/lgpl.html
'
' - Mozilla Public License Version 1.1 or later (the "MPL")
' http://www.mozilla.org/MPL/MPL-1.1.html
'
' == END LICENSE ==
'
' This is the "File Uploader" for ASP.
%>
<!--#include file="config.asp"-->
<!--#include file="util.asp"-->
<!--#include file="io.asp"-->
<!--#include file="commands.asp"-->
<!--#include file="class_upload.asp"-->
<%
' Check if this uploader has been enabled.
If ( ConfigIsEnabled = False ) Then
SendUploadResults "1", "", "", "This file uploader is disabled. Please check the ""editor/filemanager/connectors/asp/config.asp"" file"
End If
Dim sCommand, sResourceType, sCurrentFolder
sCommand = "QuickUpload"
sResourceType = Request.QueryString("Type")
If ( sResourceType = "" ) Then sResourceType = "File"
sCurrentFolder = GetCurrentFolder()
' Is Upload enabled?
if ( Not IsAllowedCommand( sCommand ) ) then
SendUploadResults "1", "", "", "The """ & sCommand & """ command isn't allowed"
end if
' Check if it is an allowed resource type.
if ( Not IsAllowedType( sResourceType ) ) Then
SendUploadResults "1", "", "", "The " & sResourceType & " resource type isn't allowed"
end if
FileUpload sResourceType, sCurrentFolder, sCommand
%>

View file

@ -0,0 +1,55 @@
<%
' FCKeditor - The text editor for Internet - http://www.fckeditor.net
' Copyright (C) 2003-2007 Frederico Caldeira Knabben
'
' == BEGIN LICENSE ==
'
' Licensed under the terms of any of the following licenses at your
' choice:
'
' - GNU General Public License Version 2 or later (the "GPL")
' http://www.gnu.org/licenses/gpl.html
'
' - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
' http://www.gnu.org/licenses/lgpl.html
'
' - Mozilla Public License Version 1.1 or later (the "MPL")
' http://www.mozilla.org/MPL/MPL-1.1.html
'
' == END LICENSE ==
'
' This file include generic functions used by the ASP Connector.
%>
<%
Function RemoveFromStart( sourceString, charToRemove )
Dim oRegex
Set oRegex = New RegExp
oRegex.Pattern = "^" & charToRemove & "+"
RemoveFromStart = oRegex.Replace( sourceString, "" )
End Function
Function RemoveFromEnd( sourceString, charToRemove )
Dim oRegex
Set oRegex = New RegExp
oRegex.Pattern = charToRemove & "+$"
RemoveFromEnd = oRegex.Replace( sourceString, "" )
End Function
Function ConvertToXmlAttribute( value )
ConvertToXmlAttribute = Replace( value, "&", "&amp;" )
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
%>

View file

@ -0,0 +1,98 @@
<%@ Control Language="C#" EnableViewState="false" AutoEventWireup="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Config" %>
<%--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Configuration file for the File Browser Connector for ASP.NET.
--%>
<script runat="server">
/**
* This function must check the user session to be sure that he/she is
* authorized to upload and access files in the File Browser.
*/
private bool CheckAuthentication()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
//
// return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
//
// ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
// user logs in your system.
return false;
}
public override void SetConfig()
{
// SECURITY: You must explicitly enable this "connector". (Set it to "true").
Enabled = CheckAuthentication();
// URL path to user files.
UserFilesPath = "/userfiles/";
// The connector tries to resolve the above UserFilesPath automatically.
// Use the following setting it you prefer to explicitely specify the
// absolute path. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
// Attention: The above 'UserFilesPath' URL must point to the same directory.
UserFilesAbsolutePath = "";
// Due to security issues with Apache modules, it is recommended to leave the
// following setting enabled.
ForceSingleExtension = true;
// Allowed Resource Types
AllowedTypes = new string[] { "File", "Image", "Flash", "Media" };
// For security, HTML is allowed in the first Kb of data for files having the
// following extensions only.
HtmlExtensions = new string[] { "html", "htm", "xml", "xsd", "txt", "js" };
TypeConfig[ "File" ].AllowedExtensions = new string[] { "7z", "aiff", "asf", "avi", "bmp", "csv", "doc", "fla", "flv", "gif", "gz", "gzip", "jpeg", "jpg", "mid", "mov", "mp3", "mp4", "mpc", "mpeg", "mpg", "ods", "odt", "pdf", "png", "ppt", "pxd", "qt", "ram", "rar", "rm", "rmi", "rmvb", "rtf", "sdc", "sitd", "swf", "sxc", "sxw", "tar", "tgz", "tif", "tiff", "txt", "vsd", "wav", "wma", "wmv", "xls", "xml", "zip" };
TypeConfig[ "File" ].DeniedExtensions = new string[] { };
TypeConfig[ "File" ].FilesPath = "%UserFilesPath%file/";
TypeConfig[ "File" ].FilesAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%file/" );
TypeConfig[ "File" ].QuickUploadPath = "%UserFilesPath%";
TypeConfig[ "File" ].QuickUploadAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%" );
TypeConfig[ "Image" ].AllowedExtensions = new string[] { "bmp", "gif", "jpeg", "jpg", "png" };
TypeConfig[ "Image" ].DeniedExtensions = new string[] { };
TypeConfig[ "Image" ].FilesPath = "%UserFilesPath%image/";
TypeConfig[ "Image" ].FilesAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%image/" );
TypeConfig[ "Image" ].QuickUploadPath = "%UserFilesPath%";
TypeConfig[ "Image" ].QuickUploadAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%" );
TypeConfig[ "Flash" ].AllowedExtensions = new string[] { "swf", "flv" };
TypeConfig[ "Flash" ].DeniedExtensions = new string[] { };
TypeConfig[ "Flash" ].FilesPath = "%UserFilesPath%flash/";
TypeConfig[ "Flash" ].FilesAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%flash/" );
TypeConfig[ "Flash" ].QuickUploadPath = "%UserFilesPath%";
TypeConfig[ "Flash" ].QuickUploadAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%" );
TypeConfig[ "Media" ].AllowedExtensions = new string[] { "aiff", "asf", "avi", "bmp", "fla", "flv", "gif", "jpeg", "jpg", "mid", "mov", "mp3", "mp4", "mpc", "mpeg", "mpg", "png", "qt", "ram", "rm", "rmi", "rmvb", "swf", "tif", "tiff", "wav", "wma", "wmv" };
TypeConfig[ "Media" ].DeniedExtensions = new string[] { };
TypeConfig[ "Media" ].FilesPath = "%UserFilesPath%media/";
TypeConfig[ "Media" ].FilesAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%media/" );
TypeConfig[ "Media" ].QuickUploadPath = "%UserFilesPath%";
TypeConfig[ "Media" ].QuickUploadAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%" );
}
</script>

View file

@ -0,0 +1,32 @@
<%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Connector" AutoEventWireup="false" %>
<%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %>
<%--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the File Browser Connector for ASP.NET.
*
* The code of this page if included in the FCKeditor.Net package,
* in the FredCK.FCKeditorV2.dll assembly file. So to use it you must
* include that DLL in your "bin" directory.
*
* To download the FCKeditor.Net package, go to our official web site:
* http://www.fckeditor.net
--%>
<FCKeditor:Config id="Config" runat="server"></FCKeditor:Config>

View file

@ -0,0 +1,32 @@
<%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Uploader" AutoEventWireup="false" %>
<%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %>
<%--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the 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
--%>
<FCKeditor:Config id="Config" runat="server"></FCKeditor:Config>

View file

@ -0,0 +1,273 @@
<cfcomponent name="ImageObject">
<!---
ImageObject.cfc written by Rick Root (rick@webworksllc.com)
Related Web Sites:
- http://www.opensourcecf.com/imagecfc (home page)
This is an object oriented interface to the original
ImageCFC.
Example Code:
io = createObject("component","ImageObject");
io.setOption("defaultJpegCompression",95);
io.init("#ExpandPath(".")#/emily.jpg");
io.scaleWidth(500);
io.save("#ExpandPath(".")#/imagex1.jpg");
io.flipHorizontal();
io.save("#ExpandPath(".")#/imagex2.jpg");
io.revert();
io.filterFastBlur(2,5);
io.save("#ExpandPath(".")#/imagex3.jpg");
io.revert();
io.filterPosterize(32);
io.save("#ExpandPath(".")#/imagex4.jpg");
LICENSE
-------
Copyright (c) 2006, Rick Root <rick@webworksllc.com>
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
- Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
- Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
- Neither the name of the Webworks, LLC. nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
<cfset variables.img = "">
<cfset variables.revertimg = "">
<cfset variables.imageCFC = createObject("component","image")>
<cfset variables.imageInfo = structNew()>
<cfset variables.imageInfo.width = 0>
<cfset variables.imageInfo.height = 0>
<cfset variables.imageInfo.colorModel = "">
<cfset variables.imageInfo.colorspace = "">
<cfset variables.imageInfo.objColorModel = "">
<cfset variables.imageInfo.objColorspace = "">
<cfset variables.imageInfo.sampleModel = "">
<cfset variables.imageInfo.imageType = 0>
<cfset variables.imageInfo.misc = "">
<cfset variables.imageInfo.canModify = false>
<cfset variables.imageCFC.setOption("throwonerror",true)>
<!---
init(filename) Initialize object from a file.
init(width, height) Initialize with a blank image
init(bufferedImage) Initiailize with an existing object
--->
<cffunction name="init" access="public" output="false" returnType="void">
<cfargument name="arg1" type="any" required="yes">
<cfargument name="arg2" type="any" required="no">
<cfif isDefined("arg2") and isNumeric(arg1) and isNumeric(arg2)>
<cfset arg1 = javacast("int",int(arg1))>
<cfset arg2 = javacast("int",int(arg2))>
<cfset variables.img = createObject("java","java.awt.image.BufferedImage")>
<cfset variables.img.init(arg1,arg2,variables.img.TYPE_INT_RGB)>
<cfelseif arg1.getClass().getName() eq "java.awt.image.BufferedImage">
<cfset variables.img = arg1>
<cfelseif isSimpleValue(arg1) and len(arg1) gt 0>
<cfset imageResults = variables.imageCFC.readImage(arg1, "no")>
<cfset variables.img = imageResults.img>
<cfelse>
<cfthrow message="Object Instantiation Error" detail="You have attempted to initialize ooimage.cfc with invalid arguments. Please consult the documentation for correct initialization arguments.">
</cfif>
<cfif variables.revertimg eq "">
<cfset variables.revertimg = variables.img>
</cfif>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
<cfreturn>
</cffunction>
<cffunction name="flipHorizontal" access="public" output="true" returnType="void" hint="Flip an image horizontally.">
<cfset var imageResults = imageCFC.flipHorizontal(variables.img,"","")>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="getImageInfo" access="public" output="true" returntype="struct" hint="Returns image information.">
<cfreturn variables.imageInfo>
</cffunction>
<cffunction name="getImageObject" access="public" output="true" returntype="struct" hint="Returns a java Buffered Image Object.">
<cfreturn variables.img>
</cffunction>
<cffunction name="flipVertical" access="public" output="true" returntype="void" hint="Flop an image vertically.">
<cfset var imageResults = imageCFC.flipVertical(variables.img,"","")>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="scaleWidth" access="public" output="true" returntype="void" hint="Scale an image to a specific width.">
<cfargument name="newWidth" required="yes" type="numeric">
<cfset var imageResults = imageCFC.scaleWidth(variables.img,"","", newWidth)>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="scaleHeight" access="public" output="true" returntype="void" hint="Scale an image to a specific height.">
<cfargument name="newHeight" required="yes" type="numeric">
<cfset var imageResults = imageCFC.scaleHeight(variables.img,"","", newHeight)>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="resize" access="public" output="true" returntype="void" hint="Resize an image to a specific width and height.">
<cfargument name="newWidth" required="yes" type="numeric">
<cfargument name="newHeight" required="yes" type="numeric">
<cfargument name="preserveAspect" required="no" type="boolean" default="FALSE">
<cfargument name="cropToExact" required="no" type="boolean" default="FALSE">
<cfset var imageResults = imageCFC.resize(variables.img,"","",newWidth,newHeight,preserveAspect,cropToExact)>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="crop" access="public" output="true" returntype="void" hint="Crop an image.">
<cfargument name="fromX" required="yes" type="numeric">
<cfargument name="fromY" required="yes" type="numeric">
<cfargument name="newWidth" required="yes" type="numeric">
<cfargument name="newHeight" required="yes" type="numeric">
<cfset var imageResults = imageCFC.crop(variables.img,"","",fromX,fromY,newWidth,newHeight)>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="rotate" access="public" output="true" returntype="void" hint="Rotate an image (+/-)90, (+/-)180, or (+/-)270 degrees.">
<cfargument name="degrees" required="yes" type="numeric">
<cfset var imageResults = imageCFC.rotate(variables.img,"","",degrees)>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="setOption" access="public" output="true" returnType="void" hint="Sets values for allowed CFC options.">
<cfargument name="key" type="string" required="yes">
<cfargument name="val" type="string" required="yes">
<cfif lcase(trim(key)) eq "throwonerror">
<cfthrow message="Option Configuration Error" detail="You cannot set the throwOnError option when using ImageObject.cfc">
</cfif>
<cfset imageCFC.setOption(key, val)>
</cffunction>
<cffunction name="getOption" access="public" output="true" returnType="any" hint="Returns the current value for the specified CFC option.">
<cfargument name="key" type="string" required="yes">
<cfreturn imageCFC.getOption(key)>
</cffunction>
<cffunction name="filterFastBlur" access="public" output="true" returntype="void" hint="Internal method used for flipping and flopping images.">
<cfargument name="blurAmount" required="yes" type="numeric">
<cfargument name="iterations" required="yes" type="numeric">
<cfset var imageResults = imageCFC.filterFastBlur(variables.img,"","",blurAmount,iterations)>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="filterSharpen" access="public" output="true" returntype="void" hint="Internal method used for flipping and flopping images.">
<cfset var imageResults = imageCFC.filterSharpen(variables.img,"","")>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="filterPosterize" access="public" output="true" returntype="void" hint="Internal method used for flipping and flopping images.">
<cfargument name="amount" required="yes" type="string">
<cfset var imageResults = imageCFC.filterPosterize(variables.img,"","",amount)>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="addText" access="public" output="true" returntype="void" hint="Add text to an image.">
<cfargument name="x" required="yes" type="numeric">
<cfargument name="y" required="yes" type="numeric">
<cfargument name="fontDetails" required="yes" type="struct">
<cfargument name="content" required="yes" type="String">
<cfset var imageResults = imageCFC.addText(variables.img,"","",x,y,fontDetails,content)>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="watermark" access="public" output="false" returnType="void">
<cfargument name="wmImage" required="yes" type="Any">
<cfargument name="alpha" required="yes" type="numeric">
<cfargument name="placeAtX" required="yes" type="numeric">
<cfargument name="placeAtY" required="yes" type="numeric">
<cfset var imageResults = "">
<cfif isSimpleValue(wmImage)>
<!--- filename or URL --->
<cfset imageResults = imageCFC.watermark(variables.img,"","",wmImage,alpha,placeAtX,placeAtY)>
<cfelse>
<!--- must be a java object --->
<cfset imageResults = imageCFC.watermark(variables.img,wmImage,"","",alpha,placeAtX,placeAtY)>
</cfif>
<cfset variables.revertimg = variables.img>
<cfset variables.img = imageResults.img>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
<cffunction name="save" access="public" output="false" returnType="void">
<cfargument name="filename" type="string" required="no">
<cfargument name="jpegCompression" type="numeric" required="no">
<cfif isDefined("arguments.jpegCompression") and isNumeric(arguments.jpegCompression)>
<cfset imageCFC.writeImage(filename,variables.img,jpegCompression)>
<cfelse>
<cfset imageCFC.writeImage(filename,variables.img)>
</cfif>
</cffunction>
<cffunction name="revert" access="public" output="true" returntype="void" hint="Undo the previous manipulation.">
<cfset variables.img = variables.revertimg>
<cfset variables.imageInfo = imageCFC.getImageInfo(variables.img,"")>
</cffunction>
</cfcomponent>

View file

@ -0,0 +1,315 @@
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* File Browser connector for ColdFusion 5.
* (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.
*
--->
<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;
if ( userFilesPath eq "" )
{
userFilesPath = "/userfiles/";
}
// make sure the user files path is correctly formatted
userFilesPath = replace(userFilesPath, "\", "/", "ALL");
userFilesPath = replace(userFilesPath, '//', '/', 'ALL');
if ( right(userFilesPath,1) NEQ "/" )
{
userFilesPath = userFilesPath & "/";
}
if ( left(userFilesPath,1) NEQ "/" )
{
userFilesPath = "/" & userFilesPath;
}
// make sure the current folder is correctly formatted
url.currentFolder = replace(url.currentFolder, "\", "/", "ALL");
url.currentFolder = replace(url.currentFolder, '//', '/', 'ALL');
if ( right(url.currentFolder,1) neq "/" )
{
url.currentFolder = url.currentFolder & "/";
}
if ( left(url.currentFolder,1) neq "/" )
{
url.currentFolder = "/" & url.currentFolder;
}
if ( find("/",getBaseTemplatePath()) neq 0 )
{
fs = "/";
}
else
{
fs = "\";
}
// Get the base physical path to the web root for this application. The code to determine the path automatically assumes that
// the "FCKeditor" directory in the http request path is directly off the web root for the application and that it's not a
// virtual directory or a symbolic link / junction. Use the serverPath config setting to force a physical path if necessary.
if ( len(config.serverPath) )
{
serverPath = config.serverPath;
if ( right(serverPath,1) neq fs )
{
serverPath = serverPath & fs;
}
}
else
{
serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),"") & replace(userFilesPath,"/",fs,"all");
}
rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ;
xmlContent = ""; // append to this string to build content
</cfscript>
<cfset resourceTypeUrl = rereplace( replace( Config.FileTypesPath[url.type], fs, "/", "all"), "/$", "") >
<cfif isDefined( "Config.FileTypesAbsolutePath" )
and structkeyexists( Config.FileTypesAbsolutePath, url.type )
and Len( Config.FileTypesAbsolutePath[url.type] )>
<cfset userFilesServerPath = Config.FileTypesAbsolutePath[url.type] & url.currentFolder>
<cfelse>
<cftry>
<cfset userFilesServerPath = expandpath( resourceTypeUrl ) & url.currentFolder>
<!--- Catch: Parameter 1 of function ExpandPath must be a relative path --->
<cfcatch type="any">
<cfset userFilesServerPath = rootPath & Config.FileTypesPath[url.type] & url.currentFolder>
</cfcatch>
</cftry>
</cfif>
<cfset userFilesServerPath = replace( userFilesServerPath, "/", fs, "all" ) >
<!--- get rid of double directory separators --->
<cfset userFilesServerPath = replace( userFilesServerPath, fs & fs, fs, "all") >
<cfif not config.enabled>
<cfset xmlContent = "<Error number=""1"" text=""This connector is disabled. Please check the 'editor/filemanager/connectors/cfm/config.cfm' file"" />">
<cfelseif find("..",url.currentFolder)>
<cfset xmlContent = "<Error number=""102"" />">
<cfelseif isDefined("Config.ConfigAllowedCommands") and not ListFind(Config.ConfigAllowedCommands, url.command)>
<cfset xmlContent = '<Error number="1" text="The &quot;' & url.command & '&quot; command isn''t allowed" />'>
<cfelseif isDefined("Config.ConfigAllowedTypes") and not ListFind(Config.ConfigAllowedTypes, url.type)>
<cfset xmlContent = '<Error number="1" text="The &quot;' & url.type & '&quot; type isn''t allowed" />'>
</cfif>
<cfset resourceTypeDirectory = left( userFilesServerPath, Len(userFilesServerPath) - Len(url.currentFolder) )>
<cfif not len(xmlContent) and not directoryexists(resourceTypeDirectory)>
<!--- create directories in physical path if they don't already exist --->
<cfset currentPath = "">
<cftry>
<cfloop list="#resourceTypeDirectory#" index="name" delimiters="#fs#">
<cfif currentPath eq "" and fs eq "\">
<!--- Without checking this, we would have in Windows \C:\ --->
<cfif not directoryExists(name)>
<cfdirectory action="create" directory="#name#" mode="755">
</cfif>
<cfelse>
<cfif not directoryExists(currentPath & fs & name)>
<cfdirectory action="create" directory="#currentPath##fs##name#" mode="755">
</cfif>
</cfif>
<cfif fs eq "\" and currentPath eq "">
<cfset currentPath = name>
<cfelse>
<cfset currentPath = currentPath & fs & name>
</cfif>
</cfloop>
<cfcatch type="any">
<!--- 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>
<cfswitch expression="#url.command#">
<cfcase value="FileUpload">
<cfset config_included = true >
<cfinclude template="cf5_upload.cfm">
<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="#HTMLEditFormat( 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="#HTMLEditFormat(qDir.name[i])#" />';
} else if( not compareNoCase( qDir.type[i], "FILE" ) ) {
fileSizeKB = round(qDir.size[i] / 1024);
files = files & '<File name="#HTMLEditFormat(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="#resourceTypeUrl##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>

View file

@ -0,0 +1,296 @@
<cfsetting enablecfoutputonly="Yes">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the "File Uploader" for ColdFusion 5.
* Based on connector.cfm by Mark Woods (mark@thickpaddy.com)
*
* 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.
*
--->
<cfparam name="url.command" default="QuickUpload">
<cfparam name="url.type" default="File">
<cfparam name="url.currentFolder" default="/">
<cfif not isDefined("config_included")>
<cfinclude template="config.cfm">
</cfif>
<cfscript>
function SendUploadResults(errorNumber, fileUrl, fileName, customMsg)
{
WriteOutput('<script type="text/javascript">');
WriteOutput('window.parent.OnUploadCompleted(' & errorNumber & ', "' & JSStringFormat(fileUrl) & '", "' & JSStringFormat(fileName) & '", "' & JSStringFormat(customMsg) & '");' );
WriteOutput('</script>');
}
</cfscript>
<cfif NOT config.enabled>
<cfset SendUploadResults(1, "", "", "This file uploader is disabled. Please check the ""editor/filemanager/connectors/cfm/config.cfm"" file")>
<cfabort>
</cfif>
<cfif isDefined("Config.ConfigAllowedCommands") and not ListFind(Config.ConfigAllowedCommands, url.command)>
<cfset SendUploadResults(1, "", "", "The """ & url.command & """ command isn't allowed")>
<cfabort>
</cfif>
<cfif isDefined("Config.ConfigAllowedTypes") and not ListFind(Config.ConfigAllowedTypes, url.type)>
<cfset SendUploadResults(1, "", "", "The """ & url.type & """ type isn't allowed")>
<cfabort>
</cfif>
<cfif find( "..", url.currentFolder)>
<cfset SendUploadResults(102)>
<cfabort>
</cfif>
<cfscript>
userFilesPath = config.userFilesPath;
if ( userFilesPath eq "" ) {
userFilesPath = "/userfiles/";
}
// make sure the user files path is correctly formatted
userFilesPath = replace(userFilesPath, "\", "/", "ALL");
userFilesPath = replace(userFilesPath, '//', '/', 'ALL');
if ( right(userFilesPath,1) NEQ "/" ) {
userFilesPath = userFilesPath & "/";
}
if ( left(userFilesPath,1) NEQ "/" ) {
userFilesPath = "/" & userFilesPath;
}
// make sure the current folder is correctly formatted
url.currentFolder = replace(url.currentFolder, "\", "/", "ALL");
url.currentFolder = replace(url.currentFolder, '//', '/', 'ALL');
if ( right(url.currentFolder,1) neq "/" ) {
url.currentFolder = url.currentFolder & "/";
}
if ( left(url.currentFolder,1) neq "/" ) {
url.currentFolder = "/" & url.currentFolder;
}
if (find("/",getBaseTemplatePath())) {
fs = "/";
} else {
fs = "\";
}
// Get the base physical path to the web root for this application. The code to determine the path automatically assumes that
// the "FCKeditor" directory in the http request path is directly off the web root for the application and that it's not a
// virtual directory or a symbolic link / junction. Use the serverPath config setting to force a physical path if necessary.
if ( len(config.serverPath) ) {
serverPath = config.serverPath;
if ( right(serverPath,1) neq fs ) {
serverPath = serverPath & fs;
}
} else {
serverPath = replaceNoCase(getBaseTemplatePath(),replace(cgi.script_name,"/",fs,"all"),"") & replace(userFilesPath,"/",fs,"all");
}
rootPath = left( serverPath, Len(serverPath) - Len(userFilesPath) ) ;
</cfscript>
<cfif url.command eq "QuickUpload">
<cfset resourceTypeUrl = rereplace( replace( Config.QuickUploadPath[url.type], fs, "/", "all"), "/$", "") >
<cfif isDefined( "Config.QuickUploadAbsolutePath" )
and structkeyexists( Config.QuickUploadAbsolutePath, url.type )
and Len( Config.QuickUploadAbsolutePath[url.type] )>
<cfset userFilesServerPath = Config.QuickUploadAbsolutePath[url.type] & url.currentFolder>
<cfelse>
<cftry>
<cfset userFilesServerPath = expandpath( resourceTypeUrl ) & url.currentFolder>
<!--- Catch: Parameter 1 of function ExpandPath must be a relative path --->
<cfcatch type="any">
<cfset userFilesServerPath = rootPath & Config.QuickUploadPath[url.type] & url.currentFolder>
</cfcatch>
</cftry>
</cfif>
<cfelse>
<cfset resourceTypeUrl = rereplace( replace( Config.FileTypesPath[url.type], fs, "/", "all"), "/$", "") >
<cfif isDefined( "Config.FileTypesAbsolutePath" )
and structkeyexists( Config.FileTypesAbsolutePath, url.type )
and Len( Config.FileTypesAbsolutePath[url.type] )>
<cfset userFilesServerPath = Config.FileTypesAbsolutePath[url.type] & url.currentFolder>
<cfelse>
<cftry>
<cfset userFilesServerPath = expandpath( resourceTypeUrl ) & url.currentFolder>
<!--- Catch: Parameter 1 of function ExpandPath must be a relative path --->
<cfcatch type="any">
<cfset userFilesServerPath = rootPath & Config.FileTypesPath[url.type] & url.currentFolder>
</cfcatch>
</cftry>
</cfif>
</cfif>
<cfset userFilesServerPath = replace( userFilesServerPath, "/", fs, "all" ) >
<!--- get rid of double directory separators --->
<cfset userFilesServerPath = replace( userFilesServerPath, fs & fs, fs, "all") >
<!--- create resource type directory if not exists --->
<cfset resourceTypeDirectory = left( userFilesServerPath, Len(userFilesServerPath) - Len(url.currentFolder) )>
<cfif not directoryexists( resourceTypeDirectory )>
<cfset currentPath = "">
<cftry>
<cfloop list="#resourceTypeDirectory#" index="name" delimiters="#fs#">
<cfif currentPath eq "" and fs eq "\">
<!--- Without checking this, we would have in Windows \C:\ --->
<cfif not directoryExists(name)>
<cfdirectory action="create" directory="#name#" mode="755">
</cfif>
<cfelse>
<cfif not directoryExists(currentPath & fs & name)>
<cfdirectory action="create" directory="#currentPath##fs##name#" mode="755">
</cfif>
</cfif>
<cfif fs eq "\" and currentPath eq "">
<cfset currentPath = name>
<cfelse>
<cfset currentPath = currentPath & fs & name>
</cfif>
</cfloop>
<cfcatch type="any">
<!--- this should only occur as a result of a permissions problem --->
<cfset SendUploadResults(103)>
<cfabort>
</cfcatch>
</cftry>
</cfif>
<cfset currentFolderPath = userFilesServerPath>
<cfset resourceType = url.type>
<cfset fileName = "">
<cfset fileExt = "">
<!--- Can be overwritten. The last value will be sent with the result --->
<cfset customMsg = "">
<cftry>
<!--- 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>
<cfset lAllowedExtensions = config.allowedExtensions[#resourceType#]>
<cfset lDeniedExtensions = config.deniedExtensions[#resourceType#]>
<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 ;
fileExisted = false ;
// munge filename for html download. Only a-z, 0-9, _, - and . are allowed
if( reFind("[^A-Za-z0-9_\-\.]", fileName) ) {
fileName = reReplace(fileName, "[^A-Za-z0-9\-\.]", "_", "ALL");
fileName = reReplace(fileName, "_{2,}", "_", "ALL");
fileName = reReplace(fileName, "([^_]+)_+$", "\1", "ALL");
fileName = reReplace(fileName, "$_([^_]+)$", "\1", "ALL");
}
// remove additional dots from file name
if( isDefined("Config.ForceSingleExtension") and Config.ForceSingleExtension )
fileName = replace( fileName, '.', "_", "all" ) ;
// When the original filename already exists, add numbers (0), (1), (2), ... at the end of the filename.
if( compare( cffile.ServerFileName, fileName ) ) {
counter = 0;
tmpFileName = fileName;
while( fileExists("#currentFolderPath##fileName#.#fileExt#") ) {
fileExisted = true ;
counter = counter + 1 ;
fileName = tmpFileName & '(#counter#)' ;
}
}
</cfscript>
<!--- Rename the uploaded file, if neccessary --->
<cfif compare(cffile.ServerFileName,fileName)>
<cfif fileExisted>
<cfset errorNumber = "201">
</cfif>
<cffile
action="rename"
source="#currentFolderPath##cffile.ServerFileName#.#cffile.ServerFileExt#"
destination="#currentFolderPath##fileName#.#fileExt#"
mode="644"
attributes="normal">
</cfif>
</cfif>
<cfcatch type="any">
<cfset errorNumber = "1">
<cfset customMsg = cfcatch.message >
</cfcatch>
</cftry>
<cfif errorNumber EQ 0>
<!--- file was uploaded succesfully --->
<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##url.currentFolder##fileName#.#fileExt#', "", "")>
<cfabort>
<cfelseif errorNumber EQ 201>
<!--- file was changed (201), submit the new filename --->
<cfset SendUploadResults(errorNumber, '#resourceTypeUrl##url.currentFolder##fileName#.#fileExt#', replace( fileName & "." & fileExt, "'", "\'", "ALL"), customMsg)>
<cfabort>
<cfelse>
<!--- An error occured(202). Submit only the error code and a message (if available). --->
<cfset SendUploadResults(errorNumber, '', '', customMsg)>
<cfabort>
</cfif>

View file

@ -0,0 +1,68 @@
<cfsetting enablecfoutputonly="Yes">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This file include the functions that create the base XML output by the ColdFusion Connector (MX 6.0 and above).
--->
<cffunction name="SetXmlHeaders" returntype="void">
<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">
</cffunction>
<cffunction name="CreateXmlHeader" returntype="void" output="true">
<cfargument name="command" required="true">
<cfargument name="resourceType" required="true">
<cfargument name="currentFolder" required="true">
<cfset SetXmlHeaders()>
<cfoutput><?xml version="1.0" encoding="utf-8" ?></cfoutput>
<cfoutput><Connector command="#ARGUMENTS.command#" resourceType="#ARGUMENTS.resourceType#"></cfoutput>
<cfoutput><CurrentFolder path="#HTMLEditFormat(ARGUMENTS.currentFolder)#" url="#HTMLEditFormat( GetUrlFromPath( resourceType, currentFolder, command ) )#" /></cfoutput>
<cfset REQUEST.HeaderSent = true>
</cffunction>
<cffunction name="CreateXmlFooter" returntype="void" output="true">
<cfoutput></Connector></cfoutput>
</cffunction>
<cffunction name="SendError" returntype="void" output="true">
<cfargument name="number" required="true" type="Numeric">
<cfargument name="text" required="true">
<cfif isDefined("REQUEST.HeaderSent") and REQUEST.HeaderSent>
<cfset SendErrorNode( ARGUMENTS.number, ARGUMENTS.text )>
<cfset CreateXmlFooter() >
<cfelse>
<cfset SetXmlHeaders()>
<cfoutput><?xml version="1.0" encoding="utf-8" ?></cfoutput>
<cfoutput><Connector></cfoutput>
<cfset SendErrorNode( ARGUMENTS.number, ARGUMENTS.text )>
<cfset CreateXmlFooter() >
</cfif>
<cfabort>
</cffunction>
<cffunction name="SendErrorNode" returntype="void" output="true">
<cfargument name="number" required="true" type="Numeric">
<cfargument name="text" required="true">
<cfoutput><Error number="#ARGUMENTS.number#" text="#htmleditformat(ARGUMENTS.text)#" /></cfoutput>
</cffunction>

View file

@ -0,0 +1,225 @@
<cfsetting enablecfoutputonly="Yes">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This file include the functions that handle the Command requests
* in the ColdFusion Connector (MX 6.0 and above).
--->
<cffunction name="FileUpload" returntype="void" output="true">
<cfargument name="resourceType" type="string" required="yes" default="">
<cfargument name="currentFolder" type="string" required="yes" default="">
<cfargument name="sCommand" type="string" required="yes" default="">
<cfset var sFileName = "">
<cfset var sFilePart = "">
<cfset var sFileExt = "">
<cfset var sFileUrl = "">
<cfset var sTempFilePath = "">
<cfset var errorNumber = 0>
<cfset var customMsg = 0>
<cfset var counter = 0>
<cfset var destination = "">
<cftry>
<cffile action="UPLOAD" filefield="NewFile" destination="#GetTempDirectory()#" nameconflict="makeunique" mode="0755" />
<cfset sTempFilePath = CFFILE.ServerDirectory & REQUEST.fs & CFFILE.ServerFile>
<!--- Map the virtual path to the local server path. --->
<cfset sServerDir = ServerMapFolder( ARGUMENTS.resourceType, ARGUMENTS.currentFolder, ARGUMENTS.sCommand) >
<!--- Get the uploaded file name. --->
<cfset sFileName = SanitizeFileName( CFFILE.ClientFile ) >
<cfset sOriginalFileName = sFileName >
<cfif isDefined( "REQUEST.Config.SecureImageUploads" ) and REQUEST.Config.SecureImageUploads>
<cfif not IsImageValid( sTempFilePath, CFFILE.ClientFileExt )>
<cftry>
<cffile action="delete" file="#sTempFilePath#">
<cfcatch type="any">
</cfcatch>
</cftry>
<cfthrow errorcode="202" type="fckeditor">
</cfif>
</cfif>
<cfif isDefined( "REQUEST.Config.HtmlExtensions" ) and not listFindNoCase( REQUEST.Config.HtmlExtensions, CFFILE.ClientFileExt )>
<cfif DetectHtml( sTempFilePath )>
<cftry>
<cffile action="delete" file="#sTempFilePath#">
<cfcatch type="any">
</cfcatch>
</cftry>
<cfthrow errorcode="202" type="fckeditor">
</cfif>
</cfif>
<cfif not IsAllowedExt( CFFILE.ClientFileExt, ARGUMENTS.resourceType )>
<cftry>
<cffile action="delete" file="#sTempFilePath#">
<cfcatch type="any">
</cfcatch>
</cftry>
<cfthrow errorcode="202" type="fckeditor">
</cfif>
<!--- When the original filename already exists, add numbers (0), (1), (2), ... at the end of the filename. --->
<cfscript>
sFileExt = GetExtension( sFileName ) ;
sFilePart = RemoveExtension( sFileName );
while( fileExists( sServerDir & sFileName ) )
{
counter = counter + 1;
sFileName = sFilePart & '(#counter#).' & CFFILE.ClientFileExt;
errorNumber = 201;
}
</cfscript>
<cfset destination = sServerDir & sFileName>
<!---
<cfdump var="#sTempFilePath#">
<cfoutput ><br /></cfoutput>
<cfdump var="#destination#">
<cfabort>
--->
<cflock name="#destination#" timeout="30" type="Exclusive">
<cftry>
<cffile action="move" source="#sTempFilePath#" destination="#destination#" mode="755">
<!--- omit CF 6.1 error during moving uploaded file, just copy that file instead of moving --->
<cfcatch type="any">
<cffile action="copy" source="#sTempFilePath#" destination="#destination#" mode="755">
</cfcatch>
</cftry>
</cflock>
<cfset sFileUrl = CombinePaths( GetResourceTypePath( ARGUMENTS.resourceType, sCommand ) , ARGUMENTS.currentFolder ) >
<cfset sFileUrl = CombinePaths( sFileUrl , sFileName ) >
<cfcatch type="fckeditor">
<cfset errorNumber = CFCATCH.ErrorCode>
</cfcatch>
<cfcatch type="any">
<cfset errorNumber = "1">
<cfset customMsg = CFCATCH.Message >
</cfcatch>
</cftry>
<cfset SendUploadResults( errorNumber, sFileUrl, sFileName, customMsg ) >
</cffunction>
<cffunction name="GetFolders" returntype="void" output="true">
<cfargument name="resourceType" type="String" required="true">
<cfargument name="currentFolder" type="String" required="true">
<cfset var i = 1>
<cfset var folders = "">
<!--- Map the virtual path to the local server path --->
<cfset var sServerDir = ServerMapFolder( ARGUMENTS.resourceType, ARGUMENTS.currentFolder, "GetFolders" ) >
<!--- Sort directories first, name ascending --->
<cfdirectory action="list" directory="#sServerDir#" name="qDir" sort="type,name">
<cfscript>
while( i lte qDir.recordCount )
{
if( compareNoCase( qDir.type[i], "FILE" ) and not listFind( ".,..", qDir.name[i] ) )
{
folders = folders & '<Folder name="#HTMLEditFormat( qDir.name[i] )#" />' ;
}
i = i + 1;
}
</cfscript>
<cfoutput><Folders>#folders#</Folders></cfoutput>
</cffunction>
<cffunction name="GetFoldersAndfiles" returntype="void" output="true">
<cfargument name="resourceType" type="String" required="true">
<cfargument name="currentFolder" type="String" required="true">
<cfset var i = 1>
<cfset var folders = "">
<cfset var files = "">
<!--- Map the virtual path to the local server path --->
<cfset var sServerDir = ServerMapFolder( ARGUMENTS.resourceType, ARGUMENTS.currentFolder, "GetFolders" ) >
<!--- Sort directories first, name ascending --->
<cfdirectory action="list" directory="#sServerDir#" name="qDir" sort="type,name">
<cfscript>
while( i lte qDir.recordCount )
{
if( not compareNoCase( qDir.type[i], "DIR" ) and not listFind( ".,..", qDir.name[i] ) )
{
folders = folders & '<Folder name="#HTMLEditFormat(qDir.name[i])#" />' ;
}
else if( not compareNoCase( qDir.type[i], "FILE" ) )
{
fileSizeKB = round(qDir.size[i] / 1024) ;
files = files & '<File name="#HTMLEditFormat(qDir.name[i])#" size="#IIf( fileSizeKB GT 0, DE( fileSizeKB ), 1)#" />' ;
}
i = i + 1 ;
}
</cfscript>
<cfoutput><Folders>#folders#</Folders></cfoutput>
<cfoutput><Files>#files#</Files></cfoutput>
</cffunction>
<cffunction name="CreateFolder" returntype="void" output="true">
<cfargument name="resourceType" required="true" type="string">
<cfargument name="currentFolder" required="true" type="string">
<cfset var sNewFolderName = url.newFolderName >
<cfset var sServerDir = "" >
<cfset var errorNumber = 0>
<cfset var sErrorMsg = "">
<cfset var currentFolderPath = ServerMapFolder( ARGUMENTS.resourceType, ARGUMENTS.currentFolder, 'CreateFolder' )>
<cfparam name="url.newFolderName" default="">
<cfscript>
sNewFolderName = SanitizeFolderName( sNewFolderName ) ;
</cfscript>
<cfif not len( sNewFolderName ) or len( sNewFolderName ) gt 255>
<cfset errorNumber = 102>
<cfelseif directoryExists( currentFolderPath & sNewFolderName )>
<cfset errorNumber = 101>
<cfelseif find( "..", sNewFolderName )>
<cfset errorNumber = 103>
<cfelse>
<cfset errorNumber = 0>
<!--- Map the virtual path to the local server path of the current folder. --->
<cfset sServerDir = currentFolderPath & sNewFolderName >
<cftry>
<cfdirectory action="create" directory="#currentFolderPath##sNewFolderName#" mode="755">
<cfcatch type="any">
<!---
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>
<cfoutput><Error number="#errorNumber#" originalDescription="#HTMLEditFormat(sErrorMsg)#" /></cfoutput>
</cffunction>

View file

@ -0,0 +1,89 @@
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* File Browser connector for ColdFusion (MX 6.0 and above).
* (based on the original CF connector by Hendrik Kramer - hk@lwd.de)
*
--->
<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">
<cfinclude template="cf_util.cfm">
<cfinclude template="cf_io.cfm">
<cfinclude template="cf_basexml.cfm">
<cfinclude template="cf_commands.cfm">
<cfif not Config.Enabled>
<cfset SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/cfm/config.cfm" file' )>
</cfif>
<cfset REQUEST.Config = Config>
<cfif find( "/", getBaseTemplatePath() ) >
<cfset REQUEST.Fs = "/">
<cfelse>
<cfset REQUEST.Fs = "\">
</cfif>
<cfset DoResponse() >
<cffunction name="DoResponse" output="true" returntype="void">
<!--- Get the main request informaiton. --->
<cfset var sCommand = "#URL.Command#" >
<cfset var sResourceType = URL.Type >
<cfset var sCurrentFolder = GetCurrentFolder() >
<!--- Check if it is an allowed command --->
<cfif not IsAllowedCommand( sCommand ) >
<cfset SendError( 1, "The """ & sCommand & """ command isn't allowed" ) >
</cfif>
<!--- Check if it is an allowed type. --->
<cfif not IsAllowedType( sResourceType ) >
<cfset SendError( 1, 'Invalid type specified' ) >
</cfif>
<!--- File Upload doesn't have to Return XML, so it must be intercepted before anything. --->
<cfif sCommand eq "FileUpload">
<cfset FileUpload( sResourceType, sCurrentFolder, sCommand )>
<cfabort>
</cfif>
<cfset CreateXmlHeader( sCommand, sResourceType, sCurrentFolder )>
<!--- Execute the required command. --->
<cfif sCommand eq "GetFolders">
<cfset GetFolders( sResourceType, sCurrentFolder ) >
<cfelseif sCommand eq "GetFoldersAndFiles">
<cfset GetFoldersAndFiles( sResourceType, sCurrentFolder ) >
<cfelseif sCommand eq "CreateFolder">
<cfset CreateFolder( sResourceType, sCurrentFolder ) >
</cfif>
<cfset CreateXmlFooter()>
<cfexit>
</cffunction>

View file

@ -0,0 +1,288 @@
<cfsetting enablecfoutputonly="Yes">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This file include IO specific functions used by the ColdFusion Connector (MX 6.0 and above).
*
--->
<cffunction name="CombinePaths" returntype="String" output="true">
<cfargument name="sBasePath" required="true">
<cfargument name="sFolder" required="true">
<cfset sBasePath = RemoveFromEnd( sBasePath, "/" )>
<cfset sBasePath = RemoveFromEnd( sBasePath, "\" )>
<cfreturn sBasePath & "/" & RemoveFromStart( ARGUMENTS.sFolder, '/' )>
</cffunction>
<cffunction name="GetResourceTypePath" returntype="String" output="false">
<cfargument name="resourceType" required="true">
<cfargument name="sCommand" required="true">
<cfif ARGUMENTS.sCommand eq "QuickUpload">
<cfreturn REQUEST.Config['QuickUploadPath'][ARGUMENTS.resourceType]>
<cfelse>
<cfreturn REQUEST.Config['FileTypesPath'][ARGUMENTS.resourceType]>
</cfif>
</cffunction>
<cffunction name="GetResourceTypeDirectory" returntype="String" output="false">
<cfargument name="resourceType" required="true">
<cfargument name="sCommand" required="true">
<cfif ARGUMENTS.sCommand eq "QuickUpload">
<cfif isDefined( "REQUEST.Config.QuickUploadAbsolutePath" )
and structkeyexists( REQUEST.Config.QuickUploadAbsolutePath, ARGUMENTS.resourceType )
and Len( REQUEST.Config.QuickUploadAbsolutePath[ARGUMENTS.resourceType] )>
<cfreturn REQUEST.Config.QuickUploadAbsolutePath[ARGUMENTS.resourceType]>
</cfif>
<cfreturn expandpath( REQUEST.Config.QuickUploadPath[ARGUMENTS.resourceType] )>
<cfelse>
<cfif isDefined( "REQUEST.Config.FileTypesAbsolutePath" )
and structkeyexists( REQUEST.Config.FileTypesAbsolutePath, ARGUMENTS.resourceType )
and Len( REQUEST.Config.FileTypesAbsolutePath[ARGUMENTS.resourceType] )>
<cfreturn REQUEST.Config.FileTypesAbsolutePath[ARGUMENTS.resourceType]>
</cfif>
<cfreturn expandpath( REQUEST.Config.FileTypesPath[ARGUMENTS.resourceType] )>
</cfif>
</cffunction>
<cffunction name="GetUrlFromPath" returntype="String" output="false">
<cfargument name="resourceType" required="true">
<cfargument name="folderPath" required="true">
<cfargument name="sCommand" required="true">
<cfreturn CombinePaths( GetResourceTypePath( ARGUMENTS.resourceType, ARGUMENTS.sCommand ), ARGUMENTS.folderPath )>
</cffunction>
<cffunction name="RemoveExtension" output="false" returntype="String">
<cfargument name="fileName" required="true">
<cfset var pos = find( ".", reverse ( ARGUMENTS.fileName ) )>
<cfreturn mid( ARGUMENTS.fileName, 1, Len( ARGUMENTS.fileName ) - pos ) >
</cffunction>
<cffunction name="GetExtension" output="false" returntype="String">
<cfargument name="fileName" required="true">
<cfset var pos = find( ".", reverse ( ARGUMENTS.fileName ) )>
<cfif not pos>
<cfreturn "">
</cfif>
<cfreturn mid( ARGUMENTS.fileName, pos, Len( ARGUMENTS.fileName ) - pos ) >
</cffunction>
<cffunction name="ServerMapFolder" returntype="String" output="false">
<cfargument name="resourceType" required="true">
<cfargument name="folderPath" required="true">
<cfargument name="sCommand" required="true">
<!--- Get the resource type directory. --->
<cfset var sResourceTypePath = GetResourceTypeDirectory( ARGUMENTS.resourceType, ARGUMENTS.sCommand ) >
<!--- Ensure that the directory exists. --->
<cfset var sErrorMsg = CreateServerFolder( sResourceTypePath ) >
<cfif sErrorMsg neq ''>
<cfset SendError( 1, 'Error creating folder "' & sResourceTypePath & '" (' & sErrorMsg & ')' )>
</cfif>
<!--- Return the resource type directory combined with the required path. --->
<cfreturn CombinePaths( sResourceTypePath , ARGUMENTS.folderPath )>
</cffunction>
<cffunction name="GetParentFolder" returntype="string" output="false">
<cfargument name="folderPath" required="true">
<cfreturn rereplace(ARGUMENTS.folderPath, "[/\\\\][^/\\\\]+[/\\\\]?$", "")>
</cffunction>
<cffunction name="CreateServerFolder" returntype="String" output="false">
<cfargument name="folderPath">
<!--- Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms --->
<cfset folderPath = rereplace(ARGUMENTS.folderPath, "//+", "/", "all")>
<cfif directoryexists(ARGUMENTS.folderPath) or fileexists(ARGUMENTS.folderPath)>
<cfreturn "">
<cfelse>
<cftry>
<cfdirectory action="create" mode="0755" directory="#ARGUMENTS.folderPath#">
<cfcatch type="any">
<cfreturn CFCATCH.Message>
</cfcatch>
</cftry>
</cfif>
<cfreturn "">
</cffunction>
<cffunction name="IsAllowedExt" returntype="boolean" output="false">
<cfargument name="sExtension" required="true">
<cfargument name="resourceType" required="true">
<cfif isDefined( "REQUEST.Config.AllowedExtensions." & ARGUMENTS.resourceType )
and listLen( REQUEST.Config.AllowedExtensions[ARGUMENTS.resourceType] )
and not listFindNoCase( REQUEST.Config.AllowedExtensions[ARGUMENTS.resourceType], ARGUMENTS.sExtension )>
<cfreturn false>
</cfif>
<cfif isDefined( "REQUEST.Config.DeniedExtensions." & ARGUMENTS.resourceType )
and listLen( REQUEST.Config.DeniedExtensions[ARGUMENTS.resourceType] )
and listFindNoCase( REQUEST.Config.DeniedExtensions[ARGUMENTS.resourceType], ARGUMENTS.sExtension )>
<cfreturn false>
</cfif>
<cfreturn true>
</cffunction>
<cffunction name="IsAllowedType" returntype="boolean" output="false">
<cfargument name="resourceType">
<cfif not listFindNoCase( REQUEST.Config.ConfigAllowedTypes, ARGUMENTS.resourceType )>
<cfreturn false>
</cfif>
<cfreturn true>
</cffunction>
<cffunction name="IsAllowedCommand" returntype="boolean" output="true">
<cfargument name="sCommand" required="true" type="String">
<cfif not listFindNoCase( REQUEST.Config.ConfigAllowedCommands, ARGUMENTS.sCommand )>
<cfreturn false>
</cfif>
<cfreturn true>
</cffunction>
<cffunction name="GetCurrentFolder" returntype="String" output="false">
<cfset var sCurrentFolder = "/">
<cfif isDefined( "URL.CurrentFolder" )>
<cfset sCurrentFolder = URL.CurrentFolder>
</cfif>
<!--- Check the current folder syntax (must begin and start with a slash). --->
<cfif not refind( "/$", sCurrentFolder)>
<cfset sCurrentFolder = sCurrentFolder & "/">
</cfif>
<cfif not refind( "^/", sCurrentFolder )>
<cfset sCurrentFolder = "/" & sCurrentFolder>
</cfif>
<!--- Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms --->
<cfset sCurrentFolder = rereplace( sCurrentFolder, "//+", "/", "all" )>
<cfif find( "..", sCurrentFolder)>
<cfset SendError( 102, "" )>
</cfif>
<cfreturn sCurrentFolder>
</cffunction>
<cffunction name="SanitizeFolderName" returntype="String" output="false">
<cfargument name="sNewFolderName" required="true">
<!--- Do a cleanup of the folder name to avoid possible problems --->
<!--- Remove . \ / | : ? * " < > --->
<cfset sNewFolderName = rereplace( sNewFolderName, '\.+|\\+|\/+|\|+|\:+|\?+|\*+|"+|<+|>+', "_", "all" )>
<cfreturn sNewFolderName>
</cffunction>
<cffunction name="BinaryFileRead" returntype="String" output="true">
<cfargument name="fileName" required="true" type="string">
<cfargument name="bytes" required="true" type="Numeric">
<cfscript>
var chunk = "";
var fileReaderClass = "";
var fileReader = "";
var file = "";
var done = false;
var counter = 0;
var byteArray = "";
if( not fileExists( ARGUMENTS.fileName ) )
{
return "" ;
}
if (REQUEST.CFVersion gte 8)
{
file = FileOpen( ARGUMENTS.fileName, "readbinary" ) ;
byteArray = FileRead( file, 1024 ) ;
chunk = toString( toBinary( toBase64( byteArray ) ) ) ;
FileClose( file ) ;
}
else
{
fileReaderClass = createObject("java", "java.io.FileInputStream");
fileReader = fileReaderClass.init(fileName);
while(not done)
{
char = fileReader.read();
counter = counter + 1;
if ( char eq -1 or counter eq ARGUMENTS.bytes)
{
done = true;
}
else
{
chunk = chunk & chr(char) ;
}
}
}
</cfscript>
<cfreturn chunk>
</cffunction>
<cffunction name="SendUploadResults" returntype="String" output="true">
<cfargument name="errorNumber" required="true" type="Numeric">
<cfargument name="fileUrl" required="false" type="String" default="">
<cfargument name="fileName" required="false" type="String" default="">
<cfargument name="customMsg" required="false" type="String" default="">
<cfoutput>
<script type="text/javascript">
window.parent.OnUploadCompleted( #errorNumber#, "#JSStringFormat(fileUrl)#", "#JSStringFormat(fileName)#", "#JSStringFormat(customMsg)#" );
</script>
</cfoutput>
<cfabort>
</cffunction>
<cffunction name="SanitizeFileName" returntype="String" output="false">
<cfargument name="sNewFileName" required="true">
<cfif isDefined("REQUEST.Config.ForceSingleExtension") and REQUEST.Config.ForceSingleExtension>
<cfset sNewFileName = rereplace( sNewFileName, '\.(?![^.]*$)', "_", "all" )>
</cfif>
<!--- Do a cleanup of the file name to avoid possible problems --->
<!--- Remove \ / | : ? * " < > --->
<cfset sNewFileName = rereplace( sNewFileName, '\\[.]+|\\+|\/+|\|+|\:+|\?+|\*+|"+|<+|>+', "_", "all" )>
<cfreturn sNewFileName>
</cffunction>

View file

@ -0,0 +1,68 @@
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* File Browser connector for ColdFusion (MX 6.0 and above).
* (based on the original CF connector by Hendrik Kramer - hk@lwd.de)
--->
<cfparam name="url.type" default="File">
<cfparam name="url.currentFolder" default="/">
<!--- note: no serverPath url parameter - see config.cfm if you need to set the serverPath manually --->
<cfinclude template="config.cfm">
<cfinclude template="cf_util.cfm">
<cfinclude template="cf_io.cfm">
<cfinclude template="cf_commands.cfm">
<cfset REQUEST.Config = Config>
<cfif find( "/", getBaseTemplatePath() ) >
<cfset REQUEST.Fs = "/">
<cfelse>
<cfset REQUEST.Fs = "\">
</cfif>
<cfif not Config.Enabled>
<cfset SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/cfm/config.cfm" file' )>
</cfif>
<cfset sCommand = 'QuickUpload'>
<cfset sType = "File">
<cfif isDefined( "URL.Type" )>
<cfset sType = URL.Type>
</cfif>
<cfset sCurrentFolder = GetCurrentFolder()>
<!--- Is enabled the upload? --->
<cfif not IsAllowedCommand( sCommand )>
<cfset SendUploadResults( "1", "", "", "The """ & sCommand & """ command isn't allowed" )>
</cfif>
<!--- Check if it is an allowed type. --->
<cfif not IsAllowedType( sType )>
<cfset SendUploadResults( "1", "", "", "Invalid type specified" ) >
</cfif>
<cfset FileUpload( sType, sCurrentFolder, sCommand )>

View file

@ -0,0 +1,132 @@
<cfsetting enablecfoutputonly="Yes">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This file include generic functions used by the ColdFusion Connector (MX 6.0 and above).
--->
<cffunction name="RemoveFromStart" output="false" returntype="String">
<cfargument name="sourceString" type="String">
<cfargument name="charToRemove" type="String">
<cfif left(ARGUMENTS.sourceString, 1) eq ARGUMENTS.charToRemove>
<cfreturn mid( ARGUMENTS.sourceString, 2, len(ARGUMENTS.sourceString) -1 )>
</cfif>
<cfreturn ARGUMENTS.sourceString>
</cffunction>
<cffunction name="RemoveFromEnd" output="false" returntype="String">
<cfargument name="sourceString" type="String">
<cfargument name="charToRemove" type="String">
<cfif right(ARGUMENTS.sourceString, 1) eq ARGUMENTS.charToRemove>
<cfreturn mid( ARGUMENTS.sourceString, 1, len(ARGUMENTS.sourceString) -1 )>
</cfif>
<cfreturn ARGUMENTS.sourceString>
</cffunction>
<!---
Check file content.
Currently this function validates only image files.
Returns false if file is invalid.
detectionLevel:
0 = none
1 = check image size for images,
2 = use DetectHtml for images
---->
<cffunction name="IsImageValid" returntype="boolean" output="true">
<cfargument name="filePath" required="true" type="String">
<cfargument name="extension" required="true" type="String">
<cfset var imageCFC = "">
<cfset var imageInfo = "">
<cfif not ListFindNoCase("gif,jpeg,jpg,png,swf,psd,bmp,iff,tiff,tif,swc,jpc,jp2,jpx,jb2,xmb,wbmp", ARGUMENTS.extension)>
<cfreturn true>
</cfif>
<cftry>
<cfif REQUEST.CFVersion gte 8>
<cfset objImage = ImageRead(ARGUMENTS.filePath) >
<cfset imageInfo = ImageInfo(objImage)>
<!--- <cfimage action="info" source="#ARGUMENTS.filePath#" structName="imageInfo" /> --->
<cfelse>
<cfset imageCFC = createObject("component", "image")>
<cfset imageInfo = imageCFC.getImageInfo("", ARGUMENTS.filePath)>
</cfif>
<cfif imageInfo.height lte 0 or imageInfo.width lte 0>
<cfreturn false>
</cfif>
<cfcatch type="any">
<cfreturn false>
</cfcatch>
</cftry>
<cfreturn true>
</cffunction>
<!---
Detect HTML in the first KB to prevent against potential security issue with
IE/Safari/Opera file type auto detection bug.
Returns true if file contain insecure HTML code at the beginning.
--->
<cffunction name="DetectHtml" output="false" returntype="boolean">
<cfargument name="filePath" required="true" type="String">
<cfset var tags = "<body,<head,<html,<img,<pre,<script,<table,<title">
<cfset var chunk = lcase( Trim( BinaryFileRead( ARGUMENTS.filePath, 1024 ) ) )>
<cfif not Len(chunk)>
<cfreturn false>
</cfif>
<cfif refind('<!doctype\W*x?html', chunk)>
<cfreturn true>
</cfif>
<cfloop index = "tag" list = "#tags#">
<cfif find( tag, chunk )>
<cfreturn true>
</cfif>
</cfloop>
<!--- type = javascript --->
<cfif refind('type\s*=\s*[''"]?\s*(?:\w*/)?(?:ecma|java)', chunk)>
<cfreturn true>
</cfif> >
<!--- href = javascript --->
<!--- src = javascript --->
<!--- data = javascript --->
<cfif refind('(?:href|src|data)\s*=\s*[\''"]?\s*(?:ecma|java)script:', chunk)>
<cfreturn true>
</cfif>
<!--- url(javascript --->
<cfif refind('url\s*\(\s*[\''"]?\s*(?:ecma|java)script:', chunk)>
<cfreturn true>
</cfif>
<cfreturn false>
</cffunction>

View file

@ -0,0 +1,183 @@
<cfsetting enablecfoutputonly="Yes">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Configuration file for the ColdFusion Connector (all versions).
--->
<cfscript>
Config = StructNew() ;
// SECURITY: You must explicitly enable this "connector". (Set enabled to "true")
Config.Enabled = true ;
// Path to uploaded files relative to the document root.
Config.UserFilesPath = "/userfiles/" ;
// Use this to force the server path if FCKeditor is not running directly off
// the root of the application or the FCKeditor directory in the URL is a virtual directory
// or a symbolic link / junction
// Example: C:\inetpub\wwwroot\myDocs\
Config.ServerPath = "" ;
// Due to security issues with Apache modules, it is recommended to leave the
// following setting enabled.
Config.ForceSingleExtension = true ;
// Perform additional checks for image files - if set to true, validate image size
// (This feature works in MX 6.0 and above)
Config.SecureImageUploads = true;
// What the user can do with this connector
Config.ConfigAllowedCommands = "QuickUpload,FileUpload,GetFolders,GetFoldersAndFiles,CreateFolder" ;
//Allowed Resource Types
Config.ConfigAllowedTypes = "File,Image,Flash,Media" ;
// For security, HTML is allowed in the first Kb of data for files having the
// following extensions only.
// (This feature works in MX 6.0 and above))
Config.HtmlExtensions = "html,htm,xml,xsd,txt,js" ;
// Configuration settings for each Resource Type
//
// - AllowedExtensions: the possible extensions that can be allowed.
// If it is empty then any file type can be uploaded.
// - DeniedExtensions: The extensions that won't be allowed.
// If it is empty then no restrictions are done here.
//
// For a file to be uploaded it has to fulfill both the AllowedExtensions
// and DeniedExtensions (that's it: not being denied) conditions.
//
// - FileTypesPath: the virtual folder relative to the document root where
// these resources will be located.
// Attention: It must start and end with a slash: '/'
//
// - FileTypesAbsolutePath: the physical path to the above folder. It must be
// an absolute path.
// If it's an empty string then it will be autocalculated.
// Usefull if you are using a virtual directory, symbolic link or alias.
// Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
// Attention: The above 'FileTypesPath' must point to the same directory.
// Attention: It must end with a slash: '/'
//
//
// - QuickUploadPath: the virtual folder relative to the document root where
// these resources will be uploaded using the Upload tab in the resources
// dialogs.
// Attention: It must start and end with a slash: '/'
//
// - QuickUploadAbsolutePath: the physical path to the above folder. It must be
// an absolute path.
// If it's an empty string then it will be autocalculated.
// Usefull if you are using a virtual directory, symbolic link or alias.
// Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
// Attention: The above 'QuickUploadPath' must point to the same directory.
// Attention: It must end with a slash: '/'
Config.AllowedExtensions = StructNew() ;
Config.DeniedExtensions = StructNew() ;
Config.FileTypesPath = StructNew() ;
Config.FileTypesAbsolutePath = StructNew() ;
Config.QuickUploadPath = StructNew() ;
Config.QuickUploadAbsolutePath = StructNew() ;
Config.AllowedExtensions["File"] = "7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xml,zip" ;
Config.DeniedExtensions["File"] = "" ;
Config.FileTypesPath["File"] = Config.UserFilesPath & 'file/' ;
Config.FileTypesAbsolutePath["File"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'file/') ) ;
Config.QuickUploadPath["File"] = Config.FileTypesPath["File"] ;
Config.QuickUploadAbsolutePath["File"] = Config.FileTypesAbsolutePath["File"] ;
Config.AllowedExtensions["Image"] = "bmp,gif,jpeg,jpg,png" ;
Config.DeniedExtensions["Image"] = "" ;
Config.FileTypesPath["Image"] = Config.UserFilesPath & 'image/' ;
Config.FileTypesAbsolutePath["Image"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'image/') ) ;
Config.QuickUploadPath["Image"] = Config.FileTypesPath["Image"] ;
Config.QuickUploadAbsolutePath["Image"] = Config.FileTypesAbsolutePath["Image"] ;
Config.AllowedExtensions["Flash"] = "swf,flv" ;
Config.DeniedExtensions["Flash"] = "" ;
Config.FileTypesPath["Flash"] = Config.UserFilesPath & 'flash/' ;
Config.FileTypesAbsolutePath["Flash"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'flash/') ) ;
Config.QuickUploadPath["Flash"] = Config.FileTypesPath["Flash"] ;
Config.QuickUploadAbsolutePath["Flash"] = Config.FileTypesAbsolutePath["Flash"] ;
Config.AllowedExtensions["Media"] = "aiff,asf,avi,bmp,fla,flv,gif,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,png,qt,ram,rm,rmi,rmvb,swf,tif,tiff,wav,wma,wmv" ;
Config.DeniedExtensions["Media"] = "" ;
Config.FileTypesPath["Media"] = Config.UserFilesPath & 'media/' ;
Config.FileTypesAbsolutePath["Media"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'media/') ) ;
Config.QuickUploadPath["Media"] = Config.FileTypesPath["Media"] ;
Config.QuickUploadAbsolutePath["Media"] = Config.FileTypesAbsolutePath["Media"] ;
</cfscript>
<cftry>
<!--- 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 application and server scopes --->
<cfif 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>
<!--- catch potential "The requested scope application has not been enabled" exception --->
<cfcatch type="any">
</cfcatch>
</cftry>
<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>

View file

@ -0,0 +1,31 @@
<cfsetting enablecfoutputonly="Yes">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* File Browser connector for ColdFusion (all versions).
*
--->
<cfset REQUEST.CFVersion = Left( SERVER.COLDFUSION.PRODUCTVERSION, Find( ",", SERVER.COLDFUSION.PRODUCTVERSION ) - 1 )>
<cfif REQUEST.CFVersion lte 5>
<cfinclude template="cf5_connector.cfm">
<cfelse>
<cfinclude template="cf_connector.cfm">
</cfif>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,31 @@
<cfsetting enablecfoutputonly="Yes">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the "File Uploader" for ColdFusion (all versions).
*
--->
<cfset REQUEST.CFVersion = Left( SERVER.COLDFUSION.PRODUCTVERSION, Find( ",", SERVER.COLDFUSION.PRODUCTVERSION ) - 1 )>
<cfif REQUEST.CFVersion lte 5>
<cfinclude template="cf5_upload.cfm">
<cfelse>
<cfinclude template="cf_upload.cfm">
</cfif>

View file

@ -0,0 +1,65 @@
[//lasso
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Configuration file for the File Manager Connector for Lasso.
*/
/*.....................................................................
The connector uses the file tags, which require authentication. Enter a
valid username and password from Lasso admin for a group with file tags
permissions for uploads and the path you define in UserFilesPath below.
*/
var('connection') = array(
-username='xxxxxxxx',
-password='xxxxxxxx'
);
/*.....................................................................
Set the base path for files that users can upload and browse (relative
to server root).
Set which file extensions are allowed and/or denied for each file type.
*/
var('config') = map(
'Enabled' = false,
'UserFilesPath' = '/userfiles/',
'Subdirectories' = map(
'File' = 'File/',
'Image' = 'Image/',
'Flash' = 'Flash/',
'Media' = 'Media/'
),
'AllowedExtensions' = map(
'File' = array('7z','aiff','asf','avi','bmp','csv','doc','fla','flv','gif','gz','gzip','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','ods','odt','pdf','png','ppt','pxd','qt','ram','rar','rm','rmi','rmvb','rtf','sdc','sitd','swf','sxc','sxw','tar','tgz','tif','tiff','txt','vsd','wav','wma','wmv','xls','xml','zip'),
'Image' = array('bmp','gif','jpeg','jpg','png'),
'Flash' = array('swf','flv'),
'Media' = array('aiff','asf','avi','bmp','fla','flv','gif','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','png','qt','ram','rm','rmi','rmvb','swf','tif','tiff','wav','wma','wmv')
),
'DeniedExtensions' = map(
'File' = array(),
'Image' = array(),
'Flash' = array(),
'Media' = array()
)
);
]

View file

@ -0,0 +1,257 @@
[//lasso
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the File Manager Connector for Lasso.
*/
/*.....................................................................
Include global configuration. See config.lasso for details.
*/
include('config.lasso');
/*.....................................................................
Translate current date/time to GMT for custom header.
*/
var('headerDate') = date_localtogmt(date)->format('%a, %d %b %Y %T GMT');
/*.....................................................................
Convert query string parameters to variables and initialize output.
*/
var(
'Command' = 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;
case;
$uploadResult = '202';
/select;
/if;
/if;
/*.........................................................
Set the HTML response.
*/
if($uploadResult == '0' || $uploadResult == '201');
$__html_reply__ = '\
<script type="text/javascript">
window.parent.frames[\'frmUpload\'].OnUploadCompleted(' + $uploadResult + ',\'' + $NewFilePath + '\',\'' + $NewFilePath->split('/')->last + '\');
</script>
';
else;
$__html_reply__ = '\
<script type="text/javascript">
window.parent.frames[\'frmUpload\'].OnUploadCompleted(' + $uploadResult + ');
</script>
';
/if;
/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;
]

View file

@ -0,0 +1,157 @@
[//lasso
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the "File Uploader" for Lasso.
*/
/*.....................................................................
Include global configuration. See config.lasso for details.
*/
include('config.lasso');
/*.....................................................................
Convert query string parameters to variables and initialize output.
*/
var(
'Type' = action_param('Type'),
'CurrentFolder' = action_param('CurrentFolder'),
'ServerPath' = action_param('ServerPath'),
'NewFile' = null,
'NewFileName' = string,
'OrigFilePath' = string,
'NewFilePath' = string,
'errorNumber' = 0,
'customMsg' = ''
);
$Type == '' ? $Type = 'File';
/*.....................................................................
Calculate the path to the current folder.
*/
$ServerPath == '' ? $ServerPath = $config->find('UserFilesPath');
var('currentFolderURL' = $ServerPath
+ $config->find('Subdirectories')->find(action_param('Type'))
+ action_param('CurrentFolder')
);
/*.....................................................................
Custom tag sets the HTML response.
*/
define_tag(
'sendresults',
-namespace='fck_',
-priority='replace',
-required='errorNumber',
-type='integer',
-optional='fileUrl',
-type='string',
-optional='fileName',
-type='string',
-optional='customMsg',
-type='string',
-description='Sets the HTML response for the FCKEditor Quick Upload feature.'
);
$__html_reply__ = '\
<script type="text/javascript">
window.parent.OnUploadCompleted(' + #errorNumber + ',"'
+ string_replace(#fileUrl, -find='"', -replace='\\"') + '","'
+ string_replace(#fileName, -find='"', -replace='\\"') + '","'
+ string_replace(#customMsg, -find='"', -replace='\\"') + '");
</script>
';
/define_tag;
if($config->find('Enabled'));
/*.................................................................
Process an uploaded file.
*/
inline($connection);
/*.............................................................
Was a file actually uploaded?
*/
file_uploads->size ? $NewFile = file_uploads->get(1) | $errorNumber = 202;
if($errorNumber == 0);
/*.........................................................
Split the file's extension from the filename in order
to follow the API's naming convention for duplicate
files. (Test.txt, Test(1).txt, Test(2).txt, etc.)
*/
$NewFileName = $NewFile->find('OrigName');
$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'));
$errorNumber = 202;
else;
/*.....................................................
Rename the target path until it is unique.
*/
while(file_exists($NewFilePath));
$NewFileName = #shortFileName + '(' + loop_count + ')' + #fileExtension;
$NewFilePath = $currentFolderURL + $NewFileName;
/while;
/*.....................................................
Copy the uploaded file to its final location.
*/
file_copy($NewFile->find('path'), $NewFilePath);
/*.....................................................
Set the error code for the response.
*/
select(file_currenterror( -errorcode));
case(0);
$OrigFilePath != $NewFilePath ? $errorNumber = 201;
case;
$errorNumber = 202;
/select;
/if;
/if;
/inline;
else;
$errorNumber = 1;
$customMsg = 'This file uploader is disabled. Please check the "editor/filemanager/upload/lasso/config.lasso" file.';
/if;
fck_sendresults(
-errorNumber=$errorNumber,
-fileUrl=$NewFilePath,
-fileName=$NewFileName,
-customMsg=$customMsg
);
]

View file

@ -0,0 +1,63 @@
#####
# FCKeditor - The text editor for Internet - http://www.fckeditor.net
# Copyright (C) 2003-2007 Frederico Caldeira Knabben
#
# == BEGIN LICENSE ==
#
# Licensed under the terms of any of the following licenses at your
# choice:
#
# - GNU General Public License Version 2 or later (the "GPL")
# http://www.gnu.org/licenses/gpl.html
#
# - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
# http://www.gnu.org/licenses/lgpl.html
#
# - Mozilla Public License Version 1.1 or later (the "MPL")
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# == END LICENSE ==
#
# This is the File Manager Connector for Perl.
#####
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;

View file

@ -0,0 +1,168 @@
#####
# FCKeditor - The text editor for Internet - http://www.fckeditor.net
# Copyright (C) 2003-2007 Frederico Caldeira Knabben
#
# == BEGIN LICENSE ==
#
# Licensed under the terms of any of the following licenses at your
# choice:
#
# - GNU General Public License Version 2 or later (the "GPL")
# http://www.gnu.org/licenses/gpl.html
#
# - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
# http://www.gnu.org/licenses/lgpl.html
#
# - Mozilla Public License Version 1.1 or later (the "MPL")
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# == END LICENSE ==
#
# This is the File Manager Connector for Perl.
#####
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;
SendUploadResults($sErrorNumber, $resourceType.$currentFolder.$sFileName, $sFileName, '');
}
sub SendUploadResults
{
local($sErrorNumber, $sFileUrl, $sFileName, $customMsg) = @_;
print "Content-type: text/html\n\n";
print '<script type="text/javascript">';
print 'window.parent.OnUploadCompleted(' . $sErrorNumber . ',"' . JS_cnv($sFileUrl) . '","' . JS_cnv($sFileName) . '","' . JS_cnv($customMsg) . '") ;';
print '</script>';
exit ;
}
1;

Some files were not shown because too many files have changed in this diff Show more