4
# FCKeditor - The text editor for Internet - http://www.fckeditor.net
5
# Copyright (C) 2003-2007 Frederico Caldeira Knabben
9
# Licensed under the terms of any of the following licenses at your
12
# - GNU General Public License Version 2 or later (the "GPL")
13
# http://www.gnu.org/licenses/gpl.html
15
# - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
16
# http://www.gnu.org/licenses/lgpl.html
18
# - Mozilla Public License Version 1.1 or later (the "MPL")
19
# http://www.mozilla.org/MPL/MPL-1.1.html
23
# This is the File Manager Connector for Perl.
27
# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file.
30
## START: Hack for Windows (Not important to understand the editor code... Perl specific).
32
chdir(GetScriptPath($0));
40
if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; }
42
if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; }
44
if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; }
45
if($www_server_os=~ /win/i) { return(1); }
51
if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; }
59
require 'commands.pl';
60
require 'upload_fck.pl';
63
# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR.
65
&SendUploadResults(1, '', '', 'This connector is disabled. Please check the "editor/filemanager/connectors/perl/upload.cgi" file' ) ;
69
if($FORM{'ServerPath'} ne "") {
70
$GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'};
71
if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) {
72
$GLOBALS{'UserFilesPath'} .= '/' ;
75
$GLOBALS{'UserFilesPath'} = '/userfiles/';
78
# Map the "UserFiles" path to a local directory.
79
$rootpath = &GetRootPath();
80
$GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'};
86
# Get the main request information.
87
$sCommand = 'FileUpload'; #$FORM{'Command'};
88
$sResourceType = $FORM{'Type'};
89
$sCurrentFolder = $FORM{'CurrentFolder'};
91
if ($sResourceType eq '') {
92
$sResourceType = 'File' ;
94
if ($sCurrentFolder eq '') {
95
$sCurrentFolder = '/' ;
98
# Check the current folder syntax (must begin and start with a slash).
99
if(!($sCurrentFolder =~ /\/$/)) {
100
$sCurrentFolder .= '/';
102
if(!($sCurrentFolder =~ /^\//)) {
103
$sCurrentFolder = '/' . $sCurrentFolder;
106
# Check for invalid folder paths (..)
107
if ( $sCurrentFolder =~ /\.\./ ) {
108
SendError( 102, "" ) ;
111
# File Upload doesn't have to Return XML, so it must be intercepted before anything.
112
if($sCommand eq 'FileUpload') {
113
FileUpload($sResourceType,$sCurrentFolder);
4
# FCKeditor - The text editor for Internet - http://www.fckeditor.net
5
# Copyright (C) 2003-2007 Frederico Caldeira Knabben
9
# Licensed under the terms of any of the following licenses at your
12
# - GNU General Public License Version 2 or later (the "GPL")
13
# http://www.gnu.org/licenses/gpl.html
15
# - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
16
# http://www.gnu.org/licenses/lgpl.html
18
# - Mozilla Public License Version 1.1 or later (the "MPL")
19
# http://www.mozilla.org/MPL/MPL-1.1.html
23
# This is the File Manager Connector for Perl.
27
# ATTENTION: To enable this connector, look for the "SECURITY" comment in this file.
30
## START: Hack for Windows (Not important to understand the editor code... Perl specific).
32
chdir(GetScriptPath($0));
40
if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; }
42
if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; }
44
if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; }
45
if($www_server_os=~ /win/i) { return(1); }
51
if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; }
59
require 'commands.pl';
60
require 'upload_fck.pl';
63
# SECURITY: REMOVE/COMMENT THE FOLLOWING LINE TO ENABLE THIS CONNECTOR.
65
&SendUploadResults(1, '', '', 'This connector is disabled. Please check the "editor/filemanager/connectors/perl/upload.cgi" file' ) ;
69
if($FORM{'ServerPath'} ne "") {
70
$GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'};
71
if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) {
72
$GLOBALS{'UserFilesPath'} .= '/' ;
75
$GLOBALS{'UserFilesPath'} = '/userfiles/';
78
# Map the "UserFiles" path to a local directory.
79
$rootpath = &GetRootPath();
80
$GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'};
86
# Get the main request information.
87
$sCommand = 'FileUpload'; #$FORM{'Command'};
88
$sResourceType = $FORM{'Type'};
89
$sCurrentFolder = $FORM{'CurrentFolder'};
91
if ($sResourceType eq '') {
92
$sResourceType = 'File' ;
94
if ($sCurrentFolder eq '') {
95
$sCurrentFolder = '/' ;
98
# Check the current folder syntax (must begin and start with a slash).
99
if(!($sCurrentFolder =~ /\/$/)) {
100
$sCurrentFolder .= '/';
102
if(!($sCurrentFolder =~ /^\//)) {
103
$sCurrentFolder = '/' . $sCurrentFolder;
106
# Check for invalid folder paths (..)
107
if ( $sCurrentFolder =~ /\.\./ ) {
108
SendError( 102, "" ) ;
111
# File Upload doesn't have to Return XML, so it must be intercepted before anything.
112
if($sCommand eq 'FileUpload') {
113
FileUpload($sResourceType,$sCurrentFolder);