Index: /FCKeditor/trunk/_whatsnew.html
===================================================================
--- /FCKeditor/trunk/_whatsnew.html	(revision 1624)
+++ /FCKeditor/trunk/_whatsnew.html	(revision 1625)
@@ -132,4 +132,6 @@
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1906">#1906</a>] PHP file browser: fixed
 			problems with DetectHtml() function when open_basedir was set.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1871">#1871</a>] PHP file browser: permissions 
+			applied with the chmod command are now configurable.</li>
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1873">#1873</a>] Python file browser: permissions 
 			applied with the chmod command are now configurable.</li>
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/commands.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/commands.php	(revision 1624)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/commands.php	(revision 1625)
@@ -221,6 +221,18 @@
 					if ( is_file( $sFilePath ) )
 					{
+						if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] )
+						{
+							break ;
+						}
+						
+						$permissions = 0777;
+						
+						if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] )
+						{
+							$permissions = $Config['ChmodOnUpload'] ;
+						}
+						
 						$oldumask = umask(0) ;
-						chmod( $sFilePath, 0777 ) ;
+						chmod( $sFilePath, $permissions ) ;
 						umask( $oldumask ) ;
 					}
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/config.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/config.php	(revision 1624)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/config.php	(revision 1625)
@@ -48,12 +48,12 @@
 $Config['ForceSingleExtension'] = true ;
 
-// Perform additional checks for image files
-// if set to true, validate image size (using getimagesize)
+// Perform additional checks for image files.
+// If set to true, validate image size (using getimagesize).
 $Config['SecureImageUploads'] = true;
 
-// What the user can do with this connector
+// What the user can do with this connector.
 $Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder') ;
 
-// Allowed Resource Types
+// Allowed Resource Types.
 $Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media') ;
 
@@ -61,4 +61,15 @@
 // following extensions only.
 $Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js") ;
+
+// After file is uploaded, sometimes it is required to change its permissions
+// so that it was possible to access it at the later time.
+// If possible, it is recommended to set more restrictive permissions, like 0755.
+// Set to 0 to disable this feature.
+// Note: not needed on Windows-based servers.
+$Config['ChmodOnUpload'] = 0777 ;
+
+// See comments above.
+// Used when creating folders that does not exist.
+$Config['ChmodOnFolderCreate'] = 0777 ;
 
 /*
Index: /FCKeditor/trunk/editor/filemanager/connectors/php/io.php
===================================================================
--- /FCKeditor/trunk/editor/filemanager/connectors/php/io.php	(revision 1624)
+++ /FCKeditor/trunk/editor/filemanager/connectors/php/io.php	(revision 1625)
@@ -89,4 +89,5 @@
 function CreateServerFolder( $folderPath, $lastFolder = null )
 {
+	global $Config ;
 	$sParent = GetParentFolder( $folderPath ) ;
 
@@ -118,9 +119,21 @@
 		// Enable error tracking to catch the error.
 		ini_set( 'track_errors', '1' ) ;
-
-		// To create the folder with 0777 permissions, we need to set umask to zero.
-		$oldumask = umask(0) ;
-		mkdir( $folderPath, 0777 ) ;
-		umask( $oldumask ) ;
+		
+		if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] )
+		{
+			mkdir( $folderPath ) ;
+		}
+		else 
+		{
+			$permissions = 0777 ;
+			if ( isset( $Config['ChmodOnFolderCreate'] ) )
+			{
+				$permissions = $Config['ChmodOnFolderCreate'] ;
+			}
+			// To create the folder with 0777 permissions, we need to set umask to zero.
+			$oldumask = umask(0) ;
+			mkdir( $folderPath, $permissions ) ;
+			umask( $oldumask ) ;			
+		}		
 
 		$sErrorMsg = $php_errormsg ;
