[ Index ]
 

Code source de FCKeditor 2.4

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

title

Body

[fermer]

/editor/filemanager/browser/default/connectors/php/ -> io.php (source)

   1  <?php 
   2  /*
   3   * FCKeditor - The text editor for Internet - http://www.fckeditor.net
   4   * Copyright (C) 2003-2007 Frederico Caldeira Knabben
   5   * 
   6   * == BEGIN LICENSE ==
   7   * 
   8   * Licensed under the terms of any of the following licenses at your
   9   * choice:
  10   * 
  11   *  - GNU General Public License Version 2 or later (the "GPL")
  12   *    http://www.gnu.org/licenses/gpl.html
  13   * 
  14   *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  15   *    http://www.gnu.org/licenses/lgpl.html
  16   * 
  17   *  - Mozilla Public License Version 1.1 or later (the "MPL")
  18   *    http://www.mozilla.org/MPL/MPL-1.1.html
  19   * 
  20   * == END LICENSE ==
  21   * 
  22   * File Name: io.php
  23   *     This is the File Manager Connector for ASP.
  24   * 
  25   * File Authors:
  26   *         Frederico Caldeira Knabben (www.fckeditor.net)
  27   */
  28  
  29  function GetUrlFromPath( $resourceType, $folderPath )
  30  {
  31      if ( $resourceType == '' )
  32          return RemoveFromEnd( $GLOBALS["UserFilesPath"], '/' ) . $folderPath ;
  33      else
  34          return $GLOBALS["UserFilesPath"] . strtolower( $resourceType ) . $folderPath ;
  35  }
  36  
  37  function RemoveExtension( $fileName )
  38  {
  39      return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ;
  40  }
  41  
  42  function ServerMapFolder( $resourceType, $folderPath )
  43  {
  44      // Get the resource type directory.
  45      $sResourceTypePath = $GLOBALS["UserFilesDirectory"] . strtolower( $resourceType ) . '/' ;
  46  
  47      // Ensure that the directory exists.
  48      CreateServerFolder( $sResourceTypePath ) ;
  49  
  50      // Return the resource type directory combined with the required path.
  51      return $sResourceTypePath . RemoveFromStart( $folderPath, '/' ) ;
  52  }
  53  
  54  function GetParentFolder( $folderPath )
  55  {
  56      $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ;
  57      return preg_replace( $sPattern, '', $folderPath ) ;
  58  }
  59  
  60  function CreateServerFolder( $folderPath )
  61  {
  62      $sParent = GetParentFolder( $folderPath ) ;
  63  
  64      // Check if the parent exists, or create it.
  65      if ( !file_exists( $sParent ) )
  66      {
  67          $sErrorMsg = CreateServerFolder( $sParent ) ;
  68          if ( $sErrorMsg != '' )
  69              return $sErrorMsg ;
  70      }
  71  
  72      if ( !file_exists( $folderPath ) )
  73      {
  74          // Turn off all error reporting.
  75          error_reporting( 0 ) ;
  76          // Enable error tracking to catch the error.
  77          ini_set( 'track_errors', '1' ) ;
  78  
  79          // To create the folder with 0777 permissions, we need to set umask to zero.
  80          $oldumask = umask(0) ;
  81          mkdir( $folderPath, 0777 ) ;
  82          umask( $oldumask ) ;
  83  
  84          $sErrorMsg = $php_errormsg ;
  85  
  86          // Restore the configurations.
  87          ini_restore( 'track_errors' ) ;
  88          ini_restore( 'error_reporting' ) ;
  89  
  90          return $sErrorMsg ;
  91      }
  92      else
  93          return '' ;
  94  }
  95  
  96  function GetRootPath()
  97  {
  98      $sRealPath = realpath( './' ) ;
  99  
 100      $sSelfPath = $_SERVER['PHP_SELF'] ;
 101      $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ;
 102  
 103      return substr( $sRealPath, 0, strlen( $sRealPath ) - strlen( $sSelfPath ) ) ;
 104  }
 105  ?>


Généré le : Sun Feb 25 15:28:05 2007 par Balluche grâce à PHPXref 0.7