We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

sk8rjess on 05/12/08


Tagged


Versions (?)


connector


Published in: PHP 


  1. <?php
  2. /*
  3.  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  4.  * Copyright (C) 2003-2008 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.  * This is the File Manager Connector for PHP.
  23.  */
  24.  
  25.  
  26. require('./config.php') ;
  27. require('./util.php') ;
  28. require('./io.php') ;
  29. require('./basexml.php') ;
  30. require('./commands.php') ;
  31. require('./phpcompat.php') ;
  32.  
  33. if ( !$Config['Enabled'] )
  34. SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ;
  35.  
  36. DoResponse() ;
  37.  
  38. function DoResponse()
  39. {
  40. if (!isset($_GET)) {
  41. global $_GET;
  42. }
  43. if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
  44. return ;
  45.  
  46. // Get the main request informaiton.
  47. $sCommand = $_GET['Command'] ;
  48. $sResourceType = $_GET['Type'] ;
  49. $sCurrentFolder = GetCurrentFolder() ;
  50.  
  51. // Check if it is an allowed command
  52. if ( ! IsAllowedCommand( $sCommand ) )
  53. SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ) ;
  54.  
  55. // Check if it is an allowed type.
  56. if ( !IsAllowedType( $sResourceType ) )
  57. SendError( 1, 'Invalid type specified' ) ;
  58.  
  59. // File Upload doesn't have to Return XML, so it must be intercepted before anything.
  60. if ( $sCommand == 'FileUpload' )
  61. {
  62. FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ;
  63. return ;
  64. }
  65.  
  66. CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
  67.  
  68. // Execute the required command.
  69. switch ( $sCommand )
  70. {
  71. case 'GetFolders' :
  72. GetFolders( $sResourceType, $sCurrentFolder ) ;
  73. break ;
  74. case 'GetFoldersAndFiles' :
  75. GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
  76. break ;
  77. case 'CreateFolder' :
  78. CreateFolder( $sResourceType, $sCurrentFolder ) ;
  79. break ;
  80. case 'DeleteFile':
  81. DeleteFile( $sResourceType, $sCurrentFolder ,$_GET['sDeleteFileName']);
  82. break;
  83. }
  84.  
  85. CreateXmlFooter() ;
  86.  
  87. exit ;
  88. }
  89. ?>

Report this snippet 

You need to login to post a comment.