initial commit
This commit is contained in:
commit
252dac3143
1516 changed files with 694271 additions and 0 deletions
65
FCKeditor/editor/filemanager/connectors/lasso/config.lasso
Normal file
65
FCKeditor/editor/filemanager/connectors/lasso/config.lasso
Normal file
|
@ -0,0 +1,65 @@
|
|||
[//lasso
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Configuration file for the File Manager Connector for Lasso.
|
||||
*/
|
||||
|
||||
/*.....................................................................
|
||||
The connector uses the file tags, which require authentication. Enter a
|
||||
valid username and password from Lasso admin for a group with file tags
|
||||
permissions for uploads and the path you define in UserFilesPath below.
|
||||
*/
|
||||
|
||||
var('connection') = array(
|
||||
-username='xxxxxxxx',
|
||||
-password='xxxxxxxx'
|
||||
);
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Set the base path for files that users can upload and browse (relative
|
||||
to server root).
|
||||
|
||||
Set which file extensions are allowed and/or denied for each file type.
|
||||
*/
|
||||
var('config') = map(
|
||||
'Enabled' = false,
|
||||
'UserFilesPath' = '/userfiles/',
|
||||
'Subdirectories' = map(
|
||||
'File' = 'File/',
|
||||
'Image' = 'Image/',
|
||||
'Flash' = 'Flash/',
|
||||
'Media' = 'Media/'
|
||||
),
|
||||
'AllowedExtensions' = map(
|
||||
'File' = array('7z','aiff','asf','avi','bmp','csv','doc','fla','flv','gif','gz','gzip','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','ods','odt','pdf','png','ppt','pxd','qt','ram','rar','rm','rmi','rmvb','rtf','sdc','sitd','swf','sxc','sxw','tar','tgz','tif','tiff','txt','vsd','wav','wma','wmv','xls','xml','zip'),
|
||||
'Image' = array('bmp','gif','jpeg','jpg','png'),
|
||||
'Flash' = array('swf','flv'),
|
||||
'Media' = array('aiff','asf','avi','bmp','fla','flv','gif','jpeg','jpg','mid','mov','mp3','mp4','mpc','mpeg','mpg','png','qt','ram','rm','rmi','rmvb','swf','tif','tiff','wav','wma','wmv')
|
||||
),
|
||||
'DeniedExtensions' = map(
|
||||
'File' = array(),
|
||||
'Image' = array(),
|
||||
'Flash' = array(),
|
||||
'Media' = array()
|
||||
)
|
||||
);
|
||||
]
|
257
FCKeditor/editor/filemanager/connectors/lasso/connector.lasso
Normal file
257
FCKeditor/editor/filemanager/connectors/lasso/connector.lasso
Normal file
|
@ -0,0 +1,257 @@
|
|||
[//lasso
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the File Manager Connector for Lasso.
|
||||
*/
|
||||
|
||||
/*.....................................................................
|
||||
Include global configuration. See config.lasso for details.
|
||||
*/
|
||||
include('config.lasso');
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Translate current date/time to GMT for custom header.
|
||||
*/
|
||||
var('headerDate') = date_localtogmt(date)->format('%a, %d %b %Y %T GMT');
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Convert query string parameters to variables and initialize output.
|
||||
*/
|
||||
var(
|
||||
'Command' = action_param('Command'),
|
||||
'Type' = action_param('Type'),
|
||||
'CurrentFolder' = action_param('CurrentFolder'),
|
||||
'ServerPath' = action_param('ServerPath'),
|
||||
'NewFolderName' = action_param('NewFolderName'),
|
||||
'NewFile' = null,
|
||||
'NewFileName' = string,
|
||||
'OrigFilePath' = string,
|
||||
'NewFilePath' = string,
|
||||
'commandData' = string,
|
||||
'folders' = '\t<Folders>\n',
|
||||
'files' = '\t<Files>\n',
|
||||
'errorNumber' = integer,
|
||||
'responseType' = 'xml',
|
||||
'uploadResult' = '0'
|
||||
);
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Calculate the path to the current folder.
|
||||
*/
|
||||
$ServerPath == '' ? $ServerPath = $config->find('UserFilesPath');
|
||||
|
||||
var('currentFolderURL' = $ServerPath
|
||||
+ $config->find('Subdirectories')->find(action_param('Type'))
|
||||
+ action_param('CurrentFolder')
|
||||
);
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Build the appropriate response per the 'Command' parameter. Wrap the
|
||||
entire process in an inline for file tag permissions.
|
||||
*/
|
||||
inline($connection);
|
||||
select($Command);
|
||||
/*.............................................................
|
||||
List all subdirectories in the 'Current Folder' directory.
|
||||
*/
|
||||
case('GetFolders');
|
||||
$commandData += '\t<Folders>\n';
|
||||
|
||||
iterate(file_listdirectory($currentFolderURL), local('this'));
|
||||
#this->endswith('/') ? $commandData += '\t\t<Folder name="' + #this->removetrailing('/')& + '" />\n';
|
||||
/iterate;
|
||||
|
||||
$commandData += '\t</Folders>\n';
|
||||
|
||||
|
||||
/*.............................................................
|
||||
List both files and folders in the 'Current Folder' directory.
|
||||
Include the file sizes in kilobytes.
|
||||
*/
|
||||
case('GetFoldersAndFiles');
|
||||
iterate(file_listdirectory($currentFolderURL), local('this'));
|
||||
if(#this->endswith('/'));
|
||||
$folders += '\t\t<Folder name="' + #this->removetrailing('/')& + '" />\n';
|
||||
else;
|
||||
local('size') = file_getsize($currentFolderURL + #this) / 1024;
|
||||
$files += '\t\t<File name="' + #this + '" size="' + #size + '" />\n';
|
||||
/if;
|
||||
/iterate;
|
||||
|
||||
$folders += '\t</Folders>\n';
|
||||
$files += '\t</Files>\n';
|
||||
|
||||
$commandData += $folders + $files;
|
||||
|
||||
|
||||
/*.............................................................
|
||||
Create a directory 'NewFolderName' within the 'Current Folder.'
|
||||
*/
|
||||
case('CreateFolder');
|
||||
var('newFolder' = $currentFolderURL + $NewFolderName + '/');
|
||||
file_create($newFolder);
|
||||
|
||||
|
||||
/*.........................................................
|
||||
Map Lasso's file error codes to FCKEditor's error codes.
|
||||
*/
|
||||
select(file_currenterror( -errorcode));
|
||||
case(0);
|
||||
$errorNumber = 0;
|
||||
case( -9983);
|
||||
$errorNumber = 101;
|
||||
case( -9976);
|
||||
$errorNumber = 102;
|
||||
case( -9977);
|
||||
$errorNumber = 102;
|
||||
case( -9961);
|
||||
$errorNumber = 103;
|
||||
case;
|
||||
$errorNumber = 110;
|
||||
/select;
|
||||
|
||||
$commandData += '<Error number="' + $errorNumber + '" />\n';
|
||||
|
||||
|
||||
/*.............................................................
|
||||
Process an uploaded file.
|
||||
*/
|
||||
case('FileUpload');
|
||||
/*.........................................................
|
||||
This is the only command that returns an HTML response.
|
||||
*/
|
||||
$responseType = 'html';
|
||||
|
||||
|
||||
/*.........................................................
|
||||
Was a file actually uploaded?
|
||||
*/
|
||||
file_uploads->size ? $NewFile = file_uploads->get(1) | $uploadResult = '202';
|
||||
|
||||
if($uploadResult == '0');
|
||||
/*.....................................................
|
||||
Split the file's extension from the filename in order
|
||||
to follow the API's naming convention for duplicate
|
||||
files. (Test.txt, Test(1).txt, Test(2).txt, etc.)
|
||||
*/
|
||||
$NewFileName = $NewFile->find('OrigName');
|
||||
$OrigFilePath = $currentFolderURL + $NewFileName;
|
||||
$NewFilePath = $OrigFilePath;
|
||||
local('fileExtension') = '.' + $NewFile->find('OrigExtension');
|
||||
local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&;
|
||||
|
||||
|
||||
/*.....................................................
|
||||
Make sure the file extension is allowed.
|
||||
*/
|
||||
if($config->find('DeniedExtensions')->find($Type) >> $NewFile->find('OrigExtension'));
|
||||
$uploadResult = '202';
|
||||
else;
|
||||
/*.................................................
|
||||
Rename the target path until it is unique.
|
||||
*/
|
||||
while(file_exists($NewFilePath));
|
||||
$NewFilePath = $currentFolderURL + #shortFileName + '(' + loop_count + ')' + #fileExtension;
|
||||
/while;
|
||||
|
||||
|
||||
/*.................................................
|
||||
Copy the uploaded file to its final location.
|
||||
*/
|
||||
file_copy($NewFile->find('path'), $NewFilePath);
|
||||
|
||||
|
||||
/*.................................................
|
||||
Set the error code for the response. Note whether
|
||||
the file had to be renamed.
|
||||
*/
|
||||
select(file_currenterror( -errorcode));
|
||||
case(0);
|
||||
$OrigFilePath != $NewFilePath ? $uploadResult = 201;
|
||||
case;
|
||||
$uploadResult = '202';
|
||||
/select;
|
||||
/if;
|
||||
/if;
|
||||
|
||||
|
||||
/*.........................................................
|
||||
Set the HTML response.
|
||||
*/
|
||||
if($uploadResult == '0' || $uploadResult == '201');
|
||||
$__html_reply__ = '\
|
||||
<script type="text/javascript">
|
||||
window.parent.frames[\'frmUpload\'].OnUploadCompleted(' + $uploadResult + ',\'' + $NewFilePath + '\',\'' + $NewFilePath->split('/')->last + '\');
|
||||
</script>
|
||||
';
|
||||
else;
|
||||
$__html_reply__ = '\
|
||||
<script type="text/javascript">
|
||||
window.parent.frames[\'frmUpload\'].OnUploadCompleted(' + $uploadResult + ');
|
||||
</script>
|
||||
';
|
||||
/if;
|
||||
/select;
|
||||
/inline;
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Send a custom header for xml responses.
|
||||
*/
|
||||
if($responseType == 'xml');
|
||||
header;
|
||||
]
|
||||
HTTP/1.0 200 OK
|
||||
Date: [$headerDate]
|
||||
Server: Lasso Professional [lasso_version( -lassoversion)]
|
||||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Last-Modified: [$headerDate]
|
||||
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
||||
Pragma: no-cache
|
||||
Keep-Alive: timeout=15, max=98
|
||||
Connection: Keep-Alive
|
||||
Content-Type: text/xml; charset=utf-8
|
||||
[//lasso
|
||||
/header;
|
||||
|
||||
|
||||
/*.................................................................
|
||||
Set the content type encoding for Lasso.
|
||||
*/
|
||||
content_type('text/xml; charset=utf-8');
|
||||
|
||||
|
||||
/*.................................................................
|
||||
Wrap the response as XML and output.
|
||||
*/
|
||||
$__html_reply__ = '\
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Connector command="' + $Command + '" resourceType="' + $Type + '">
|
||||
<CurrentFolder path="' + $CurrentFolder + '" url="' + $currentFolderURL + '" />
|
||||
' + $commandData + '
|
||||
</Connector>
|
||||
';
|
||||
/if;
|
||||
]
|
157
FCKeditor/editor/filemanager/connectors/lasso/upload.lasso
Normal file
157
FCKeditor/editor/filemanager/connectors/lasso/upload.lasso
Normal file
|
@ -0,0 +1,157 @@
|
|||
[//lasso
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the "File Uploader" for Lasso.
|
||||
*/
|
||||
|
||||
/*.....................................................................
|
||||
Include global configuration. See config.lasso for details.
|
||||
*/
|
||||
include('config.lasso');
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Convert query string parameters to variables and initialize output.
|
||||
*/
|
||||
var(
|
||||
'Type' = action_param('Type'),
|
||||
'CurrentFolder' = action_param('CurrentFolder'),
|
||||
'ServerPath' = action_param('ServerPath'),
|
||||
'NewFile' = null,
|
||||
'NewFileName' = string,
|
||||
'OrigFilePath' = string,
|
||||
'NewFilePath' = string,
|
||||
'errorNumber' = 0,
|
||||
'customMsg' = ''
|
||||
);
|
||||
|
||||
$Type == '' ? $Type = 'File';
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Calculate the path to the current folder.
|
||||
*/
|
||||
$ServerPath == '' ? $ServerPath = $config->find('UserFilesPath');
|
||||
|
||||
var('currentFolderURL' = $ServerPath
|
||||
+ $config->find('Subdirectories')->find(action_param('Type'))
|
||||
+ action_param('CurrentFolder')
|
||||
);
|
||||
|
||||
|
||||
/*.....................................................................
|
||||
Custom tag sets the HTML response.
|
||||
*/
|
||||
|
||||
define_tag(
|
||||
'sendresults',
|
||||
-namespace='fck_',
|
||||
-priority='replace',
|
||||
-required='errorNumber',
|
||||
-type='integer',
|
||||
-optional='fileUrl',
|
||||
-type='string',
|
||||
-optional='fileName',
|
||||
-type='string',
|
||||
-optional='customMsg',
|
||||
-type='string',
|
||||
-description='Sets the HTML response for the FCKEditor Quick Upload feature.'
|
||||
);
|
||||
$__html_reply__ = '\
|
||||
<script type="text/javascript">
|
||||
window.parent.OnUploadCompleted(' + #errorNumber + ',"'
|
||||
+ string_replace(#fileUrl, -find='"', -replace='\\"') + '","'
|
||||
+ string_replace(#fileName, -find='"', -replace='\\"') + '","'
|
||||
+ string_replace(#customMsg, -find='"', -replace='\\"') + '");
|
||||
</script>
|
||||
';
|
||||
/define_tag;
|
||||
|
||||
|
||||
if($config->find('Enabled'));
|
||||
/*.................................................................
|
||||
Process an uploaded file.
|
||||
*/
|
||||
inline($connection);
|
||||
/*.............................................................
|
||||
Was a file actually uploaded?
|
||||
*/
|
||||
file_uploads->size ? $NewFile = file_uploads->get(1) | $errorNumber = 202;
|
||||
|
||||
if($errorNumber == 0);
|
||||
/*.........................................................
|
||||
Split the file's extension from the filename in order
|
||||
to follow the API's naming convention for duplicate
|
||||
files. (Test.txt, Test(1).txt, Test(2).txt, etc.)
|
||||
*/
|
||||
$NewFileName = $NewFile->find('OrigName');
|
||||
$OrigFilePath = $currentFolderURL + $NewFileName;
|
||||
$NewFilePath = $OrigFilePath;
|
||||
local('fileExtension') = '.' + $NewFile->find('OrigExtension');
|
||||
local('shortFileName') = $NewFileName->removetrailing(#fileExtension)&;
|
||||
|
||||
|
||||
/*.........................................................
|
||||
Make sure the file extension is allowed.
|
||||
*/
|
||||
|
||||
if($config->find('DeniedExtensions')->find($Type) >> $NewFile->find('OrigExtension'));
|
||||
$errorNumber = 202;
|
||||
else;
|
||||
/*.....................................................
|
||||
Rename the target path until it is unique.
|
||||
*/
|
||||
while(file_exists($NewFilePath));
|
||||
$NewFileName = #shortFileName + '(' + loop_count + ')' + #fileExtension;
|
||||
$NewFilePath = $currentFolderURL + $NewFileName;
|
||||
/while;
|
||||
|
||||
|
||||
/*.....................................................
|
||||
Copy the uploaded file to its final location.
|
||||
*/
|
||||
file_copy($NewFile->find('path'), $NewFilePath);
|
||||
|
||||
|
||||
/*.....................................................
|
||||
Set the error code for the response.
|
||||
*/
|
||||
select(file_currenterror( -errorcode));
|
||||
case(0);
|
||||
$OrigFilePath != $NewFilePath ? $errorNumber = 201;
|
||||
case;
|
||||
$errorNumber = 202;
|
||||
/select;
|
||||
/if;
|
||||
/if;
|
||||
/inline;
|
||||
else;
|
||||
$errorNumber = 1;
|
||||
$customMsg = 'This file uploader is disabled. Please check the "editor/filemanager/upload/lasso/config.lasso" file.';
|
||||
/if;
|
||||
|
||||
fck_sendresults(
|
||||
-errorNumber=$errorNumber,
|
||||
-fileUrl=$NewFilePath,
|
||||
-fileName=$NewFileName,
|
||||
-customMsg=$customMsg
|
||||
);
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue