PageRenderTime 36ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/public/admin-console/media/js/fckeditor/editor/filemanager/connectors/php/connector.php

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