Ticket #1871: 1871_2.patch

File 1871_2.patch, 3.4 kB (added by wwalc, 8 months ago)
  • editor/filemanager/connectors/php/commands.php

     
    219219 
    220220                                        if ( is_file( $sFilePath ) ) 
    221221                                        { 
     222                                                if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] ) 
     223                                                { 
     224                                                        break ; 
     225                                                } 
     226                                                 
     227                                                $permissions = 0777; 
     228                                                 
     229                                                if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] ) 
     230                                                { 
     231                                                        $permissions = $Config['ChmodOnUpload'] ; 
     232                                                } 
     233                                                 
    222234                                                $oldumask = umask(0) ; 
    223                                                 chmod( $sFilePath, 0777 ) ; 
     235                                                chmod( $sFilePath, $permissions ) ; 
    224236                                                umask( $oldumask ) ; 
    225237                                        } 
    226238 
  • editor/filemanager/connectors/php/config.php

     
    4747// following setting enabled. 
    4848$Config['ForceSingleExtension'] = true ; 
    4949 
    50 // Perform additional checks for image files 
    51 // if set to true, validate image size (using getimagesize) 
     50// Perform additional checks for image files. 
     51// If set to true, validate image size (using getimagesize). 
    5252$Config['SecureImageUploads'] = true; 
    5353 
    54 // What the user can do with this connector 
     54// What the user can do with this connector. 
    5555$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder') ; 
    5656 
    57 // Allowed Resource Types 
     57// Allowed Resource Types. 
    5858$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media') ; 
    5959 
    6060// For security, HTML is allowed in the first Kb of data for files having the 
    6161// following extensions only. 
    6262$Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js") ; 
    6363 
     64// After file is uploaded, sometimes it is required to change its permissions 
     65// so that it was possible to access it at the later time. 
     66// If possible, it is recommended to set more restrictive permissions, like 0755. 
     67// Set to 0 to disable this feature. 
     68// Note: not needed on Windows-based servers. 
     69$Config['ChmodOnUpload'] = 0777 ; 
     70 
     71// See comments above. 
     72// Used when creating folders that does not exist. 
     73$Config['ChmodOnFolderCreate'] = 0777 ; 
     74 
    6475/* 
    6576        Configuration settings for each Resource Type 
    6677 
  • editor/filemanager/connectors/php/io.php

     
    8888 
    8989function CreateServerFolder( $folderPath, $lastFolder = null ) 
    9090{ 
     91        global $Config ; 
    9192        $sParent = GetParentFolder( $folderPath ) ; 
    9293 
    9394        // Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms 
     
    118119                // Enable error tracking to catch the error. 
    119120                ini_set( 'track_errors', '1' ) ; 
    120121 
     122                $permissions = 0777 ; 
     123                if ( isset( $Config['ChmodOnFolderCreate'] ) && $Config['ChmodOnFolderCreate'] ) 
     124                { 
     125                        $permissions = $Config['ChmodOnFolderCreate'] ; 
     126                } 
     127                 
    121128                // To create the folder with 0777 permissions, we need to set umask to zero. 
    122129                $oldumask = umask(0) ; 
    123                 mkdir( $folderPath, 0777 ) ; 
     130                mkdir( $folderPath, $permissions ) ; 
    124131                umask( $oldumask ) ; 
    125132 
    126133                $sErrorMsg = $php_errormsg ;