Source for file connector.php

Documentation is available at connector.php

  1. <?php 
  2. /*
  3.  * FCKeditor - The text editor for internet
  4.  * Copyright (C) 2003-2006 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.  
  22. include('config.php';
  23. include('util.php';
  24. include('io.php';
  25. include('basexml.php';
  26. include('commands.php';
  27.  
  28. if !$Config['Enabled')
  29.     SendError1'This connector is disabled. Please check the "editor/filemanager/browser/default/connectors/php/config.php" file' ;
  30.  
  31. // Get the "UserFiles" path.
  32. $GLOBALS["UserFilesPath"'' ;
  33.  
  34. if isset$Config['UserFilesPath') )
  35.     $GLOBALS["UserFilesPath"$Config['UserFilesPath';
  36. else if isset$_GET['ServerPath') )
  37.     $GLOBALS["UserFilesPath"$_GET['ServerPath';
  38. else
  39.     $GLOBALS["UserFilesPath"'/UserFiles/' ;
  40.  
  41. if ereg'/$'$GLOBALS["UserFilesPath") )
  42.     $GLOBALS["UserFilesPath".= '/' ;
  43.  
  44. if strlen$Config['UserFilesAbsolutePath'
  45. {
  46.     $GLOBALS["UserFilesDirectory"$Config['UserFilesAbsolutePath';
  47.  
  48.     if ereg'/$'$GLOBALS["UserFilesDirectory") )
  49.         $GLOBALS["UserFilesDirectory".= '/' ;
  50. }
  51. else
  52. {
  53.     // Map the "UserFiles" path to a local directory.
  54.     $GLOBALS["UserFilesDirectory"GetRootPath($GLOBALS["UserFilesPath";
  55. }
  56.  
  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$sResourceTypearray('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'/' !== $sCurrentFolder '/' $sCurrentFolder ;
  75.     
  76.     // Check for invalid folder paths (..)
  77.     if strpos$sCurrentFolder'..' ) )
  78.         SendError102"" ;
  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. ?>

Documentation generated on Sun, 09 Mar 2008 23:51:03 -0300 by phpDocumentor 1.4.0

SourceForge.net Logo Support This Project