[ Index ] |
|
Code source de FCKeditor 2.4 |
1 ##### 2 # FCKeditor - The text editor for Internet - http://www.fckeditor.net 3 # Copyright (C) 2003-2007 Frederico Caldeira Knabben 4 # 5 # == BEGIN LICENSE == 6 # 7 # Licensed under the terms of any of the following licenses at your 8 # choice: 9 # 10 # - GNU General Public License Version 2 or later (the "GPL") 11 # http://www.gnu.org/licenses/gpl.html 12 # 13 # - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 14 # http://www.gnu.org/licenses/lgpl.html 15 # 16 # - Mozilla Public License Version 1.1 or later (the "MPL") 17 # http://www.mozilla.org/MPL/MPL-1.1.html 18 # 19 # == END LICENSE == 20 # 21 # File Name: io.pl 22 # This is the File Manager Connector for Perl. 23 # 24 # File Authors: 25 # Takashi Yamaguchi (jack@omakase.net) 26 ##### 27 28 sub GetUrlFromPath 29 { 30 local($resourceType, $folderPath) = @_; 31 32 if($resourceType eq '') { 33 $rmpath = &RemoveFromEnd($GLOBALS{'UserFilesPath'},'/'); 34 return("$rmpath$folderPath"); 35 } else { 36 return("$GLOBALS{'UserFilesPath'}$resourceType$folderPath"); 37 } 38 } 39 40 sub RemoveExtension 41 { 42 local($fileName) = @_; 43 local($path, $base, $ext); 44 if($fileName !~ /\./) { 45 $fileName .= '.'; 46 } 47 if($fileName =~ /([^\\\/]*)\.(.*)$/) { 48 $base = $1; 49 $ext = $2; 50 if($fileName =~ /(.*)$base\.$ext$/) { 51 $path = $1; 52 } 53 } 54 return($path,$base,$ext); 55 56 } 57 58 sub ServerMapFolder 59 { 60 local($resourceType,$folderPath) = @_; 61 62 # Get the resource type directory. 63 $sResourceTypePath = $GLOBALS{'UserFilesDirectory'} . $resourceType . '/'; 64 65 # Ensure that the directory exists. 66 &CreateServerFolder($sResourceTypePath); 67 68 # Return the resource type directory combined with the required path. 69 $rmpath = &RemoveFromStart($folderPath,'/'); 70 return("$sResourceTypePath$rmpath"); 71 } 72 73 sub GetParentFolder 74 { 75 local($folderPath) = @_; 76 77 $folderPath =~ s/[\/][^\/]+[\/]?$//g; 78 return $folderPath; 79 } 80 81 sub CreateServerFolder 82 { 83 local($folderPath) = @_; 84 85 $sParent = &GetParentFolder($folderPath); 86 # Check if the parent exists, or create it. 87 if(!(-e $sParent)) { 88 $sErrorMsg = &CreateServerFolder($sParent); 89 if($sErrorMsg == 1) { 90 return(1); 91 } 92 } 93 if(!(-e $folderPath)) { 94 umask(000); 95 mkdir("$folderPath",0777); 96 chmod(0777,"$folderPath"); 97 return(0); 98 } else { 99 return(1); 100 } 101 } 102 103 sub GetRootPath 104 { 105 #use Cwd; 106 107 # my $dir = getcwd; 108 # print $dir; 109 # $dir =~ s/$ENV{'DOCUMENT_ROOT'}//g; 110 # print $dir; 111 # return($dir); 112 113 # $wk = $0; 114 # $wk =~ s/\/connector\.cgi//g; 115 # if($wk) { 116 # $current_dir = $wk; 117 # } else { 118 # $current_dir = `pwd`; 119 # } 120 # return($current_dir); 121 use Cwd; 122 123 if($ENV{'DOCUMENT_ROOT'}) { 124 $dir = $ENV{'DOCUMENT_ROOT'}; 125 } else { 126 my $dir = getcwd; 127 $workdir =~ s/\/connector\.cgi//g; 128 $dir =~ s/$workdir//g; 129 } 130 return($dir); 131 132 133 134 } 135 1;
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:28:05 2007 | par Balluche grâce à PHPXref 0.7 |