New: A filemanager is now working inside ckeditor
87
htdocs/includes/fckeditor/editor/filemanagerdol/browser/default/browser.css
Executable file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* CSS styles used by all pages that compose the File Browser.
|
||||
*/
|
||||
|
||||
body
|
||||
{
|
||||
background-color: #f1f1e3;
|
||||
margin-top:0;
|
||||
margin-bottom:0;
|
||||
}
|
||||
|
||||
form
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.Frame
|
||||
{
|
||||
background-color: #f1f1e3;
|
||||
border: thin inset #f1f1e3;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
color: #3b3b3b;
|
||||
border: #939393 1px solid;
|
||||
background-color: #dedede;
|
||||
}
|
||||
|
||||
.FolderListCurrentFolder img
|
||||
{
|
||||
background-image: url(images/FolderOpened.gif);
|
||||
}
|
||||
|
||||
.FolderListFolder img
|
||||
{
|
||||
background-image: url(images/Folder.gif);
|
||||
}
|
||||
|
||||
.fullHeight {
|
||||
height: 100%;
|
||||
}
|
||||
200
htdocs/includes/fckeditor/editor/filemanagerdol/browser/default/browser.html
Executable file
@ -0,0 +1,200 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
|
||||
"http://www.w3.org/TR/html4/frameset.dtd">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This page compose the File Browser dialog frameset.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>FCKeditor - Resources Browser</title>
|
||||
<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/fckxml.js"></script>
|
||||
<script type="text/javascript">
|
||||
// Automatically detect the correct document.domain (#1919).
|
||||
(function()
|
||||
{
|
||||
var d = document.domain ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
// Test if we can access a parent property.
|
||||
try
|
||||
{
|
||||
var test = window.opener.document.domain ;
|
||||
break ;
|
||||
}
|
||||
catch( e )
|
||||
{}
|
||||
|
||||
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
|
||||
d = d.replace( /.*?(?:\.|$)/, '' ) ;
|
||||
|
||||
if ( d.length == 0 )
|
||||
break ; // It was not able to detect the domain.
|
||||
|
||||
try
|
||||
{
|
||||
document.domain = d ;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
|
||||
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 )
|
||||
{
|
||||
if (errorNumber == "1")
|
||||
window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg ) ;
|
||||
else
|
||||
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>
|
||||
@ -0,0 +1,95 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This page shows the actual folder path.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Folder path</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="browser.css" type="text/css" rel="stylesheet">
|
||||
<script type="text/javascript">
|
||||
// Automatically detect the correct document.domain (#1919).
|
||||
(function()
|
||||
{
|
||||
var d = document.domain ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
// Test if we can access a parent property.
|
||||
try
|
||||
{
|
||||
var test = window.top.opener.document.domain ;
|
||||
break ;
|
||||
}
|
||||
catch( e )
|
||||
{}
|
||||
|
||||
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
|
||||
d = d.replace( /.*?(?:\.|$)/, '' ) ;
|
||||
|
||||
if ( d.length == 0 )
|
||||
break ; // It was not able to detect the domain.
|
||||
|
||||
try
|
||||
{
|
||||
document.domain = d ;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
|
||||
function SetCurrentFolder( resourceType, folderPath )
|
||||
{
|
||||
document.getElementById('tdName').innerHTML = folderPath ;
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedActualFolder = true ;
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<button style="WIDTH: 100%" type="button">
|
||||
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td><img height="32" alt="" src="images/FolderOpened32.gif" width="32"></td>
|
||||
<td> </td>
|
||||
<td id="tdName" width="100%" nowrap class="ActualFolder">/</td>
|
||||
<td> </td>
|
||||
<td><img height="8" src="images/ButtonArrow.gif" width="12" alt=""></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@ -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-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Page used to create new folders in the current folder.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Create Folder</title>
|
||||
<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 type="text/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>
|
||||
<table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" style="WIDTH: 100%" onclick="CreateFolder();">
|
||||
<table cellSpacing="0" cellPadding="0" border="0">
|
||||
<tr>
|
||||
<td><img height="16" alt="" src="images/Folder.gif" width="16"></td>
|
||||
<td> </td>
|
||||
<td nowrap>Create New Folder</td>
|
||||
</tr>
|
||||
</table>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
198
htdocs/includes/fckeditor/editor/filemanagerdol/browser/default/frmfolders.html
Executable file
@ -0,0 +1,198 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This page shows the list of folders available in the parent folder
|
||||
* of the current folder.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Folders</title>
|
||||
<link href="browser.css" type="text/css" rel="stylesheet">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script type="text/javascript" src="js/common.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var sActiveFolder ;
|
||||
|
||||
var bIsLoaded = false ;
|
||||
var iIntervalId ;
|
||||
|
||||
var oListManager = new Object() ;
|
||||
|
||||
oListManager.Init = function()
|
||||
{
|
||||
this.Table = document.getElementById('tableFiles') ;
|
||||
this.UpRow = document.getElementById('trUp') ;
|
||||
|
||||
this.TableRows = new Object() ;
|
||||
}
|
||||
|
||||
oListManager.Clear = function()
|
||||
{
|
||||
// Remove all other rows available.
|
||||
while ( this.Table.rows.length > 1 )
|
||||
this.Table.deleteRow(1) ;
|
||||
|
||||
// Reset the TableRows collection.
|
||||
this.TableRows = new Object() ;
|
||||
}
|
||||
|
||||
oListManager.AddItem = function( folderName, folderPath )
|
||||
{
|
||||
// Create the new row.
|
||||
var oRow = this.Table.insertRow(-1) ;
|
||||
oRow.className = 'FolderListFolder' ;
|
||||
|
||||
// Build the link to view the folder.
|
||||
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
|
||||
|
||||
// Add the folder icon cell.
|
||||
var oCell = oRow.insertCell(-1) ;
|
||||
oCell.width = 16 ;
|
||||
oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"><\/a>' ;
|
||||
|
||||
// Add the folder name cell.
|
||||
oCell = oRow.insertCell(-1) ;
|
||||
oCell.noWrap = true ;
|
||||
oCell.innerHTML = ' ' + sLink + folderName + '<\/a>' ;
|
||||
|
||||
this.TableRows[ folderPath ] = oRow ;
|
||||
}
|
||||
|
||||
oListManager.ShowUpFolder = function( upFolderPath )
|
||||
{
|
||||
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
|
||||
|
||||
if ( upFolderPath != null )
|
||||
{
|
||||
document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
|
||||
{
|
||||
LoadFolders( upFolderPath ) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CheckLoaded()
|
||||
{
|
||||
if ( window.top.IsLoadedActualFolder
|
||||
&& window.top.IsLoadedCreateFolder
|
||||
&& window.top.IsLoadedUpload
|
||||
&& window.top.IsLoadedResourcesList )
|
||||
{
|
||||
window.clearInterval( iIntervalId ) ;
|
||||
bIsLoaded = true ;
|
||||
OpenFolder( sActiveFolder ) ;
|
||||
}
|
||||
}
|
||||
|
||||
function OpenFolder( folderPath )
|
||||
{
|
||||
sActiveFolder = folderPath ;
|
||||
|
||||
if ( ! bIsLoaded )
|
||||
{
|
||||
if ( ! iIntervalId )
|
||||
iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
// Change the style for the select row (to show the opened folder).
|
||||
for ( var sFolderPath in oListManager.TableRows )
|
||||
{
|
||||
oListManager.TableRows[ sFolderPath ].className =
|
||||
( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
|
||||
}
|
||||
|
||||
// Set the current folder in all frames.
|
||||
window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
||||
window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
||||
window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
||||
|
||||
// Load the resources list for this folder.
|
||||
window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
|
||||
}
|
||||
|
||||
function LoadFolders( folderPath )
|
||||
{
|
||||
// Clear the folders list.
|
||||
oListManager.Clear() ;
|
||||
|
||||
// Get the parent folder path.
|
||||
var sParentFolderPath ;
|
||||
if ( folderPath != '/' )
|
||||
sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
|
||||
|
||||
// Show/Hide the Up Folder.
|
||||
oListManager.ShowUpFolder( sParentFolderPath ) ;
|
||||
|
||||
if ( folderPath != '/' )
|
||||
{
|
||||
sActiveFolder = folderPath ;
|
||||
oConnector.CurrentFolder = sParentFolderPath ;
|
||||
oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
|
||||
}
|
||||
else
|
||||
OpenFolder( '/' ) ;
|
||||
}
|
||||
|
||||
function GetFoldersCallBack( fckXml )
|
||||
{
|
||||
if ( oConnector.CheckError( fckXml ) != 0 )
|
||||
return ;
|
||||
|
||||
// Get the current folder path.
|
||||
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
|
||||
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
|
||||
|
||||
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
|
||||
|
||||
for ( var i = 0 ; i < oNodes.length ; i++ )
|
||||
{
|
||||
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
|
||||
oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ) ;
|
||||
}
|
||||
|
||||
OpenFolder( sActiveFolder ) ;
|
||||
}
|
||||
|
||||
function SetResourceType( type )
|
||||
{
|
||||
oConnector.ResourceType = type ;
|
||||
LoadFolders( '/' ) ;
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
oListManager.Init() ;
|
||||
LoadFolders( '/' ) ;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body class="FileArea">
|
||||
<table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr id="trUp" style="DISPLAY: none">
|
||||
<td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
|
||||
<td nowrap width="100%"> <a id="linkUp" href="#">..</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,183 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This page shows all resources available in a folder in the File Browser.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Resources</title>
|
||||
<link href="browser.css" type="text/css" rel="stylesheet">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<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"> ' +
|
||||
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> ' +
|
||||
sLink +
|
||||
fileName +
|
||||
'<\/a>' +
|
||||
'<\/td><td align="right" nowrap> ' +
|
||||
fileSize +
|
||||
' KB' +
|
||||
'<\/td><\/tr>' ;
|
||||
}
|
||||
|
||||
function OpenFolder( folderPath )
|
||||
{
|
||||
// Load the resources list for this folder.
|
||||
window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
|
||||
}
|
||||
|
||||
function 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 '' ;
|
||||
}
|
||||
|
||||
function OpenFile( fileUrl )
|
||||
{
|
||||
funcNum = GetUrlParam('CKEditorFuncNum') ;
|
||||
window.top.opener.CKEDITOR.tools.callFunction( funcNum, encodeURI( fileUrl ).replace( '#', '%23' ));
|
||||
|
||||
///////////////////////////////////
|
||||
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 : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' ) ;
|
||||
|
||||
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>
|
||||
@ -0,0 +1,69 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This page shows the list of available resource types.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Available types</title>
|
||||
<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 type="text/javascript">
|
||||
|
||||
function SetResourceType( type )
|
||||
{
|
||||
window.parent.frames["frmFolders"].SetResourceType( type ) ;
|
||||
}
|
||||
|
||||
var aTypes = [
|
||||
['File','File'],
|
||||
['Image','Image'],
|
||||
['Flash','Flash'],
|
||||
['Media','Media']
|
||||
] ;
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
var oCombo = document.getElementById('cmbType') ;
|
||||
oCombo.innerHTML = '' ;
|
||||
for ( var i = 0 ; i < aTypes.length ; i++ )
|
||||
{
|
||||
if ( oConnector.ShowAllTypes || aTypes[i][0] == oConnector.ResourceType )
|
||||
AddSelectOption( oCombo, aTypes[i][1], aTypes[i][0] ) ;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td nowrap>
|
||||
Resource Type<BR>
|
||||
<select id="cmbType" style="WIDTH: 100%" onchange="SetResourceType(this.value);">
|
||||
<option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
115
htdocs/includes/fckeditor/editor/filemanagerdol/browser/default/frmupload.html
Executable file
@ -0,0 +1,115 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Page used to upload new files in the current folder.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>File Upload</title>
|
||||
<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 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>
|
||||
<form id="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();">
|
||||
<table class="fullHeight" cellspacing="0" cellpadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td nowrap="nowrap">
|
||||
<span id="eUploadMessage">Upload a new file in this folder</span><br>
|
||||
<table cellspacing="0" cellpadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td width="100%"><input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file"></td>
|
||||
<td nowrap="nowrap"> <input id="btnUpload" type="submit" value="Upload"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 138 B |
|
After Width: | Height: | Size: 128 B |
|
After Width: | Height: | Size: 281 B |
|
After Width: | Height: | Size: 132 B |
|
After Width: | Height: | Size: 264 B |
|
After Width: | Height: | Size: 132 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 454 B |
|
After Width: | Height: | Size: 709 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 177 B |
|
After Width: | Height: | Size: 258 B |
|
After Width: | Height: | Size: 260 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 946 B |
|
After Width: | Height: | Size: 704 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 463 B |
|
After Width: | Height: | Size: 274 B |
|
After Width: | Height: | Size: 274 B |
|
After Width: | Height: | Size: 454 B |
|
After Width: | Height: | Size: 567 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 725 B |
|
After Width: | Height: | Size: 724 B |
|
After Width: | Height: | Size: 213 B |
|
After Width: | Height: | Size: 277 B |
|
After Width: | Height: | Size: 271 B |
|
After Width: | Height: | Size: 408 B |
|
After Width: | Height: | Size: 368 B |
|
After Width: | Height: | Size: 403 B |
|
After Width: | Height: | Size: 249 B |
|
After Width: | Height: | Size: 126 B |
|
After Width: | Height: | Size: 128 B |
|
After Width: | Height: | Size: 113 B |
|
After Width: | Height: | Size: 132 B |
|
After Width: | Height: | Size: 140 B |
|
After Width: | Height: | Size: 109 B |
|
After Width: | Height: | Size: 382 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 621 B |
|
After Width: | Height: | Size: 621 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 139 B |
|
After Width: | Height: | Size: 146 B |
|
After Width: | Height: | Size: 249 B |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 139 B |
|
After Width: | Height: | Size: 606 B |
|
After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 122 B |
|
After Width: | Height: | Size: 136 B |
|
After Width: | Height: | Size: 138 B |
|
After Width: | Height: | Size: 231 B |
|
After Width: | Height: | Size: 235 B |
|
After Width: | Height: | Size: 43 B |
88
htdocs/includes/fckeditor/editor/filemanagerdol/browser/default/js/common.js
Executable file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Common objects and functions shared by all pages that compose the
|
||||
* File Browser dialog window.
|
||||
*/
|
||||
|
||||
// Automatically detect the correct document.domain (#1919).
|
||||
(function()
|
||||
{
|
||||
var d = document.domain ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
// Test if we can access a parent property.
|
||||
try
|
||||
{
|
||||
var test = window.top.opener.document.domain ;
|
||||
break ;
|
||||
}
|
||||
catch( e )
|
||||
{}
|
||||
|
||||
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
|
||||
d = d.replace( /.*?(?:\.|$)/, '' ) ;
|
||||
|
||||
if ( d.length == 0 )
|
||||
break ; // It was not able to detect the domain.
|
||||
|
||||
try
|
||||
{
|
||||
document.domain = d ;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
|
||||
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( '' ) ;
|
||||
}
|
||||
147
htdocs/includes/fckeditor/editor/filemanagerdol/browser/default/js/fckxml.js
Executable file
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* 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
|
||||
try { return new XMLHttpRequest(); }
|
||||
catch(e) {}
|
||||
|
||||
// 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 )
|
||||
{
|
||||
var oXml ;
|
||||
try
|
||||
{
|
||||
// this is the same test for an FF2 bug as in fckxml_gecko.js
|
||||
// but we've moved the responseXML assignment into the try{}
|
||||
// so we don't even have to check the return status codes.
|
||||
var test = oXmlHttp.responseXML.firstChild ;
|
||||
oXml = oXmlHttp.responseXML ;
|
||||
}
|
||||
catch ( e )
|
||||
{
|
||||
try
|
||||
{
|
||||
oXml = (new DOMParser()).parseFromString( oXmlHttp.responseText, 'text/xml' ) ;
|
||||
}
|
||||
catch ( e ) {}
|
||||
}
|
||||
|
||||
if ( !oXml || !oXml.firstChild || oXml.firstChild.nodeName == 'parsererror' )
|
||||
{
|
||||
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 = oXml ;
|
||||
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 ;
|
||||
}
|
||||
}
|
||||
99
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/php/basexml.php
Executable file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* These functions define the base of the XML response sent by the PHP
|
||||
* connector.
|
||||
*/
|
||||
|
||||
function SetXmlHeaders()
|
||||
{
|
||||
ob_end_clean() ;
|
||||
|
||||
// Prevent the browser from caching the result.
|
||||
// Date in the past
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
|
||||
// always modified
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
|
||||
// HTTP/1.1
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate') ;
|
||||
header('Cache-Control: post-check=0, pre-check=0', false) ;
|
||||
// HTTP/1.0
|
||||
header('Pragma: no-cache') ;
|
||||
|
||||
// Set the response format.
|
||||
header( 'Content-Type: text/xml; charset=utf-8' ) ;
|
||||
}
|
||||
|
||||
function CreateXmlHeader( $command, $resourceType, $currentFolder )
|
||||
{
|
||||
SetXmlHeaders() ;
|
||||
|
||||
// Create the XML document header.
|
||||
echo '<?xml version="1.0" encoding="utf-8" ?>' ;
|
||||
|
||||
// Create the main "Connector" node.
|
||||
echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
|
||||
|
||||
// Add the current folder node.
|
||||
echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ;
|
||||
|
||||
$GLOBALS['HeaderSent'] = true ;
|
||||
}
|
||||
|
||||
function CreateXmlFooter()
|
||||
{
|
||||
echo '</Connector>' ;
|
||||
}
|
||||
|
||||
function SendError( $number, $text )
|
||||
{
|
||||
if ( $_GET['Command'] == 'FileUpload' )
|
||||
SendUploadResults( $number, "", "", $text ) ;
|
||||
|
||||
if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
|
||||
{
|
||||
SendErrorNode( $number, $text ) ;
|
||||
CreateXmlFooter() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetXmlHeaders() ;
|
||||
|
||||
// Create the XML document header
|
||||
echo '<?xml version="1.0" encoding="utf-8" ?>' ;
|
||||
|
||||
echo '<Connector>' ;
|
||||
|
||||
SendErrorNode( $number, $text ) ;
|
||||
|
||||
echo '</Connector>' ;
|
||||
}
|
||||
exit ;
|
||||
}
|
||||
|
||||
function SendErrorNode( $number, $text )
|
||||
{
|
||||
if ($text)
|
||||
echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;
|
||||
else
|
||||
echo '<Error number="' . $number . '" />' ;
|
||||
}
|
||||
?>
|
||||
299
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/php/commands.php
Executable file
@ -0,0 +1,299 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the File Manager Connector for PHP.
|
||||
*/
|
||||
|
||||
function GetFolders( $resourceType, $currentFolder )
|
||||
{
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' ) ;
|
||||
|
||||
// Array that will hold the folders names.
|
||||
$aFolders = array() ;
|
||||
|
||||
$oCurrentFolder = @opendir( $sServerDir ) ;
|
||||
|
||||
if ($oCurrentFolder !== false)
|
||||
{
|
||||
while ( $sFile = readdir( $oCurrentFolder ) )
|
||||
{
|
||||
if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
|
||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
|
||||
}
|
||||
closedir( $oCurrentFolder ) ;
|
||||
}
|
||||
|
||||
// Open the "Folders" node.
|
||||
echo "<Folders>" ;
|
||||
|
||||
natcasesort( $aFolders ) ;
|
||||
foreach ( $aFolders as $sFolder )
|
||||
echo $sFolder ;
|
||||
|
||||
// Close the "Folders" node.
|
||||
echo "</Folders>" ;
|
||||
}
|
||||
|
||||
function GetFoldersAndFiles( $resourceType, $currentFolder )
|
||||
{
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ;
|
||||
|
||||
// Arrays that will hold the folders and files names.
|
||||
$aFolders = array() ;
|
||||
$aFiles = array() ;
|
||||
|
||||
$oCurrentFolder = @opendir( $sServerDir ) ;
|
||||
|
||||
if ($oCurrentFolder !== false)
|
||||
{
|
||||
while ( $sFile = readdir( $oCurrentFolder ) )
|
||||
{
|
||||
if ( $sFile != '.' && $sFile != '..' )
|
||||
{
|
||||
if ( is_dir( $sServerDir . $sFile ) )
|
||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
|
||||
else
|
||||
{
|
||||
$iFileSize = @filesize( $sServerDir . $sFile ) ;
|
||||
if ( !$iFileSize ) {
|
||||
$iFileSize = 0 ;
|
||||
}
|
||||
if ( $iFileSize > 0 )
|
||||
{
|
||||
$iFileSize = round( $iFileSize / 1024 ) ;
|
||||
if ( $iFileSize < 1 )
|
||||
$iFileSize = 1 ;
|
||||
}
|
||||
|
||||
$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir( $oCurrentFolder ) ;
|
||||
}
|
||||
|
||||
// Send the folders
|
||||
natcasesort( $aFolders ) ;
|
||||
echo '<Folders>' ;
|
||||
|
||||
foreach ( $aFolders as $sFolder )
|
||||
echo $sFolder ;
|
||||
|
||||
echo '</Folders>' ;
|
||||
|
||||
// Send the files
|
||||
natcasesort( $aFiles ) ;
|
||||
echo '<Files>' ;
|
||||
|
||||
foreach ( $aFiles as $sFiles )
|
||||
echo $sFiles ;
|
||||
|
||||
echo '</Files>' ;
|
||||
}
|
||||
|
||||
function CreateFolder( $resourceType, $currentFolder )
|
||||
{
|
||||
if (!isset($_GET)) {
|
||||
global $_GET;
|
||||
}
|
||||
$sErrorNumber = '0' ;
|
||||
$sErrorMsg = '' ;
|
||||
|
||||
if ( isset( $_GET['NewFolderName'] ) )
|
||||
{
|
||||
$sNewFolderName = $_GET['NewFolderName'] ;
|
||||
$sNewFolderName = SanitizeFolderName( $sNewFolderName ) ;
|
||||
|
||||
if ( strpos( $sNewFolderName, '..' ) !== FALSE )
|
||||
$sErrorNumber = '102' ; // Invalid folder name.
|
||||
else
|
||||
{
|
||||
// Map the virtual path to the local server path of the current folder.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' ) ;
|
||||
|
||||
if ( is_writable( $sServerDir ) )
|
||||
{
|
||||
$sServerDir .= $sNewFolderName ;
|
||||
|
||||
$sErrorMsg = CreateServerFolder( $sServerDir ) ;
|
||||
|
||||
switch ( $sErrorMsg )
|
||||
{
|
||||
case '' :
|
||||
$sErrorNumber = '0' ;
|
||||
break ;
|
||||
case 'Invalid argument' :
|
||||
case 'No such file or directory' :
|
||||
$sErrorNumber = '102' ; // Path too long.
|
||||
break ;
|
||||
default :
|
||||
$sErrorNumber = '110' ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else
|
||||
$sErrorNumber = '103' ;
|
||||
}
|
||||
}
|
||||
else
|
||||
$sErrorNumber = '102' ;
|
||||
|
||||
// Create the "Error" node.
|
||||
echo '<Error number="' . $sErrorNumber . '" />' ;
|
||||
}
|
||||
|
||||
// DOL_CHANGE
|
||||
//function FileUpload( $resourceType, $currentFolder, $sCommand )
|
||||
function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
||||
{
|
||||
if (!isset($_FILES)) {
|
||||
global $_FILES;
|
||||
}
|
||||
$sErrorNumber = '0' ;
|
||||
$sFileName = '' ;
|
||||
|
||||
if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] )
|
||||
# This is for the QuickUpload tab box
|
||||
or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name'])))
|
||||
{
|
||||
global $Config ;
|
||||
|
||||
$oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload'];
|
||||
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ;
|
||||
|
||||
// Get the uploaded file name.
|
||||
$sFileName = $oFile['name'] ;
|
||||
$sFileName = SanitizeFileName( $sFileName ) ;
|
||||
|
||||
$sOriginalFileName = $sFileName ;
|
||||
|
||||
// Get the extension.
|
||||
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
|
||||
$sExtension = strtolower( $sExtension ) ;
|
||||
|
||||
if ( isset( $Config['SecureImageUploads'] ) )
|
||||
{
|
||||
if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false )
|
||||
{
|
||||
$sErrorNumber = '202' ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $Config['HtmlExtensions'] ) )
|
||||
{
|
||||
if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) &&
|
||||
( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true )
|
||||
{
|
||||
$sErrorNumber = '202' ;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it is an allowed extension.
|
||||
if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) )
|
||||
{
|
||||
$iCounter = 0 ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
$sFilePath = $sServerDir . $sFileName ;
|
||||
|
||||
if ( is_file( $sFilePath ) )
|
||||
{
|
||||
$iCounter++ ;
|
||||
$sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
|
||||
$sErrorNumber = '201' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
|
||||
|
||||
if ( is_file( $sFilePath ) )
|
||||
{
|
||||
if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] )
|
||||
{
|
||||
break ;
|
||||
}
|
||||
|
||||
$permissions = 0777;
|
||||
|
||||
if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] )
|
||||
{
|
||||
$permissions = $Config['ChmodOnUpload'] ;
|
||||
}
|
||||
|
||||
$oldumask = umask(0) ;
|
||||
chmod( $sFilePath, $permissions ) ;
|
||||
umask( $oldumask ) ;
|
||||
}
|
||||
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( file_exists( $sFilePath ) )
|
||||
{
|
||||
//previous checks failed, try once again
|
||||
if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false )
|
||||
{
|
||||
@unlink( $sFilePath ) ;
|
||||
$sErrorNumber = '202' ;
|
||||
}
|
||||
else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true )
|
||||
{
|
||||
@unlink( $sFilePath ) ;
|
||||
$sErrorNumber = '202' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
$sErrorNumber = '202' ;
|
||||
}
|
||||
else
|
||||
$sErrorNumber = '202' ;
|
||||
|
||||
|
||||
$sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ) ;
|
||||
$sFileUrl = CombinePaths( $sFileUrl, $sFileName ) ;
|
||||
|
||||
|
||||
// DOL_CHANGE
|
||||
//SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ;
|
||||
if($CKEcallback == '')
|
||||
{
|
||||
// this line already exists so wrap the if block around it
|
||||
SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
//issue the CKEditor Callback
|
||||
SendCKEditorResults ($CKEcallback, $sFileUrl,
|
||||
($sErrorNumber != 0
|
||||
? 'Error '. $sErrorNumber. ' upload failed. '. $sErrorMsg
|
||||
: 'Upload Successful'));
|
||||
}
|
||||
|
||||
exit ;
|
||||
}
|
||||
?>
|
||||
170
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/php/config.php
Executable file
@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Configuration file for the File Manager Connector for PHP.
|
||||
*/
|
||||
|
||||
global $Config ;
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
|
||||
// We must include the main because this page is
|
||||
// a web page that require security controls and
|
||||
// is a security hole if anybody can access without
|
||||
// being an authenticated user.
|
||||
require_once("../../../../../../main.inc.php");
|
||||
$uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root);
|
||||
$pos = strstr ($uri, '/'); // $pos contient alors url sans nom domaine
|
||||
if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a ''
|
||||
define('DOL_URL_ROOT', $pos);
|
||||
|
||||
/*
|
||||
$conf->syslog->enabled=1;
|
||||
define('SYSLOG_FILE','c:/log/dolibarr/dolibarr.log');
|
||||
require_once("../../../../../../lib/functions.lib.php");
|
||||
dol_syslog("eee".$conf->fckeditor->dir_output);
|
||||
*/
|
||||
|
||||
// SECURITY: You must explicitly enable this "connector". (Set it to "true").
|
||||
// WARNING: don't just set "$Config['Enabled'] = true ;", you must be sure that only
|
||||
// authenticated users can access this file or use some kind of session checking.
|
||||
$Config['Enabled'] = true ;
|
||||
|
||||
|
||||
// Path to user files relative to the document root.
|
||||
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ;
|
||||
|
||||
// Fill the following value it you prefer to specify the absolute path for the
|
||||
// user files directory. Useful if you are using a virtual directory, symbolic
|
||||
// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
|
||||
// Attention: The above 'UserFilesPath' must point to the same directory.
|
||||
$Config['UserFilesAbsolutePath'] = $dolibarr_main_data_root.'/fckeditor/';
|
||||
|
||||
// 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 (using getimagesize).
|
||||
$Config['SecureImageUploads'] = true;
|
||||
|
||||
// What the user can do with this connector.
|
||||
$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder') ;
|
||||
|
||||
// Allowed Resource Types.
|
||||
$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media') ;
|
||||
|
||||
// For security, HTML is allowed in the first Kb of data for files having the
|
||||
// following extensions only.
|
||||
$Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js") ;
|
||||
|
||||
// After file is uploaded, sometimes it is required to change its permissions
|
||||
// so that it was possible to access it at the later time.
|
||||
// If possible, it is recommended to set more restrictive permissions, like 0755.
|
||||
// Set to 0 to disable this feature.
|
||||
// Note: not needed on Windows-based servers.
|
||||
$Config['ChmodOnUpload'] = 0775 ;
|
||||
|
||||
// See comments above.
|
||||
// Used when creating folders that does not exist.
|
||||
$Config['ChmodOnFolderCreate'] = 0775 ;
|
||||
|
||||
/*
|
||||
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: '/'
|
||||
|
||||
NOTE: by default, QuickUploadPath and QuickUploadAbsolutePath point to
|
||||
"userfiles" directory to maintain backwards compatibility with older versions of FCKeditor.
|
||||
This is fine, but you in some cases you will be not able to browse uploaded files using file browser.
|
||||
Example: if you click on "image button", select "Upload" tab and send image
|
||||
to the server, image will appear in FCKeditor correctly, but because it is placed
|
||||
directly in /userfiles/ directory, you'll be not able to see it in built-in file browser.
|
||||
The more expected behaviour would be to send images directly to "image" subfolder.
|
||||
To achieve that, simply change
|
||||
$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;
|
||||
$Config['QuickUploadAbsolutePath']['Image'] = $Config['UserFilesAbsolutePath'] ;
|
||||
into:
|
||||
$Config['QuickUploadPath']['Image'] = $Config['FileTypesPath']['Image'] ;
|
||||
$Config['QuickUploadAbsolutePath']['Image'] = $Config['FileTypesAbsolutePath']['Image'] ;
|
||||
|
||||
*/
|
||||
|
||||
$Config['AllowedExtensions']['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') ;
|
||||
$Config['DeniedExtensions']['File'] = array() ;
|
||||
$Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . 'file/' ;
|
||||
$Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ;
|
||||
$Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] ;
|
||||
$Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ;
|
||||
|
||||
$Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','png') ;
|
||||
$Config['DeniedExtensions']['Image'] = array() ;
|
||||
$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . 'image/' ;
|
||||
$Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ;
|
||||
$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;
|
||||
$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;
|
||||
|
||||
$Config['AllowedExtensions']['Flash'] = array('swf','flv') ;
|
||||
$Config['DeniedExtensions']['Flash'] = array() ;
|
||||
$Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . 'flash/' ;
|
||||
$Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ;
|
||||
$Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] ;
|
||||
$Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ;
|
||||
|
||||
$Config['AllowedExtensions']['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') ;
|
||||
$Config['DeniedExtensions']['Media'] = array() ;
|
||||
$Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . 'media/' ;
|
||||
$Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ;
|
||||
$Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] ;
|
||||
$Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'] ;
|
||||
|
||||
?>
|
||||
87
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/php/connector.php
Executable file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the File Manager Connector for PHP.
|
||||
*/
|
||||
|
||||
ob_start() ;
|
||||
|
||||
require('./config.php') ;
|
||||
require('./util.php') ;
|
||||
require('./io.php') ;
|
||||
require('./basexml.php') ;
|
||||
require('./commands.php') ;
|
||||
require('./phpcompat.php') ;
|
||||
|
||||
if ( !$Config['Enabled'] )
|
||||
SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ;
|
||||
|
||||
DoResponse() ;
|
||||
|
||||
function DoResponse()
|
||||
{
|
||||
if (!isset($_GET)) {
|
||||
global $_GET;
|
||||
}
|
||||
if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
|
||||
return ;
|
||||
|
||||
// Get the main request informaiton.
|
||||
$sCommand = $_GET['Command'] ;
|
||||
$sResourceType = $_GET['Type'] ;
|
||||
$sCurrentFolder = GetCurrentFolder() ;
|
||||
|
||||
// Check if it is an allowed command
|
||||
if ( ! IsAllowedCommand( $sCommand ) )
|
||||
SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ) ;
|
||||
|
||||
// Check if it is an allowed type.
|
||||
if ( !IsAllowedType( $sResourceType ) )
|
||||
SendError( 1, 'Invalid type specified' ) ;
|
||||
|
||||
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
|
||||
if ( $sCommand == 'FileUpload' )
|
||||
{
|
||||
FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
|
||||
|
||||
// Execute the required command.
|
||||
switch ( $sCommand )
|
||||
{
|
||||
case 'GetFolders' :
|
||||
GetFolders( $sResourceType, $sCurrentFolder ) ;
|
||||
break ;
|
||||
case 'GetFoldersAndFiles' :
|
||||
GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
|
||||
break ;
|
||||
case 'CreateFolder' :
|
||||
CreateFolder( $sResourceType, $sCurrentFolder ) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
CreateXmlFooter() ;
|
||||
|
||||
exit ;
|
||||
}
|
||||
?>
|
||||
320
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/php/io.php
Executable file
@ -0,0 +1,320 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the File Manager Connector for PHP.
|
||||
*/
|
||||
function CombinePaths( $sBasePath, $sFolder )
|
||||
{
|
||||
return RemoveFromEnd( $sBasePath, '/' ) . '/' . RemoveFromStart( $sFolder, '/' ) ;
|
||||
}
|
||||
function GetResourceTypePath( $resourceType, $sCommand )
|
||||
{
|
||||
global $Config ;
|
||||
|
||||
if ( $sCommand == "QuickUpload")
|
||||
return $Config['QuickUploadPath'][$resourceType] ;
|
||||
else
|
||||
return $Config['FileTypesPath'][$resourceType] ;
|
||||
}
|
||||
|
||||
function GetResourceTypeDirectory( $resourceType, $sCommand )
|
||||
{
|
||||
global $Config ;
|
||||
if ( $sCommand == "QuickUpload")
|
||||
{
|
||||
if ( strlen( $Config['QuickUploadAbsolutePath'][$resourceType] ) > 0 )
|
||||
return $Config['QuickUploadAbsolutePath'][$resourceType] ;
|
||||
|
||||
// Map the "UserFiles" path to a local directory.
|
||||
return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( strlen( $Config['FileTypesAbsolutePath'][$resourceType] ) > 0 )
|
||||
return $Config['FileTypesAbsolutePath'][$resourceType] ;
|
||||
|
||||
// Map the "UserFiles" path to a local directory.
|
||||
return Server_MapPath( $Config['FileTypesPath'][$resourceType] ) ;
|
||||
}
|
||||
}
|
||||
|
||||
function GetUrlFromPath( $resourceType, $folderPath, $sCommand )
|
||||
{
|
||||
return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath ) ;
|
||||
}
|
||||
|
||||
function RemoveExtension( $fileName )
|
||||
{
|
||||
return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ;
|
||||
}
|
||||
|
||||
function ServerMapFolder( $resourceType, $folderPath, $sCommand )
|
||||
{
|
||||
// Get the resource type directory.
|
||||
$sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand ) ;
|
||||
|
||||
// Ensure that the directory exists.
|
||||
$sErrorMsg = CreateServerFolder( $sResourceTypePath ) ;
|
||||
if ( $sErrorMsg != '' )
|
||||
SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ;
|
||||
|
||||
// Return the resource type directory combined with the required path.
|
||||
return CombinePaths( $sResourceTypePath , $folderPath ) ;
|
||||
}
|
||||
|
||||
function GetParentFolder( $folderPath )
|
||||
{
|
||||
$sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ;
|
||||
return preg_replace( $sPattern, '', $folderPath ) ;
|
||||
}
|
||||
|
||||
function CreateServerFolder( $folderPath, $lastFolder = null )
|
||||
{
|
||||
global $Config ;
|
||||
$sParent = GetParentFolder( $folderPath ) ;
|
||||
|
||||
// Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms
|
||||
while ( strpos($folderPath, '//') !== false )
|
||||
{
|
||||
$folderPath = str_replace( '//', '/', $folderPath ) ;
|
||||
}
|
||||
|
||||
// Check if the parent exists, or create it.
|
||||
if ( !empty($sParent) && !file_exists( $sParent ) )
|
||||
{
|
||||
//prevents agains infinite loop when we can't create root folder
|
||||
if ( !is_null( $lastFolder ) && $lastFolder === $sParent) {
|
||||
return "Can't create $folderPath directory" ;
|
||||
}
|
||||
|
||||
$sErrorMsg = CreateServerFolder( $sParent, $folderPath ) ;
|
||||
if ( $sErrorMsg != '' )
|
||||
return $sErrorMsg ;
|
||||
}
|
||||
|
||||
if ( !file_exists( $folderPath ) )
|
||||
{
|
||||
// Turn off all error reporting.
|
||||
error_reporting( 0 ) ;
|
||||
|
||||
$php_errormsg = '' ;
|
||||
// Enable error tracking to catch the error.
|
||||
ini_set( 'track_errors', '1' ) ;
|
||||
|
||||
if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] )
|
||||
{
|
||||
mkdir( $folderPath ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$permissions = 0777 ;
|
||||
if ( isset( $Config['ChmodOnFolderCreate'] ) )
|
||||
{
|
||||
$permissions = $Config['ChmodOnFolderCreate'] ;
|
||||
}
|
||||
// To create the folder with 0777 permissions, we need to set umask to zero.
|
||||
$oldumask = umask(0) ;
|
||||
mkdir( $folderPath, $permissions ) ;
|
||||
umask( $oldumask ) ;
|
||||
}
|
||||
|
||||
$sErrorMsg = $php_errormsg ;
|
||||
|
||||
// Restore the configurations.
|
||||
ini_restore( 'track_errors' ) ;
|
||||
ini_restore( 'error_reporting' ) ;
|
||||
|
||||
return $sErrorMsg ;
|
||||
}
|
||||
else
|
||||
return '' ;
|
||||
}
|
||||
|
||||
function GetRootPath()
|
||||
{
|
||||
if (!isset($_SERVER)) {
|
||||
global $_SERVER;
|
||||
}
|
||||
$sRealPath = realpath( './' ) ;
|
||||
// #2124 ensure that no slash is at the end
|
||||
$sRealPath = rtrim($sRealPath,"\\/");
|
||||
|
||||
$sSelfPath = $_SERVER['PHP_SELF'] ;
|
||||
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ;
|
||||
|
||||
$sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath ) ;
|
||||
|
||||
$position = strpos( $sRealPath, $sSelfPath ) ;
|
||||
|
||||
// This can check only that this script isn't run from a virtual dir
|
||||
// But it avoids the problems that arise if it isn't checked
|
||||
if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) )
|
||||
SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ) ;
|
||||
|
||||
return substr( $sRealPath, 0, $position ) ;
|
||||
}
|
||||
|
||||
// Emulate the asp Server.mapPath function.
|
||||
// given an url path return the physical directory that it corresponds to
|
||||
function Server_MapPath( $path )
|
||||
{
|
||||
// This function is available only for Apache
|
||||
if ( function_exists( 'apache_lookup_uri' ) )
|
||||
{
|
||||
$info = apache_lookup_uri( $path ) ;
|
||||
return $info->filename . $info->path_info ;
|
||||
}
|
||||
|
||||
// This isn't correct but for the moment there's no other solution
|
||||
// If this script is under a virtual directory or symlink it will detect the problem and stop
|
||||
return GetRootPath() . $path ;
|
||||
}
|
||||
|
||||
function IsAllowedExt( $sExtension, $resourceType )
|
||||
{
|
||||
global $Config ;
|
||||
// Get the allowed and denied extensions arrays.
|
||||
$arAllowed = $Config['AllowedExtensions'][$resourceType] ;
|
||||
$arDenied = $Config['DeniedExtensions'][$resourceType] ;
|
||||
|
||||
if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) )
|
||||
return false ;
|
||||
|
||||
if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) )
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
function IsAllowedType( $resourceType )
|
||||
{
|
||||
global $Config ;
|
||||
if ( !in_array( $resourceType, $Config['ConfigAllowedTypes'] ) )
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
function IsAllowedCommand( $sCommand )
|
||||
{
|
||||
global $Config ;
|
||||
|
||||
if ( !in_array( $sCommand, $Config['ConfigAllowedCommands'] ) )
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
function GetCurrentFolder()
|
||||
{
|
||||
if (!isset($_GET)) {
|
||||
global $_GET;
|
||||
}
|
||||
$sCurrentFolder = isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ;
|
||||
|
||||
// Check the current folder syntax (must begin and start with a slash).
|
||||
if ( !preg_match( '|/$|', $sCurrentFolder ) )
|
||||
$sCurrentFolder .= '/' ;
|
||||
if ( strpos( $sCurrentFolder, '/' ) !== 0 )
|
||||
$sCurrentFolder = '/' . $sCurrentFolder ;
|
||||
|
||||
// Ensure the folder path has no double-slashes
|
||||
while ( strpos ($sCurrentFolder, '//') !== false ) {
|
||||
$sCurrentFolder = str_replace ('//', '/', $sCurrentFolder) ;
|
||||
}
|
||||
|
||||
// Check for invalid folder paths (..)
|
||||
if ( strpos( $sCurrentFolder, '..' ) || strpos( $sCurrentFolder, "\\" ))
|
||||
SendError( 102, '' ) ;
|
||||
|
||||
if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder))
|
||||
SendError( 102, '' ) ;
|
||||
|
||||
return $sCurrentFolder ;
|
||||
}
|
||||
|
||||
// Do a cleanup of the folder name to avoid possible problems
|
||||
function SanitizeFolderName( $sNewFolderName )
|
||||
{
|
||||
$sNewFolderName = stripslashes( $sNewFolderName ) ;
|
||||
|
||||
// Remove . \ / | : ? * " < >
|
||||
$sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName ) ;
|
||||
|
||||
return $sNewFolderName ;
|
||||
}
|
||||
|
||||
// Do a cleanup of the file name to avoid possible problems
|
||||
function SanitizeFileName( $sNewFileName )
|
||||
{
|
||||
global $Config ;
|
||||
|
||||
$sNewFileName = stripslashes( $sNewFileName ) ;
|
||||
|
||||
// Replace dots in the name with underscores (only one dot can be there... security issue).
|
||||
if ( $Config['ForceSingleExtension'] )
|
||||
$sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName ) ;
|
||||
|
||||
// Remove \ / | : ? * " < >
|
||||
$sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ) ;
|
||||
|
||||
return $sNewFileName ;
|
||||
}
|
||||
|
||||
// This is the function that sends the results of the uploading process.
|
||||
function SendUploadResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' )
|
||||
{
|
||||
// Minified version of the document.domain automatic fix script (#1919).
|
||||
// The original script can be found at _dev/domain_fix_template.js
|
||||
echo <<<EOF
|
||||
<script type="text/javascript">
|
||||
(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();
|
||||
EOF;
|
||||
|
||||
if ($errorNumber && $errorNumber != 201) {
|
||||
$fileUrl = "";
|
||||
$fileName = "";
|
||||
}
|
||||
|
||||
$rpl = array( '\\' => '\\\\', '"' => '\\"' ) ;
|
||||
echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '") ;' ;
|
||||
echo '</script>' ;
|
||||
exit ;
|
||||
}
|
||||
|
||||
|
||||
// DOL_CHANGE
|
||||
|
||||
// This is the function that sends the results of the uploading process to CKE.
|
||||
function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '')
|
||||
{
|
||||
echo '<script type="text/javascript">';
|
||||
|
||||
$rpl = array( '\\' => '\\\\', '"' => '\\"' ) ;
|
||||
|
||||
echo 'window.parent.CKEDITOR.tools.callFunction("'. $callback. '","'.
|
||||
strtr($sFileUrl, $rpl). '", "'. strtr( $customMsg, $rpl). '");' ;
|
||||
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
17
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/php/phpcompat.php
Executable file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
if ( !isset( $_SERVER ) ) {
|
||||
$_SERVER = $HTTP_SERVER_VARS ;
|
||||
}
|
||||
if ( !isset( $_GET ) ) {
|
||||
$_GET = $HTTP_GET_VARS ;
|
||||
}
|
||||
if ( !isset( $_FILES ) ) {
|
||||
$_FILES = $HTTP_POST_FILES ;
|
||||
}
|
||||
|
||||
if ( !defined( 'DIRECTORY_SEPARATOR' ) ) {
|
||||
define( 'DIRECTORY_SEPARATOR',
|
||||
strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/'
|
||||
) ;
|
||||
}
|
||||
67
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php
Executable file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the "File Uploader" for PHP.
|
||||
*/
|
||||
|
||||
require('./config.php') ;
|
||||
require('./util.php') ;
|
||||
require('./io.php') ;
|
||||
require('./commands.php') ;
|
||||
require('./phpcompat.php') ;
|
||||
|
||||
function SendError( $number, $text )
|
||||
{
|
||||
SendUploadResults( $number, '', '', $text ) ;
|
||||
}
|
||||
|
||||
|
||||
// Check if this uploader has been enabled.
|
||||
if ( !$Config['Enabled'] )
|
||||
SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ;
|
||||
|
||||
$sCommand = 'QuickUpload' ;
|
||||
|
||||
// The file type (from the QueryString, by default 'File').
|
||||
$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
|
||||
|
||||
$sCurrentFolder = "/" ;
|
||||
|
||||
// Is enabled the upload?
|
||||
if ( ! IsAllowedCommand( $sCommand ) )
|
||||
SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' ) ;
|
||||
|
||||
// Check if it is an allowed type.
|
||||
if ( !IsAllowedType( $sType ) )
|
||||
SendUploadResults( 1, '', '', 'Invalid type specified' ) ;
|
||||
|
||||
|
||||
// DOL_CHANGE
|
||||
//FileUpload( $sType, $sCurrentFolder, $sCommand )
|
||||
|
||||
// Get the CKEditor Callback
|
||||
$CKEcallback = $_GET['CKEditorFuncNum'];
|
||||
|
||||
//modify the next line adding in the new param
|
||||
FileUpload($sType, $sCurrentFolder, $sCommand, $CKEcallback);
|
||||
|
||||
|
||||
?>
|
||||
220
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/php/util.php
Executable file
@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Utility functions for the File Manager Connector for PHP.
|
||||
*/
|
||||
|
||||
function RemoveFromStart( $sourceString, $charToRemove )
|
||||
{
|
||||
$sPattern = '|^' . $charToRemove . '+|' ;
|
||||
return preg_replace( $sPattern, '', $sourceString ) ;
|
||||
}
|
||||
|
||||
function RemoveFromEnd( $sourceString, $charToRemove )
|
||||
{
|
||||
$sPattern = '|' . $charToRemove . '+$|' ;
|
||||
return preg_replace( $sPattern, '', $sourceString ) ;
|
||||
}
|
||||
|
||||
function FindBadUtf8( $string )
|
||||
{
|
||||
$regex =
|
||||
'([\x00-\x7F]'.
|
||||
'|[\xC2-\xDF][\x80-\xBF]'.
|
||||
'|\xE0[\xA0-\xBF][\x80-\xBF]'.
|
||||
'|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.
|
||||
'|\xED[\x80-\x9F][\x80-\xBF]'.
|
||||
'|\xF0[\x90-\xBF][\x80-\xBF]{2}'.
|
||||
'|[\xF1-\xF3][\x80-\xBF]{3}'.
|
||||
'|\xF4[\x80-\x8F][\x80-\xBF]{2}'.
|
||||
'|(.{1}))';
|
||||
|
||||
while (preg_match('/'.$regex.'/S', $string, $matches)) {
|
||||
if ( isset($matches[2])) {
|
||||
return true;
|
||||
}
|
||||
$string = substr($string, strlen($matches[0]));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function ConvertToXmlAttribute( $value )
|
||||
{
|
||||
if ( defined( 'PHP_OS' ) )
|
||||
{
|
||||
$os = PHP_OS ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$os = php_uname() ;
|
||||
}
|
||||
|
||||
if ( strtoupper( substr( $os, 0, 3 ) ) === 'WIN' || FindBadUtf8( $value ) )
|
||||
{
|
||||
return ( utf8_encode( htmlspecialchars( $value ) ) ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( htmlspecialchars( $value ) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether given extension is in html etensions list
|
||||
*
|
||||
* @param string $ext
|
||||
* @param array $htmlExtensions
|
||||
* @return boolean
|
||||
*/
|
||||
function IsHtmlExtension( $ext, $htmlExtensions )
|
||||
{
|
||||
if ( !$htmlExtensions || !is_array( $htmlExtensions ) )
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
$lcaseHtmlExtensions = array() ;
|
||||
foreach ( $htmlExtensions as $key => $val )
|
||||
{
|
||||
$lcaseHtmlExtensions[$key] = strtolower( $val ) ;
|
||||
}
|
||||
return in_array( $ext, $lcaseHtmlExtensions ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param string $filePath absolute path to file
|
||||
* @return boolean
|
||||
*/
|
||||
function DetectHtml( $filePath )
|
||||
{
|
||||
$fp = @fopen( $filePath, 'rb' ) ;
|
||||
|
||||
//open_basedir restriction, see #1906
|
||||
if ( $fp === false || !flock( $fp, LOCK_SH ) )
|
||||
{
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
$chunk = fread( $fp, 1024 ) ;
|
||||
flock( $fp, LOCK_UN ) ;
|
||||
fclose( $fp ) ;
|
||||
|
||||
$chunk = strtolower( $chunk ) ;
|
||||
|
||||
if (!$chunk)
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
$chunk = trim( $chunk ) ;
|
||||
|
||||
if ( preg_match( "/<!DOCTYPE\W*X?HTML/sim", $chunk ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' ) ;
|
||||
|
||||
foreach( $tags as $tag )
|
||||
{
|
||||
if( false !== strpos( $chunk, $tag ) )
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
//type = javascript
|
||||
if ( preg_match( '!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk ) )
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
|
||||
//href = javascript
|
||||
//src = javascript
|
||||
//data = javascript
|
||||
if ( preg_match( '!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) )
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
|
||||
//url(javascript
|
||||
if ( preg_match( '!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) )
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check file content.
|
||||
* Currently this function validates only image files.
|
||||
* Returns false if file is invalid.
|
||||
*
|
||||
* @param string $filePath absolute path to file
|
||||
* @param string $extension file extension
|
||||
* @param integer $detectionLevel 0 = none, 1 = use getimagesize for images, 2 = use DetectHtml for images
|
||||
* @return boolean
|
||||
*/
|
||||
function IsImageValid( $filePath, $extension )
|
||||
{
|
||||
if (!@is_readable($filePath)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$imageCheckExtensions = array('gif', 'jpeg', 'jpg', 'png', 'swf', 'psd', 'bmp', 'iff');
|
||||
|
||||
// version_compare is available since PHP4 >= 4.0.7
|
||||
if ( function_exists( 'version_compare' ) ) {
|
||||
$sCurrentVersion = phpversion();
|
||||
if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) {
|
||||
$imageCheckExtensions[] = "tiff";
|
||||
$imageCheckExtensions[] = "tif";
|
||||
}
|
||||
if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) {
|
||||
$imageCheckExtensions[] = "swc";
|
||||
}
|
||||
if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) {
|
||||
$imageCheckExtensions[] = "jpc";
|
||||
$imageCheckExtensions[] = "jp2";
|
||||
$imageCheckExtensions[] = "jpx";
|
||||
$imageCheckExtensions[] = "jb2";
|
||||
$imageCheckExtensions[] = "xbm";
|
||||
$imageCheckExtensions[] = "wbmp";
|
||||
}
|
||||
}
|
||||
|
||||
if ( !in_array( $extension, $imageCheckExtensions ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( @getimagesize( $filePath ) === false ) {
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
210
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/test.html
Executable file
@ -0,0 +1,210 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Test page for the File Browser connectors.
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>FCKeditor - Connectors Tests</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script type="text/javascript">
|
||||
|
||||
// Automatically detect the correct document.domain (#1919).
|
||||
(function()
|
||||
{
|
||||
var d = document.domain ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
// Test if we can access a parent property.
|
||||
try
|
||||
{
|
||||
var test = window.opener.document.domain ;
|
||||
break ;
|
||||
}
|
||||
catch( e ) {}
|
||||
|
||||
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
|
||||
d = d.replace( /.*?(?:\.|$)/, '' ) ;
|
||||
|
||||
if ( d.length == 0 )
|
||||
break ; // It was not able to detect the domain.
|
||||
|
||||
try
|
||||
{
|
||||
document.domain = d ;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
|
||||
function BuildBaseUrl( command )
|
||||
{
|
||||
var sUrl =
|
||||
document.getElementById('cmbConnector').value +
|
||||
'?Command=' + command +
|
||||
'&Type=' + document.getElementById('cmbType').value +
|
||||
'&CurrentFolder=' + encodeURIComponent(document.getElementById('txtFolder').value) ;
|
||||
|
||||
return sUrl ;
|
||||
}
|
||||
|
||||
function SetFrameUrl( url )
|
||||
{
|
||||
document.getElementById('eRunningFrame').src = url ;
|
||||
|
||||
document.getElementById('eUrl').innerHTML = url ;
|
||||
}
|
||||
|
||||
function GetFolders()
|
||||
{
|
||||
SetFrameUrl( BuildBaseUrl( 'GetFolders' ) ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
function GetFoldersAndFiles()
|
||||
{
|
||||
SetFrameUrl( BuildBaseUrl( 'GetFoldersAndFiles' ) ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
function CreateFolder()
|
||||
{
|
||||
var sFolder = prompt( 'Type the folder name:', 'Test Folder' ) ;
|
||||
|
||||
if ( ! sFolder )
|
||||
return false ;
|
||||
|
||||
var sUrl = BuildBaseUrl( 'CreateFolder' ) ;
|
||||
sUrl += '&NewFolderName=' + encodeURIComponent( sFolder ) ;
|
||||
|
||||
SetFrameUrl( sUrl ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
function OnUploadCompleted( errorNumber, fileName )
|
||||
{
|
||||
switch ( errorNumber )
|
||||
{
|
||||
case 0 :
|
||||
alert( 'File uploaded with no errors' ) ;
|
||||
break ;
|
||||
case 201 :
|
||||
GetFoldersAndFiles() ;
|
||||
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
|
||||
break ;
|
||||
case 202 :
|
||||
alert( 'Invalid file' ) ;
|
||||
break ;
|
||||
default :
|
||||
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
this.frames.frmUpload = this ;
|
||||
|
||||
function SetAction()
|
||||
{
|
||||
var sUrl = BuildBaseUrl( 'FileUpload' ) ;
|
||||
document.getElementById('eUrl').innerHTML = sUrl ;
|
||||
document.getElementById('frmUpload').action = sUrl ;
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
Connector:<br />
|
||||
<select id="cmbConnector" name="cmbConnector">
|
||||
<option value="asp/connector.asp" selected="selected">ASP</option>
|
||||
<option value="aspx/connector.aspx">ASP.Net</option>
|
||||
<option value="cfm/connector.cfm">ColdFusion</option>
|
||||
<option value="lasso/connector.lasso">Lasso</option>
|
||||
<option value="perl/connector.cgi">Perl</option>
|
||||
<option value="php/connector.php">PHP</option>
|
||||
<option value="py/connector.py">Python</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Current Folder<br />
|
||||
<input id="txtFolder" type="text" value="/" name="txtFolder" /></td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Resource Type<br />
|
||||
<select id="cmbType" name="cmbType">
|
||||
<option value="File" selected="selected">File</option>
|
||||
<option value="Image">Image</option>
|
||||
<option value="Flash">Flash</option>
|
||||
<option value="Media">Media</option>
|
||||
<option value="Invalid">Invalid Type (for testing)</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<a href="#" onclick="GetFolders();">Get Folders</a></td>
|
||||
<td>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<a href="#" onclick="GetFoldersAndFiles();">Get Folders and Files</a></td>
|
||||
<td>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<a href="#" onclick="CreateFolder();">Create Folder</a></td>
|
||||
<td>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<form id="frmUpload" action="" target="eRunningFrame" method="post" enctype="multipart/form-data">
|
||||
File Upload<br />
|
||||
<input id="txtFileUpload" type="file" name="NewFile" />
|
||||
<input type="submit" value="Upload" onclick="SetAction();" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
URL: <span id="eUrl"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="100%" valign="top">
|
||||
<iframe id="eRunningFrame" src="javascript:void(0)" name="eRunningFrame" width="100%"
|
||||
height="100%"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
192
htdocs/includes/fckeditor/editor/filemanagerdol/connectors/uploadtest.html
Executable file
@ -0,0 +1,192 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Test page for the "File Uploaders".
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>FCKeditor - Uploaders Tests</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script type="text/javascript">
|
||||
|
||||
// Automatically detect the correct document.domain (#1919).
|
||||
(function()
|
||||
{
|
||||
var d = document.domain ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
// Test if we can access a parent property.
|
||||
try
|
||||
{
|
||||
var test = window.opener.document.domain ;
|
||||
break ;
|
||||
}
|
||||
catch( e ) {}
|
||||
|
||||
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
|
||||
d = d.replace( /.*?(?:\.|$)/, '' ) ;
|
||||
|
||||
if ( d.length == 0 )
|
||||
break ; // It was not able to detect the domain.
|
||||
|
||||
try
|
||||
{
|
||||
document.domain = d ;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
|
||||
function SendFile()
|
||||
{
|
||||
var sUploaderUrl = cmbUploaderUrl.value ;
|
||||
|
||||
if ( sUploaderUrl.length == 0 )
|
||||
sUploaderUrl = txtCustomUrl.value ;
|
||||
|
||||
if ( sUploaderUrl.length == 0 )
|
||||
{
|
||||
alert( 'Please provide your custom URL or select a default one' ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
eURL.innerHTML = sUploaderUrl ;
|
||||
txtUrl.value = '' ;
|
||||
|
||||
var date = new Date()
|
||||
|
||||
frmUpload.action = sUploaderUrl + '?time=' + date.getTime();
|
||||
if (document.getElementById('cmbType').value) {
|
||||
frmUpload.action = frmUpload.action + '&Type='+document.getElementById('cmbType').value;
|
||||
}
|
||||
if (document.getElementById('CurrentFolder').value) {
|
||||
frmUpload.action = frmUpload.action + '&CurrentFolder='+document.getElementById('CurrentFolder').value;
|
||||
}
|
||||
frmUpload.submit() ;
|
||||
}
|
||||
|
||||
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
|
||||
{
|
||||
switch ( errorNumber )
|
||||
{
|
||||
case 0 : // No errors
|
||||
txtUrl.value = fileUrl ;
|
||||
alert( 'File uploaded with no errors' ) ;
|
||||
break ;
|
||||
case 1 : // Custom error
|
||||
alert( customMsg ) ;
|
||||
break ;
|
||||
case 10 : // Custom warning
|
||||
txtUrl.value = fileUrl ;
|
||||
alert( customMsg ) ;
|
||||
break ;
|
||||
case 201 :
|
||||
txtUrl.value = fileUrl ;
|
||||
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
|
||||
break ;
|
||||
case 202 :
|
||||
alert( 'Invalid file' ) ;
|
||||
break ;
|
||||
case 203 :
|
||||
alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
|
||||
break ;
|
||||
default :
|
||||
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table cellSpacing="0" cellPadding="0" width="100%" border="0" height="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td nowrap>
|
||||
Select the "File Uploader" to use: <br>
|
||||
<select id="cmbUploaderUrl">
|
||||
<option selected value="asp/upload.asp">ASP</option>
|
||||
<option value="aspx/upload.aspx">ASP.Net</option>
|
||||
<option value="cfm/upload.cfm">ColdFusion</option>
|
||||
<option value="lasso/upload.lasso">Lasso</option>
|
||||
<option value="perl/upload.cgi">Perl</option>
|
||||
<option value="php/upload.php">PHP</option>
|
||||
<option value="py/upload.py">Python</option>
|
||||
<option value="">(Custom)</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
Resource Type<br />
|
||||
<select id="cmbType" name="cmbType">
|
||||
<option value="">None</option>
|
||||
<option value="File">File</option>
|
||||
<option value="Image">Image</option>
|
||||
<option value="Flash">Flash</option>
|
||||
<option value="Media">Media</option>
|
||||
<option value="Invalid">Invalid Type (for testing)</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
Current Folder: <br>
|
||||
<input type="text" name="CurrentFolder" id="CurrentFolder" value="/">
|
||||
</td>
|
||||
<td nowrap> </td>
|
||||
<td width="100%">
|
||||
Custom Uploader URL:<BR>
|
||||
<input id="txtCustomUrl" style="WIDTH: 100%; BACKGROUND-COLOR: #dcdcdc" disabled type="text">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td noWrap>
|
||||
<form id="frmUpload" target="UploadWindow" enctype="multipart/form-data" action="" method="post">
|
||||
Upload a new file:<br>
|
||||
<input type="file" name="NewFile"><br>
|
||||
|
||||
<input type="button" value="Send it to the Server" onclick="SendFile();">
|
||||
</form>
|
||||
</td>
|
||||
<td style="WIDTH: 16px"> </td>
|
||||
<td vAlign="top" width="100%">
|
||||
Uploaded File URL:<br>
|
||||
<INPUT id="txtUrl" style="WIDTH: 100%" readonly type="text">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
Post URL: <span id="eURL"> </span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="100%">
|
||||
<iframe name="UploadWindow" width="100%" height="100%" src="javascript:void(0)"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@ -188,10 +188,11 @@ class DolEditor
|
||||
{
|
||||
print ','."\n";
|
||||
// To use filemanager with old fckeditor (GPL)
|
||||
print ' filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanager/browser/default/browser.html?Connector='.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanager/connectors/php/connector.php\',
|
||||
filebrowserUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanager/connectors/php/upload.php?Type=File\',
|
||||
filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector='.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanager/connectors/php/connector.php\',
|
||||
filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanager/connectors/php/upload.php?Type=Image\','."\n";
|
||||
print ' filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/browser/default/browser.html?Connector='.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/connector.php\',';
|
||||
//print ' filebrowserUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=File\',';
|
||||
print ' filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/browser/default/browser.html?Type=Image&Connector='.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/connector.php\',';
|
||||
//print ' filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=Image\',';
|
||||
print "\n";
|
||||
// To use filemanager with ckfinder (Non free) and ckfinder directory is inside htdocs/includes
|
||||
/* print ' filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html\',
|
||||
filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html?Type=Images\',
|
||||
|
||||