add contents
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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: #dedede;
|
||||
margin:auto;
|
||||
}
|
||||
|
||||
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: 14px;
|
||||
font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana;
|
||||
}
|
||||
|
||||
.ActualFolder
|
||||
{
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.PopupButtons
|
||||
{
|
||||
border-top: #d5d59d 1px solid;
|
||||
background-color: #e3e3c7;
|
||||
padding: 7px 10px 7px 10px;
|
||||
}
|
||||
|
||||
.FileBrowserTopButton {
|
||||
color: #dedede;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
.Button, button
|
||||
{
|
||||
color: #50485C;
|
||||
border: #7A7261 1px solid;
|
||||
background-color: #c7c78f;
|
||||
}
|
||||
|
||||
#btn__create_folder {
|
||||
color: #3b3b1f;
|
||||
border: #737357 1px solid;
|
||||
background-color: #CEC6B5;
|
||||
}
|
||||
|
||||
.FolderListFolder img
|
||||
{
|
||||
background-image: url(images/Folder.gif);
|
||||
}
|
||||
|
||||
.FolderListCurrentFolder img
|
||||
{
|
||||
background-image: url(images/FolderOpened.gif);
|
||||
}
|
||||
|
||||
.FolderListFolderRO img
|
||||
{
|
||||
background-image: url(images/FolderRO.gif);
|
||||
}
|
||||
|
||||
.FolderListCurrentFolderRO img
|
||||
{
|
||||
background-image: url(images/FolderOpenedRO.gif);
|
||||
}
|
||||
|
||||
td { font-size: 10pt; }
|
||||
|
||||
.fullHeight {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
div.img_buttons {
|
||||
padding-top: 1px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
#big_imagewin {
|
||||
display:none;
|
||||
border: gray 2px solid;
|
||||
overflow:none;
|
||||
text-align:center;
|
||||
padding-top: 8px;
|
||||
|
||||
|
||||
}
|
||||
#big_iwin_close {
|
||||
margin: auto;
|
||||
padding: 4px;
|
||||
text-align: right;
|
||||
}
|
||||
.bigwin_close_but {
|
||||
background-color: #ECE9D8;
|
||||
}
|
||||
|
||||
td.img { border-bottom: 1px solid gray; padding-top: 2px; }
|
||||
td.silver {
|
||||
background-color: #dedede;
|
||||
border-bottom: 1px solid gray;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
div#wrapper{
|
||||
margin:auto;
|
||||
background-color:#ddd;
|
||||
height: 563px;
|
||||
width: 960px;
|
||||
}
|
||||
div.left_sidebar {
|
||||
float:left;
|
||||
height: 505px; width: 180px;
|
||||
}
|
||||
|
||||
div.right_page {
|
||||
float:right; padding:0px;
|
||||
width: 760px; height:580px;
|
||||
}
|
||||
.resourceslist {
|
||||
border-left: 0px;
|
||||
}
|
||||
.frameborder {
|
||||
border: 2px inset #f1f1e3;
|
||||
}
|
||||
div#bottom_matter {
|
||||
height:108px;
|
||||
width: 758px;
|
||||
background-color: #dddddd;
|
||||
border: inset #f1f1e3;
|
||||
|
||||
}
|
||||
.createfolder {
|
||||
float: left;
|
||||
border:none;
|
||||
height:60px;
|
||||
width:140px;
|
||||
}
|
||||
|
||||
div.frmupload{
|
||||
float:right;
|
||||
padding-left:1px;
|
||||
padding-right:4px;
|
||||
height:60px;
|
||||
width: 598px;
|
||||
|
||||
}
|
||||
.ckg_td1 {
|
||||
padding-right:8px;
|
||||
padding-left:8px;
|
||||
}
|
||||
div#worker {
|
||||
height:0px; width:0px;
|
||||
}
|
||||
div#help {
|
||||
width: 470px;
|
||||
height: 350px;
|
||||
border-left: inset 2px #f1f1e3;
|
||||
border-top: inset 2px #f1f1e3;
|
||||
border-right: outset 2px #f1f1e3;
|
||||
border-bottom: outset 2px #f1f1e3;
|
||||
position:absolute;
|
||||
top:20px;
|
||||
left:375px;
|
||||
padding: 6px;
|
||||
visibility:hidden;
|
||||
background-color: #eee;
|
||||
overflow:auto;
|
||||
}
|
||||
input.closebut {
|
||||
float: right;
|
||||
background-color: #eee;
|
||||
}
|
||||
div.closebut {
|
||||
width: 420px;
|
||||
}
|
||||
div#help h3 {
|
||||
text-align: center;
|
||||
}
|
@@ -0,0 +1,378 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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" src="js/language.js"></script>
|
||||
<script type="text/javascript" src="js/safeFN_class.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.onbeforeunload = function() { };
|
||||
var CurrentDWikiUser = opener.oDokuWiki_FCKEditorInstance.dwiki_user; // use this variable to pass into frame (frmupload.html)
|
||||
var CurrentDWikiClient = opener.oDokuWiki_FCKEditorInstance.dwiki_client; // use this variable to pass into frame (frmupload.html)
|
||||
var isLocalDwikiBrowser = opener.oDokuWiki_FCKEditorInstance.isLocalDwikiBrowser ? true : false;
|
||||
var CreateDwikiFolder = opener.oDokuWiki_FCKEditorInstance.dwiki_create_folder; // use this variable to pass into frame (frmupload.html)
|
||||
var DwikiFNencode = opener.oDokuWiki_FCKEditorInstance.dwiki_fnencode;
|
||||
var isDwikiUrlExtern = opener.oDokuWiki_FCKEditorInstance.isUrlExtern ? true: false;
|
||||
var DwikiImageUploadAllowedExtensions = opener.oDokuWiki_FCKEditorInstance.imageUploadAllowedExtensions;
|
||||
var isDwikiMediaFile = opener.oDokuWiki_FCKEditorInstance.isDwikiMediaFile;
|
||||
var isDwikiImage = opener.oDokuWiki_FCKEditorInstance.isDwikiImage;
|
||||
var fbsz_increment =opener.oDokuWiki_FCKEditorInstance.fbsz_increment;
|
||||
// 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 ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedCreateFolder = true ;
|
||||
setupLanguage();
|
||||
|
||||
if(CurrentDWikiUser == 'visitor' || isLocalDwikiBrowser || !CurrentDWikiUser) {
|
||||
document.getElementById("btn__create_folder").disabled = true;
|
||||
document.getElementById("create_folder").innerHTML = "";
|
||||
}
|
||||
else document.getElementById("create_folder").style.display='block';
|
||||
|
||||
if(CreateDwikiFolder == 'n') {
|
||||
document.getElementById('create_folder').style.display = 'none';
|
||||
}
|
||||
|
||||
if(navigator.userAgent.match(/macintosh/i)) {
|
||||
document.getElementById('is_mac').innerHTML = 'Cmd';
|
||||
}
|
||||
if(navigator.userAgent.indexOf('MSIE') != -1 || navigator.userAgent.indexOf('Trident') != -1) {
|
||||
document.getElementById('adustfbbuttons').style.display='none';
|
||||
}
|
||||
if(fbsz_increment > 0) {
|
||||
var isIE = navigator.userAgent.indexOf('MSIE') >= 0 ? true : false;
|
||||
var fbl = document.getElementById("frmResourcesList");
|
||||
var frmfolders = document.getElementById("frmFolders");
|
||||
fbl['height'] = 400 + (400*(fbsz_increment/100));
|
||||
frmfolders['height'] = 490 + (490*(fbsz_increment/100));
|
||||
if(!isIE) {
|
||||
var fbaf = document.getElementById("frmActualFolder");
|
||||
var width = 750 + (750*(fbsz_increment/100));
|
||||
fbl['width'] = width;
|
||||
fbaf['width'] = width;
|
||||
frmfolders['width'] = 180 + (180*(fbsz_increment/100));
|
||||
var fbmatter = document.getElementById("bottom_matter");
|
||||
fbmatter.style.width = width;
|
||||
}
|
||||
var whichsz = document.getElementById("adjfbsz" + fbsz_increment);
|
||||
whichsz.checked=true;
|
||||
|
||||
}
|
||||
}
|
||||
function GetUrlParam( paramName )
|
||||
{
|
||||
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
|
||||
var oMatch = oRegex.exec( window.top.location.search ) ;
|
||||
|
||||
if ( oMatch && oMatch.length > 1 ) {
|
||||
// alert(paramName + ' ' + decodeURIComponent( oMatch[1] ) );
|
||||
return decodeURIComponent( oMatch[1] ) ;
|
||||
// return dwikiUTF8_decodeFN( oMatch[1],DwikiFNencode);
|
||||
}
|
||||
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=' + dwikiUTF8_encodeFN(sServerPath, 'url') + '&' ;
|
||||
|
||||
oConnector.ResourceType = GetUrlParam( 'Type' ) ;
|
||||
oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 ) ;
|
||||
|
||||
if ( oConnector.ShowAllTypes )
|
||||
oConnector.ResourceType = 'File' ;
|
||||
|
||||
oConnector.SendCommand = function( command, params, callBackFunction )
|
||||
{
|
||||
/* requires safe_ascii */
|
||||
|
||||
var sUrl = this.ConnectorUrl + 'Command=' + command ;
|
||||
sUrl += '&Type=' + this.ResourceType ;
|
||||
sUrl += '&CurrentFolder=' + dwikiUTF8_encodeFN(this.CurrentFolder, DwikiFNencode);
|
||||
|
||||
// sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ) ;
|
||||
|
||||
if ( params ) sUrl += '&' + params ;
|
||||
|
||||
// opener takes its values from onload of helper.php
|
||||
// alert('opener='+opener.oDokuWiki_FCKEditorInstance.dwiki_usergroups);
|
||||
|
||||
// sUrl += '&DWFCK_Browser=local'; // this opens the local browser
|
||||
|
||||
if(isLocalDwikiBrowser) {
|
||||
sUrl += '&DWFCK_Browser=local';
|
||||
}
|
||||
if(CurrentDWikiClient) {
|
||||
sUrl += '&DWFCK_Client=' + CurrentDWikiClient;
|
||||
}
|
||||
if(CurrentDWikiClient) {
|
||||
sUrl += '&DWFCK_usergrps=' + opener.oDokuWiki_FCKEditorInstance.dwiki_usergroups;
|
||||
}
|
||||
|
||||
// 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 ) ;
|
||||
alert(translateErrorAny(oErrorNode.attributes.getNamedItem('text').value )) ;
|
||||
break ;
|
||||
case 101 :
|
||||
alert(translateItem('FileBrowserError_101', 'Folder already exists' ));
|
||||
break ;
|
||||
case 102 :
|
||||
alert(translateItem('FileBrowserError_102', 'Invalid folder name' ));
|
||||
break ;
|
||||
case 103 :
|
||||
alert(translateItem('FileBrowserError_103', 'You have no permissions to create the folder' ));
|
||||
break ;
|
||||
case 110 :
|
||||
alert(translateItem('FileBrowserError_110', 'Unknown error creating folder' ));
|
||||
break ;
|
||||
case 204 :
|
||||
alert(translateItem('FileBrowserError_204', 'Unable to delete the selected file' ));
|
||||
break ;
|
||||
case 205 :
|
||||
alert(translateItem('FileBrowserError_205',
|
||||
'Unable to rename the selected file; check your directory/write permisssions' ));
|
||||
break ;
|
||||
default :
|
||||
var err_default = translateItem('FileBrowserError_default', 'Error on your request. Error number: ' );
|
||||
alert(err_default + 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 )
|
||||
{
|
||||
// alert( errorNumber +"\nurl="+ fileUrl+"\nfname="+ fileName+"\nmsg="+ customMsg );
|
||||
fileUrl = fileUrl.replace(/.*?(media|userfiles\/image|file)\//,"");
|
||||
//alert(fileUrl);
|
||||
|
||||
if (errorNumber == "1" || parseInt(errorNumber) > 300)
|
||||
window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg ) ;
|
||||
else {
|
||||
window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ) ;
|
||||
fileUrl = encodeURIComponent(fileUrl);
|
||||
opener.ckged_setmedia(fileUrl,"") ;
|
||||
}
|
||||
}
|
||||
|
||||
function fbsz_inc(val) {
|
||||
var d = new Date();
|
||||
if(val == 'reset') {
|
||||
document.cookie ="fbsz=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
|
||||
alert(translateItem('DlgFileBrowserResizeMsg', "The file browser window will be reset to its default size after your page is reloaded into the editor."));
|
||||
// alert("The file browser window will be reset to its default size after your page is reloaded into the editor.")
|
||||
return;
|
||||
}
|
||||
d.setTime(d.getTime() + 365*24*60*60*1000);
|
||||
var expires = "expires="+d.toUTCString();
|
||||
document.cookie = "fbsz=" + val + "; " + expires + "; path=/";
|
||||
alert("The file browser window will be re-sized by "+ val + "% after your page is reloaded into the editor.")
|
||||
}
|
||||
|
||||
function fb_sort(type) {
|
||||
window.frames['frmResourcesList'].sortFileList(type);
|
||||
}
|
||||
function fb_search(f) {
|
||||
window.frames['frmResourcesList'].findFiles(f.fsearch.value);
|
||||
}
|
||||
function fb_sz_date_order(el) {
|
||||
window.frames['frmResourcesList'].reverseListOrder(el.checked);
|
||||
}
|
||||
|
||||
function onSubmitFn() {
|
||||
alert("use the button to submit");
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="help">
|
||||
<h3><span fckLang="DlgFileBrowserButtonHelp"></span></h3>
|
||||
<ol>
|
||||
<li>
|
||||
<span fckLang="DlgFileBrowserInfo_1" >
|
||||
If you increase the zoom level of your browser, ckgedit's file browser may exceed the size of its enclosing window, forcing scrollbars. To eliminate the scrollbars,
|
||||
you can enlarge the window up to 20%. The new size takes effect after you have closed and re-opened the editor. Resizing uses a cookie with a year's duration.
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span fckLang="DlgFileBrowserInfo_2">
|
||||
The file listings can be sorted by Name, Date, and File Size. By default they sort in ascending order, but Date and File Size can
|
||||
be sorted in descending order by checking the Reverse Order option. The sort functions are not supported in Internet Explorer but do work in Win 10 Edge.
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span fckLang="DlgFileBrowserInfo_3">The search function will search for whole or part of a file name.</span>
|
||||
</li>
|
||||
</ol>
|
||||
<div class='closebut'><form><input type="button" onclick="document.getElementById('help').style.visibility='hidden';" class='closebut'" value="Close"></form></div>
|
||||
|
||||
|
||||
</div >
|
||||
<div id='wrapper'>
|
||||
<div class="left_sidebar">
|
||||
<iframe src="frmresourcetype.html" height="50" width="180"></iframe>
|
||||
<iframe name="frmFolders" id="frmFolders" src="frmfolders.html" scrolling="auto" width="180" height="490" ></iframe>
|
||||
</div>
|
||||
<div class="right_page">
|
||||
<div class="frameborder">
|
||||
<iframe name="frmActualFolder" id="frmActualFolder" src="frmactualfolder.html" frameborder="0" width=750" height="50"></iframe>
|
||||
</div>
|
||||
<div class="frameborder">
|
||||
<iframe name="frmResourcesList" class="resourceslist" src="frmresourceslist.html" frameborder="0" id="frmResourcesList" width="758" height="400" scrolling="auto"></iframe>
|
||||
</div>
|
||||
<div id="bottom_matter">
|
||||
<div id="create_folder" class="createfolder" style="display:none">
|
||||
<table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<button id = "btn__create_folder" type="button" style="WIDTH: 100%" onclick="window.frames['frmCreateFolder'].CreateFolder();">
|
||||
<table cellSpacing="0" cellPadding="0" border="0">
|
||||
<tr id="create_folder_img">
|
||||
<td><img height="15" alt="" src="images/Folder.gif" width="15"></td>
|
||||
<td> </td>
|
||||
<td nowrap><span fckLang="DlgFileBrowserNewFolder">Create Folder</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="frmupload">
|
||||
<iframe name="frmUpload" src="frmupload.html" frameborder="0" width="598" height="60" ></iframe>
|
||||
</div>
|
||||
<div style="display:none">
|
||||
<iframe name="frmCreateFolder" frameborder="0" height="0" width="0" src="frmcreatefolder.html"></iframe>
|
||||
</div> <table><tr><td colspan="2">
|
||||
<form id= adjustfbsz"><span fckLang="DlgFileBrowserAdjustSize">Adjust browser window size</span>: 5%<input type="radio" name="adjfbsz" id = "adjfbsz5"onchange="fbsz_inc(5);"> 10%<input type="radio" name="adjfbsz" id = "adjfbsz10" onchange="fbsz_inc(10);"> 15%<input type="radio" name="adjfbsz" id = "adjfbsz15" onchange="fbsz_inc(15);">
|
||||
20%<input type="radio" name="adjfbsz" id = "adjfbsz20" onchange="fbsz_inc(20);"> -10%<input type="radio" name="adjfbsz" id = "adjfbsz-10" onchange="fbsz_inc(-10);">
|
||||
-20%<input type="radio" name="adjfbsz" id = "adjfbsz-20" onchange="fbsz_inc(-20);"> <span fckLang="DlgFileBrowserReset"> Reset</span><input type="radio" name="adjfbsz" onchange="fbsz_inc('reset');"></form>
|
||||
</td></tr>
|
||||
<tr><td ><form onsubmit="return onSubmitFn();"><div id="adustfbbuttons"><span fckLang="DlgFileBrowserSortBy">Sort by</span>: <span fckLang="DlgFileBrowserSortName">Name</span><input type="radio" name="srtbrfiles" onchange="fb_sort('name');"> <span fckLang="DlgFileBrowserSortDate">Date</span><input type="radio" name="srtbrfiles" onchange="fb_sort('mtime');"> <span fckLang="DlgFileBrowserSortSize">File Size</span><input type="radio" name="srtbrfiles" onchange="fb_sort('fsize');"> <span fckLang="DlgFileBrowserSortOrder">Reverse Order</span><input type="checkbox" name="srtbrorder" id="srtbrorder" onchange="fb_sz_date_order(this);"></div>
|
||||
</td><td class="ckg_td1"><input type="button" name="srtbrfiles" onclick="fb_search(this.form)" fckLang="DlgFileBrowserSearch" value="Find files(s):"> <input type="text" name="fsearch" id="fsearch"> <input type="button" name="srtbrfiles" onclick="document.getElementById('help').style.visibility='visible';" fckLang="DlgFileBrowserButtonHelp" value="Help"> </form></td></tr></table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<iframe name="frmUploadWorker" src="javascript:void(0)" style="height:0px;width:0px">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,99 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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" src="js/safeFN_class.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.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 )
|
||||
{
|
||||
var DwikiFNencode = parent.DwikiFNencode;
|
||||
|
||||
// document.getElementById('tdName').innerHTML = folderPath ;
|
||||
document.getElementById('tdName').innerHTML = dwikiUTF8_decodeFN(folderPath,DwikiFNencode) ;
|
||||
}
|
||||
|
||||
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" class="FileBrowserTopButton" >
|
||||
<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,86 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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" src="js/language.js"></script>
|
||||
<script type="text/javascript" src="js/safeFN_class.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var CurrentDWikiUser = parent.CurrentDWikiUser;
|
||||
var isLocalDwikiBrowser = parent.isLocalDwikiBrowser;
|
||||
var CreateDwikiFolder = parent.CreateDwikiFolder;
|
||||
var DwikiFNencode = parent.DwikiFNencode;
|
||||
|
||||
function SetCurrentFolder( resourceType, folderPath )
|
||||
{
|
||||
oConnector.ResourceType = resourceType ;
|
||||
oConnector.CurrentFolder = folderPath ;
|
||||
}
|
||||
|
||||
function CreateFolder()
|
||||
{
|
||||
var sFolderName ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
sFolderName = prompt(translateItem('DlgFileBrowserFolderPrompt', 'Type the name of the new folder:'), '' ) ;
|
||||
|
||||
if ( sFolderName == null )
|
||||
return ;
|
||||
else if ( sFolderName.length == 0 )
|
||||
alert(translateItem('DlgFileBrowserFolderWarning', 'Please type the folder name' ) ) ;
|
||||
else
|
||||
break ;
|
||||
}
|
||||
|
||||
/* requires safe_ascii */
|
||||
if(DwikiFNencode == 'safe') {
|
||||
sFolderName=sFolderName.toLowerCase();
|
||||
sFolderName=sFolderName.replace(/\s/g, '_');
|
||||
}
|
||||
oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + dwikiUTF8_encodeFN(sFolderName,DwikiFNencode) , CreateFolderCallBack ) ;
|
||||
}
|
||||
|
||||
function CreateFolderCallBack( fckXml )
|
||||
{
|
||||
if ( oConnector.CheckError( fckXml ) == 0 )
|
||||
window.parent.frames['frmResourcesList'].Refresh() ;
|
||||
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedCreateFolder = true ;
|
||||
setupLanguage();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,278 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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" src="js/language.js"></script>
|
||||
<script type="text/javascript" src="js/safeFN_class.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
/* requires safe_ascii */
|
||||
|
||||
var sActiveFolder ;
|
||||
|
||||
var bIsLoaded = false ;
|
||||
var iIntervalId ;
|
||||
var DwikiFNencode = parent.DwikiFNencode;;
|
||||
var oListManager = new Object() ;
|
||||
|
||||
function getHTTPObject()
|
||||
{
|
||||
if (window.XMLHttpRequest)
|
||||
{
|
||||
return new XMLHttpRequest();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window.ActiveXObject)
|
||||
{
|
||||
return new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(translateItem('FileBrowserError_Ajax', 'Your browser does not support AJAX.'));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function GetCurentFolder()
|
||||
{
|
||||
httpObject = getHTTPObject();
|
||||
if (httpObject != null)
|
||||
{
|
||||
httpObject.onreadystatechange = GetCurentFolder_from_Request;
|
||||
httpObject.open("GET", '../../connectors/php/connector.php?Command=GetDwfckNs&Type=File&CurrentFolder=nothing', true);
|
||||
httpObject.send(null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function GetCurentFolder_from_Request()
|
||||
{
|
||||
if (httpObject.readyState == 4)
|
||||
{
|
||||
if (httpObject.status == 200)
|
||||
{
|
||||
response = (httpObject.responseText);
|
||||
res = response.replace(/:/g,"/");
|
||||
if(res.match(/lib\/plugins\/ckgedit\/fckeditor\/userfiles\/image/)) {
|
||||
res = ''; // temp fix for puzzling encoding=url bug in frmresourceslist.html,
|
||||
// where image loading is processed in GetFileRowHtml()
|
||||
}
|
||||
if(res!='')
|
||||
{
|
||||
res = "/" + res + "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
res = "/";
|
||||
}
|
||||
LoadFolders(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
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, folder_class )
|
||||
{
|
||||
// Create the new row.
|
||||
var oRow = this.Table.insertRow(-1) ;
|
||||
if(folder_class == 'r') {
|
||||
oRow.className = 'FolderListFolderRO'
|
||||
}
|
||||
else {
|
||||
oRow.className = 'FolderListFolder' ;
|
||||
}
|
||||
|
||||
folderName = dwikiUTF8_decodeFN(folderName,DwikiFNencode);
|
||||
folderPath = dwikiUTF8_decodeFN(folderPath,DwikiFNencode);
|
||||
// folderPath = decodeURI(folderPath);
|
||||
|
||||
// Build the link to view the folder.
|
||||
var sLink = '<a href="#" onclick="OpenFolder(\'' + dwikiUTF8_encodeFN(folderPath,DwikiFNencode) + '\');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 ;
|
||||
GetCurentFolder();
|
||||
//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 )
|
||||
{
|
||||
$ronly = "";
|
||||
if(oListManager.TableRows[ sFolderPath ].className.match(/RO/)) {
|
||||
$ronly='RO';
|
||||
|
||||
}
|
||||
oListManager.TableRows[ sFolderPath ].className =
|
||||
( sFolderPath == folderPath ? 'FolderListCurrentFolder' + $ronly : 'FolderListFolder' + $ronly ) ;
|
||||
}
|
||||
|
||||
// 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 = decodeURI(oNodes[i].attributes.getNamedItem('name').value) ;
|
||||
var sFolderName = dwikiUTF8_decodeFN(oNodes[i].attributes.getNamedItem('name').value,DwikiFNencode);
|
||||
var folder_class = oNodes[i].attributes.getNamedItem('class').value ;
|
||||
oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/', folder_class ) ;
|
||||
}
|
||||
|
||||
OpenFolder( sActiveFolder ) ;
|
||||
}
|
||||
|
||||
function SetResourceType( type )
|
||||
{
|
||||
oConnector.ResourceType = type ;
|
||||
LoadFolders( '/' ) ;
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
setupLanguage();
|
||||
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,575 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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" src="js/language.js"></script>
|
||||
<script type="text/javascript" src="js/safeFN_class.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var oListManager = new Object() ;
|
||||
var currentFolderUploadStatus;
|
||||
var DwikiFNencode = parent.DwikiFNencode;
|
||||
var isInternalLink = parent.isLocalDwikiBrowser;
|
||||
var ImagesAllowed = new RegExp(parent.DwikiImageUploadAllowedExtensions);
|
||||
var isDwikiUrlExtern = parent.isDwikiUrlExtern;
|
||||
var isDwikiMediaFile = parent.isDwikiMediaFile;
|
||||
var FCKImageSaveDir = false;
|
||||
var isDwikiImage = parent.isDwikiImage;
|
||||
var isInternet_Explorer = false;
|
||||
if(navigator.userAgent.indexOf('MSIE') != -1 || navigator.userAgent.indexOf('Trident') != -1) {
|
||||
isInternet_Explorer = true;
|
||||
}
|
||||
|
||||
function getFCKSaveDir() {
|
||||
//alert(dwikiUTF8_decodeFN(document.cookie,DwikiFNencode));
|
||||
var allcookies = document.cookie;
|
||||
var pos = allcookies.indexOf("FCK_media=");
|
||||
if(pos != -1) {
|
||||
var start = pos+10;
|
||||
var end = allcookies.indexOf(";",start);
|
||||
if(end == -1) end = allcookies.length;
|
||||
var value = allcookies.substring(start,end);
|
||||
value = decodeURIComponent(value);
|
||||
return dwikiUTF8_decodeFN(value,DwikiFNencode);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
window.onbeforeunload = function() { };
|
||||
|
||||
oListManager.Clear = function()
|
||||
{
|
||||
document.body.innerHTML = '' ;
|
||||
}
|
||||
|
||||
function ProtectPath(path)
|
||||
{
|
||||
path = path.replace( /\\/g, '\\\\') ;
|
||||
path = path.replace( /'/g, '\\\'') ;
|
||||
return path ;
|
||||
}
|
||||
|
||||
oListManager.GetFolderRowHtml = function( folderName, folderPath, folder_class, isImage )
|
||||
{
|
||||
|
||||
folderPath = dwikiUTF8_decodeFN(folderPath,DwikiFNencode);
|
||||
var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ;
|
||||
icon = 'images/Folder.gif';
|
||||
|
||||
if(folder_class == 'r') icon = 'images/FolderRO.gif';
|
||||
var ColSpan = isImage ? 4 : 3;
|
||||
return '<tr>' +
|
||||
'<td width="16">' +
|
||||
sLink +
|
||||
'<img alt="" src="' + icon +'" width="16" height="16" border="0"><\/a>' +
|
||||
'<\/td><td nowrap colspan="' + ColSpan +'"> ' +
|
||||
sLink +
|
||||
folderName +
|
||||
'<\/a>' +
|
||||
'<\/td><\/tr>' ;
|
||||
}
|
||||
|
||||
|
||||
var imageDirectoryRegex = new RegExp ('^(.*?ckgedit\\/fckeditor\\/userfiles\\/image\\/)(.*)');
|
||||
var imageDirectoryRegexFarms = new RegExp ('^(.*?ckgedit\\/fckeditor\\/.*?\\/image\\/)(.*)');
|
||||
function reviseImgSrc(url) {
|
||||
|
||||
var imgUrl =decodeURI(dwikiUTF8_decodeFN(url,DwikiFNencode));
|
||||
|
||||
var matches = imgUrl.match(imageDirectoryRegex);
|
||||
if(!matches) matches = imgUrl.match(imageDirectoryRegexFarms);
|
||||
if(matches && matches.length > 1) {
|
||||
if(!matches[1].match(/^\//)) matches[1] = '/'+matches[1];
|
||||
return matches[1]+ encodeURI(dwikiUTF8_encodeFN(matches[2],DwikiFNencode));
|
||||
}
|
||||
else {
|
||||
var matches = imgUrl.match(/^http:\/\/(.*)/);
|
||||
if(matches) {
|
||||
return 'http://' + encodeURI(dwikiUTF8_encodeFN(matches[1],DwikiFNencode));
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
function oListImage(fileUrl,width,height) {
|
||||
fileUrl = encodeURI(dwikiUTF8_encodeFN(fileUrl,DwikiFNencode));
|
||||
this.src = ProtectPath( fileUrl );
|
||||
|
||||
this.src = reviseImgSrc(this.src);
|
||||
|
||||
|
||||
this.fileUrl = fileUrl;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
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 imgCount = 0;
|
||||
var imageArray = new Array();
|
||||
var KBArray = new Array();
|
||||
var imgProcessingStack = new Array();
|
||||
|
||||
function big_image(id) {
|
||||
var elems = id.split('_');
|
||||
var oImg = imageArray[elems[1]];
|
||||
|
||||
|
||||
var height = oImg.height;
|
||||
var width = oImg.width;
|
||||
|
||||
if(elems.length > 1) {
|
||||
if(oImg.width > 500) {
|
||||
height = Math.round( oImg.height * ( 500 / oImg.width ) ) ;
|
||||
width = 500;
|
||||
}
|
||||
if(height > 400) {
|
||||
width = Math.round( width * ( 400 / height ) ) ;
|
||||
height = 400;
|
||||
}
|
||||
}
|
||||
|
||||
var element = '<img border = "0" src = "' + oImg.src + '" width = "' + width + '" height="' + height + '">';
|
||||
element += '<center><br /><button class="bigwin_close_but" onclick="OpenFile(\''+ ProtectPath(oImg.fileUrl) +'\');void 0;">insert into document<\/button><\/center>';
|
||||
var big_win = document.getElementById('bigwin_display');
|
||||
big_win.innerHTML = element;
|
||||
big_win = document.getElementById('big_imagewin');
|
||||
big_win.style.display = 'block';
|
||||
big_win.scrollIntoView();
|
||||
|
||||
}
|
||||
|
||||
function getImageSize(oImgWidth,oImgHeight) {
|
||||
|
||||
var width = oImgWidth; var height = oImgHeight;
|
||||
|
||||
if(oImgWidth > 120) {
|
||||
height = Math.round( oImgHeight * ( 120 / oImgWidth ) ) ;
|
||||
width = 120;
|
||||
}
|
||||
if(height > 120) {
|
||||
width = Math.round( width * ( 120 / height ) ) ;
|
||||
height = 120;
|
||||
}
|
||||
|
||||
return width + 'x' + height +' ';
|
||||
}
|
||||
|
||||
function showImage(id) {
|
||||
var elems = id.split('_');
|
||||
var oImg = imageArray[elems[1]];
|
||||
if(!oImg) return id;
|
||||
|
||||
var height = oImg.height;
|
||||
var width = oImg.width;
|
||||
|
||||
|
||||
if(oImg.width > 120) {
|
||||
height = Math.round( oImg.height * ( 120 / oImg.width ) ) ;
|
||||
width = 120;
|
||||
}
|
||||
if(height > 120) {
|
||||
width = Math.round( width * ( 120 / height ) ) ;
|
||||
height = 120;
|
||||
}
|
||||
|
||||
var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( oImg.src ) + '\');return false;">' ;
|
||||
var element = sLink + '<img border = "0" src = "' + oImg.src + '" width = "' + width + '" height="' + height + '"></a>';
|
||||
return element;
|
||||
// document.getElementById(id).innerHTML = element;
|
||||
|
||||
|
||||
}
|
||||
|
||||
var foldersDone = { };
|
||||
oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize, isImage, fileTime,iLinkTitle )
|
||||
{
|
||||
var c_type = "file";
|
||||
if(isImage) {
|
||||
|
||||
if(imgCount % 2 == 0) {
|
||||
c_type = 'silver';
|
||||
}
|
||||
else c_type = 'img';
|
||||
}
|
||||
else if(fileUrl.match(/data\/pages/)) {
|
||||
c_type = 'txt';
|
||||
}
|
||||
|
||||
fileTime = new Date(Number(fileTime)*1000);
|
||||
fileTime =" " + fileTime.toDateString().replace(/^\w+\s*/,"") + " " + fileTime.toLocaleTimeString();
|
||||
var Unlink,sUnlink,trash,sLink,sTitle;
|
||||
if(iLinkTitle) {
|
||||
sTitle = ';;' + iLinkTitle;
|
||||
fileUrl += sTitle;
|
||||
}
|
||||
// Build the link to view the folder.
|
||||
var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ;
|
||||
|
||||
var trash = 'images/trash.png';
|
||||
var sUnlink = '<td width="20" class="' + c_type +'"><a href="#" onclick="UnlinkFile(event,\'' + fileName + '\');return false;">' ;
|
||||
sUnlink += '<img src="' + trash + '" border="0"></a><\/td>';
|
||||
if(c_type == 'txt'){
|
||||
sUnlink = ""; //ilink title here
|
||||
}
|
||||
var imgTD = "";
|
||||
var fileSizeSpan="";
|
||||
if(isImage) {
|
||||
elems = fileSize.split(';;');
|
||||
fileSize = elems[0];
|
||||
|
||||
var oImage = new oListImage(fileUrl, elems[1],elems[2]);
|
||||
oImage.inserted = false;
|
||||
imageArray[imgCount] = oImage;
|
||||
var imgId = 'img_' + imgCount;
|
||||
var imgTD = '<td width="152" align="center" class="' +c_type +'"><div id="' + imgId + '">'
|
||||
+ showImage(imgId) + '<\/div>' +
|
||||
'<div class="img_buttons"><a href="#" onclick="big_image(\'' + imgId + '\');return false;">'
|
||||
+ translateItem('DlgFileBrowserMagnify', 'magnify') +
|
||||
'<\/a><\/div><\/td>';
|
||||
fileSizeSpan='<span id="size_'+ imgCount + '">' + elems[1] + 'x' + elems[2] + ' </span>';
|
||||
imgCount++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(currentFolderUploadStatus != 'd') sUnlink = ' ';
|
||||
// Get the file icon.
|
||||
var sIcon = oIcons.GetIcon( fileName ) ;
|
||||
return '<tr>' + sUnlink +
|
||||
'<td width="16" class="' + c_type + '">' +
|
||||
sLink +
|
||||
'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +
|
||||
'<\/td><td class="' + c_type + '"> ' +
|
||||
sLink +
|
||||
fileName +
|
||||
'<\/a>' +
|
||||
'<\/td>' + imgTD +
|
||||
'<\/td>' + '<td align="right" class="' + c_type + '"nowrap> ' + fileSizeSpan +
|
||||
fileSize +
|
||||
' KB' + fileTime +
|
||||
'<\/td><\/tr>' ;
|
||||
}
|
||||
|
||||
function OpenFolder( folderPath )
|
||||
{
|
||||
|
||||
// Load the resources list for this folder.
|
||||
window.parent.frames['frmFolders'].LoadFolders( dwikiUTF8_encodeFN(folderPath,DwikiFNencode) ) ;
|
||||
}
|
||||
|
||||
function UnlinkFile(evt,f) {
|
||||
var evt = (evt) ? evt : ((window.event) ? event : null);
|
||||
|
||||
if(evt && (evt.ctrlKey||evt.metaKey)) {
|
||||
move_to = window.prompt('Subdirectory of current directory to which you want to move ' + f, "secure");
|
||||
if(move_to) {
|
||||
move_to = move_to.replace(/^[\/\s]+/,"");
|
||||
move_to = move_to.replace(/[\/\s]+$/,"");
|
||||
if(move_to.match(/[\/\\]/)) {
|
||||
alert(translateItem('FolderMoveWarning','You can only move files to a folder one level below the current directory'));
|
||||
return false;
|
||||
}
|
||||
move_to = move_to.toLowerCase(move_to);
|
||||
move_to = move_to.replace(/\s/g, '_');
|
||||
move_to = encodeURI(dwikiUTF8_encodeFN(move_to,DwikiFNencode));
|
||||
f = move_to + '/' +f;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
else {
|
||||
if(!confirm("Delete " + f + "?")) return false;
|
||||
}
|
||||
|
||||
var id = oConnector.CurrentFolder + ':' + f;
|
||||
id = id.replace(/\//g,':');
|
||||
id = id.replace('::',':');
|
||||
parent.opener.ckged_get_unlink_size(id);
|
||||
setTimeout(oConnector.SendCommand( 'UnlinkFile', 'file=' + f, UnlinkFileCallBack ), 7000) ;
|
||||
setTimeout(LoadResources(oConnector.ResourceType, oConnector.CurrentFolder),9000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function OpenFile( fileUrl )
|
||||
{
|
||||
if(DwikiFNencode != 'safe') {
|
||||
fileUrl = dwikiUTF8_decodeFN(fileUrl,DwikiFNencode);
|
||||
fileUrl = decodeURI( fileUrl );
|
||||
}
|
||||
funcNum = GetUrlParam('CKEditorFuncNum') ;
|
||||
try {
|
||||
|
||||
if(isInternalLink) {
|
||||
fileUrl=decodeURI( fileUrl ).replace( '#', '%23' ) ;
|
||||
}
|
||||
if(isDwikiUrlExtern) {
|
||||
fileUrl = window.location.protocol +'//' + window.location.host + '/' + decodeURI( fileUrl ).replace( '#', '%23' ) ;
|
||||
}
|
||||
if(isDwikiImage) {
|
||||
if(DwikiFNencode == 'url') fileUrl=encodeURI(encodeURI(fileUrl));
|
||||
if(window.top.opener.JSINFO['ckg_canonical'] ) {
|
||||
fileUrl = window.location.protocol +'//' + window.location.host + fileUrl;
|
||||
}
|
||||
}
|
||||
window.top.opener.CKEDITOR.tools.callFunction( funcNum, fileUrl);
|
||||
if(isInternalLink) {
|
||||
fileUrl = fileUrl.replace(/^.*?\/pages\//,"")
|
||||
window.top.opener.update_ckgeditInternalLink(fileUrl);
|
||||
}
|
||||
else if(isDwikiMediaFile) {
|
||||
var url;
|
||||
if(url = fileUrl.match(/userfiles\/(file|image)\/(.*?)$/)) {
|
||||
fileUrl = url[2];
|
||||
if(!fileUrl.match(/^\//)) fileUrl = '/' + fileUrl;
|
||||
}
|
||||
else if(url = fileUrl.match(/data\/media\/(.*?)$/)) { // needs tobe updated for non-standard and Windows save dirs
|
||||
fileUrl = url[1];
|
||||
if(!fileUrl.match(/^\//)) fileUrl = '/' + fileUrl;
|
||||
}
|
||||
else {
|
||||
var cookie = ckgEedit_getCookie('FCK_animal') ;
|
||||
if(cookie) {
|
||||
var match = fileUrl.match(cookie+'\/file/(.*)');
|
||||
if(match) fileUrl = match[1];
|
||||
}
|
||||
}
|
||||
window.top.opener.update_ckgeditMediaLink(fileUrl);
|
||||
parent.opener.oDokuWiki_FCKEditorInstance.isLocalDwikiBrowser=false;
|
||||
}
|
||||
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
window.top.close() ;
|
||||
window.top.opener.focus() ;
|
||||
}
|
||||
function sortFileList(type) {
|
||||
oListManager.Clear();
|
||||
oConnector.SortType = type;
|
||||
oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
|
||||
}
|
||||
|
||||
function findFiles(search){
|
||||
oConnector.Search = new RegExp(search);
|
||||
sortFileList('search');
|
||||
}
|
||||
|
||||
function reverseListOrder(bool){
|
||||
oConnector.reverseOrder = bool;
|
||||
if(oConnector.SortType && (oConnector.SortType == 'mtime' || oConnector.SortType=='fsize')) {
|
||||
oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
|
||||
}
|
||||
}
|
||||
|
||||
function LoadResources( resourceType, folderPath )
|
||||
{
|
||||
|
||||
oListManager.Clear();
|
||||
document.body.innerHTML = translateItem('DlgFileBrowserWaitingMsg', 'Loading, please wait.'); //Show waiting message
|
||||
oConnector.ResourceType = resourceType ;
|
||||
oConnector.CurrentFolder = folderPath ? folderPath : '/';
|
||||
parent.opener.window.setTimeout( oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ), 9000) ;
|
||||
|
||||
}
|
||||
|
||||
function Refresh()
|
||||
{
|
||||
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
|
||||
}
|
||||
|
||||
function GetFoldersAndFilesCallBack( fckXml )
|
||||
{
|
||||
imgCount = 0;
|
||||
imageArray = new Array();
|
||||
KBArray = new Array();
|
||||
imgProcessingStack = new Array();
|
||||
oListManager.Clear();//Clear waiting message
|
||||
|
||||
if ( oConnector.CheckError( fckXml ) != 0 )
|
||||
return ;
|
||||
|
||||
// Get the current folder path.
|
||||
var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
|
||||
if ( oFolderNode == null )
|
||||
{
|
||||
|
||||
alert(translateItem('FileBrowserError_XML', '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 oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="0" cellpadding="1" width="100%" border="0">' ) ;
|
||||
|
||||
// Add the Folders.
|
||||
var isImage = oConnector.ResourceType == 'Image' ? true : false;
|
||||
var oNodes ;
|
||||
oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
|
||||
for ( var i = 0 ; i < oNodes.length ; i++ )
|
||||
{
|
||||
|
||||
var sFolderName = dwikiUTF8_decodeFN(oNodes[i].attributes.getNamedItem('name').value,DwikiFNencode);
|
||||
var folder_class = oNodes[i].attributes.getNamedItem('class').value ;
|
||||
if(sFolderName.match(/__AAAAAAAA__.AAA/)) {
|
||||
currentFolderUploadStatus = folder_class;
|
||||
continue;
|
||||
}
|
||||
oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/", folder_class, isImage ) ) ;
|
||||
}
|
||||
|
||||
// Add the Files.
|
||||
oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
|
||||
if(oConnector.SortType == 'mtime') {
|
||||
oNodes.sort(function(a, b) {
|
||||
var a_tm = Number(a.attributes.getNamedItem('time').value);
|
||||
var b_tm = Number(b.attributes.getNamedItem('time').value);
|
||||
if(oConnector.reverseOrder) {
|
||||
return b_tm - a_tm;
|
||||
}
|
||||
return a_tm - b_tm;
|
||||
});
|
||||
}
|
||||
else if(oConnector.SortType == 'fsize') {
|
||||
oNodes.sort(function(a, b) {
|
||||
var a_tm = parseInt(a.attributes.getNamedItem('size').value);
|
||||
var b_tm = parseInt(b.attributes.getNamedItem('size').value);
|
||||
if(oConnector.reverseOrder) {
|
||||
return b_tm - a_tm;
|
||||
}
|
||||
return a_tm - b_tm;
|
||||
});
|
||||
}
|
||||
for ( var j = 0 ; j < oNodes.length ; j++ )
|
||||
{
|
||||
var oNode = oNodes[j] ;
|
||||
var sFileName = dwikiUTF8_decodeFN(oNode.attributes.getNamedItem('name').value,DwikiFNencode);
|
||||
if(oConnector.SortType == 'search' && !sFileName.match(oConnector.Search)) continue;
|
||||
var sFileSize = oNode.attributes.getNamedItem('size').value ;
|
||||
var sFileTime = oNode.attributes.getNamedItem('time').value;
|
||||
|
||||
if(isInternalLink) {
|
||||
var sTitle = "";
|
||||
sTitle = oNode.attributes.getNamedItem('title').value;
|
||||
// if(sTitle) alert(sTitle);
|
||||
if(!sFileName.match(/\.txt$/)) continue;
|
||||
sFileName = sFileName.replace(/\.txt$/,"");
|
||||
}
|
||||
else if(isImage) {
|
||||
if(!sFileName.match(ImagesAllowed)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get the optional "url" attribute. If not available, build the url.
|
||||
var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ;
|
||||
var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : sCurrentFolderUrl + sFileName ;
|
||||
|
||||
if(isImage && FCKImageSaveDir) {
|
||||
sFileUrl=sFileUrl.replace(/^.*?\/image\//,"");
|
||||
sFileUrl = FCKImageSaveDir + sFileUrl;
|
||||
}
|
||||
|
||||
if(isImage) {
|
||||
sFileUrl = dwikiUTF8_encodeFN(sFileUrl,DwikiFNencode);
|
||||
}
|
||||
oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize, isImage, sFileTime, sTitle) ) ;
|
||||
}
|
||||
|
||||
oHtml.Append( '<\/table>' ) ;
|
||||
var big = '<center><div id="big_imagewin"><div id="bigwin_display"></div>' +
|
||||
'<div id="big_iwin_close"><button onclick="close_bigImgwin();" class="bigwin_close_but">close</button> </div></div></center>';
|
||||
document.body.innerHTML = big + oHtml.ToString() ;
|
||||
oConnector.Search = new RegExp("");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function insertImages() {
|
||||
|
||||
for(var i = 0; i<imageArray.length; i++) {
|
||||
var imgId = 'img_' + i;
|
||||
showImage(imgId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function postMessageHandler( event ) {
|
||||
/*
|
||||
console.log("We've got a message!");
|
||||
console.log("* Message:", event.data);
|
||||
console.log("* Origin:", event.origin);
|
||||
console.log("* Source:", event.source);
|
||||
*/
|
||||
Refresh();
|
||||
}
|
||||
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener("message", postMessageHandler, false);
|
||||
} else {
|
||||
window.attachEvent("onmessage", postMessageHandler);
|
||||
}
|
||||
function UnlinkFileCallBack( fckXml, id )
|
||||
{
|
||||
if(id) {
|
||||
parent.opener.ckged_setmedia(id,true,this);
|
||||
}
|
||||
GetFoldersAndFilesCallBack( fckXml );
|
||||
|
||||
}
|
||||
|
||||
function close_bigImgwin() {
|
||||
|
||||
document.getElementById('big_imagewin').style.display='none';
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedResourcesList = true ;
|
||||
setupLanguage();
|
||||
FCKImageSaveDir=getFCKSaveDir() ;
|
||||
// alert(FCKImageSaveDir);
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body class="FileArea">
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,76 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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" src="js/language.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()
|
||||
{
|
||||
setupLanguage();
|
||||
for ( var i = 0 ; i < aTypes.length ; i++ ) {
|
||||
aTypes[i][1] = translateItem('DlgFileBrowserResSelect'+ aTypes[i][0],aTypes[i][1]);
|
||||
}
|
||||
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>
|
||||
<span fckLang="DlgFileBrowserResourceType">resource type</span><BR>
|
||||
<select id="cmbType" style="WIDTH: 100%" onchange="SetResourceType(this.value);">
|
||||
<option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,188 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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" src="js/language.js"></script>
|
||||
<script type="text/javascript" src="js/safeFN_class.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
/* requires safe_ascii */
|
||||
|
||||
var CurrentDWikiUser = parent.CurrentDWikiUser;
|
||||
var isLocalDwikiBrowser = parent.isLocalDwikiBrowser;
|
||||
var CreateDwikiFolder = parent.CreateDwikiFolder;
|
||||
var DwikiFNencode = parent.DwikiFNencode;
|
||||
|
||||
function SetCurrentFolder( resourceType, folderPath )
|
||||
{
|
||||
var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ;
|
||||
sUrl += '&Type=' + resourceType ;
|
||||
sUrl += '&CurrentFolder=' + dwikiUTF8_encodeFN(folderPath,DwikiFNencode) ;
|
||||
// sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath ) ;
|
||||
|
||||
document.getElementById('frmUpload').action = sUrl ;
|
||||
}
|
||||
|
||||
function OnSubmit()
|
||||
{
|
||||
if ( document.getElementById('NewFile').value.length == 0 )
|
||||
{
|
||||
alert(translateItem('FileBrowserError_File_Submit','Please select a file from your computer'));
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
||||
// Set the interface elements.
|
||||
var progress_msg = translateItem('DlgFileBrowserUpPrg','Upload a new file in this folder (Upload in progress, please wait...)');
|
||||
document.getElementById('eUploadMessage').innerHTML = progress_msg ;
|
||||
document.getElementById('btnUpload').disabled = true ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
function OnUploadCompleted( errorNumber, data )
|
||||
{
|
||||
// Reset the Upload Worker Frame.
|
||||
window.parent.frames['frmUploadWorker'].location = 'javascript:void(0)' ;
|
||||
// alert('completed: ' + data + "\nerr=" + errorNumber);
|
||||
// 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.
|
||||
if(!errorNumber) {
|
||||
var upload_msg = translateItem('DlgFileBrowserUpMsg','Upload a new file in this folder (Upload in progress, please wait...)');
|
||||
document.getElementById('eUploadMessage').innerHTML = upload_msg ;
|
||||
}
|
||||
else document.getElementById('eUploadMessage').innerHTML = ""; ;
|
||||
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() ;
|
||||
var file_rename = translateItem('FileBrowserError_201','A file with the same name is already available. The uploaded file has been renamed to: ');
|
||||
alert(file_rename + data);
|
||||
break ;
|
||||
case 202 :
|
||||
alert(translateItem('FileBrowserError_202', 'Invalid file'));
|
||||
break ;
|
||||
case 203:
|
||||
alert(translateItem('FileBrowserError_203','You do not have permission to upload files to this folder. If you think this is incorrect please notify your administrator.'));
|
||||
break;
|
||||
case 301:
|
||||
case 302:
|
||||
case 303:
|
||||
case 304:
|
||||
case 306:
|
||||
case 307:
|
||||
case 308:
|
||||
var uploadError = 'FileBrowserError_' + errorNumber;
|
||||
alert(translateItem(uploadError,data));
|
||||
break;
|
||||
default :
|
||||
|
||||
var default_err = translateItem('FileBrowserError_default', 'Error on file upload. Error number: ');
|
||||
alert(default_err + errorNumber);
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedUpload = true ;
|
||||
setupLanguage();
|
||||
|
||||
if(CurrentDWikiUser == 'visitor' || isLocalDwikiBrowser || !CurrentDWikiUser) {
|
||||
document.getElementById('btnUpload').disabled = true ;
|
||||
document.getElementById('btnUpload_div').innerHTML = "";
|
||||
document.getElementById("frmUpload").style.display="none";
|
||||
}
|
||||
|
||||
if(CreateDwikiFolder == 'n') {
|
||||
document.getElementById('folder_hints').style.display='none';
|
||||
}
|
||||
|
||||
if(navigator.userAgent.match(/macintosh/i)) {
|
||||
document.getElementById('is_mac').innerHTML = 'Cmd';
|
||||
}
|
||||
|
||||
}
|
||||
</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" fckLang="DlgFileBrowserUpMsg">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" id="buttonUpL_td"><div id="btnUpload_div"> <input id="btnUpload" type="submit" fckLang="DlgLnkUpload" value="upload"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td align='right'>
|
||||
<div id ='folder_hints'>
|
||||
<table>
|
||||
<tr>
|
||||
<td rowspan='3'>
|
||||
<span fckLang="DlgFileBrowserMove">Move</span><br />
|
||||
<span id='is_mac'>Ctrl</span>+<img alt="trash" src="images/trash.png">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align='right'>
|
||||
<img height="16" alt="" src="images/FolderOpenedRO.gif" width="15"><span fckLang="DlgFileBrowserRead">read-only</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align='right'>
|
||||
<img height="16" alt="" src="images/FolderOpened.gif" width="16"><span fckLang="DlgFileBrowserWrite">uploadable</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</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: 379 B |
After Width: | Height: | Size: 134 B |
After Width: | Height: | Size: 129 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 |
After Width: | Height: | Size: 460 B |
@@ -0,0 +1,272 @@
|
||||
window.onbeforeunload = function() { };
|
||||
var CurrentDWikiUser = opener.oDokuWiki_FCKEditorInstance.dwiki_user; // use this variable to pass into frame (frmupload.html)
|
||||
var CurrentDWikiClient = opener.oDokuWiki_FCKEditorInstance.dwiki_client; // use this variable to pass into frame (frmupload.html)
|
||||
var isLocalDwikiBrowser = opener.oDokuWiki_FCKEditorInstance.isLocalDwikiBrowser ? true : false;
|
||||
var CreateDwikiFolder = opener.oDokuWiki_FCKEditorInstance.dwiki_create_folder; // use this variable to pass into frame (frmupload.html)
|
||||
var DwikiFNencode = opener.oDokuWiki_FCKEditorInstance.dwiki_fnencode;
|
||||
var isDwikiUrlExtern = opener.oDokuWiki_FCKEditorInstance.isUrlExtern ? true: false;
|
||||
var DwikiImageUploadAllowedExtensions = opener.oDokuWiki_FCKEditorInstance.imageUploadAllowedExtensions;
|
||||
var isDwikiMediaFile = opener.oDokuWiki_FCKEditorInstance.isDwikiMediaFile;
|
||||
var isDwikiImage = opener.oDokuWiki_FCKEditorInstance.isDwikiImage;
|
||||
var fbsz_increment =opener.oDokuWiki_FCKEditorInstance.fbsz_increment;
|
||||
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
window.top.IsLoadedCreateFolder = true ;
|
||||
setupLanguage();
|
||||
|
||||
if(CurrentDWikiUser == 'visitor' || isLocalDwikiBrowser || !CurrentDWikiUser) {
|
||||
document.getElementById("btn__create_folder").disabled = true;
|
||||
document.getElementById("create_folder").innerHTML = "";
|
||||
}
|
||||
else document.getElementById("create_folder").style.display='block';
|
||||
|
||||
if(CreateDwikiFolder == 'n') {
|
||||
document.getElementById('create_folder').style.display = 'none';
|
||||
}
|
||||
|
||||
if(navigator.userAgent.match(/macintosh/i)) {
|
||||
document.getElementById('is_mac').innerHTML = 'Cmd';
|
||||
}
|
||||
if(navigator.userAgent.indexOf('MSIE') != -1 || navigator.userAgent.indexOf('Trident') != -1) {
|
||||
document.getElementById('adustfbbuttons').style.display='none';
|
||||
}
|
||||
if(fbsz_increment > 0) {
|
||||
var isIE = navigator.userAgent.indexOf('MSIE') >= 0 ? true : false;
|
||||
var fbl = document.getElementById("frmResourcesList");
|
||||
var frmfolders = document.getElementById("frmFolders");
|
||||
fbl['height'] = 400 + (400*(fbsz_increment/100));
|
||||
frmfolders['height'] = 490 + (490*(fbsz_increment/100));
|
||||
if(!isIE) {
|
||||
var fbaf = document.getElementById("frmActualFolder");
|
||||
var width = 750 + (750*(fbsz_increment/100));
|
||||
fbl['width'] = width;
|
||||
fbaf['width'] = width;
|
||||
frmfolders['width'] = 180 + (180*(fbsz_increment/100));
|
||||
var fbmatter = document.getElementById("bottom_matter");
|
||||
fbmatter.style.width = width;
|
||||
}
|
||||
var whichsz = document.getElementById("adjfbsz" + fbsz_increment);
|
||||
whichsz.checked=true;
|
||||
|
||||
}
|
||||
}
|
||||
function GetUrlParam( paramName )
|
||||
{
|
||||
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
|
||||
var oMatch = oRegex.exec( window.top.location.search ) ;
|
||||
|
||||
if ( oMatch && oMatch.length > 1 ) {
|
||||
// alert(paramName + ' ' + decodeURIComponent( oMatch[1] ) );
|
||||
return decodeURIComponent( oMatch[1] ) ;
|
||||
// return dwikiUTF8_decodeFN( oMatch[1],DwikiFNencode);
|
||||
}
|
||||
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=' + dwikiUTF8_encodeFN(sServerPath, 'url') + '&' ;
|
||||
|
||||
oConnector.ResourceType = GetUrlParam( 'Type' ) ;
|
||||
oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 ) ;
|
||||
|
||||
if ( oConnector.ShowAllTypes )
|
||||
oConnector.ResourceType = 'File' ;
|
||||
|
||||
oConnector.SendCommand = function( command, params, callBackFunction )
|
||||
{
|
||||
/* requires safe_ascii */
|
||||
|
||||
var sUrl = this.ConnectorUrl + 'Command=' + command ;
|
||||
sUrl += '&Type=' + this.ResourceType ;
|
||||
sUrl += '&CurrentFolder=' + dwikiUTF8_encodeFN(this.CurrentFolder, DwikiFNencode);
|
||||
|
||||
// sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ) ;
|
||||
|
||||
if ( params ) sUrl += '&' + params ;
|
||||
|
||||
// opener takes its values from onload of helper.php
|
||||
// alert('opener='+opener.oDokuWiki_FCKEditorInstance.dwiki_usergroups);
|
||||
|
||||
// sUrl += '&DWFCK_Browser=local'; // this opens the local browser
|
||||
|
||||
if(isLocalDwikiBrowser) {
|
||||
sUrl += '&DWFCK_Browser=local';
|
||||
}
|
||||
if(CurrentDWikiClient) {
|
||||
sUrl += '&DWFCK_Client=' + CurrentDWikiClient;
|
||||
}
|
||||
if(CurrentDWikiClient) {
|
||||
sUrl += '&DWFCK_usergrps=' + opener.oDokuWiki_FCKEditorInstance.dwiki_usergroups;
|
||||
}
|
||||
|
||||
// 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 ) ;
|
||||
alert(translateErrorAny(oErrorNode.attributes.getNamedItem('text').value )) ;
|
||||
break ;
|
||||
case 101 :
|
||||
alert(translateItem('FileBrowserError_101', 'Folder already exists' ));
|
||||
break ;
|
||||
case 102 :
|
||||
alert(translateItem('FileBrowserError_102', 'Invalid folder name' ));
|
||||
break ;
|
||||
case 103 :
|
||||
alert(translateItem('FileBrowserError_103', 'You have no permissions to create the folder' ));
|
||||
break ;
|
||||
case 110 :
|
||||
alert(translateItem('FileBrowserError_110', 'Unknown error creating folder' ));
|
||||
break ;
|
||||
case 204 :
|
||||
alert(translateItem('FileBrowserError_204', 'Unable to delete the selected file' ));
|
||||
break ;
|
||||
case 205 :
|
||||
alert(translateItem('FileBrowserError_205',
|
||||
'Unable to rename the selected file; check your directory/write permisssions' ));
|
||||
break ;
|
||||
default :
|
||||
var err_default = translateItem('FileBrowserError_default', 'Error on your request. Error number: ' );
|
||||
alert(err_default + 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 )
|
||||
{
|
||||
// alert( errorNumber +"\nurl="+ fileUrl+"\nfname="+ fileName+"\nmsg="+ customMsg );
|
||||
fileUrl = fileUrl.replace(/.*?(media|userfiles\/image|file)\//,"");
|
||||
//alert(fileUrl);
|
||||
|
||||
if (errorNumber == "1" || parseInt(errorNumber) > 300)
|
||||
window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg ) ;
|
||||
else {
|
||||
window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ) ;
|
||||
fileUrl = encodeURIComponent(fileUrl);
|
||||
opener.ckged_setmedia(fileUrl,"") ;
|
||||
}
|
||||
}
|
||||
|
||||
function fbsz_inc(val) {
|
||||
var d = new Date();
|
||||
if(val == 'reset') {
|
||||
document.cookie ="fbsz=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
|
||||
alert(translateItem('DlgFileBrowserResizeMsg', "The file browser window will be reset to its default size after your page is reloaded into the editor."));
|
||||
// alert("The file browser window will be reset to its default size after your page is reloaded into the editor.")
|
||||
return;
|
||||
}
|
||||
d.setTime(d.getTime() + 365*24*60*60*1000);
|
||||
var expires = "expires="+d.toUTCString();
|
||||
document.cookie = "fbsz=" + val + "; " + expires + "; path=/";
|
||||
alert("The file browser window will be re-sized by "+ val + "% after your page is reloaded into the editor.")
|
||||
}
|
||||
|
||||
function fb_sort(type) {
|
||||
window.frames['frmResourcesList'].sortFileList(type);
|
||||
}
|
||||
function fb_search(f) {
|
||||
window.frames['frmResourcesList'].findFiles(f.fsearch.value);
|
||||
}
|
||||
function fb_sz_date_order(el) {
|
||||
window.frames['frmResourcesList'].reverseListOrder(el.checked);
|
||||
}
|
||||
|
||||
function onSubmitFn() {
|
||||
alert("use the button to submit");
|
||||
return false;
|
||||
}
|
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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( '' ) ;
|
||||
}
|
||||
function ckgEedit_getCookie(cname) {
|
||||
var name = cname + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0; i<ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1);
|
||||
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
|
||||
}
|
||||
return "";
|
||||
}
|
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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 ) ;
|
||||
// For IE 10
|
||||
//See: https://blogs.msdn.com/b/ie/archive/2012/07/19/xmlhttprequest-responsexml-in-ie10-release-preview.aspx?Redirected=true
|
||||
try { oXmlHttp.responseType = 'msxml-document'; } catch(e){}
|
||||
|
||||
this.RespType = oXmlHttp.responseType;
|
||||
|
||||
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 ;
|
||||
var id = getimgid(urlToCall);
|
||||
|
||||
if(id){
|
||||
id = encodeURIComponent(id);
|
||||
asyncFunctionPointer( oFCKXml,id) ;
|
||||
}
|
||||
else 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(this.RespType && this.RespType == 'msxml-document' || navigator.userAgent.indexOf('MSIE') >= 0)
|
||||
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(this.RespType && this.RespType == 'msxml-document' || navigator.userAgent.indexOf('MSIE') >= 0) {
|
||||
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 ;
|
||||
}
|
||||
}
|
||||
function getimgid(url)
|
||||
{
|
||||
urlspl = url.split('?');
|
||||
var id = '';
|
||||
var folder,file;
|
||||
var str = urlspl[1];
|
||||
if (str.match(/Unlink/)) {
|
||||
//alert('str='+str) ;
|
||||
found = str.split(/&/);
|
||||
console.log(found);
|
||||
// alert('ps='+found);
|
||||
|
||||
for(i=0; i<found.length; i++) {
|
||||
|
||||
if(found[i].match(/Folder/)) {
|
||||
var ar = found[i].split(/=/);
|
||||
folder = ar[1];
|
||||
}
|
||||
|
||||
if(found[i].match(/file/)) {
|
||||
var ar = found[i].split(/=/);
|
||||
file = ar[1];
|
||||
}
|
||||
}
|
||||
|
||||
if(file) {
|
||||
id = folder + file;
|
||||
console.log(id);
|
||||
}
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
@@ -0,0 +1,79 @@
|
||||
var fck_Lang;
|
||||
|
||||
function setupLanguage() {
|
||||
|
||||
if(opener && opener.oDokuWiki_FCKEditorInstance.Lang) {
|
||||
if(opener.oDokuWiki_FCKEditorInstance.Lang['fbrowser'])
|
||||
fck_Lang=opener.oDokuWiki_FCKEditorInstance.Lang['fbrowser'];
|
||||
ckgTranslatePage(document);
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent && parent.opener.oDokuWiki_FCKEditorInstance.Lang) {
|
||||
fck_Lang=parent.opener.oDokuWiki_FCKEditorInstance.Lang['fbrowser'];
|
||||
ckgTranslatePage(document);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function translateItem(js_code, default_str) {
|
||||
|
||||
if(!fck_Lang) return default_str;
|
||||
if(fck_Lang[js_code] && fck_Lang[js_code] != "") {
|
||||
return fck_Lang[js_code];
|
||||
}
|
||||
|
||||
return default_str;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* translate errors for error case 1 which implements variable error messages */
|
||||
function translateErrorAny(err_str) {
|
||||
if(!fck_Lang) return err_str;
|
||||
if(!err_str.match(/^FileBrowserError_/)) {
|
||||
return err_str;
|
||||
}
|
||||
|
||||
if(err_str.match(/;;/)) {
|
||||
var elems = err_str.split(/;;/);
|
||||
if(fck_Lang[elems[0]]) {
|
||||
return fck_Lang[elems[0]] + ' ' + elems[1];
|
||||
}
|
||||
return err_str
|
||||
}
|
||||
|
||||
if(err_str.match(/^FileBrowserError_\w+$/)) {
|
||||
return fck_Lang[err_str];
|
||||
}
|
||||
|
||||
return err_str;
|
||||
}
|
||||
|
||||
function ckgTranslatePage(d) {
|
||||
|
||||
var spans = d.getElementsByTagName('span');
|
||||
|
||||
for(i=0; i<spans.length; i++) {
|
||||
if(spans[i].getAttribute("fckLang")) {
|
||||
var val = spans[i].getAttribute("fckLang");
|
||||
var translation = translateItem(val, "");
|
||||
if(translation) {
|
||||
spans[i].innerHTML = translation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var input = d.getElementsByTagName('input');
|
||||
for(i=0; i<input.length; i++) {
|
||||
if(input[i].getAttribute("fckLang")) {
|
||||
var val = input[i].getAttribute("fckLang");
|
||||
var translation = translateItem(val, "");
|
||||
if(translation) {
|
||||
input[i].value = translation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,269 @@
|
||||
/**
|
||||
* SafeFN is a Javascript implementation of Christopher Smith's php
|
||||
* SafeFN class which was written for Dokuwiki
|
||||
*
|
||||
* @author Myron Turner <turnermm@shaw.ca>
|
||||
* @copyright Myron Turner (C) GPL 2 or greater
|
||||
*/
|
||||
|
||||
var SafeFN = {
|
||||
plain: '-./[_0123456789abcdefghijklmnopqrstuvwxyz', // these characters aren't converted
|
||||
pre_indicator: '%',
|
||||
post_indicator:']',
|
||||
|
||||
/**
|
||||
* convert numbers from base 10 to base 36 and base 36 to base 10
|
||||
*
|
||||
* @param string representing an integer or integer num number to be converted
|
||||
* @param integer from base from which to convert
|
||||
* @param integer to base to which to convert
|
||||
*
|
||||
* @return array int an array of unicode codepoints
|
||||
*
|
||||
* @author Myron Turner <turnermm02@shaw.ca>
|
||||
*/
|
||||
|
||||
changeSafeBase: function(num, from, to) {
|
||||
if(isNaN(from) || from < 2 || from > 36 || isNaN(to) || to < 2 || to > 36) {
|
||||
throw (new RangeError("Illegal radix. Radices must be integers between 2 and 36, inclusive."));
|
||||
}
|
||||
num = parseInt(num, from);
|
||||
if(from == 36) return num;
|
||||
return num.toString(to);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* convert a UTF8 string into an array of unicode code points
|
||||
*
|
||||
* @param UTF8 string
|
||||
* @return array int an array of unicode codepoints
|
||||
*
|
||||
* @author Myron Turner <turnermm02@shaw.ca>
|
||||
*/
|
||||
|
||||
get_u_array: function(utf8str) {
|
||||
var unicode_array = new Array();
|
||||
for (var i=0; i<utf8str.length; i++) {
|
||||
unicode_array[i] = utf8str.charCodeAt(i);;
|
||||
}
|
||||
return unicode_array;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* convert a 'safe_filename' string into an array of unicode codepoints
|
||||
*
|
||||
* @param string safe a filename in 'safe_filename' format
|
||||
* @return array int an array of unicode codepoints
|
||||
* @author Christopher Smith <chris@jalakai.co.uk>
|
||||
* @author Myron Turner<turnermm02@shaw.ca>
|
||||
*/
|
||||
safe_to_unicode: function(safe) {
|
||||
var unicode = new Array();
|
||||
var regex = new RegExp('(?=[' + this.pre_indicator + '\\' + this.post_indicator + '])');
|
||||
var split_array = safe.split(regex);
|
||||
var converted = false;
|
||||
|
||||
for (var i = 0; i<split_array.length; i++ ) {
|
||||
var sub = split_array[i];
|
||||
if (sub.charAt(0) != this.pre_indicator) { // i.e. sub.charAt(0) != '%'
|
||||
var start = converted?1:0;
|
||||
for (j=start; j < sub.length; j++) {
|
||||
unicode.push(sub.charCodeAt(j));
|
||||
}
|
||||
converted = false;
|
||||
} else if (sub.length==1) {
|
||||
unicode.push(sub.charCodeAt(0));
|
||||
converted = true;
|
||||
} else {
|
||||
|
||||
unicode.push(32 + this.changeSafeBase(sub.slice(1),36,10));
|
||||
converted = true;
|
||||
}
|
||||
}
|
||||
|
||||
return unicode;
|
||||
},
|
||||
|
||||
/**
|
||||
* convert an array of unicode codepoints into 'safe_filename' format
|
||||
*
|
||||
* @param array int $unicode an array of unicode codepoints
|
||||
* @return string the unicode represented in 'safe_filename' format
|
||||
*
|
||||
* @author Christopher Smith <chris@jalakai.co.uk>
|
||||
* @author Myron Turner <turnermm02@shaw.ca>
|
||||
*/
|
||||
unicode_to_safe: function (unicode) {
|
||||
var safe = '';
|
||||
var converted = false;
|
||||
var plain_str = this.plain + this.post_indicator;
|
||||
|
||||
for (var i=0; i< unicode.length; i++) {
|
||||
codepoint = unicode[i];
|
||||
var match = '';
|
||||
if(String.fromCharCode(codepoint) != '\\') {
|
||||
var regex = new RegExp(String.fromCharCode(codepoint));
|
||||
var match = plain_str.match(regex);
|
||||
}
|
||||
|
||||
if (codepoint < 127 && match) {
|
||||
if (converted) {
|
||||
safe += this.post_indicator;
|
||||
converted = false;
|
||||
}
|
||||
safe += String.fromCharCode(codepoint);
|
||||
|
||||
} else if (codepoint == this.pre_indicator.charCodeAt(0)) {
|
||||
safe += this.pre_indicator;
|
||||
converted = true;
|
||||
} else {
|
||||
safe += this.pre_indicator + this.changeSafeBase((codepoint-32), 10, 36);
|
||||
converted = true;
|
||||
}
|
||||
}
|
||||
if(converted) safe += this.post_indicator;
|
||||
|
||||
return safe;
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert an UTF-8 string to a safe ASCII String
|
||||
*
|
||||
*
|
||||
* @param string filename a utf8 string, should only include printable characters - not 0x00-0x1f
|
||||
* @return string an encoded representation of filename using only 'safe' ASCII characters
|
||||
*
|
||||
* @author Myron Turner <turnermm02@shaw.ca>
|
||||
*/
|
||||
encode: function(filename) {
|
||||
return this.unicode_to_safe(this.get_u_array(filename));
|
||||
},
|
||||
|
||||
/**
|
||||
* decode a 'safe' encoded file name and return a UTF8 string
|
||||
*
|
||||
* @param string filename a 'safe' encoded ASCII string,
|
||||
* @return string decoded utf8 string
|
||||
*
|
||||
* @author Myron Turner <turnermm02@shaw.ca>
|
||||
*/
|
||||
|
||||
decode: function (filename) {
|
||||
var unic = this.safe_to_unicode(filename);
|
||||
|
||||
// convert unicode code points to utf8
|
||||
var str = new Array();
|
||||
for (var i=0; i < unic.length; i++) {
|
||||
str[i] = this.code2utf(unic[i]);
|
||||
}
|
||||
// return the decoded string
|
||||
return this.utf8Decode(str.join(''));
|
||||
},
|
||||
|
||||
/* UTF8 encoding/decoding functions
|
||||
* Copyright (c) 2006 by Ali Farhadi.
|
||||
* released under the terms of the Gnu Public License.
|
||||
* see the GPL for details.
|
||||
*
|
||||
* Email: ali[at]farhadi[dot]ir
|
||||
* Website: http://farhadi.ir/
|
||||
*/
|
||||
|
||||
//an alias of String.fromCharCode
|
||||
chr: function (code)
|
||||
{
|
||||
return String.fromCharCode(code);
|
||||
},
|
||||
|
||||
//returns utf8 encoded charachter of a unicode value.
|
||||
//code must be a number indicating the Unicode value.
|
||||
//returned value is a string between 1 and 4 charachters.
|
||||
code2utf: function (code)
|
||||
{
|
||||
if (code < 128) return this.chr(code);
|
||||
if (code < 2048) return this.chr(192+(code>>6)) + this.chr(128+(code&63));
|
||||
if (code < 65536) return this.chr(224+(code>>12)) + this.chr(128+((code>>6)&63)) + this.chr(128+(code&63));
|
||||
if (code < 2097152) return this.chr(240+(code>>18)) + this.chr(128+((code>>12)&63)) + this.chr(128+((code>>6)&63)) + this.chr(128+(code&63));
|
||||
},
|
||||
|
||||
//it is a private function for internal use in utf8Decode function
|
||||
_utf8Decode: function (utf8str)
|
||||
{
|
||||
|
||||
var str = new Array();
|
||||
var code,code2,code3,code4,j = 0;
|
||||
for (var i=0; i<utf8str.length; ) {
|
||||
code = utf8str.charCodeAt(i++);
|
||||
|
||||
|
||||
if (code > 127) code2 = utf8str.charCodeAt(i++);
|
||||
if (code > 223) code3 = utf8str.charCodeAt(i++);
|
||||
if (code > 239) code4 = utf8str.charCodeAt(i++);
|
||||
|
||||
if (code < 128) str[j++]= this.chr(code);
|
||||
else if (code < 224) str[j++] = this.chr(((code-192)<<6) + (code2-128));
|
||||
else if (code < 240) str[j++] = this.chr(((code-224)<<12) + ((code2-128)<<6) + (code3-128));
|
||||
else str[j++] = this.chr(((code-240)<<18) + ((code2-128)<<12) + ((code3-128)<<6) + (code4-128));
|
||||
|
||||
}
|
||||
return str.join('');
|
||||
},
|
||||
|
||||
//Decodes a UTF8 formated string
|
||||
utf8Decode: function (utf8str)
|
||||
{
|
||||
var str = new Array();
|
||||
var pos = 0;
|
||||
var tmpStr = '';
|
||||
var j=0;
|
||||
while ((pos = utf8str.search(/[^\x00-\x7F]/)) != -1) {
|
||||
tmpStr = utf8str.match(/([^\x00-\x7F]+[\x00-\x7F]{0,10})+/)[0];
|
||||
str[j++]= utf8str.substr(0, pos) + this._utf8Decode(tmpStr);
|
||||
utf8str = utf8str.substr(pos + tmpStr.length);
|
||||
}
|
||||
|
||||
str[j++] = utf8str;
|
||||
return str.join('');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function SafeFN_encode(filename) {
|
||||
return SafeFN.encode(filename);
|
||||
}
|
||||
|
||||
function SafeFN_decode(filename) {
|
||||
return SafeFN.decode(filename);
|
||||
}
|
||||
|
||||
|
||||
function dwikiUTF8_encodeFN(file, encoding){
|
||||
|
||||
if(encoding == 'utf-8') return file;
|
||||
|
||||
if(file.match(/^[a-zA-Z0-9\/_\-\.%\]]+$/)){
|
||||
return file;
|
||||
}
|
||||
|
||||
if(encoding == 'safe'){
|
||||
return SafeFN_encode(file);
|
||||
}
|
||||
|
||||
file = encodeURIComponent(file);
|
||||
file = file.replace(/%2F/g,'/');
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
function dwikiUTF8_decodeFN(file, encoding){
|
||||
|
||||
if(encoding == 'utf-8') return file;
|
||||
|
||||
if(encoding == 'safe'){
|
||||
return SafeFN_decode(file);
|
||||
}
|
||||
|
||||
return decodeURIComponent(file);
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
|
||||
div#wrapper{
|
||||
margin:auto;
|
||||
background-color:#ffffff;
|
||||
height: 560px;
|
||||
width: 975px;
|
||||
}
|
||||
div.left_sidebar {
|
||||
float:left;
|
||||
height: 555px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
div.right_page {
|
||||
float:right; padding:0px;
|
||||
width: 770px; height:555px;
|
||||
}
|
||||
iframe .resourceslist {
|
||||
width:770px;
|
||||
height:200px;
|
||||
}
|
||||
div#bottom_matter {
|
||||
height:95px;
|
||||
width: 100%;
|
||||
background-color: #dddddd;
|
||||
|
||||
}
|
||||
iframe.createfolder {
|
||||
height: 90px
|
||||
width: 180px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.frmupload{
|
||||
height:50%;
|
||||
width:100%;
|
||||
float:right;
|
||||
}
|
||||
div#worker {
|
||||
height:0px; width:0px;
|
||||
}
|
||||
|
@@ -0,0 +1,335 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Encapsulates access to the $_REQUEST array, making sure used parameters are initialized and
|
||||
* have the correct type.
|
||||
*
|
||||
* All function access the $_REQUEST array by default, if you want to access $_POST or $_GET
|
||||
* explicitly use the $post and $get members.
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
class Input {
|
||||
|
||||
/** @var PostInput Access $_POST parameters */
|
||||
public $post;
|
||||
/** @var GetInput Access $_GET parameters */
|
||||
public $get;
|
||||
/** @var ServerInput Access $_SERVER parameters */
|
||||
public $server;
|
||||
|
||||
protected $access;
|
||||
|
||||
/**
|
||||
* @var Callable
|
||||
*/
|
||||
protected $filter;
|
||||
|
||||
/**
|
||||
* Intilizes the Input class and it subcomponents
|
||||
*/
|
||||
function __construct() {
|
||||
$this->access = &$_REQUEST;
|
||||
$this->post = new PostInput();
|
||||
$this->get = new GetInput();
|
||||
$this->server = new ServerInput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the set filter to the given value
|
||||
*
|
||||
* @param string $data
|
||||
* @return string
|
||||
*/
|
||||
protected function applyfilter($data){
|
||||
if(!$this->filter) return $data;
|
||||
return call_user_func($this->filter, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a filtered copy of the input object
|
||||
*
|
||||
* Expects a callable that accepts one string parameter and returns a filtered string
|
||||
*
|
||||
* @param Callable|string $filter
|
||||
* @return Input
|
||||
*/
|
||||
public function filter($filter='stripctl'){
|
||||
$this->filter = $filter;
|
||||
$clone = clone $this;
|
||||
$this->filter = '';
|
||||
return $clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a parameter was set
|
||||
*
|
||||
* Basically a wrapper around isset. When called on the $post and $get subclasses,
|
||||
* the parameter is set to $_POST or $_GET and to $_REQUEST
|
||||
*
|
||||
* @see isset
|
||||
* @param string $name Parameter name
|
||||
* @return bool
|
||||
*/
|
||||
public function has($name) {
|
||||
return isset($this->access[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a parameter from the superglobals
|
||||
*
|
||||
* Basically a wrapper around unset. When NOT called on the $post and $get subclasses,
|
||||
* the parameter will also be removed from $_POST or $_GET
|
||||
*
|
||||
* @see isset
|
||||
* @param string $name Parameter name
|
||||
*/
|
||||
public function remove($name) {
|
||||
if(isset($this->access[$name])) {
|
||||
unset($this->access[$name]);
|
||||
}
|
||||
// also remove from sub classes
|
||||
if(isset($this->post) && isset($_POST[$name])) {
|
||||
unset($_POST[$name]);
|
||||
}
|
||||
if(isset($this->get) && isset($_GET[$name])) {
|
||||
unset($_GET[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Access a request parameter without any type conversion
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param mixed $default Default to return if parameter isn't set
|
||||
* @param bool $nonempty Return $default if parameter is set but empty()
|
||||
* @return mixed
|
||||
*/
|
||||
public function param($name, $default = null, $nonempty = false) {
|
||||
if(!isset($this->access[$name])) return $default;
|
||||
$value = $this->applyfilter($this->access[$name]);
|
||||
if($nonempty && empty($value)) return $default;
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parameter
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param mixed $value Value to set
|
||||
*/
|
||||
public function set($name, $value) {
|
||||
$this->access[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to a request parameter
|
||||
*
|
||||
* This avoids copying data in memory, when the parameter is not set it will be created
|
||||
* and intialized with the given $default value before a reference is returned
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param mixed $default If parameter is not set, initialize with this value
|
||||
* @param bool $nonempty Init with $default if parameter is set but empty()
|
||||
* @return mixed (reference)
|
||||
*/
|
||||
public function &ref($name, $default = '', $nonempty = false) {
|
||||
if(!isset($this->access[$name]) || ($nonempty && empty($this->access[$name]))) {
|
||||
$this->set($name, $default);
|
||||
}
|
||||
|
||||
return $this->access[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Access a request parameter as int
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param int $default Default to return if parameter isn't set or is an array
|
||||
* @param bool $nonempty Return $default if parameter is set but empty()
|
||||
* @return int
|
||||
*/
|
||||
public function int($name, $default = 0, $nonempty = false) {
|
||||
if(!isset($this->access[$name])) return $default;
|
||||
if(is_array($this->access[$name])) return $default;
|
||||
$value = $this->applyfilter($this->access[$name]);
|
||||
if($value === '') return $default;
|
||||
if($nonempty && empty($value)) return $default;
|
||||
|
||||
return (int) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access a request parameter as string
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param string $default Default to return if parameter isn't set or is an array
|
||||
* @param bool $nonempty Return $default if parameter is set but empty()
|
||||
* @return string
|
||||
*/
|
||||
public function str($name, $default = '', $nonempty = false) {
|
||||
if(!isset($this->access[$name])) return $default;
|
||||
if(is_array($this->access[$name])) return $default;
|
||||
$value = $this->applyfilter($this->access[$name]);
|
||||
if($nonempty && empty($value)) return $default;
|
||||
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access a request parameter and make sure it is has a valid value
|
||||
*
|
||||
* Please note that comparisons to the valid values are not done typesafe (request vars
|
||||
* are always strings) however the function will return the correct type from the $valids
|
||||
* array when an match was found.
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param array $valids Array of valid values
|
||||
* @param mixed $default Default to return if parameter isn't set or not valid
|
||||
* @return null|mixed
|
||||
*/
|
||||
public function valid($name, $valids, $default = null) {
|
||||
if(!isset($this->access[$name])) return $default;
|
||||
if(is_array($this->access[$name])) return $default; // we don't allow arrays
|
||||
$value = $this->applyfilter($this->access[$name]);
|
||||
$found = array_search($value, $valids);
|
||||
if($found !== false) return $valids[$found]; // return the valid value for type safety
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access a request parameter as bool
|
||||
*
|
||||
* Note: $nonempty is here for interface consistency and makes not much sense for booleans
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param mixed $default Default to return if parameter isn't set
|
||||
* @param bool $nonempty Return $default if parameter is set but empty()
|
||||
* @return bool
|
||||
*/
|
||||
public function bool($name, $default = false, $nonempty = false) {
|
||||
if(!isset($this->access[$name])) return $default;
|
||||
if(is_array($this->access[$name])) return $default;
|
||||
$value = $this->applyfilter($this->access[$name]);
|
||||
if($value === '') return $default;
|
||||
if($nonempty && empty($value)) return $default;
|
||||
|
||||
return (bool) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access a request parameter as array
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param mixed $default Default to return if parameter isn't set
|
||||
* @param bool $nonempty Return $default if parameter is set but empty()
|
||||
* @return array
|
||||
*/
|
||||
public function arr($name, $default = array(), $nonempty = false) {
|
||||
if(!isset($this->access[$name])) return $default;
|
||||
if(!is_array($this->access[$name])) return $default;
|
||||
if($nonempty && empty($this->access[$name])) return $default;
|
||||
|
||||
return (array) $this->access[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a simple key from an array key
|
||||
*
|
||||
* This is useful to access keys where the information is given as an array key or as a single array value.
|
||||
* For example when the information was submitted as the name of a submit button.
|
||||
*
|
||||
* This function directly changes the access array.
|
||||
*
|
||||
* Eg. $_REQUEST['do']['save']='Speichern' becomes $_REQUEST['do'] = 'save'
|
||||
*
|
||||
* This function returns the $INPUT object itself for easy chaining
|
||||
*
|
||||
* @param string $name
|
||||
* @return Input
|
||||
*/
|
||||
public function extract($name){
|
||||
if(!isset($this->access[$name])) return $this;
|
||||
if(!is_array($this->access[$name])) return $this;
|
||||
$keys = array_keys($this->access[$name]);
|
||||
if(!$keys){
|
||||
// this was an empty array
|
||||
$this->remove($name);
|
||||
return $this;
|
||||
}
|
||||
// get the first key
|
||||
$value = array_shift($keys);
|
||||
if($value === 0){
|
||||
// we had a numeric array, assume the value is not in the key
|
||||
$value = array_shift($this->access[$name]);
|
||||
}
|
||||
|
||||
$this->set($name, $value);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal class used for $_POST access in Input class
|
||||
*/
|
||||
class PostInput extends Input {
|
||||
protected $access;
|
||||
|
||||
/**
|
||||
* Initialize the $access array, remove subclass members
|
||||
*/
|
||||
function __construct() {
|
||||
$this->access = &$_POST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parameter in $_POST and $_REQUEST
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param mixed $value Value to set
|
||||
*/
|
||||
public function set($name, $value) {
|
||||
parent::set($name, $value);
|
||||
$_REQUEST[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal class used for $_GET access in Input class
|
||||
*/
|
||||
class GetInput extends Input {
|
||||
protected $access;
|
||||
|
||||
/**
|
||||
* Initialize the $access array, remove subclass members
|
||||
*/
|
||||
function __construct() {
|
||||
$this->access = &$_GET;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parameter in $_GET and $_REQUEST
|
||||
*
|
||||
* @param string $name Parameter name
|
||||
* @param mixed $value Value to set
|
||||
*/
|
||||
public function set($name, $value) {
|
||||
parent::set($name, $value);
|
||||
$_REQUEST[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal class used for $_SERVER access in Input class
|
||||
*/
|
||||
class ServerInput extends Input {
|
||||
protected $access;
|
||||
|
||||
/**
|
||||
* Initialize the $access array, remove subclass members
|
||||
*/
|
||||
function __construct() {
|
||||
$this->access = &$_SERVER;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class to safely store UTF-8 in a Filename
|
||||
*
|
||||
* Encodes a utf8 string using only the following characters 0-9a-z_.-%
|
||||
* characters 0-9a-z in the original string are preserved, "plain".
|
||||
* all other characters are represented in a substring that starts
|
||||
* with '%' are "converted".
|
||||
* The transition from converted substrings to plain characters is
|
||||
* marked with a '.'
|
||||
*
|
||||
* @author Christopher Smith <chris@jalakai.co.uk>
|
||||
* @date 2010-04-02
|
||||
*/
|
||||
class SafeFN {
|
||||
|
||||
// 'safe' characters are a superset of $plain, $pre_indicator and $post_indicator
|
||||
private static $plain = '-./[_0123456789abcdefghijklmnopqrstuvwxyz'; // these characters aren't converted
|
||||
private static $pre_indicator = '%';
|
||||
private static $post_indicator = ']';
|
||||
|
||||
/**
|
||||
* Convert an UTF-8 string to a safe ASCII String
|
||||
*
|
||||
* conversion process
|
||||
* - if codepoint is a plain or post_indicator character,
|
||||
* - if previous character was "converted", append post_indicator to output, clear "converted" flag
|
||||
* - append ascii byte for character to output
|
||||
* (continue to next character)
|
||||
*
|
||||
* - if codepoint is a pre_indicator character,
|
||||
* - append ascii byte for character to output, set "converted" flag
|
||||
* (continue to next character)
|
||||
*
|
||||
* (all remaining characters)
|
||||
* - reduce codepoint value for non-printable ASCII characters (0x00 - 0x1f). Space becomes our zero.
|
||||
* - convert reduced value to base36 (0-9a-z)
|
||||
* - append $pre_indicator characater followed by base36 string to output, set converted flag
|
||||
* (continue to next character)
|
||||
*
|
||||
* @param string $filename a utf8 string, should only include printable characters - not 0x00-0x1f
|
||||
* @return string an encoded representation of $filename using only 'safe' ASCII characters
|
||||
*
|
||||
* @author Christopher Smith <chris@jalakai.co.uk>
|
||||
*/
|
||||
public static function encode($filename) {
|
||||
return self::unicode_to_safe(utf8_to_unicode($filename));
|
||||
}
|
||||
|
||||
/**
|
||||
* decoding process
|
||||
* - split the string into substrings at any occurrence of pre or post indicator characters
|
||||
* - check the first character of the substring
|
||||
* - if its not a pre_indicator character
|
||||
* - if previous character was converted, skip over post_indicator character
|
||||
* - copy codepoint values of remaining characters to the output array
|
||||
* - clear any converted flag
|
||||
* (continue to next substring)
|
||||
*
|
||||
* _ else (its a pre_indicator character)
|
||||
* - if string length is 1, copy the post_indicator character to the output array
|
||||
* (continue to next substring)
|
||||
*
|
||||
* - else (string length > 1)
|
||||
* - skip the pre-indicator character and convert remaining string from base36 to base10
|
||||
* - increase codepoint value for non-printable ASCII characters (add 0x20)
|
||||
* - append codepoint to output array
|
||||
* (continue to next substring)
|
||||
*
|
||||
* @param string $filename a 'safe' encoded ASCII string,
|
||||
* @return string decoded utf8 representation of $filename
|
||||
*
|
||||
* @author Christopher Smith <chris@jalakai.co.uk>
|
||||
*/
|
||||
public static function decode($filename) {
|
||||
return unicode_to_utf8(self::safe_to_unicode(strtolower($filename)));
|
||||
}
|
||||
|
||||
public static function validate_printable_utf8($printable_utf8) {
|
||||
return !preg_match('#[\x01-\x1f]#',$printable_utf8);
|
||||
}
|
||||
|
||||
public static function validate_safe($safe) {
|
||||
return !preg_match('#[^'.self::$plain.self::$post_indicator.self::$pre_indicator.']#',$safe);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert an array of unicode codepoints into 'safe_filename' format
|
||||
*
|
||||
* @param array int $unicode an array of unicode codepoints
|
||||
* @return string the unicode represented in 'safe_filename' format
|
||||
*
|
||||
* @author Christopher Smith <chris@jalakai.co.uk>
|
||||
*/
|
||||
private static function unicode_to_safe($unicode) {
|
||||
|
||||
$safe = '';
|
||||
$converted = false;
|
||||
|
||||
foreach ($unicode as $codepoint) {
|
||||
if ($codepoint < 127 && (strpos(self::$plain.self::$post_indicator,chr($codepoint))!==false)) {
|
||||
if ($converted) {
|
||||
$safe .= self::$post_indicator;
|
||||
$converted = false;
|
||||
}
|
||||
$safe .= chr($codepoint);
|
||||
|
||||
} else if ($codepoint == ord(self::$pre_indicator)) {
|
||||
$safe .= self::$pre_indicator;
|
||||
$converted = true;
|
||||
} else {
|
||||
$safe .= self::$pre_indicator.base_convert((string)($codepoint-32),10,36);
|
||||
$converted = true;
|
||||
}
|
||||
}
|
||||
if($converted) $safe .= self::$post_indicator;
|
||||
return $safe;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a 'safe_filename' string into an array of unicode codepoints
|
||||
*
|
||||
* @param string $safe a filename in 'safe_filename' format
|
||||
* @return array int an array of unicode codepoints
|
||||
*
|
||||
* @author Christopher Smith <chris@jalakai.co.uk>
|
||||
*/
|
||||
private static function safe_to_unicode($safe) {
|
||||
|
||||
$unicode = array();
|
||||
$split = preg_split('#(?=['.self::$post_indicator.self::$pre_indicator.'])#',$safe,-1,PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$converted = false;
|
||||
foreach ($split as $sub) {
|
||||
$len = strlen($sub);
|
||||
if ($sub[0] != self::$pre_indicator) {
|
||||
// plain (unconverted) characters, optionally starting with a post_indicator
|
||||
// set initial value to skip any post_indicator
|
||||
for ($i=($converted?1:0); $i < $len; $i++) {
|
||||
$unicode[] = ord($sub[$i]);
|
||||
}
|
||||
$converted = false;
|
||||
} else if ($len==1) {
|
||||
// a pre_indicator character in the real data
|
||||
$unicode[] = ord($sub);
|
||||
$converted = true;
|
||||
} else {
|
||||
// a single codepoint in base36, adjusted for initial 32 non-printable chars
|
||||
$unicode[] = 32 + (int)base_convert(substr($sub,1),36,10);
|
||||
$converted = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $unicode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a UTF-8 filename to use on any filesystem
|
||||
*
|
||||
* Uses the 'fnencode' option to determine encoding
|
||||
*
|
||||
* When the second parameter is true the string will
|
||||
* be encoded only if non ASCII characters are detected -
|
||||
* This makes it safe to run it multiple times on the
|
||||
* same string (default is true)
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @see urlencode
|
||||
*/
|
||||
function dwiki_encodeFN($file,$safe=true){
|
||||
global $Dwfck_conf_values;
|
||||
if($Dwfck_conf_values['fnencode'] == 'utf-8') return $file;
|
||||
|
||||
if($safe && preg_match('#^[a-zA-Z0-9/_\-\\]%]+$#',$file)){
|
||||
return $file;
|
||||
}
|
||||
|
||||
if($Dwfck_conf_values['fnencode'] == 'safe'){
|
||||
return SafeFN::encode($file);
|
||||
}
|
||||
|
||||
$file = urlencode($file);
|
||||
$file = str_replace('%2F','/',$file);
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a filename back to UTF-8
|
||||
*
|
||||
* Uses the 'fnencode' option to determine encoding
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @see urldecode
|
||||
*/
|
||||
function dwiki_decodeFN($file){
|
||||
global $Dwfck_conf_values;
|
||||
if($Dwfck_conf_values['fnencode'] == 'utf-8') return $file;
|
||||
|
||||
if($Dwfck_conf_values['fnencode'] == 'safe'){
|
||||
return SafeFN::decode($file);
|
||||
}
|
||||
|
||||
return urldecode($file);
|
||||
}
|
||||
|
||||
|
||||
function safe_write_debug($what) {
|
||||
return;
|
||||
if(is_array($what)) {
|
||||
$what = print_r($what,true);
|
||||
}
|
||||
$dwfckFHandle = fopen("safe_dbg.txt", "a");
|
||||
fwrite($dwfckFHandle, "$what\n");
|
||||
fclose($dwfckFHandle);
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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 . '" />' ;
|
||||
}
|
||||
?>
|
@@ -0,0 +1,336 @@
|
||||
<?php
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../../../../../').'/');
|
||||
$CONF_DIR = DOKU_INC.'conf';
|
||||
if(file_exists($CONF_DIR)) {
|
||||
if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/');
|
||||
}
|
||||
else {
|
||||
require_once(DOKU_INC. 'inc/preload.php');
|
||||
}
|
||||
require_once 'utf8.php';
|
||||
|
||||
// some ACL level defines
|
||||
define('AUTH_NONE',0);
|
||||
define('AUTH_READ',1);
|
||||
define('AUTH_EDIT',2);
|
||||
define('AUTH_CREATE',4);
|
||||
define('AUTH_UPLOAD',8);
|
||||
define('AUTH_DELETE',16);
|
||||
define('AUTH_ADMIN',255);
|
||||
global $AUTH_ACL;
|
||||
|
||||
global $cache_authname; $cache_authname = array();
|
||||
global $config_cascade;
|
||||
global $Dwfck_conf_values;
|
||||
$AUTH_ACL = array();
|
||||
|
||||
//load ACL into a global array XXX
|
||||
$auth_file = DOKU_CONF. '/acl.auth.php';
|
||||
if(isset( $_COOKIE['FCK_animal_inc'] )) {
|
||||
$animal_inc = $_COOKIE['FCK_animal_inc'];
|
||||
$auth_file = $animal_inc.'conf/acl.auth.php';
|
||||
}
|
||||
|
||||
$AUTH_ACL = file($auth_file);
|
||||
|
||||
/**
|
||||
* Returns the maximum rights a user has for
|
||||
* the given ID or its namespace
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*
|
||||
* @param string $id page ID
|
||||
* @param string $user Username
|
||||
* @param array $groups Array of groups the user is in
|
||||
* @return int permission level
|
||||
*/
|
||||
function auth_aclcheck($id,$user,$groups, $_auth=1){
|
||||
|
||||
global $AUTH_ACL;
|
||||
$AUTH_ACL = auth_loadACL($AUTH_ACL);
|
||||
if($_auth == 255) {
|
||||
return 255;
|
||||
}
|
||||
elseif(isset($_SESSION['dwfck_acl']) && $_SESSION['dwfck_acl'] == 255) {
|
||||
return 255;
|
||||
}
|
||||
//make sure groups is an array
|
||||
if(!is_array($groups)) $groups = array();
|
||||
|
||||
if(!auth_isCaseSensitive()) {
|
||||
$user = utf8_strtolower($user);
|
||||
$groups = array_map('utf8_strtolower', $groups);
|
||||
}
|
||||
$user = auth_cleanUser($user);
|
||||
$groups = array_map('auth_cleanGroup', (array) $groups);
|
||||
$user = auth_nameencode($user);
|
||||
|
||||
//prepend groups with @ and nameencode
|
||||
$cnt = count($groups);
|
||||
for($i = 0; $i < $cnt; $i++) {
|
||||
$groups[$i] = '@'.auth_nameencode($groups[$i]);
|
||||
}
|
||||
|
||||
$ns = getNS($id);
|
||||
$perm = -1;
|
||||
|
||||
if($user || count($groups)) {
|
||||
//add ALL group
|
||||
$groups[] = '@ALL';
|
||||
//add User
|
||||
if($user) $groups[] = $user;
|
||||
} else {
|
||||
$groups[] = '@ALL';
|
||||
}
|
||||
|
||||
//check exact match first
|
||||
$matches = preg_grep('/^'.preg_quote($id, '/').'[ \t]+([^ \t]+)[ \t]+/', $AUTH_ACL);
|
||||
if(count($matches)) {
|
||||
foreach($matches as $match) {
|
||||
$match = preg_replace('/#.*$/', '', $match); //ignore comments
|
||||
$acl = preg_split('/[ \t]+/', $match);
|
||||
if(!auth_isCaseSensitive() && $acl[1] !== '@ALL') {
|
||||
$acl[1] = utf8_strtolower($acl[1]);
|
||||
}
|
||||
if(!in_array($acl[1], $groups)) {
|
||||
continue;
|
||||
}
|
||||
if($acl[2] > AUTH_DELETE) $acl[2] = AUTH_DELETE; //no admins in the ACL!
|
||||
if($acl[2] > $perm) {
|
||||
$perm = $acl[2];
|
||||
}
|
||||
}
|
||||
if($perm > -1) {
|
||||
//we had a match - return it
|
||||
return (int) $perm;
|
||||
}
|
||||
}
|
||||
|
||||
//still here? do the namespace checks
|
||||
if($ns) {
|
||||
$path = $ns.':*';
|
||||
} else {
|
||||
$path = '*'; //root document
|
||||
}
|
||||
|
||||
do {
|
||||
$matches = preg_grep('/^'.preg_quote($path, '/').'[ \t]+([^ \t]+)[ \t]+/', $AUTH_ACL);
|
||||
if(count($matches)) {
|
||||
foreach($matches as $match) {
|
||||
$match = preg_replace('/#.*$/', '', $match); //ignore comments
|
||||
$acl = preg_split('/[ \t]+/', $match);
|
||||
if(!auth_isCaseSensitive() && $acl[1] !== '@ALL') {
|
||||
$acl[1] = utf8_strtolower($acl[1]);
|
||||
}
|
||||
if(!in_array($acl[1], $groups)) {
|
||||
continue;
|
||||
}
|
||||
if($acl[2] > AUTH_DELETE) $acl[2] = AUTH_DELETE; //no admins in the ACL!
|
||||
if($acl[2] > $perm) {
|
||||
$perm = $acl[2];
|
||||
}
|
||||
}
|
||||
//we had a match - return it
|
||||
if($perm != -1) {
|
||||
return (int) $perm;
|
||||
}
|
||||
}
|
||||
//get next higher namespace
|
||||
$ns = getNS($ns);
|
||||
|
||||
if($path != '*') {
|
||||
$path = $ns.':*';
|
||||
if($path == ':*') $path = '*';
|
||||
} else {
|
||||
//we did this already
|
||||
//looks like there is something wrong with the ACL
|
||||
//break here
|
||||
|
||||
return AUTH_NONE;
|
||||
}
|
||||
} while(1); //this should never loop endless
|
||||
return AUTH_NONE;
|
||||
}
|
||||
|
||||
function auth_isCaseSensitive() {
|
||||
global $Dwfck_conf_values;
|
||||
if(!isset($Dwfck_conf_values['plugin'])) return false;
|
||||
$ckgedit = $Dwfck_conf_values['plugin']['ckgedit'];
|
||||
if(isset($ckgedit['auth_ci']) && $ckgedit['auth_ci']) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function auth_nameencode($name,$skip_group=false){
|
||||
global $cache_authname;
|
||||
$cache =& $cache_authname;
|
||||
$name = (string) $name;
|
||||
|
||||
// never encode wildcard FS#1955
|
||||
if($name == '%USER%') return $name;
|
||||
if($name == '%GROUP%') return $name;
|
||||
|
||||
if (!isset($cache[$name][$skip_group])) {
|
||||
if($skip_group && $name{0} =='@'){
|
||||
$cache[$name][$skip_group] = '@'.preg_replace_callback(
|
||||
'/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/',
|
||||
'auth_nameencode_callback', substr($name, 1)
|
||||
);
|
||||
}else{
|
||||
$cache[$name][$skip_group] = preg_replace_callback(
|
||||
'/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/',
|
||||
'auth_nameencode_callback', $name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $cache[$name][$skip_group];
|
||||
}
|
||||
|
||||
/**
|
||||
* callback encodes the matches
|
||||
*
|
||||
* @param array $matches first complete match, next matching subpatterms
|
||||
* @return string
|
||||
*/
|
||||
function auth_nameencode_callback($matches) {
|
||||
return '%'.dechex(ord(substr($matches[1],-1)));
|
||||
}
|
||||
|
||||
|
||||
function getNS($id){
|
||||
$pos = strrpos((string)$id,':');
|
||||
if($pos!==false){
|
||||
return substr((string)$id,0,$pos);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove unwanted chars from ID
|
||||
*
|
||||
* Cleans a given ID to only use allowed characters. Accented characters are
|
||||
* converted to unaccented ones
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @param string $raw_id The pageid to clean
|
||||
* @param boolean $ascii Force ASCII
|
||||
* @param boolean $media Allow leading or trailing _ for media files
|
||||
*/
|
||||
function cleanID($raw_id,$ascii=false,$media=false){
|
||||
global $dwfck_conf;
|
||||
|
||||
static $sepcharpat = null;
|
||||
static $cache = array();
|
||||
|
||||
// check if it's already in the memory cache
|
||||
if (isset($cache[(string)$raw_id])) {
|
||||
return $cache[(string)$raw_id];
|
||||
}
|
||||
|
||||
|
||||
$sepchar = $dwfck_conf['sepchar'];
|
||||
if($sepcharpat == null) // build string only once to save clock cycles
|
||||
$sepcharpat = '#\\'.$sepchar.'+#';
|
||||
|
||||
$id = trim((string)$raw_id);
|
||||
$id = utf8_strtolower($id);
|
||||
|
||||
//alternative namespace seperator
|
||||
$id = strtr($id,';',':');
|
||||
if($dwfck_conf['useslash']){
|
||||
$id = strtr($id,'/',':');
|
||||
}else{
|
||||
$id = strtr($id,'/',$sepchar);
|
||||
}
|
||||
|
||||
if($dwfck_conf['deaccent'] == 2 || $ascii) $id = utf8_romanize($id);
|
||||
if($dwfck_conf['deaccent'] || $ascii) $id = utf8_deaccent($id,-1);
|
||||
|
||||
//remove specials
|
||||
$id = utf8_stripspecials($id,$sepchar,'\*');
|
||||
|
||||
if($ascii) $id = utf8_strip($id);
|
||||
|
||||
//clean up
|
||||
$id = preg_replace($sepcharpat,$sepchar,$id);
|
||||
$id = preg_replace('#:+#',':',$id);
|
||||
$id = ($media ? trim($id,':.-') : trim($id,':._-'));
|
||||
$id = preg_replace('#:[:\._\-]+#',':',$id);
|
||||
|
||||
$cache[(string)$raw_id] = $id;
|
||||
return($id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads the ACL setup and handle user wildcards
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @returns array
|
||||
*/
|
||||
function auth_loadACL($acl_file){
|
||||
global $config_cascade;
|
||||
|
||||
$acl = $acl_file;
|
||||
$sess_id = session_id();
|
||||
if(!isset($sess_id) || $sess_id != $_COOKIE['FCK_NmSp_acl']) {
|
||||
session_id($_COOKIE['FCK_NmSp_acl']);
|
||||
session_start();
|
||||
if(isset($_SESSION['dwfck_client'])) {
|
||||
$_SERVER['REMOTE_USER'] = $_SESSION['dwfck_client'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(isset($_SESSION['dwfck_client'])) {
|
||||
$_SERVER['REMOTE_USER'] = $_SESSION['dwfck_client'];
|
||||
}
|
||||
}
|
||||
//support user wildcard
|
||||
if(isset($_SERVER['REMOTE_USER'])){
|
||||
$len = count($acl);
|
||||
for($i=0; $i<$len; $i++){
|
||||
if($acl[$i]{0} == '#') continue;
|
||||
list($id,$rest) = preg_split('/\s+/',$acl[$i],2);
|
||||
$id = str_replace('%USER%',cleanID($_SERVER['REMOTE_USER']),$id);
|
||||
$rest = str_replace('%USER%',auth_nameencode($_SERVER['REMOTE_USER']),$rest);
|
||||
$acl[$i] = "$id\t$rest";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$acl = str_replace('%USER%',$user,$acl); // fall-back, in case client not found
|
||||
}
|
||||
return $acl;
|
||||
}
|
||||
|
||||
function checkacl_write_debug($data) {
|
||||
|
||||
return;
|
||||
if (!$handle = fopen('acl.txt', 'a')) {
|
||||
return;
|
||||
}
|
||||
|
||||
fwrite($handle, "$data\n");
|
||||
fclose($handle);
|
||||
|
||||
}
|
||||
|
||||
function get_conf_array($str) {
|
||||
$str = preg_replace('/\s+/',"",$str);
|
||||
return explode(';;', $str);
|
||||
}
|
||||
|
||||
function has_acl_auth($path) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function auth_cleanUser($user) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
function auth_cleanGroup($group) {
|
||||
return $group;
|
||||
}
|
||||
|
@@ -0,0 +1,816 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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.
|
||||
*/
|
||||
|
||||
|
||||
require_once 'useheading.php';
|
||||
require_once 'check_acl.php';
|
||||
require_once 'input_utils.php';
|
||||
global $dwfck_conf;
|
||||
global $_FolderClass;
|
||||
|
||||
function GetDwfckNs()
|
||||
{
|
||||
echo $_SESSION['dwfck_ns'];
|
||||
}
|
||||
|
||||
|
||||
function has_permission($folder, $resourceType, $isFolder=true) {
|
||||
global $_FolderClass;
|
||||
global $Dwfck_conf_values;
|
||||
$folder = str_replace('//','/',$folder);
|
||||
|
||||
$sFolderPath = GetResourceTypeDirectory( $resourceType, 'GetFoldersAndFiles');
|
||||
|
||||
$ns_tmp = str_replace('/',':',$folder);
|
||||
$ns_tmp=trim($ns_tmp,':');
|
||||
|
||||
if(preg_match('/%[a-zA-a0-9]/', $ns_tmp) && $Dwfck_conf_values['fnencode'] == 'safe') {
|
||||
$test = dwiki_decodeFN($ns_tmp);
|
||||
}
|
||||
else {
|
||||
|
||||
$test = urldecode($ns_tmp);
|
||||
}
|
||||
|
||||
if($isFolder) {
|
||||
$test .= ':*' ;
|
||||
}
|
||||
else {
|
||||
$test=preg_replace('/\.txt$/',"",$test);
|
||||
}
|
||||
|
||||
$AUTH = auth_aclcheck($test, $_SESSION['dwfck_client'] , $_SESSION['dwfck_grps'], 1);
|
||||
|
||||
$_FolderClass = $AUTH;
|
||||
if(!$isFolder) return($AUTH > 0);
|
||||
return ($AUTH >1);
|
||||
}
|
||||
|
||||
|
||||
function GetFolders( $resourceType, $currentFolder )
|
||||
{
|
||||
|
||||
global $_FolderClass;
|
||||
global $Config;
|
||||
$currentFolder=encode_dir($currentFolder);
|
||||
|
||||
$isInternalLink = input_strval('DWFCK_Browser', 'local') ;
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' ) ;
|
||||
|
||||
if($Config['osWindows']) {
|
||||
$sServerDir = normalizeWIN($sServerDir);
|
||||
}
|
||||
|
||||
// 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 ) ) {
|
||||
|
||||
|
||||
if(has_permission(dwiki_encodeFN($currentFolder) .'/' . $sFile, $resourceType) || has_open_access() ) {
|
||||
if($isInternalLink && $_FolderClass < 255) {
|
||||
$class = 'r';
|
||||
}
|
||||
else $class = ($_FolderClass < 8) ? 'r' : 'u';
|
||||
can_delete($class);
|
||||
if($_FolderClass) {
|
||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) .
|
||||
'" class="'. $class .'" />' ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
closedir( $oCurrentFolder ) ;
|
||||
}
|
||||
|
||||
// Open the "Folders" node.
|
||||
echo "<Folders>" ;
|
||||
|
||||
natcasesort( $aFolders ) ;
|
||||
|
||||
foreach ( $aFolders as $sFolder )
|
||||
|
||||
echo $sFolder ;
|
||||
|
||||
|
||||
// Close the "Folders" node.
|
||||
echo "</Folders>" ;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
seeks to determine whether user has rights to create folder
|
||||
if the folder does not exist when file browser is opened
|
||||
and the editor has not created it
|
||||
This situation occurs when the file browser opened from the
|
||||
root directory, where the file being written to is in a
|
||||
new subdirectory that has been created for the file:
|
||||
parent_dir:new_dir:new_file
|
||||
Dokuwiki creates new_dir in data/pages but not in data/media.
|
||||
Dokuwiki creates data/media/new_dir when the user opens
|
||||
the media manager. Similarly, this directory has to be created when
|
||||
FCKeditor's file browser is opened
|
||||
|
||||
*/
|
||||
function has_open_access() {
|
||||
|
||||
$open_access = false;
|
||||
if(isset($_REQUEST['TopLevel'])) {
|
||||
// list($top_level,$auth) = explode(';;',$_REQUEST['TopLevel']);
|
||||
// if($auth == 255 && $top_level =='/') $open_access = true;
|
||||
}
|
||||
$isadmin = isset($_SESSION['dwfck_conf']['isadmin']) ? $_SESSION['dwfck_conf']['isadmin'] : false;
|
||||
$acl = isset($_SESSION['dwfck_acl']) ? $_SESSION['dwfck_acl'] : 1;
|
||||
$openbrowser = (isset($_SESSION['dwfck_openfb']) && $_SESSION['dwfck_openfb'] == 'y') ? true : false;
|
||||
if($open_access || $isadmin || $acl == 255 || ($openbrowser && $acl >= 8)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function GetFoldersAndFiles( $resourceType, $currentFolder )
|
||||
{
|
||||
if (!isset($_GET)) {
|
||||
global $_GET;
|
||||
}
|
||||
global $Config;
|
||||
|
||||
$isInternalLink = input_strval('DWFCK_Browser', 'local') ;
|
||||
global $_FolderClass;
|
||||
global $Config;
|
||||
$currentFolder=encode_dir($currentFolder);
|
||||
|
||||
$sess_id = session_id();
|
||||
if(!isset($sess_id) || $sess_id != $_COOKIE['FCK_NmSp_acl']) {
|
||||
session_id($_COOKIE['FCK_NmSp_acl']);
|
||||
session_start();
|
||||
}
|
||||
$acl_del = isset($_SESSION['dwfck_del']) ? $_SESSION['dwfck_del'] : 0;
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ;
|
||||
if($Config['osWindows']) {
|
||||
$sServerDir = normalizeWIN($sServerDir);
|
||||
}
|
||||
|
||||
mkdir_rek($sServerDir);
|
||||
// Arrays that will hold the folders and files names.
|
||||
$aFolders = array() ;
|
||||
$aFiles = array() ;
|
||||
|
||||
$sFile = '__AAAAAAAA__.AAA';
|
||||
$temp_folder = $currentFolder;
|
||||
$temp_folder = dwiki_encodeFN(trim($temp_folder,'/'));
|
||||
has_permission($temp_folder, $resourceType);
|
||||
if($isInternalLink && $_FolderClass < 16) {
|
||||
$sfclass = 'r';
|
||||
}
|
||||
else {
|
||||
if($acl_del) {
|
||||
$sfclass = $_FolderClass >= 16 ? 'u' : 'r';
|
||||
}
|
||||
else $sfclass = ($_FolderClass >= 8 || has_open_access()) ? 'u' : 'r';
|
||||
can_delete($sfclass);
|
||||
}
|
||||
if(!$_FolderClass) return;
|
||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) .
|
||||
'" class="'. $sfclass .'" />' ;
|
||||
|
||||
$sErrorNumber=0;
|
||||
|
||||
|
||||
$sFolderPath = GetResourceTypeDirectory( $resourceType, 'GetFoldersAndFiles');
|
||||
|
||||
$absolute_path = $Config['UserFilesAbsolutePath'];
|
||||
|
||||
|
||||
|
||||
|
||||
$oCurrentFolder = @opendir( $sServerDir ) ;
|
||||
|
||||
if ($oCurrentFolder !== false)
|
||||
{
|
||||
while ( $sFile = readdir( $oCurrentFolder ) )
|
||||
{
|
||||
|
||||
if ( $sFile != '.' && $sFile != '..' )
|
||||
{
|
||||
if ( is_dir( $sServerDir . $sFile ) ) {
|
||||
|
||||
if(has_permission(dwiki_encodeFN($currentFolder) .$sFile, $resourceType) || has_open_access()) {
|
||||
if($isInternalLink && $_FolderClass < 255) {
|
||||
$class = 'r';
|
||||
}
|
||||
else {
|
||||
$class = ($_FolderClass < 8) ? 'r' : 'u';
|
||||
can_delete($class);
|
||||
}
|
||||
if($_FolderClass){
|
||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) .
|
||||
'" class="'. $class .'" />' ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$iFileSize = @filesize( $sServerDir . $sFile ) ;
|
||||
$cTime= filectime( $sServerDir . $sFile );
|
||||
if ( !$iFileSize ) {
|
||||
$iFileSize = 0 ;
|
||||
}
|
||||
if ( $iFileSize > 0 )
|
||||
{
|
||||
$iFileSize = round( $iFileSize / 1024 ) ;
|
||||
if ( $iFileSize < 1 )
|
||||
$iFileSize = 1 ;
|
||||
}
|
||||
if($isInternalLink) {
|
||||
if(has_permission(dwiki_encodeFN($currentFolder) .DOKU_INC, $resourceType, false)) {
|
||||
$title =ckg_get_title($sFile,$currentFolder);
|
||||
// $aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" time="' . $cTime .'" />' ;
|
||||
$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" time="' . $cTime .'" title = "'.$title.'"/>' ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($resourceType == 'Image') {
|
||||
list($width, $height, $type, $attr) = getimagesize($sServerDir . $sFile);
|
||||
if(isset($width) && isset($height)) {
|
||||
$iFileSize .= ";;$width;;$height";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// $aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
|
||||
$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" time="' . $cTime .'" />' ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
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 )
|
||||
{
|
||||
global $_FolderClass;
|
||||
global $Config;
|
||||
if (!isset($_GET)) {
|
||||
global $_GET;
|
||||
}
|
||||
$sErrorNumber = '0' ;
|
||||
$sErrorMsg = '' ;
|
||||
if(!has_permission($currentFolder, $resourceType) || $_FolderClass < 8 ) {
|
||||
if(!has_open_access()) {
|
||||
$sErrorNumber = 103;
|
||||
echo '<Error number="' . $sErrorNumber . '" />' ;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$sNewFolderName = input_strval('NewFolderName');
|
||||
if(isset($sNewFolderName))
|
||||
{
|
||||
$sess_id = session_id();
|
||||
if(!isset($sess_id) || $sess_id != $_COOKIE['FCK_NmSp_acl']) {
|
||||
session_id($_COOKIE['FCK_NmSp_acl']);
|
||||
session_start();
|
||||
}
|
||||
|
||||
global $Dwfck_conf_values;
|
||||
global $dwfck_conf;
|
||||
$dwfck_conf = $_SESSION['dwfck_conf'];
|
||||
if(empty($dwfck_conf)) {
|
||||
$dwfck_conf['deaccent'] = isset($Dwfck_conf_values['deaccent'])? $Dwfck_conf_values['deaccent'] : 1;
|
||||
$dwfck_conf['useslash'] = isset($Dwfck_conf_values['useslash']) ? $Dwfck_conf_values['useslash'] : 0;
|
||||
$dwfck_conf['sepchar'] = isset($Dwfck_conf_values['sepchar']) ? $Dwfck_conf_values['sepchar'] : '_';
|
||||
}
|
||||
|
||||
$sNewFolderName = input_strval('NewFolderName');
|
||||
$sNewFolderName = str_replace(' ', $dwfck_conf['sepchar'], $sNewFolderName);
|
||||
$sNewFolderName=Dwfck_sanitize( $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($Dwfck_conf_values['fnencode'] == 'url' || ($Config['osWindows'] && !isset($Dwfck_conf_values['fnencode']))) {
|
||||
$sServerDir=encode_dir($sServerDir);
|
||||
}
|
||||
if($Config['osWindows']) {
|
||||
$sServerDir = normalizeWIN($sServerDir);
|
||||
}
|
||||
|
||||
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 . '" />' ;
|
||||
}
|
||||
|
||||
function Dwfck_sanitize($sFileName, $media=false) {
|
||||
global $Dwfck_conf_values;
|
||||
|
||||
$sFileName = dwiki_decodeFN($sFileName);
|
||||
$sFileName = cleanID($sFileName,false,$media);
|
||||
return dwiki_encodeFN($sFileName);
|
||||
}
|
||||
|
||||
|
||||
function normalizeWIN($path) {
|
||||
if(!$path) return "";
|
||||
global $winChars, $winSearch;
|
||||
if(!isset($winSearch)) {
|
||||
$winChars = array('/',':','(',')','{','}','{','}',' ', '\\',
|
||||
']','[', '$', '+', '@', '!', '#', '%', '*', '?');
|
||||
$winSearch = array_map('rawurlencode', $winChars);
|
||||
}
|
||||
|
||||
$path = str_replace($winSearch,$winChars,$path);
|
||||
$path = str_replace('/','\\',$path);
|
||||
// $path = preg_replace('#\\\\{2,}#','\\',$path);
|
||||
$path = str_replace('.\\','\\',$path);
|
||||
|
||||
return str_replace('+',' ', $path);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function UnlinkFile($resourceType, $currentFolder, $sCommand, $filename ) {
|
||||
global $Config;
|
||||
global $Dwfck_conf_values;
|
||||
$move = false;
|
||||
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ;
|
||||
$path = $sServerDir.$filename;
|
||||
$parts=pathinfo($path);
|
||||
|
||||
if(preg_match('/^(.*?)\/(.*?)$/',$filename,$matches)) {
|
||||
$move = true;
|
||||
$sMoveDir = $sServerDir;
|
||||
$sMoveDir .= dwiki_encodeFN($matches[1]);
|
||||
|
||||
$sMoveDir = rtrim($sMoveDir, '/');
|
||||
$filename = $matches[2];
|
||||
mkdir_rek($sMoveDir);
|
||||
|
||||
|
||||
if(preg_match('/secure$/', $sMoveDir)){
|
||||
if(!file_exists($sMoveDir . '/' . '.htaccess')) {
|
||||
copy( 'htaccess' , $sMoveDir . '/' . '.htaccess') ;
|
||||
}
|
||||
}
|
||||
$moveFile = $sMoveDir . '/' . dwiki_encodeFN($filename );
|
||||
|
||||
}
|
||||
else {
|
||||
if($Dwfck_conf_values['fnencode'] == 'url' || ($Config['osWindows'] && !isset($Dwfck_conf_values['fnencode']))) {
|
||||
$sServerDir=encode_dir($sServerDir);
|
||||
}
|
||||
}
|
||||
|
||||
$unlinkFile = $sServerDir . dwiki_encodeFN($filename );
|
||||
|
||||
if($Config['osWindows']) {
|
||||
$unlinkFile = normalizeWIN($unlinkFile);
|
||||
}
|
||||
|
||||
if($move) {
|
||||
if($Config['osWindows']) {
|
||||
$moveFile = normalizeWIN($moveFile);
|
||||
}
|
||||
|
||||
if(rename($unlinkFile, $moveFile)) {
|
||||
return GetFoldersAndFiles( $resourceType, $currentFolder );
|
||||
}
|
||||
else {
|
||||
$sErrorNumber = '205';
|
||||
echo '<Error number="' . $sErrorNumber . '" />' ;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return GetFoldersAndFiles( $resourceType, $currentFolder );
|
||||
if(file_exists($unlinkFile)&& unlink($unlinkFile)) {
|
||||
return GetFoldersAndFiles( $resourceType, $currentFolder );
|
||||
}
|
||||
else {
|
||||
$sErrorNumber = '204';
|
||||
echo '<Error number="' . $sErrorNumber . '" />' ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function encode_dir($path) {
|
||||
|
||||
if(preg_match('/%25/',$path)) {
|
||||
$path = urldecode($path);
|
||||
while(preg_match('/%25/',$path)) {
|
||||
$path = urldecode($path);
|
||||
}
|
||||
|
||||
return $path;
|
||||
|
||||
}
|
||||
|
||||
if(preg_match('/%[A-F]\d/i',$path) || preg_match('/%\d[A-F]/i',$path)) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
||||
$dirs = explode('/',$path);
|
||||
|
||||
$new_path = "";
|
||||
foreach($dirs as $dir) {
|
||||
$new_path .= dwiki_encodeFN($dir). '/';
|
||||
}
|
||||
|
||||
$new_path = rtrim($new_path,'/');
|
||||
$new_path .= '/';
|
||||
|
||||
return $new_path;
|
||||
}
|
||||
|
||||
function FileUpload( $resourceType, $currentFolder, $sCommand )
|
||||
{
|
||||
global $dwfck_conf;
|
||||
|
||||
if (!isset($_FILES)) {
|
||||
global $_FILES;
|
||||
}
|
||||
$f_args = array(
|
||||
'name' => array('filter' => FILTER_SANITIZE_STRING|FILTER_SANITIZE_ENCODED,
|
||||
'flags' => FILTER_FLAG_STRIP_LOW, FILTER_FLAG_STRIP_HIGH),
|
||||
'type' => "",
|
||||
'tmp_name' => "",
|
||||
'error' => "",
|
||||
'size' => ""
|
||||
) ;
|
||||
$keys = array_keys($_FILES);
|
||||
$_FILES['NewFile']['name'] = cleanID(str_replace('&','_', $_FILES['NewFile']['name']));
|
||||
$file_data = filter_var_array($_FILES[$keys[0]], $f_args);
|
||||
// cmd_write_debug($_FILES);
|
||||
// cmd_write_debug($file_data);
|
||||
$sErrorNumber = '0' ;
|
||||
$sFileName = '' ;
|
||||
|
||||
$sess_id = session_id();
|
||||
if(!isset($sess_id) || $sess_id != $_COOKIE['FCK_NmSp_acl']) {
|
||||
session_id($_COOKIE['FCK_NmSp_acl']);
|
||||
session_start();
|
||||
}
|
||||
|
||||
global $Dwfck_conf_values;
|
||||
$dwfck_conf = $_SESSION['dwfck_conf'];
|
||||
if(empty($dwfck_conf)) {
|
||||
$dwfck_conf['deaccent'] = isset($Dwfck_conf_values['deaccent'])? $Dwfck_conf_values['deaccent'] : 1;
|
||||
$dwfck_conf['useslash'] = isset($Dwfck_conf_values['useslash']) ? $Dwfck_conf_values['useslash'] : 0;
|
||||
$dwfck_conf['sepchar'] = isset($Dwfck_conf_values['sepchar']) ? $Dwfck_conf_values['sepchar'] : '_';
|
||||
}
|
||||
|
||||
$auth = 0;
|
||||
if(isset($_REQUEST['TopLevel'])) {
|
||||
list($top_level,$auth) = explode(';;',$_REQUEST['TopLevel']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$safe = false;
|
||||
global $Dwfck_conf_values;
|
||||
if($Dwfck_conf_values['fnencode'] == 'safe') {
|
||||
if(preg_match('/%[a-z]+[0-9]/',$currentFolder) || preg_match('/%[0-9][a-z]/',$currentFolder)) {
|
||||
$safe = true;
|
||||
}
|
||||
}
|
||||
$ns_tmp = dwiki_decodeFN(trim($currentFolder, '/'));
|
||||
|
||||
$ns_tmp = str_replace('/', ':', $ns_tmp);
|
||||
$test = $ns_tmp . ':*' ;
|
||||
|
||||
if(!$safe) {
|
||||
$test = urldecode($test);
|
||||
|
||||
while(preg_match('/%25/',$test)){
|
||||
$test = urldecode($test);
|
||||
}
|
||||
$test = urldecode($test);
|
||||
}
|
||||
|
||||
$isadmin = isset($_SESSION['dwfck_conf']['isadmin']) ? $_SESSION['dwfck_conf']['isadmin'] : false;
|
||||
if(!$isadmin) {
|
||||
$AUTH = auth_aclcheck($test, $_SESSION['dwfck_client'] , $_SESSION['dwfck_grps'],1);
|
||||
|
||||
if($AUTH < 8) {
|
||||
$msg="";
|
||||
$sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ) ;
|
||||
$sFileUrl = CombinePaths( $sFileUrl, $file_data['name']);
|
||||
SendUploadResults( '203', $sFileUrl, $file_data['name'], $msg ) ;
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
if(!$safe) {
|
||||
$currentFolder = encode_dir($currentFolder);
|
||||
}
|
||||
if ( isset( $file_data ) && !is_null( $file_data['tmp_name'] ) )
|
||||
{
|
||||
global $Config ;
|
||||
|
||||
$upload_err = $file_data['error'];
|
||||
if($upload_err ) {
|
||||
send_ckg_UploadError($upload_err,$sFileUrl, $file_data['name']);
|
||||
exit;
|
||||
}
|
||||
$oFile = $file_data ;
|
||||
|
||||
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ;
|
||||
|
||||
// Get the uploaded file name.
|
||||
$sFileName = dwiki_encodeFN($oFile['name']) ;
|
||||
$sOriginalFileName = dwiki_encodeFN($sFileName);
|
||||
|
||||
// Get the extension.
|
||||
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
|
||||
$sExtension = strtolower( $sExtension ) ;
|
||||
$image_file = false;
|
||||
|
||||
if(in_array($sExtension,$Config['AllowedExtensions']['Image'])) {
|
||||
$image_file=true;
|
||||
}
|
||||
|
||||
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' ;
|
||||
}
|
||||
}
|
||||
|
||||
$sFileName = Dwfck_sanitize($sFileName, $image_file);
|
||||
|
||||
// Check if it is an allowed extension.
|
||||
if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) )
|
||||
{
|
||||
$iCounter = 0 ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
|
||||
//$sFileName = strtolower($sFileName);
|
||||
|
||||
if(!is_dir($sServerDir))
|
||||
{
|
||||
if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] )
|
||||
{
|
||||
mkdir_rek($sServerDir,$permissions);
|
||||
}
|
||||
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_rek($sServerDir,$permissions);
|
||||
umask( $oldumask ) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$sFilePath = $sServerDir . $sFileName ;
|
||||
|
||||
|
||||
if ( is_file( $sFilePath ) )
|
||||
{
|
||||
$iCounter++ ;
|
||||
|
||||
if($Dwfck_conf_values['fnencode'] == 'safe') {
|
||||
$sFileName = RemoveExtension(dwiki_decodeFN($sOriginalFileName)) . '_' . $iCounter . ".$sExtension" ;
|
||||
}
|
||||
else $sFileName = RemoveExtension($sOriginalFileName) . '_' . $iCounter . ".$sExtension" ;
|
||||
$sFileName = Dwfck_sanitize($sFileName, $image_file);
|
||||
$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 ) ;
|
||||
|
||||
SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ;
|
||||
|
||||
exit ;
|
||||
}
|
||||
|
||||
function mkdir_rek($dir, $mode = 0777)
|
||||
{
|
||||
global $Config;
|
||||
if($Config['osWindows']) $dir=normalizeWIN($dir);
|
||||
if (!is_dir($dir)) {
|
||||
mkdir_rek(dirname($dir), $mode);
|
||||
mkdir($dir, $mode);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function send_ckg_UploadError($err,$sFileUrl, $file) {
|
||||
switch($err) {
|
||||
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
$msg = "The uploaded file exceeds the upload_max_filesize directive in php.ini.";
|
||||
break;
|
||||
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
$msg = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
|
||||
break;
|
||||
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
$msg = "The uploaded file was only partially uploaded.";
|
||||
break;
|
||||
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
$msg = "No file was uploaded.";
|
||||
break;
|
||||
|
||||
case 6: // UPLOAD_ERR_NO_TMP_DIR Introduced in PHP 4.3.10 and PHP 5.0.3.
|
||||
$msg = "Missing a temporary folder.";
|
||||
break;
|
||||
|
||||
case 7: //UPLOAD_ERR_CANT_WRITE Introduced in PHP 5.1.0.
|
||||
$msg="Failed to write file to disk.";
|
||||
break;
|
||||
|
||||
case 8: //UPLOAD_ERR_EXTENSION Introduced in PHP 5.2.0.
|
||||
$msg="PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.";
|
||||
break;
|
||||
|
||||
default:
|
||||
$msg = "Undetermined upload error";
|
||||
break;
|
||||
}
|
||||
$upload_error = 300 + $err;
|
||||
SendUploadResults( $upload_error, $sFileUrl, $file, $msg ) ;
|
||||
|
||||
}
|
||||
|
||||
function can_delete(&$class) {
|
||||
global $_FolderClass;
|
||||
if($_FolderClass >=16) $class = 'd';
|
||||
}
|
||||
|
||||
function cmd_write_debug($what) {
|
||||
return;
|
||||
if(is_array($what)) {
|
||||
$what = print_r($what,true);
|
||||
}
|
||||
$dwfckFHandle = fopen("fbrowser_dbg.txt", "a");
|
||||
fwrite($dwfckFHandle, "$what\n");
|
||||
fclose($dwfckFHandle);
|
||||
}
|
||||
?>
|
@@ -0,0 +1,499 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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.
|
||||
*/
|
||||
|
||||
require_once 'check_acl.php';
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../../../../../').'/');
|
||||
|
||||
|
||||
global $Config ;
|
||||
global $AUTH;
|
||||
global $dwfck_client;
|
||||
global $topLevelFolder;
|
||||
global $sep;
|
||||
global $useNixStyle;
|
||||
global $Dwfck_conf_values;
|
||||
$Dwfck_conf_values = doku_config_values();
|
||||
|
||||
$DWFCK_con_dbg = false;
|
||||
// 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 ;
|
||||
|
||||
if(isset($_REQUEST ) && isset($_REQUEST['DWFCK_Client'])) {
|
||||
$dwfck_client = $_REQUEST['DWFCK_Client'];
|
||||
if(!$dwfck_client) $AUTH_INI = 255;
|
||||
}
|
||||
else $AUTH_INI = 255;
|
||||
|
||||
|
||||
$Config['osDarwin'] = DWFCK_is_OS('DARWIN') ? true : false;
|
||||
|
||||
$animal = 'userfiles';
|
||||
if(isset( $_COOKIE['FCK_animal'] )) {
|
||||
$animal = $_COOKIE['FCK_animal'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
For filebrowser installation documents relating to this file, see the following:
|
||||
http://www.mturner.org/fckgLite/doku.php?id=file_browser_install
|
||||
http://www.mturner.org/fckgLite/doku.php?id=docs:auto_install
|
||||
http://www.mturner.org/fckgLite/doku.php?id=media#security_and_the_media_directory
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$isWindows = DWFCK_isWinOS();
|
||||
$Config['osWindows'] = $isWindows;
|
||||
$useWinStyle = false;
|
||||
$useNixStyle = false;
|
||||
$sep = $isWindows ? '\\' : '/';
|
||||
$dwfck_local = false;
|
||||
$useNixStyle=false;
|
||||
if(isset($Dwfck_conf_values['plugin']['ckgedit']['nix_style'])) {
|
||||
$useNixStyle = $Dwfck_conf_values['plugin']['ckgedit']['nix_style'];
|
||||
}
|
||||
if(isset($_REQUEST['DWFCK_Browser']) && $_REQUEST['DWFCK_Browser'] == 'local') {
|
||||
$useWinStyle = true;
|
||||
$dwfck_local = true;
|
||||
$useNixStyle = false;
|
||||
}
|
||||
|
||||
$Config['isWinStyle'] = $useWinStyle;
|
||||
|
||||
if(!isset($Config['UserFilesAbsolutePath']) || !isset($Config['UserFilesPath'])) {
|
||||
if(isset($_COOKIE['FCKConnector']) && $_COOKIE['FCKConnector'] == 'WIN') {
|
||||
$useWinStyle = true;
|
||||
}
|
||||
|
||||
if($isWindows || $useWinStyle) {
|
||||
setupBasePathsWin();
|
||||
if($dwfck_local) {
|
||||
$savedir = $Dwfck_conf_values['savedir'];
|
||||
if(trim($savedir,'./') != 'data') {
|
||||
$Config['UserFilesPath'] = $savedir .'/pages/';
|
||||
$Config['UserFilesAbsolutePath'] = $Config['UserFilesPath'];
|
||||
}
|
||||
else $Config['UserFilesPath'] = str_replace('/media', '/pages', $Config['UserFilesPath']);
|
||||
|
||||
if($isWindows) {
|
||||
if(isset($Dwfck_conf_values['ckg_savedir'])) {
|
||||
$Config['UserFilesAbsolutePath'] = realpath(DOKU_INC . $Dwfck_conf_values['ckg_savedir'] . '/pages/');
|
||||
$Config['UserFilesPath']=$Dwfck_conf_values['ckg_savedir'] . '/pages/';
|
||||
// config_write_debug($Config['UserFilesAbsolutePath']);
|
||||
}
|
||||
else $Config['UserFilesAbsolutePath'] = str_replace('\\media', '\\pages', $Config['UserFilesAbsolutePath']);
|
||||
}
|
||||
else {
|
||||
if($Dwfck_conf_values['ckg_savedir']) {
|
||||
$Config['UserFilesAbsolutePath'] = $Dwfck_conf_values['ckg_savedir'] . '/pages/';
|
||||
}
|
||||
else $Config['UserFilesAbsolutePath'] = str_replace('/media', '/pages/', $Config['UserFilesAbsolutePath']);
|
||||
$Config['UserFilesAbsolutePath'] = rtrim($Config['UserFilesAbsolutePath'],'/') . '/';
|
||||
|
||||
if(isset($_COOKIE['FCK_farmlocal'])) {
|
||||
$Config['UserFilesAbsolutePath'] = $_COOKIE['FCK_farmlocal'] . '/';
|
||||
if(preg_match('#(\/\w+\/' . $animal . ')#',$path,$matches)) {
|
||||
$Config['UserFilesPath'] = $matches[1] . '/data/pages/';
|
||||
}
|
||||
else $Config['UserFilesPath'] = '../' . $animal . '/data/pages/';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if($DWFCK_con_dbg && $isWindows) {
|
||||
DWFCK_cfg_dbg('win_paths.txt');
|
||||
}
|
||||
else {
|
||||
if($DWFCK_con_dbg) DWFCK_cfg_dbg('nix_local_paths-' . getAccessNum () . '.txt');
|
||||
}
|
||||
}
|
||||
else {
|
||||
setupBasePathsNix();
|
||||
if($DWFCK_con_dbg) DWFCK_cfg_dbg('nix_paths-' . getAccessNum () . '.txt');
|
||||
}
|
||||
}
|
||||
else { //if both UserFilesPath and UserFilesAbsolutePath are set
|
||||
if($isWindows || $useWinStyle) {
|
||||
if($dwfck_local) {
|
||||
$Config['UserFilesPath'] = str_replace('/media', '/pages', $Config['UserFilesPath']);
|
||||
if($isWindows) {
|
||||
$Config['UserFilesAbsolutePath'] = str_replace('\\media', '\\pages', $Config['UserFilesAbsolutePath']);
|
||||
}
|
||||
else {
|
||||
$Config['UserFilesAbsolutePath'] = str_replace('/media', '/pages', $Config['UserFilesAbsolutePath']);
|
||||
}
|
||||
}
|
||||
if($DWFCK_con_dbg) DWFCK_cfg_dbg('win_paths.txt');
|
||||
}
|
||||
}
|
||||
|
||||
setUpMediaPaths();
|
||||
|
||||
// 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', 'GetDwfckNs', 'UnlinkFile') ;
|
||||
|
||||
// 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.
|
||||
if(isset($Dwfck_conf_values)) {
|
||||
$Config['ChmodOnUpload'] = $Dwfck_conf_values['fmode'] ;
|
||||
$Config['ChmodOnFolderCreate'] = $Dwfck_conf_values['dmode'] ;
|
||||
}
|
||||
else {
|
||||
$Config['ChmodOnUpload'] = 0755 ;
|
||||
$Config['ChmodOnFolderCreate'] = 0755 ;
|
||||
}
|
||||
|
||||
// See comments above.
|
||||
// Used when creating folders that does not exist.
|
||||
|
||||
|
||||
|
||||
function setupBasePathsNix() {
|
||||
global $Config,$animal;
|
||||
$dir = dirname(__FILE__) ;
|
||||
|
||||
$dir = preg_replace('/editor\/filemanager\/connectors\/.*/', "$animal/",$dir);
|
||||
$Config['UserFilesAbsolutePath'] = $dir;
|
||||
$document_root = $_SERVER['DOCUMENT_ROOT'];
|
||||
$relative_dir = str_replace($document_root, "", $dir);
|
||||
$Config['UserFilesPath'] = $relative_dir;
|
||||
}
|
||||
|
||||
function setupBasePathsWin() {
|
||||
global $Config, $Dwfck_conf_values;
|
||||
global $isWindows;
|
||||
global $useNixStyle;
|
||||
global $animal;
|
||||
|
||||
$data_media = $isWindows ? 'data\\media\\' : 'data/media/';
|
||||
if($useNixStyle) {
|
||||
$regex = $isWindows ? '\editor\filemanager\connectors' : 'lib/plugins/ckgedit/fckeditor/editor/filemanager/connectors';
|
||||
$data_media = '\\userfiles\\';
|
||||
}
|
||||
else {
|
||||
$regex = $isWindows ? 'lib\plugins\ckgedit\fckeditor\editor\filemanager\connectors' : 'lib/plugins/ckgedit/fckeditor/editor/filemanager/connectors';
|
||||
}
|
||||
$dir = dirname(__FILE__) ;
|
||||
|
||||
$regex = preg_quote($regex, '/');
|
||||
|
||||
$dir = preg_replace('/'. $regex .'.*/', $data_media, $dir);
|
||||
|
||||
$Config['UserFilesAbsolutePath'] = $dir;
|
||||
|
||||
$base_url = getBaseURL_fck();
|
||||
if($useNixStyle) {
|
||||
$Config['UserFilesPath'] = $base_url . 'lib/plugins/ckgedit/fckeditor/' . $animal .'/';
|
||||
}
|
||||
else $Config['UserFilesPath'] = $base_url . 'data/media/';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* find hierarchically highest level parent namespace which allows acl CREATE
|
||||
*/
|
||||
function get_start_dir() {
|
||||
global $Config ;
|
||||
global $AUTH;
|
||||
global $AUTH_INI;
|
||||
global $sep;
|
||||
global $dwfck_client;
|
||||
if(!$dwfck_client || $AUTH_INI == 255) return "";
|
||||
|
||||
if(isset($_REQUEST['DWFCK_usergrps'])) {
|
||||
$usergrps = get_conf_array($_REQUEST['DWFCK_usergrps']);
|
||||
}
|
||||
else $usergrps = array();
|
||||
|
||||
$elems = explode(':', $_COOKIE['FCK_NmSp']);
|
||||
array_pop($elems);
|
||||
$ns = "";
|
||||
$prev_auth = -1;
|
||||
while(count($elems) > 0) {
|
||||
$ns_tmp = implode(':',$elems);
|
||||
$test = $ns_tmp . ':*';
|
||||
$AUTH = auth_aclcheck($test,$dwfck_client,$usergrps);
|
||||
if($AUTH < 4) {
|
||||
if(!$ns) {
|
||||
$ns = $ns_tmp;
|
||||
break;
|
||||
}
|
||||
$AUTH = $prev_auth;
|
||||
break;
|
||||
}
|
||||
$prev_auth = $AUTH;
|
||||
$ns = $ns_tmp;
|
||||
array_pop($elems);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($ns) {
|
||||
if(strpos($ns, ':')) {
|
||||
return str_replace(':', '/', $ns);
|
||||
}
|
||||
$AUTH = auth_aclcheck(':*', $dwfck_client,$usergrps);
|
||||
|
||||
if($AUTH >= 8) return "";
|
||||
return $ns;
|
||||
}
|
||||
$AUTH = auth_aclcheck(':*', $dwfck_client,$usergrps);
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
function setUpMediaPaths() {
|
||||
|
||||
global $Config;
|
||||
global $isWindows;
|
||||
global $useWinStyle;
|
||||
global $AUTH;
|
||||
global $dwfck_client;
|
||||
global $useNixStyle;
|
||||
|
||||
if($useNixStyle) {
|
||||
$useWinStyle=false;
|
||||
$isWindows = false;
|
||||
}
|
||||
$ALLOWED_MIMES = DOKU_INC . 'conf/mime.conf';
|
||||
if(!file_exists($ALLOWED_MIMES)) {
|
||||
$ALLOWED_MIMES = DOKU_CONF . '/mime.conf';
|
||||
$MIMES_LOCAL = DOKU_CONF . '/mime.local.conf';
|
||||
}
|
||||
$out=@file($ALLOWED_MIMES,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
|
||||
if(file_exists(DOKU_INC . 'conf/mime.local.conf'))
|
||||
{
|
||||
$out_local = @file(DOKU_INC . 'conf/mime.local.conf',FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$out = array_merge($out,$out_local);
|
||||
}
|
||||
elseif(isset($MIMES_LOCAL) && file_exists($MIMES_LOCAL)) {
|
||||
$out_local = @file($MIMES_LOCAL,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$out = array_merge($out,$out_local);
|
||||
}
|
||||
$extensions = array();
|
||||
$image_extensions = array();
|
||||
foreach($out as $line) {
|
||||
if(strpos($line,'#') === false) {
|
||||
list($ext,$mtype) = preg_split('/\s+/', $line);
|
||||
$extensions[] = $ext;
|
||||
if(strpos($mtype,'image')!==false) {
|
||||
$image_extensions[] = $ext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if !$dwfck_client then the file browser is not restricted to the client's permissions
|
||||
if(!$dwfck_client) {
|
||||
$unrestricted_browser = true;
|
||||
}
|
||||
else $unrestricted_browser = false;
|
||||
|
||||
if(isset($_REQUEST['DWFCK_usergrps'])) {
|
||||
$usergrps = get_conf_array($_REQUEST['DWFCK_usergrps']);
|
||||
}
|
||||
else $usergrps = array();
|
||||
|
||||
|
||||
$Config['AllowedExtensions']['File'] = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv',
|
||||
'doc', 'docx','fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg',
|
||||
'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt',
|
||||
'pdf', 'png', 'ppt', 'psd', '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') ;
|
||||
|
||||
if(count($extensions) ) {
|
||||
$Config['AllowedExtensions']['File'] = array_merge($Config['AllowedExtensions']['File'],$extensions);
|
||||
}
|
||||
$Config['DeniedExtensions']['File'] = array() ;
|
||||
$Config['AllowedExtensions']['Image'] = array_merge(array('bmp','gif','jpeg','jpg','png'),$image_extensions) ;
|
||||
$Config['DeniedExtensions']['Image'] = array() ;
|
||||
$Config['AllowedExtensions']['Flash'] = array('swf','flv') ;
|
||||
$Config['DeniedExtensions']['Flash'] = array() ;
|
||||
$Config['AllowedExtensions']['Media'] = array_merge(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') ,$image_extensions);
|
||||
$Config['DeniedExtensions']['Media'] = array() ;
|
||||
|
||||
$DWFCK_MediaTypes = array('File','Image', 'Flash','Media');
|
||||
$DWFCK_use_acl = true;
|
||||
if($unrestricted_browser) $DWFCK_use_acl = false;
|
||||
$current__Folder = "";
|
||||
if($DWFCK_use_acl && isset($_COOKIE['FCK_NmSp'])) {
|
||||
if(strpos($_COOKIE['FCK_NmSp'], ':')) {
|
||||
$current__Folder=get_start_dir();
|
||||
}
|
||||
}
|
||||
|
||||
$sess_id = session_id();
|
||||
if(!isset($sess_id) || $sess_id != $_COOKIE['FCK_NmSp_acl']) {
|
||||
session_id($_COOKIE['FCK_NmSp_acl']);
|
||||
session_start();
|
||||
}
|
||||
//file_put_contents('session.txt',print_r($_SESSION,true));
|
||||
if($_SESSION['dwfck_openfb'] == 'y') {
|
||||
$current__Folder = "";
|
||||
}
|
||||
|
||||
$topLevelFolder=$current__Folder ? $current__Folder : '/';
|
||||
if($current__Folder) $current__Folder .= '/';
|
||||
if($unrestricted_browser) $AUTH = 255;
|
||||
setcookie("TopLevel", "$topLevelFolder;;$AUTH", time()+3600, '/');
|
||||
foreach($DWFCK_MediaTypes as $type) {
|
||||
|
||||
$abs_type_dir = strtolower($type) . '/';
|
||||
if($isWindows || $useWinStyle) {
|
||||
$abs_type_dir = "";
|
||||
}
|
||||
else {
|
||||
$abs_type_dir = strtolower($type) . '/';
|
||||
}
|
||||
$Config['FileTypesPath'][$type] = $Config['UserFilesPath'] . $abs_type_dir; // $dir_type;
|
||||
$Config['FileTypesAbsolutePath'][$type] = $Config['UserFilesAbsolutePath'] . $abs_type_dir; // $abs_type_dir ;
|
||||
$Config['QuickUploadPath'][$type] = $Config['UserFilesPath'] . $abs_type_dir; // $dir_type ;
|
||||
$Config['QuickUploadAbsolutePath'][$type]= $Config['UserFilesAbsolutePath'] . $abs_type_dir;
|
||||
|
||||
$Config['FileTypesPath'][$type] = $Config['UserFilesPath'] . $abs_type_dir; //$dir_type;
|
||||
$Config['FileTypesAbsolutePath'][$type] = $Config['UserFilesAbsolutePath'] . $abs_type_dir ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getBaseURL_fck(){
|
||||
|
||||
if(substr($_SERVER['SCRIPT_NAME'],-4) == '.php'){
|
||||
$dir = dirname($_SERVER['SCRIPT_NAME']);
|
||||
}elseif(substr($_SERVER['PHP_SELF'],-4) == '.php'){
|
||||
$dir = dirname($_SERVER['PHP_SELF']);
|
||||
}elseif($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']){
|
||||
$dir = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','',
|
||||
$_SERVER['SCRIPT_FILENAME']);
|
||||
$dir = dirname('/'.$dir);
|
||||
}else{
|
||||
$dir = '.'; //probably wrong
|
||||
}
|
||||
|
||||
$dir = str_replace('\\','/',$dir); // bugfix for weird WIN behaviour
|
||||
$dir = preg_replace('#//+#','/',"/$dir/"); // ensure leading and trailing slashes
|
||||
|
||||
//handle script in lib/exe dir
|
||||
$dir = preg_replace('!lib/exe/$!','',$dir);
|
||||
|
||||
//handle script in lib/plugins dir
|
||||
$dir = preg_replace('!lib/plugins/.*$!','',$dir);
|
||||
|
||||
//finish here for relative URLs
|
||||
return $dir;
|
||||
}
|
||||
|
||||
function DWFCK_isWinOS() {
|
||||
global $Config;
|
||||
if(isset($_SERVER['WINDIR']) && $_SERVER['WINDIR']) {
|
||||
return true;
|
||||
}
|
||||
elseif(stristr(PHP_OS, 'WIN') && !DWFCK_is_OS('DARWIN')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function DWFCK_is_OS($os) {
|
||||
$os = strtolower($os);
|
||||
$_OS = strtolower(PHP_OS);
|
||||
|
||||
if($os == $_OS || stristr(PHP_OS, $os) || stristr($os,PHP_OS) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function doku_config_values() {
|
||||
$dwphp = DOKU_INC . 'conf/dokuwiki.php';
|
||||
if(!file_exists($dwphp)) {
|
||||
$dwphp = DOKU_CONF . 'dokuwiki.php';
|
||||
$localphp = DOKU_CONF . 'local.php';
|
||||
}
|
||||
else $localphp = DOKU_INC . 'conf/local.php';
|
||||
|
||||
if(file_exists($dwphp))
|
||||
{
|
||||
include($dwphp);
|
||||
if(file_exists($localphp))
|
||||
{
|
||||
include($localphp);
|
||||
}
|
||||
if(trim($conf['savedir'],'/.\/') != 'data') {
|
||||
$conf['ckg_savedir']= $conf['savedir'];
|
||||
}
|
||||
|
||||
return $conf;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function DWFCK_cfg_dbg($fname) {
|
||||
global $Config;
|
||||
global $Dwfck_conf_values;
|
||||
$request = print_r($_REQUEST,true);
|
||||
$request .= "\n" . print_r($Dwfck_conf_values,true);
|
||||
file_put_contents($fname, $Config['UserFilesAbsolutePath'] . "\r\n" . $Config['UserFilesPath'] . "\r\n" .$request ."\r\n");
|
||||
}
|
||||
|
||||
function config_write_debug($what) {
|
||||
return;
|
||||
if(is_array($what)) {
|
||||
$what = print_r($what,true);
|
||||
}
|
||||
$dwfckFHandle = fopen("fbrowser_dbg.txt", "a");
|
||||
fwrite($dwfckFHandle, "$what\n");
|
||||
fclose($dwfckFHandle);
|
||||
}
|
||||
?>
|
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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.
|
||||
*/
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../../../../../').'/');
|
||||
|
||||
ob_start() ;
|
||||
function getAccessNum () {
|
||||
usleep(300);
|
||||
return microtime(true);
|
||||
|
||||
}
|
||||
require('./config.php') ;
|
||||
require('./util.php') ;
|
||||
require('./io.php') ;
|
||||
require('./basexml.php') ;
|
||||
require('./commands.php') ;
|
||||
require('./phpcompat.php') ;
|
||||
require_once('./SafeFN.class.php');
|
||||
require_once 'input_utils.php';
|
||||
|
||||
if ( !$Config['Enabled'] )
|
||||
SendError( 1, 'FileBrowserError_Connector') ;
|
||||
|
||||
|
||||
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 = urlencode($_GET['Command'] );
|
||||
$sResourceType = urlencode($_GET['Type']) ;
|
||||
$sCurrentFolder = GetCurrentFolder() ;
|
||||
|
||||
// Check if it is an allowed command
|
||||
if ( ! IsAllowedCommand( $sCommand ) )
|
||||
SendError( 1, 'FileBrowserError_Command' . ';;' . $sCommand ) ;
|
||||
|
||||
// Check if it is an allowed type.
|
||||
if ( !IsAllowedType( $sResourceType ) )
|
||||
SendError( 1, 'FileBrowserError_Type' . ';;' . $sResourceType) ;
|
||||
|
||||
|
||||
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
|
||||
if ( $sCommand == 'FileUpload' )
|
||||
{
|
||||
FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( $sCommand == 'GetDwfckNs' )
|
||||
{
|
||||
GetDwfckNs();
|
||||
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 ;
|
||||
case 'UnlinkFile' :
|
||||
UnlinkFile($sResourceType, $sCurrentFolder, $sCommand, input_strval('file'));
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
CreateXmlFooter() ;
|
||||
|
||||
exit ;
|
||||
}
|
||||
|
||||
function fck_write_debug($what) {
|
||||
if(is_array($what)) {
|
||||
$what = print_r($what,true);
|
||||
}
|
||||
$dwfckFHandle = fopen("fckbrowser_dbg.txt", "a");
|
||||
fwrite($dwfckFHandle, "$what\n");
|
||||
fclose($dwfckFHandle);
|
||||
}
|
||||
|
||||
?>
|
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
global $dwfck_sessions_ini;
|
||||
|
||||
|
||||
$dwfck_sessions_ini = false;
|
||||
function dwfck_open($save_path, $session_name)
|
||||
{
|
||||
global $dwfck_sessions_ini;
|
||||
global $sess_save_path;
|
||||
$dwfck_sessions_ini = true;
|
||||
$sess_save_path = $save_path;
|
||||
return(true);
|
||||
}
|
||||
|
||||
function dwfck_close()
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
|
||||
function dwfck_read($id)
|
||||
{
|
||||
|
||||
global $sess_save_path;
|
||||
|
||||
$sess_file = "$sess_save_path/sess_$id";
|
||||
file_put_contents('session_read.txt', $sess_file);
|
||||
return (string) @file_get_contents($sess_file);
|
||||
}
|
||||
|
||||
function dwfck_write($id, $sess_data)
|
||||
{
|
||||
|
||||
global $sess_save_path;
|
||||
|
||||
$sess_file = "$sess_save_path/sess_$id";
|
||||
file_put_contents('session_write.txt', $sess_file);
|
||||
if ($fp = @fopen($sess_file, "w")) {
|
||||
$return = fwrite($fp, $sess_data);
|
||||
fclose($fp);
|
||||
return $return;
|
||||
} else {
|
||||
return(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function dwfck_destroy($id)
|
||||
{
|
||||
|
||||
global $sess_save_path;
|
||||
|
||||
$sess_file = "$sess_save_path/sess_$id";
|
||||
return(@unlink($sess_file));
|
||||
}
|
||||
|
||||
function dwfck_gc($maxlifetime)
|
||||
{
|
||||
global $sess_save_path;
|
||||
|
||||
foreach (glob("$sess_save_path/sess_*") as $filename) {
|
||||
if (filemtime($filename) + $maxlifetime < time()) {
|
||||
@unlink($filename);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function dwfck_unserialize() {
|
||||
|
||||
list($dw,$str) = explode('|',$sstr,2);
|
||||
$inf = unserialize($str);
|
||||
$ar = print_r($inf, true);
|
||||
file_put_contents('DW_session', "$ar $sstr");
|
||||
}
|
||||
|
||||
function dwfck_session_start() {
|
||||
global $dwfck_sessions_ini;
|
||||
if(isset($_REQUEST['FCK_NmSp_acl'])) {
|
||||
if(!$dwfck_sessions_ini) {
|
||||
session_set_save_handler("dwfck_open", "dwfck_close", "dwfck_read", "dwfck_write", "dwfck_destroy", "dwfck_gc");
|
||||
}
|
||||
session_id($_REQUEST['FCK_NmSp_acl']);
|
||||
}
|
||||
session_start();
|
||||
}
|
||||
?>
|
||||
|
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Connector to Dokuwiki Input class
|
||||
* sanitizes $_REQUEST variables
|
||||
* @author Myron Turner
|
||||
*/
|
||||
|
||||
# i(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../../../../../').'/');
|
||||
require_once('Input.class.php');
|
||||
global $INPUT;
|
||||
if(!isset($INPUT)) {
|
||||
$INPUT = new Input();
|
||||
}
|
||||
|
||||
function input_strval($which, $cmp="") {
|
||||
global $INPUT;
|
||||
|
||||
$val = $INPUT->str($which);
|
||||
if($cmp) return $cmp == $val;
|
||||
return $val;
|
||||
}
|
||||
|
||||
?>
|
@@ -0,0 +1,306 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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.
|
||||
*/
|
||||
require_once 'input_utils.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 ) ;
|
||||
$sParent = str_replace( '//', '/', $sParent ) ;
|
||||
}
|
||||
|
||||
// Check if the parent exists, or create it.
|
||||
if ( !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()
|
||||
{
|
||||
|
||||
$sCurrentFolder = input_strval('CurrentFolder');
|
||||
if(!$sCurrentFolder) $sCurrentFolder = '/';
|
||||
|
||||
// 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 ( $sCurrentFolder == '..' ) SendError( 102, '' ) ;
|
||||
if ( preg_match(",(/\.)|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $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 ;
|
||||
}
|
||||
|
||||
?>
|
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
if ( !defined( 'DIRECTORY_SEPARATOR' ) ) {
|
||||
define( 'DIRECTORY_SEPARATOR',
|
||||
strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/'
|
||||
) ;
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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') ;
|
||||
require_once('./SafeFN.class.php');
|
||||
require_once 'input_utils.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 = input_strval('Type');
|
||||
if(!$sType) $sType = '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' ) ;
|
||||
|
||||
|
||||
FileUpload( $sType, $sCurrentFolder, $sCommand );
|
||||
|
||||
?>
|
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../../../../../').'/');
|
||||
define ('CKG_META_DIR',DOKU_INC .'data/meta');
|
||||
|
||||
function ckg_get_title($page,$dir) {
|
||||
|
||||
$id = preg_replace('/.txt/','.meta',$page) ;
|
||||
|
||||
$meta_file = CKG_META_DIR . $dir . $id;
|
||||
if(file_exists($meta_file) && is_readable ($meta_file)){
|
||||
$inf_str = file_get_contents($meta_file);
|
||||
$inf = @unserialize($inf_str);
|
||||
if(isset($inf['current']['title']) && !empty($inf['current']['title'])) {
|
||||
return ($inf['current']['title']);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@@ -0,0 +1,286 @@
|
||||
<?php
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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 )
|
||||
{
|
||||
// util_debug($value);
|
||||
// util_debug( utf8_encode( htmlspecialchars( $value ) ));
|
||||
if ( defined( 'PHP_OS' ) )
|
||||
{
|
||||
$os = PHP_OS ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$os = php_uname() ;
|
||||
}
|
||||
|
||||
if ( strtoupper( substr( $os, 0, 3 ) ) === 'WIN' || FindBadUtf8( $value ) )
|
||||
{
|
||||
|
||||
// util_debug('FindBad' . htmlspecialchars($value));
|
||||
// util_debug('FindBad' . utf8_encode( htmlspecialchars( $value ) ));
|
||||
return ( utf8_encode( htmlspecialchars( $value ) ) ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// util_debug('speccial chars=' . htmlspecialchars($value));
|
||||
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 ) )
|
||||
{
|
||||
if($tag == '<title' && preg_match("/svg-edit/",$chunk)) continue;
|
||||
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;
|
||||
}
|
||||
|
||||
//$Config['isWinStyle']
|
||||
//$Config['osWindows']
|
||||
function folder_as_entities($path, $type="abs") {
|
||||
|
||||
global $Config;
|
||||
if($path == '/') return $path;
|
||||
|
||||
|
||||
$filetypes = "(file|image|flash|media)(?!\w)";
|
||||
if(!preg_match("#$filetypes#", $path, $matches)) {
|
||||
return $path;
|
||||
}
|
||||
$file_type = $matches[1];
|
||||
|
||||
if($Config['isWinStyle'] || $Config['osWindows']) {
|
||||
$pat = preg_quote(DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR) . '$';
|
||||
if(preg_match("#$pat#", $path)) {
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
$path = urldecode($path);
|
||||
|
||||
$path_type['abs'] = 'UserFilesAbsolutePath';
|
||||
$path_type['url'] = 'UserFilesPath';
|
||||
$len = strlen($Config[$path_type[$type]]);
|
||||
$rest = substr($path, $len);
|
||||
|
||||
$rest = preg_replace("#$filetypes#","",$rest);
|
||||
$rest = trim($rest,'\\/');
|
||||
$folders = preg_split("#[/\\\\]#", $rest);
|
||||
|
||||
for($i=0; $i < count($folders); $i++) {
|
||||
$folders[$i] = urlencode($folders[$i]);
|
||||
}
|
||||
|
||||
$path = implode('/', $folders) ;
|
||||
|
||||
if(isset($file_type) && $file_type != 'image') {
|
||||
if(preg_match('/(file|media|flash)/', $file_type)) {
|
||||
$return_path = $Config[$path_type[$type]] ."$file_type/$path" . '/';
|
||||
$fname = "other.txt";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$return_path = $Config[$path_type[$type]] .'image/' . $path . '/';
|
||||
$fname = "img.txt";
|
||||
}
|
||||
$return_path = rtrim($return_path, '\\,/') . DIRECTORY_SEPARATOR;
|
||||
// file_put_contents($fname,$return_path);
|
||||
return $return_path;
|
||||
}
|
||||
|
||||
function util_debug($data) {
|
||||
$handle = fopen('util.dbg', 'a');
|
||||
fwrite($handle, $data . "\n");
|
||||
fclose ($handle);
|
||||
}
|
||||
|
||||
?>
|
@@ -0,0 +1,210 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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>
|
@@ -0,0 +1,192 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 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>
|
20
lib/plugins/ckgedit/fckeditor/userfiles/.htaccess
Normal file
@@ -0,0 +1,20 @@
|
||||
#unix -- do not change or move
|
||||
<IfModule mod_authz_host>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_host>
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
</IfModule>
|
||||
|
||||
<FilesMatch "\.(gif|jpe?g|png)$">
|
||||
<IfModule mod_authz_host>
|
||||
Require all granted
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_host>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
|
||||
Options -Indexes
|
9
lib/plugins/ckgedit/fckeditor/userfiles/.htaccess.closed
Normal file
@@ -0,0 +1,9 @@
|
||||
<IfModule mod_authz_host>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_host>
|
||||
Order allow,deny
|
||||
deny from all
|
||||
</IfModule>
|
||||
|
||||
Options -Indexes
|