3
* FCKeditor - The text editor for internet
4
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
6
* Licensed under the terms of the GNU Lesser General Public License:
7
* http://www.opensource.org/licenses/lgpl-license.php
9
* For further information visit:
10
* http://www.fckeditor.net/
12
* "Support Open Source software. What about a donation today?"
14
* File Name: connector.php
15
* This is the File Manager Connector for PHP.
18
* Frederico Caldeira Knabben (fredck@fckeditor.net)
21
include('config.php') ;
24
include('basexml.php') ;
25
include('commands.php') ;
27
if ( !$Config['Enabled'] )
28
SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/browser/default/connectors/php/config.php" file' ) ;
30
// Get the "UserFiles" path.
31
$GLOBALS["UserFilesPath"] = '' ;
33
if ( isset( $Config['UserFilesPath'] ) )
34
$GLOBALS["UserFilesPath"] = $Config['UserFilesPath'] ;
35
else if ( isset( $_GET['ServerPath'] ) )
36
$GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ;
38
$GLOBALS["UserFilesPath"] = '/UserFiles/' ;
40
if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) )
41
$GLOBALS["UserFilesPath"] .= '/' ;
43
if ( strlen( $Config['UserFilesAbsolutePath'] ) > 0 )
45
$GLOBALS["UserFilesDirectory"] = $Config['UserFilesAbsolutePath'] ;
47
if ( ! ereg( '/$', $GLOBALS["UserFilesDirectory"] ) )
48
$GLOBALS["UserFilesDirectory"] .= '/' ;
52
// Map the "UserFiles" path to a local directory.
53
$GLOBALS["UserFilesDirectory"] = GetRootPath() . $GLOBALS["UserFilesPath"] ;
60
if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
63
// Get the main request informaiton.
64
$sCommand = $_GET['Command'] ;
65
$sResourceType = $_GET['Type'] ;
66
$sCurrentFolder = $_GET['CurrentFolder'] ;
68
// Check if it is an allowed type.
69
if ( !in_array( $sResourceType, array('File','Image','Flash','Media') ) )
72
// Check the current folder syntax (must begin and start with a slash).
73
if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
74
if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ;
76
// Check for invalid folder paths (..)
77
if ( strpos( $sCurrentFolder, '..' ) )
78
SendError( 102, "" ) ;
80
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
81
if ( $sCommand == 'FileUpload' )
83
FileUpload( $sResourceType, $sCurrentFolder ) ;
87
CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
89
// Execute the required command.
93
GetFolders( $sResourceType, $sCurrentFolder ) ;
95
case 'GetFoldersAndFiles' :
96
GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
99
CreateFolder( $sResourceType, $sCurrentFolder ) ;
b'\\ No newline at end of file'