[ Index ]
 

Code source de Drupal 5.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/ -> file.inc (sommaire)

(pas de description)

Poids: 734 lignes (26 kb)
Inclus ou requis: 5 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 18 fonctions

  file_create_url()
  file_create_path()
  file_check_directory()
  file_check_path()
  file_check_upload()
  file_check_location()
  file_copy()
  file_move()
  file_create_filename()
  file_delete()
  file_save_upload()
  file_save_data()
  file_transfer()
  file_download()
  file_scan_directory()
  file_directory_temp()
  file_directory_path()
  file_upload_max_size()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

file_create_url($path)   X-Ref
Create the download path to a file.

param: $path A string containing the path of the file to generate URL for.
return: A string containing a URL that can be used to download the file.

file_create_path($dest = 0)   X-Ref
Make sure the destination is a complete path and resides in the file system
directory, if it is not prepend the file system directory.

param: $dest A string containing the path to verify. If this value is
return: A string containing the path to file, with file system directory

file_check_directory(&$directory, $mode = 0, $form_item = NULL)   X-Ref
Check that the directory exists and is writable. Directories need to
have execute permissions to be considered a directory by FTP servers, etc.

param: $directory A string containing the name of a directory path.
param: $mode A Boolean value to indicate if the directory should be created
param: $form_item An optional string containing the name of a form item that
return: FALSE when directory not found, or TRUE when directory exists.

file_check_path(&$path)   X-Ref
Checks path to see if it is a directory, or a dir/file.

param: $path A string containing a file path. This will be set to the
return: If the directory is not in a Drupal writable directory, FALSE is

file_check_upload($source = 'upload')   X-Ref
Check if $source is a valid file upload. If so, move the file to Drupal's tmp dir
and return it as an object.

The use of SESSION['file_uploads'] should probably be externalized to upload.module

param: $source An upload source (the name of the upload form item), or a file
return: FALSE for an invalid file or upload. A file object for valid uploads/files.

file_check_location($source, $directory = '')   X-Ref
Check if a file is really located inside $directory. Should be used to make
sure a file specified is really located within the directory to prevent
exploits.

param: $source A string set to the file to check.
param: $directory A string where the file should be located.
return: 0 for invalid path or the real path of the source.

file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME)   X-Ref
Copies a file to a new location. This is a powerful function that in many ways
performs like an advanced version of copy().
- Checks if $source and $dest are valid and readable/writable.
- Performs a file copy if $source is not equal to $dest.
- If file already exists in $dest either the call will error out, replace the
file or rename the file based on the $replace parameter.

param: $source A string specifying the file location of the original file.
param: $dest A string containing the directory $source should be copied to.
param: $replace Replace behavior when the destination file already exists.
return: True for success, FALSE for failure.

file_move(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME)   X-Ref
Moves a file to a new location.
- Checks if $source and $dest are valid and readable/writable.
- Performs a file move if $source is not equal to $dest.
- If file already exists in $dest either the call will error out, replace the
file or rename the file based on the $replace parameter.

param: $source A string specifying the file location of the original file.
param: $dest A string containing the directory $source should be copied to.
param: $replace Replace behavior when the destination file already exists.
return: True for success, FALSE for failure.

file_create_filename($basename, $directory)   X-Ref
Create a full file path from a directory and filename. If a file with the
specified name already exists, an alternative will be used.

param: $basename string filename
param: $directory string directory
return:

file_delete($path)   X-Ref
Delete a file.

param: $path A string containing a file path.
return: True for success, FALSE for failure.

file_save_upload($source, $dest = FALSE, $replace = FILE_EXISTS_RENAME)   X-Ref
Saves a file upload to a new location. The source file is validated as a
proper upload and handled as such.

param: $source A string specifying the name of the upload field to save.
param: $dest A string containing the directory $source should be copied to,
param: $replace A boolean, set to TRUE if the destination should be replaced
return: An object containing file info or 0 in case of error.

file_save_data($data, $dest, $replace = FILE_EXISTS_RENAME)   X-Ref
Save a string to the specified destination.

param: $data A string containing the contents of the file.
param: $dest A string containing the destination location.
param: $replace Replace behavior when the destination file already exists.
return: A string containing the resulting filename or 0 on error

file_transfer($source, $headers)   X-Ref
Transfer file using http to client. Pipes a file through Drupal to the
client.

param: $source File to transfer.
param: $headers An array of http headers to send along with file.

file_download()   X-Ref
Call modules that implement hook_file_download() to find out if a file is
accessible and what headers it should be transferred with. If a module
returns -1 drupal_access_denied() will be returned. If one or more modules
returned headers the download will start with the returned headers. If no
modules respond drupal_not_found() will be returned.


file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS')   X-Ref
Finds all files that match a given mask in a given directory.
Directories and files beginning with a period are excluded; this
prevents hidden files and directories (such as SVN working directories)
from being scanned.

param: $dir
param: $mask
param: $nomask
param: $callback
param: $recurse
param: $key
param: $min_depth
param: $depth
return:

file_directory_temp()   X-Ref
Determine the default temporary directory.

return: A string containing a temp directory.

file_directory_path()   X-Ref
Determine the default 'files' directory.

return: A string containing the path to Drupal's 'files' directory.

file_upload_max_size()   X-Ref
Determine the maximum file upload size by querying the PHP settings.

return:



Généré le : Fri Nov 30 16:20:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics