[ 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/php/ -> connector.php (source)

   1  <?php 
   2  /*
   3   * FCKeditor - The text editor for internet
   4   * Copyright (C) 2003-2005 Frederico Caldeira Knabben
   5   * 
   6   * Licensed under the terms of the GNU Lesser General Public License:
   7   *         http://www.opensource.org/licenses/lgpl-license.php
   8   * 
   9   * For further information visit:
  10   *         http://www.fckeditor.net/
  11   * 
  12   * "Support Open Source software. What about a donation today?"
  13   * 
  14   * File Name: connector.php
  15   *     This is the File Manager Connector for PHP.
  16   * 
  17   * File Authors:
  18   *         Frederico Caldeira Knabben (fredck@fckeditor.net)
  19   */
  20  
  21  include ('config.php') ;
  22  include ('util.php') ;
  23  include ('io.php') ;
  24  include ('basexml.php') ;
  25  include ('commands.php') ;
  26  
  27  if ( !$Config['Enabled'] )
  28      SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/browser/default/connectors/php/config.php" file' ) ;
  29  
  30  // Get the "UserFiles" path.
  31  $GLOBALS["UserFilesPath"] = '' ;
  32  
  33  if ( isset( $Config['UserFilesPath'] ) )
  34      $GLOBALS["UserFilesPath"] = $Config['UserFilesPath'] ;
  35  else if ( isset( $_GET['ServerPath'] ) )
  36      $GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ;
  37  else
  38      $GLOBALS["UserFilesPath"] = '/UserFiles/' ;
  39  
  40  if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) )
  41      $GLOBALS["UserFilesPath"] .= '/' ;
  42  
  43  if ( strlen( $Config['UserFilesAbsolutePath'] ) > 0 ) 
  44  {
  45      $GLOBALS["UserFilesDirectory"] = $Config['UserFilesAbsolutePath'] ;
  46  
  47      if ( ! ereg( '/$', $GLOBALS["UserFilesDirectory"] ) )
  48          $GLOBALS["UserFilesDirectory"] .= '/' ;
  49  }
  50  else
  51  {
  52      // Map the "UserFiles" path to a local directory.
  53      $GLOBALS["UserFilesDirectory"] = GetRootPath() . $GLOBALS["UserFilesPath"] ;
  54  }
  55  
  56  DoResponse() ;
  57  
  58  function DoResponse()
  59  {
  60      if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
  61          return ;
  62  
  63      // Get the main request informaiton.
  64      $sCommand        = $_GET['Command'] ;
  65      $sResourceType    = $_GET['Type'] ;
  66      $sCurrentFolder    = $_GET['CurrentFolder'] ;
  67  
  68      // Check if it is an allowed type.
  69      if ( !in_array( $sResourceType, array('File','Image','Flash','Media') ) )
  70          return ;
  71  
  72      // Check the current folder syntax (must begin and start with a slash).
  73      if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
  74      if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ;
  75      
  76      // Check for invalid folder paths (..)
  77      if ( strpos( $sCurrentFolder, '..' ) )
  78          SendError( 102, "" ) ;
  79  
  80      // File Upload doesn't have to Return XML, so it must be intercepted before anything.
  81      if ( $sCommand == 'FileUpload' )
  82      {
  83          FileUpload( $sResourceType, $sCurrentFolder ) ;
  84          return ;
  85      }
  86  
  87      CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
  88  
  89      // Execute the required command.
  90      switch ( $sCommand )
  91      {
  92          case 'GetFolders' :
  93              GetFolders( $sResourceType, $sCurrentFolder ) ;
  94              break ;
  95          case 'GetFoldersAndFiles' :
  96              GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
  97              break ;
  98          case 'CreateFolder' :
  99              CreateFolder( $sResourceType, $sCurrentFolder ) ;
 100              break ;
 101      }
 102  
 103      CreateXmlFooter() ;
 104  
 105      exit ;
 106  }
 107  ?>


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