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