[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/ -> fetch.functions.php (summary)

Functions used by lib/exe/fetch.php (not included by other parts of dokuwiki)

File Size: 208 lines (7 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 4 functions

  sendFile()
  rfc2231_encode()
  checkFileStatus()
  calc_cache()

Functions
Functions that are not part of a class:

sendFile($file, $mime, $dl, $cache, $public = false, $orig = null, $csp = [])   X-Ref
Set headers and send the file to the client

The $cache parameter influences how long files may be kept in caches, the $public parameter
influences if this caching may happen in public proxis or in the browser cache only FS#2734

This function will abort the current script when a 304 is sent or file sending is handled
through x-sendfile

author: Andreas Gohr <andi@splitbrain.org>
author: Ben Coburn <btcoburn@silicodon.net>
author: Gerry Weissbach <dokuwiki@gammaproduction.de>
param: string $file local file to send
param: string $mime mime type of the file
param: bool $dl set to true to force a browser download
param: int $cache remaining cache time in seconds (-1 for $conf['cache'], 0 for no-cache)
param: bool $public is this a public ressource or a private one?
param: string $orig original file to send - the file name will be used for the Content-Disposition
param: array $csp The ContentSecurityPolicy to send

rfc2231_encode($name, $value, $charset = 'utf-8', $lang = 'en')   X-Ref
Try an rfc2231 compatible encoding. This ensures correct
interpretation of filenames outside of the ASCII set.
This seems to be needed for file names with e.g. umlauts that
would otherwise decode wrongly in IE.

There is no additional checking, just the encoding and setting the key=value for usage in headers

return: string           in the format " name=value" for values WITHOUT special characters
return: string           in the format " name*=charset'lang'value" for values WITH special characters
author: Gerry Weissbach <gerry.w@gammaproduction.de>
param: string $name      name of the field to be set in the header() call
param: string $value     value of the field to be set in the header() call
param: string $charset   used charset for the encoding of value
param: string $lang      language used.

checkFileStatus(&$media, &$file, $rev = '', $width = 0, $height = 0)   X-Ref
Check for media for preconditions and return correct status code

READ: MEDIA, MIME, EXT, CACHE
WRITE: MEDIA, FILE, array( STATUS, STATUSMESSAGE )

return: array as array(STATUS, STATUSMESSAGE)
author: Gerry Weissbach <gerry.w@gammaproduction.de>
param: string $media  reference to the media id
param: string $file   reference to the file variable
param: string $rev
param: int    $width
param: int    $height

calc_cache($cache)   X-Ref
Returns the wanted cachetime in seconds

Resolves named constants

return: int cachetime in seconds
author: Andreas Gohr <andi@splitbrain.org>
param: string $cache