Ticket #2622: commands.patch

File commands.patch, 1.3 KB (added by Ralph, 12 years ago)

fckeditor_263/editor/filemanager/connectors/php/commands.php

  • .php

    old new function FileUpload( $resourceType, $cur 
    169169
    170170                $oFile = $_FILES['NewFile'] ;
    171171
    172                 // Map the virtual path to the local server path.
    173                 $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ;
    174 
    175172                // Get the uploaded file name.
    176173                $sFileName = $oFile['name'] ;
    177174                $sFileName = SanitizeFileName( $sFileName ) ;
    function FileUpload( $resourceType, $cur 
    182179                $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
    183180                $sExtension = strtolower( $sExtension ) ;
    184181
     182                if ( $Config['QuickUploadFileDispatching'] ) {   // #PATCH: automatically dispatch uploaded files
     183                        foreach ( $Config['ConfigAllowedTypes'] as $type ) {
     184                                if ( $type != 'File' && in_array ( $sExtension, $Config['AllowedExtensions'][$type] ) ) {
     185                                        $resourceType = $type;
     186                                }
     187                        }
     188                }
     189
     190                // Map the virtual path to the local server path.
     191                $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ; // #PATCH: original line moved down
     192
    185193                if ( isset( $Config['SecureImageUploads'] ) )
    186194                {
    187195                        if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false )
© 2003 – 2021 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy