[ Index ] |
|
Code source de FCKeditor 2.4 |
1 <?php 2 /* 3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 4 * Copyright (C) 2003-2007 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 * File Name: connector.php 23 * This is the File Manager Connector for PHP. 24 * 25 * File Authors: 26 * Frederico Caldeira Knabben (www.fckeditor.net) 27 */ 28 29 ob_start() ; 30 31 include ('config.php') ; 32 include ('util.php') ; 33 include ('io.php') ; 34 include ('basexml.php') ; 35 include ('commands.php') ; 36 37 if ( !$Config['Enabled'] ) 38 SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/browser/default/connectors/php/config.php" file' ) ; 39 40 // Get the "UserFiles" path. 41 $GLOBALS["UserFilesPath"] = '' ; 42 43 if ( isset( $Config['UserFilesPath'] ) ) 44 $GLOBALS["UserFilesPath"] = $Config['UserFilesPath'] ; 45 else if ( isset( $_GET['ServerPath'] ) ) 46 $GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ; 47 else 48 $GLOBALS["UserFilesPath"] = '/userfiles/' ; 49 50 if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) ) 51 $GLOBALS["UserFilesPath"] .= '/' ; 52 53 if ( strlen( $Config['UserFilesAbsolutePath'] ) > 0 ) 54 { 55 $GLOBALS["UserFilesDirectory"] = $Config['UserFilesAbsolutePath'] ; 56 57 if ( ! ereg( '/$', $GLOBALS["UserFilesDirectory"] ) ) 58 $GLOBALS["UserFilesDirectory"] .= '/' ; 59 } 60 else 61 { 62 // Map the "UserFiles" path to a local directory. 63 $GLOBALS["UserFilesDirectory"] = GetRootPath() . $GLOBALS["UserFilesPath"] ; 64 } 65 66 DoResponse() ; 67 68 function DoResponse() 69 { 70 if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) 71 return ; 72 73 // Get the main request informaiton. 74 $sCommand = $_GET['Command'] ; 75 $sResourceType = $_GET['Type'] ; 76 $sCurrentFolder = $_GET['CurrentFolder'] ; 77 78 // Check if it is an allowed type. 79 if ( !in_array( $sResourceType, array('File','Image','Flash','Media') ) ) 80 return ; 81 82 // Check the current folder syntax (must begin and start with a slash). 83 if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ; 84 if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ; 85 86 // Check for invalid folder paths (..) 87 if ( strpos( $sCurrentFolder, '..' ) ) 88 SendError( 102, "" ) ; 89 90 // File Upload doesn't have to Return XML, so it must be intercepted before anything. 91 if ( $sCommand == 'FileUpload' ) 92 { 93 FileUpload( $sResourceType, $sCurrentFolder ) ; 94 return ; 95 } 96 97 CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ; 98 99 // Execute the required command. 100 switch ( $sCommand ) 101 { 102 case 'GetFolders' : 103 GetFolders( $sResourceType, $sCurrentFolder ) ; 104 break ; 105 case 'GetFoldersAndFiles' : 106 GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ; 107 break ; 108 case 'CreateFolder' : 109 CreateFolder( $sResourceType, $sCurrentFolder ) ; 110 break ; 111 } 112 113 CreateXmlFooter() ; 114 115 exit ; 116 } 117 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:28:05 2007 | par Balluche grâce à PHPXref 0.7 |