[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

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

   1  <?php 
/*
   2   * FCKeditor - The text editor for internet
   3   * Copyright 2006 osCMax2003-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   * File Name: connector.php
  12   *     This is the File Manager Connector for PHP.
  13   * 
  14   * File Authors:
  15   *         Frederico Caldeira Knabben ([email protected])
  16   */
  17  
  18  include ('config.php') ;
  19  include ('util.php') ;
  20  include ('io.php') ;
  21  include ('basexml.php') ;
  22  include ('commands.php') ;
  23  
  24  // Get the "UserFiles" path.
  25  $GLOBALS["UserFilesPath"] = '' ;
  26  
  27  if ( isset( $Config['UserFilesPath'] ) )
  28      $GLOBALS["UserFilesPath"] = $Config['UserFilesPath'] ;
  29  else if ( isset( $_GET['ServerPath'] ) )
  30      $GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ;
  31  else
  32      $GLOBALS["UserFilesPath"] = '/UserFiles/' ;
  33  
  34  if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) )
  35      $GLOBALS["UserFilesPath"] .= '/' ;
  36  
  37  // Map the "UserFiles" path to a local directory.
  38  //$GLOBALS["UserFilesDirectory"] = GetRootPath() . str_replace( '/', '\\', $GLOBALS["UserFilesPath"] ) ;
  39  $GLOBALS["UserFilesDirectory"] = GetRootPath() . $GLOBALS["UserFilesPath"] ;
  40  
  41  DoResponse() ;
  42  
  43  function DoResponse()
  44  {
  45      if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
  46          return ;
  47  
  48      // Get the main request informaiton.
  49      $sCommand        = $_GET['Command'] ;
  50      $sResourceType    = $_GET['Type'] ;
  51      $sCurrentFolder    = $_GET['CurrentFolder'] ;
  52  
  53      // Check if it is an allowed type.
  54      if ( !in_array( $sResourceType, array('File','Image','Flash','Media') ) )
  55          return ;
  56  
  57      // Check the current folder syntax (must begin and start with a slash).
  58      if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
  59      if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ;
  60  
  61      // File Upload doesn't have to Return XML, so it must be intercepted before anything.
  62      if ( $sCommand == 'FileUpload' )
  63      {
  64          FileUpload( $sResourceType, $sCurrentFolder ) ;
  65          return ;
  66      }
  67  
  68      // Prevent the browser from caching the result.
  69      // Date in the past
  70      header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
  71      // always modified
  72      header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
  73      // HTTP/1.1
  74      header('Cache-Control: no-store, no-cache, must-revalidate') ;
  75      header('Cache-Control: post-check=0, pre-check=0', false) ;
  76      // HTTP/1.0
  77      header('Pragma: no-cache') ;
  78  
  79      // Set the response format.
  80      header( 'Content-Type:text/xml; charset=utf-8' ) ;
  81  
  82      CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
  83  
  84      // Execute the required command.
  85      switch ( $sCommand )
  86      {
  87          case 'GetFolders' :
  88              GetFolders( $sResourceType, $sCurrentFolder ) ;
  89              break ;
  90          case 'GetFoldersAndFiles' :
  91              GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
  92              break ;
  93          case 'CreateFolder' :
  94              CreateFolder( $sResourceType, $sCurrentFolder ) ;
  95              break ;
  96      }
  97  
  98      CreateXmlFooter() ;
  99  
 100      exit ;
 101  }
 102  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7