@@ -89,7 +89,7 @@ define('FILE_STATUS_PERMANENT', 1);
|
||||
* wrappers that are appropriate for particular usage. For example, this returns
|
||||
* only stream wrappers that use local file storage:
|
||||
* @code
|
||||
* $local_stream_wrappers = file_get_stream_wrappers(STEAM_WRAPPERS_LOCAL);
|
||||
* $local_stream_wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_LOCAL);
|
||||
* @endcode
|
||||
*
|
||||
* The $filter parameter can only filter to types containing a particular flag.
|
||||
@@ -99,7 +99,7 @@ define('FILE_STATUS_PERMANENT', 1);
|
||||
* array_diff_key() function can be used to help with this. For example, this
|
||||
* returns only stream wrappers that do not use local file storage:
|
||||
* @code
|
||||
* $remote_stream_wrappers = array_diff_key(file_get_stream_wrappers(STREAM_WRAPPERS_ALL), file_get_stream_wrappers(STEAM_WRAPPERS_LOCAL));
|
||||
* $remote_stream_wrappers = array_diff_key(file_get_stream_wrappers(STREAM_WRAPPERS_ALL), file_get_stream_wrappers(STREAM_WRAPPERS_LOCAL));
|
||||
* @endcode
|
||||
*
|
||||
* @param $filter
|
||||
@@ -282,10 +282,6 @@ function file_stream_wrapper_uri_normalize($uri) {
|
||||
$uri = $scheme . '://' . $target;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// The default scheme is file://
|
||||
$url = 'file://' . $uri;
|
||||
}
|
||||
return $uri;
|
||||
}
|
||||
|
||||
@@ -834,9 +830,8 @@ function file_valid_uri($uri) {
|
||||
* A string specifying the filepath or URI of the source file.
|
||||
* @param $destination
|
||||
* A URI containing the destination that $source should be copied to. The
|
||||
* URI may be a bare filepath (without a scheme) and in that case the default
|
||||
* scheme (file://) will be used. If this value is omitted, Drupal's default
|
||||
* files scheme will be used, usually "public://".
|
||||
* URI may be a bare filepath (without a scheme). If this value is omitted,
|
||||
* Drupal's default files scheme will be used, usually "public://".
|
||||
* @param $replace
|
||||
* Replace behavior when the destination file already exists:
|
||||
* - FILE_EXISTS_REPLACE - Replace the existing file.
|
||||
@@ -892,7 +887,7 @@ function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXIST
|
||||
$destination = file_destination($destination, $replace);
|
||||
if ($destination === FALSE) {
|
||||
drupal_set_message(t('The file %file could not be copied because a file by that name already exists in the destination directory.', array('%file' => $original_source)), 'error');
|
||||
watchdog('file', 'File %file could not be copied because a file by that name already exists in the destination directory (%directory)', array('%file' => $original_source, '%destination' => $destination));
|
||||
watchdog('file', 'File %file could not be copied because a file by that name already exists in the destination directory (%directory)', array('%file' => $original_source, '%directory' => $destination));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2481,20 +2476,10 @@ function file_directory_temp() {
|
||||
function file_get_content_headers($file) {
|
||||
$name = mime_header_encode($file->filename);
|
||||
$type = mime_header_encode($file->filemime);
|
||||
// Serve images, text, and flash content for display rather than download.
|
||||
$inline_types = variable_get('file_inline_types', array('^text/', '^image/', 'flash$'));
|
||||
$disposition = 'attachment';
|
||||
foreach ($inline_types as $inline_type) {
|
||||
// Exclamation marks are used as delimiters to avoid escaping slashes.
|
||||
if (preg_match('!' . $inline_type . '!', $file->filemime)) {
|
||||
$disposition = 'inline';
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
'Content-Type' => $type,
|
||||
'Content-Length' => $file->filesize,
|
||||
'Content-Disposition' => $disposition . '; filename="' . $name . '"',
|
||||
'Cache-Control' => 'private',
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user