3
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
8
* Licensed under the terms of any of the following licenses at your
11
* - GNU General Public License Version 2 or later (the "GPL")
12
* http://www.gnu.org/licenses/gpl.html
14
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15
* http://www.gnu.org/licenses/lgpl.html
17
* - Mozilla Public License Version 1.1 or later (the "MPL")
18
* http://www.mozilla.org/MPL/MPL-1.1.html
22
* This is the File Manager Connector for PHP.
27
include('config.php') ;
30
include('basexml.php') ;
31
include('commands.php') ;
33
if ( !$Config['Enabled'] )
34
SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/browser/default/connectors/php/config.php" file' ) ;
36
// Get the "UserFiles" path.
37
$GLOBALS["UserFilesPath"] = '' ;
39
if ( isset( $Config['UserFilesPath'] ) )
40
$GLOBALS["UserFilesPath"] = $Config['UserFilesPath'] ;
41
else if ( isset( $_GET['ServerPath'] ) )
42
$GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ;
44
$GLOBALS["UserFilesPath"] = '/userfiles/' ;
46
if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) )
47
$GLOBALS["UserFilesPath"] .= '/' ;
49
if ( strlen( $Config['UserFilesAbsolutePath'] ) > 0 )
51
$GLOBALS["UserFilesDirectory"] = $Config['UserFilesAbsolutePath'] ;
53
if ( ! ereg( '/$', $GLOBALS["UserFilesDirectory"] ) )
54
$GLOBALS["UserFilesDirectory"] .= '/' ;
58
// Map the "UserFiles" path to a local directory.
59
$GLOBALS["UserFilesDirectory"] = GetRootPath() . $GLOBALS["UserFilesPath"] ;
66
if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
69
// Get the main request informaiton.
70
$sCommand = $_GET['Command'] ;
71
$sResourceType = $_GET['Type'] ;
72
$sCurrentFolder = $_GET['CurrentFolder'] ;
74
// Check if it is an allowed type.
75
if ( !in_array( $sResourceType, array('File','Image','Flash','Media') ) )
78
// Check the current folder syntax (must begin and start with a slash).
79
if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
80
if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ;
82
// Check for invalid folder paths (..)
83
if ( strpos( $sCurrentFolder, '..' ) )
84
SendError( 102, "" ) ;
86
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
87
if ( $sCommand == 'FileUpload' )
89
FileUpload( $sResourceType, $sCurrentFolder ) ;
93
CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
95
// Execute the required command.
99
GetFolders( $sResourceType, $sCurrentFolder ) ;
101
case 'GetFoldersAndFiles' :
102
GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
104
case 'CreateFolder' :
105
CreateFolder( $sResourceType, $sCurrentFolder ) ;
b'\\ No newline at end of file'