Show
Ignore:
Timestamp:
2007-06-26 00:10:59 (17 months ago)
Author:
fredck
Message:

Fix for SA25719.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/filemanager/browser/default/connectors/php/io.php

    r357 r391  
    4646        { 
    4747                if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) 
    48                 {  
     48                { 
    4949                        SendErrorNode( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ; 
    5050                        CreateXmlFooter() ; 
     
    113113        $slash = ( strpos( $sRealPath, '/' ) === false ) ? '\\' : '/' ; 
    114114        $sSelfPath = str_replace( '/', $slash, $sSelfPath ) ; 
    115          
     115 
    116116        $position = strpos( $sRealPath, $sSelfPath ) ; 
    117117 
     
    123123        return substr( $sRealPath, 0, $position ) ; 
    124124} 
     125 
     126function CheckFileName( $fileName, $resourceType ) 
     127{ 
     128        global $Config ; 
     129 
     130        // SA25719 
     131        if ( strpos( strtolower( $fileName ), '::$data' ) != false ) 
     132                return false ; 
     133 
     134        // Get the extension. 
     135        $sExtension = substr( $fileName, ( strrpos($fileName, '.') + 1 ) ) ; 
     136        $sExtension = strtolower( $sExtension ) ; 
     137 
     138        $arDenied       = $Config['DeniedExtensions'][$resourceType] ; 
     139 
     140        if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) 
     141                return false ; 
     142         
     143        $arAllowed      = $Config['AllowedExtensions'][$resourceType] ; 
     144         
     145        if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) 
     146                return false ; 
     147 
     148        return true ; 
     149} 
    125150?>