[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/include/fckeditor/editor/filemanager/browser/default/connectors/perl/ -> io.pl (source)

   1  #####
   2  #  FCKeditor - The text editor for internet
   3  #  Copyright (C) 2003-2005 Frederico Caldeira Knabben
   4  #  
   5  #  Licensed under the terms of the GNU Lesser General Public License:
   6  #          http://www.opensource.org/licenses/lgpl-license.php
   7  #  
   8  #  For further information visit:
   9  #          http://www.fckeditor.net/
  10  #  
  11  #  "Support Open Source software. What about a donation today?"
  12  #  
  13  #  File Name: io.pl
  14  #      This is the File Manager Connector for Perl.
  15  #  
  16  #  File Authors:
  17  #          Takashi Yamaguchi (jack@omakase.net)
  18  #####
  19  
  20  sub GetUrlFromPath
  21  {
  22      local($resourceType, $folderPath) = @_;
  23  
  24      if($resourceType eq '') {
  25          $rmpath = &RemoveFromEnd($GLOBALS{'UserFilesPath'},'/');
  26          return("$rmpath$folderPath");
  27      } else {
  28          return("$GLOBALS{'UserFilesPath'}$resourceType$folderPath");
  29      }
  30  }
  31  
  32  sub RemoveExtension
  33  {
  34      local($fileName) = @_;
  35      local($path, $base, $ext);
  36      if($fileName !~ /\./) {
  37          $fileName .= '.';
  38      }
  39      if($fileName =~ /([^\\\/]*)\.(.*)$/) {
  40          $base = $1;
  41          $ext  = $2;
  42          if($fileName =~ /(.*)$base\.$ext$/) {
  43              $path = $1;
  44          }
  45      }
  46      return($path,$base,$ext);
  47  
  48  }
  49  
  50  sub ServerMapFolder
  51  {
  52      local($resourceType,$folderPath) = @_;
  53  
  54      # Get the resource type directory.
  55      $sResourceTypePath = $GLOBALS{'UserFilesDirectory'} . $resourceType . '/';
  56  
  57      # Ensure that the directory exists.
  58      &CreateServerFolder($sResourceTypePath);
  59  
  60      # Return the resource type directory combined with the required path.
  61      $rmpath = &RemoveFromStart($folderPath,'/');
  62      return("$sResourceTypePath$rmpath");
  63  }
  64  
  65  sub GetParentFolder
  66  {
  67      local($folderPath) = @_;
  68  
  69      $folderPath =~ s/[\/][^\/]+[\/]?$//g;
  70      return $folderPath;
  71  }
  72  
  73  sub CreateServerFolder
  74  {
  75      local($folderPath) = @_;
  76  
  77      $sParent = &GetParentFolder($folderPath);
  78      # Check if the parent exists, or create it.
  79      if(!(-e $sParent)) {
  80          $sErrorMsg = &CreateServerFolder($sParent);
  81          if($sErrorMsg == 1) {
  82              return(1);
  83          }
  84      }
  85      if(!(-e $folderPath)) {
  86          umask(000);
  87          mkdir("$folderPath",0777);
  88          chmod(0777,"$folderPath");
  89          return(0);
  90      } else {
  91          return(1);
  92      }
  93  }
  94  
  95  sub GetRootPath
  96  {
  97  #use Cwd;
  98  
  99  #    my $dir = getcwd;
 100  #    print $dir;
 101  #    $dir  =~ s/$ENV{'DOCUMENT_ROOT'}//g;
 102  #    print $dir;
 103  #    return($dir);
 104  
 105  #    $wk = $0;
 106  #    $wk =~ s/\/connector\.cgi//g;
 107  #    if($wk) {
 108  #        $current_dir = $wk;
 109  #    } else {
 110  #        $current_dir = `pwd`;
 111  #    }
 112  #    return($current_dir);
 113  use Cwd;
 114  
 115      if($ENV{'DOCUMENT_ROOT'}) {
 116          $dir = $ENV{'DOCUMENT_ROOT'};
 117      } else {
 118          my $dir = getcwd;
 119          $workdir =~ s/\/connector\.cgi//g;
 120          $dir  =~ s/$workdir//g;
 121      }
 122      return($dir);
 123  
 124  
 125  
 126  }
 127  1;


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7