Back to index

moin  1.9.0~rc2
connector.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
00004  * Copyright (C) 2003-2009 Frederico Caldeira Knabben
00005  *
00006  * == BEGIN LICENSE ==
00007  *
00008  * Licensed under the terms of any of the following licenses at your
00009  * choice:
00010  *
00011  *  - GNU General Public License Version 2 or later (the "GPL")
00012  *    http://www.gnu.org/licenses/gpl.html
00013  *
00014  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
00015  *    http://www.gnu.org/licenses/lgpl.html
00016  *
00017  *  - Mozilla Public License Version 1.1 or later (the "MPL")
00018  *    http://www.mozilla.org/MPL/MPL-1.1.html
00019  *
00020  * == END LICENSE ==
00021  *
00022  * This is the File Manager Connector for PHP.
00023  */
00024 
00025 ob_start() ;
00026 
00027 require('./config.php') ;
00028 require('./util.php') ;
00029 require('./io.php') ;
00030 require('./basexml.php') ;
00031 require('./commands.php') ;
00032 require('./phpcompat.php') ;
00033 
00034 if ( !$Config['Enabled'] )
00035        SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ;
00036 
00037 DoResponse() ;
00038 
00039 function DoResponse()
00040 {
00041     if (!isset($_GET)) {
00042         global $_GET;
00043     }
00044        if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
00045               return ;
00046 
00047        // Get the main request informaiton.
00048        $sCommand            = $_GET['Command'] ;
00049        $sResourceType       = $_GET['Type'] ;
00050        $sCurrentFolder      = GetCurrentFolder() ;
00051 
00052        // Check if it is an allowed command
00053        if ( ! IsAllowedCommand( $sCommand ) )
00054               SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ) ;
00055 
00056        // Check if it is an allowed type.
00057        if ( !IsAllowedType( $sResourceType ) )
00058               SendError( 1, 'Invalid type specified' ) ;
00059 
00060        // File Upload doesn't have to Return XML, so it must be intercepted before anything.
00061        if ( $sCommand == 'FileUpload' )
00062        {
00063               FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ;
00064               return ;
00065        }
00066 
00067        CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
00068 
00069        // Execute the required command.
00070        switch ( $sCommand )
00071        {
00072               case 'GetFolders' :
00073                      GetFolders( $sResourceType, $sCurrentFolder ) ;
00074                      break ;
00075               case 'GetFoldersAndFiles' :
00076                      GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
00077                      break ;
00078               case 'CreateFolder' :
00079                      CreateFolder( $sResourceType, $sCurrentFolder ) ;
00080                      break ;
00081        }
00082 
00083        CreateXmlFooter() ;
00084 
00085        exit ;
00086 }
00087 ?>