2
# FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
# Copyright (C) 2003-2010 Frederico Caldeira Knabben
7
# Licensed under the terms of any of the following licenses at your
10
# - GNU General Public License Version 2 or later (the "GPL")
11
# http://www.gnu.org/licenses/gpl.html
13
# - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
# http://www.gnu.org/licenses/lgpl.html
16
# - Mozilla Public License Version 1.1 or later (the "MPL")
17
# http://www.mozilla.org/MPL/MPL-1.1.html
21
# This is the File Manager Connector for Perl.
26
local($resourceType, $folderPath) = @_;
28
if($resourceType eq '') {
29
$rmpath = &RemoveFromEnd($GLOBALS{'UserFilesPath'},'/');
30
return("$rmpath$folderPath");
32
return("$GLOBALS{'UserFilesPath'}$resourceType$folderPath");
38
local($fileName) = @_;
39
local($path, $base, $ext);
40
if($fileName !~ /\./) {
43
if($fileName =~ /([^\\\/]*)\.(.*)$/) {
46
if($fileName =~ /(.*)$base\.$ext$/) {
50
return($path,$base,$ext);
56
local($resourceType,$folderPath) = @_;
58
# Get the resource type directory.
59
$sResourceTypePath = $GLOBALS{'UserFilesDirectory'} . $resourceType . '/';
61
# Ensure that the directory exists.
62
&CreateServerFolder($sResourceTypePath);
64
# Return the resource type directory combined with the required path.
65
$rmpath = &RemoveFromStart($folderPath,'/');
66
return("$sResourceTypePath$rmpath");
71
local($folderPath) = @_;
73
$folderPath =~ s/[\/][^\/]+[\/]?$//g;
77
sub CreateServerFolder
79
local($folderPath) = @_;
81
$sParent = &GetParentFolder($folderPath);
82
# Check if the parent exists, or create it.
84
$sErrorMsg = &CreateServerFolder($sParent);
89
if(!(-e $folderPath)) {
90
if (defined $CHMOD_ON_FOLDER_CREATE && !$CHMOD_ON_FOLDER_CREATE) {
95
if (defined $CHMOD_ON_FOLDER_CREATE) {
96
mkdir("$folderPath",$CHMOD_ON_FOLDER_CREATE);
99
mkdir("$folderPath",0777);
115
# $dir =~ s/$ENV{'DOCUMENT_ROOT'}//g;
120
# $wk =~ s/\/connector\.cgi//g;
122
# $current_dir = $wk;
124
# $current_dir = `pwd`;
126
# return($current_dir);
129
if($ENV{'DOCUMENT_ROOT'}) {
130
$dir = $ENV{'DOCUMENT_ROOT'};
133
$workdir =~ s/\/connector\.cgi//g;
134
$dir =~ s/$workdir//g;