Changeset 386
- Timestamp:
- 2007-06-16 18:32:46 (3 years ago)
- Location:
- FCKeditor/branches/developers/alfonsoml/editor/filemanager/connectors/php
- Files:
-
- 2 modified
-
basexml.php (modified) (2 diffs)
-
io.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/branches/developers/alfonsoml/editor/filemanager/connectors/php/basexml.php
r383 r386 54 54 55 55 // Add the current folder node. 56 echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder ) ) . '" />' ;56 echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ; 57 57 58 58 $GLOBALS['HeaderSent'] = true ; … … 66 66 function SendError( $number, $text ) 67 67 { 68 SetXmlHeaders() ; 68 if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) 69 { 70 SendErrorNode( $number, $text ) ; 71 CreateXmlFooter() ; 72 } 73 else 74 { 75 SetXmlHeaders() ; 69 76 70 // Create the XML document header71 echo '<?xml version="1.0" encoding="utf-8" ?>' ;77 // Create the XML document header 78 echo '<?xml version="1.0" encoding="utf-8" ?>' ; 72 79 73 echo '<Connector>' ;74 75 SendErrorNode($number, $text ) ;76 77 echo '</Connector>' ;78 80 echo '<Connector>' ; 81 82 SendErrorNode( $number, $text ) ; 83 84 echo '</Connector>' ; 85 } 79 86 exit ; 80 87 } -
FCKeditor/branches/developers/alfonsoml/editor/filemanager/connectors/php/io.php
r383 r386 45 45 46 46 // Map the "UserFiles" path to a local directory. 47 return GetRootPath() . $Config['QuickUploadPath'][$resourceType];47 return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ) ; 48 48 } 49 49 else … … 53 53 54 54 // Map the "UserFiles" path to a local directory. 55 return GetRootPath() . $Config['FileTypesPath'][$resourceType];55 return Server_MapPath( $Config['FileTypesPath'][$resourceType] ) ; 56 56 } 57 57 } … … 75 75 $sErrorMsg = CreateServerFolder( $sResourceTypePath ) ; 76 76 if ( $sErrorMsg != '' ) 77 { 78 if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) 79 { 80 SendErrorNode( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ; 81 CreateXmlFooter() ; 82 exit ; 83 } 84 else 85 { 86 SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ; 87 } 88 } 77 SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ; 89 78 90 79 // Return the resource type directory combined with the required path. … … 149 138 $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ; 150 139 151 // Get the slash according to the filesystem 152 $slash = ( strpos( $sRealPath, '/' ) === false ) ? '\\' : '/' ; 153 $sSelfPath = str_replace( '/', $slash, $sSelfPath ) ; 140 $sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath ) ; 154 141 155 142 $position = strpos( $sRealPath, $sSelfPath ) ; 156 143 157 144 // This can check only that this script isn't run from a virtual dir 158 // But it avoids problemsthe problems that arise if it isn't checked145 // But it avoids the problems that arise if it isn't checked 159 146 if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) ) 160 147 SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ) ; … … 163 150 } 164 151 152 // Emulate the asp Server.mapPath function. 153 // given an url path return the physical directory that it corresponds to 154 function Server_MapPath( $path ) 155 { 156 // This function is available only for Apache 157 if ( function_exists( 'apache_lookup_uri' ) ) 158 { 159 $info = apache_lookup_uri( $path ) ; 160 return $info->filename . $info->path_info ; 161 } 162 163 // This isn't correct but for the moment there's no other solution 164 // If this script is under a virtual directory or symlink it will detect the problem and stop 165 return GetRootPath() . $path ; 166 } 165 167 166 168 function IsAllowedExt( $sExtension, $resourceType )