- if( ! $recursive )
- return @chmod($file,$mode);
- if( ! $this->is_dir($file) )
+
+ if ( ! $mode ) {
+ if ( $this->permission )
+ $mode = $this->permission;
+ elseif ( $this->is_file($file) )
+ $mode = FS_CHMOD_FILE;
+ elseif ( $this->is_dir($file) )
+ $mode = FS_CHMOD_DIR;
+ else
+ return false;
+ }
+
+ if ( ! $recursive )
+ return @chmod($file, $mode);
+ if ( ! $this->is_dir($file) )