Project

General

Profile

1
<?php
2
/*
3
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
 * Copyright (C) 2003-2009 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

    
45

    
46
	if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
47
		return ;
48

    
49
	// Get the main request informaiton.
50
	$sCommand		= $_GET['Command'] ;
51
	$sResourceType	= $_GET['Type'] ;
52
	print $sCurrentFolder	= GetCurrentFolder() ;
53

    
54
	// Check if it is an allowed command
55
	if ( ! IsAllowedCommand( $sCommand ) )
56
		SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ) ;
57

    
58
	// Check if it is an allowed type.
59
	if ( !IsAllowedType( $sResourceType ) )
60
		SendError( 1, 'Invalid type specified' ) ;
61

    
62
	// File Upload doesn't have to Return XML, so it must be intercepted before anything.
63
	if ( $sCommand == 'FileUpload' )
64
	{
65
		FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ;
66
		return ;
67
	}
68

    
69
	CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
70

    
71
	// Execute the required command.
72
	switch ( $sCommand )
73
	{
74
		case 'GetFolders' :
75
			GetFolders( $sResourceType, $sCurrentFolder ) ;
76
			break ;
77
		case 'GetFoldersAndFiles' :
78
			GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
79
			break ;
80
		case 'CreateFolder' :
81
			CreateFolder( $sResourceType, $sCurrentFolder ) ;
82
			break ;
83
	}
84

    
85
	CreateXmlFooter() ;
86

    
87
	exit ;
88
}
89
?>
(5-5/10)