+++ /dev/null
-#####\r
-# FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
-# Copyright (C) 2003-2007 Frederico Caldeira Knabben\r
-#\r
-# == BEGIN LICENSE ==\r
-#\r
-# Licensed under the terms of any of the following licenses at your\r
-# choice:\r
-#\r
-# - GNU General Public License Version 2 or later (the "GPL")\r
-# http://www.gnu.org/licenses/gpl.html\r
-#\r
-# - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
-# http://www.gnu.org/licenses/lgpl.html\r
-#\r
-# - Mozilla Public License Version 1.1 or later (the "MPL")\r
-# http://www.mozilla.org/MPL/MPL-1.1.html\r
-#\r
-# == END LICENSE ==\r
-#\r
-# This is the File Manager Connector for Perl.\r
-#####\r
-\r
-sub GetUrlFromPath\r
-{\r
- local($resourceType, $folderPath) = @_;\r
-\r
- if($resourceType eq '') {\r
- $rmpath = &RemoveFromEnd($GLOBALS{'UserFilesPath'},'/');\r
- return("$rmpath$folderPath");\r
- } else {\r
- return("$GLOBALS{'UserFilesPath'}$resourceType$folderPath");\r
- }\r
-}\r
-\r
-sub RemoveExtension\r
-{\r
- local($fileName) = @_;\r
- local($path, $base, $ext);\r
- if($fileName !~ /\./) {\r
- $fileName .= '.';\r
- }\r
- if($fileName =~ /([^\\\/]*)\.(.*)$/) {\r
- $base = $1;\r
- $ext = $2;\r
- if($fileName =~ /(.*)$base\.$ext$/) {\r
- $path = $1;\r
- }\r
- }\r
- return($path,$base,$ext);\r
-\r
-}\r
-\r
-sub ServerMapFolder\r
-{\r
- local($resourceType,$folderPath) = @_;\r
-\r
- # Get the resource type directory.\r
- $sResourceTypePath = $GLOBALS{'UserFilesDirectory'} . $resourceType . '/';\r
-\r
- # Ensure that the directory exists.\r
- &CreateServerFolder($sResourceTypePath);\r
-\r
- # Return the resource type directory combined with the required path.\r
- $rmpath = &RemoveFromStart($folderPath,'/');\r
- return("$sResourceTypePath$rmpath");\r
-}\r
-\r
-sub GetParentFolder\r
-{\r
- local($folderPath) = @_;\r
-\r
- $folderPath =~ s/[\/][^\/]+[\/]?$//g;\r
- return $folderPath;\r
-}\r
-\r
-sub CreateServerFolder\r
-{\r
- local($folderPath) = @_;\r
-\r
- $sParent = &GetParentFolder($folderPath);\r
- # Check if the parent exists, or create it.\r
- if(!(-e $sParent)) {\r
- $sErrorMsg = &CreateServerFolder($sParent);\r
- if($sErrorMsg == 1) {\r
- return(1);\r
- }\r
- }\r
- if(!(-e $folderPath)) {\r
- umask(000);\r
- mkdir("$folderPath",0777);\r
- chmod(0777,"$folderPath");\r
- return(0);\r
- } else {\r
- return(1);\r
- }\r
-}\r
-\r
-sub GetRootPath\r
-{\r
-#use Cwd;\r
-\r
-# my $dir = getcwd;\r
-# print $dir;\r
-# $dir =~ s/$ENV{'DOCUMENT_ROOT'}//g;\r
-# print $dir;\r
-# return($dir);\r
-\r
-# $wk = $0;\r
-# $wk =~ s/\/connector\.cgi//g;\r
-# if($wk) {\r
-# $current_dir = $wk;\r
-# } else {\r
-# $current_dir = `pwd`;\r
-# }\r
-# return($current_dir);\r
-use Cwd;\r
-\r
- if($ENV{'DOCUMENT_ROOT'}) {\r
- $dir = $ENV{'DOCUMENT_ROOT'};\r
- } else {\r
- my $dir = getcwd;\r
- $workdir =~ s/\/connector\.cgi//g;\r
- $dir =~ s/$workdir//g;\r
- }\r
- return($dir);\r
-\r
-\r
-\r
-}\r
-1;\r