eZ Publish  [trunk]
eZWebDAVServer Class Reference

Virtual base class for implementing WebDAV servers. More...

+ Inheritance diagram for eZWebDAVServer:

List of all members.

Public Member Functions

 copy ($source, $destination)
 delete ($target)
 eZWebDAVServer ()
 flushXMLBody ()
 get ($target)
 getCollectionContent ($collection, $depth=false, $properties=false)
 head ($target)
 mkcol ($target)
 move ($source, $destination)
 options ($target)
 processClientRequest ()
 put ($target, $tempFile)
 setServerRoot ($rootDir)
 setupXMLOutputCharset ()
 setXMLOutputCharset ($charset)
 xmlBody ()
 XMLOutputCharset ()

Static Public Member Functions

static appendLogEntry ($logString, $label=false)
 dataCharset ()
static isLoggingEnabled ()
 recode ($string, $fromCharset, $toCharset, $stop=false)
static rootDirectory ()
static tempDirectory ()
 userAgentPattern ()
 userAgentSettings ()

Public Attributes

 $ServerRootDir = ""
 $XMLBodyRead = false
 $XMLOutputCharset = 'utf-8'
const CTIME_FORMAT = "Y-m-d\\TH:i:s\\Z"
const FAILED_BAD_GATEWAY = 36
const FAILED_CONFLICT = 33
const FAILED_EXISTS = 32
const FAILED_FORBIDDEN = 30
const FAILED_LOCKED = 35
const FAILED_NOT_FOUND = 31
const FAILED_PRECONDITION = 34
const FAILED_STORAGE_FULL = 37
const FAILED_UNSUPPORTED = 38
const MTIME_FORMAT = "D, d M Y H:i:s"
const OK = 10
const OK_CREATED = 12
const OK_OVERWRITE = 13
const OK_SILENT = 11
const TEMP_FILE_PREFIX = "eZWebDAVUpload_"

Protected Member Functions

 handle ($status)
 headers ()
 outputCollectionContent ($collection, $requestedProperties)
 outputOptions ($options)
 outputSendDataToClient ($output, $headers_only=false)
 processURL ($url)
 storeUploadedFile ($target)

Detailed Description

Virtual base class for implementing WebDAV servers.

Todo:
Add support for propall and propname

Definition at line 50 of file ezwebdavserver.php.


Member Function Documentation

eZWebDAVServer::copy ( source,
destination 
)

Copies the element $source to destination $destination

Returns:
The WebDAV status code

Reimplemented in eZWebDAVFileServer.

Definition at line 764 of file ezwebdavserver.php.

Referenced by processClientRequest(), and storeUploadedFile().

Returns:
charset of data. It's used as charset for outputted xml if other charset is not specified in 'userAgentSettings'.

Definition at line 985 of file ezwebdavserver.php.

Referenced by outputCollectionContent(), and setupXMLOutputCharset().

eZWebDAVServer::delete ( target)

Removes the element $target.

Returns:
The WebDAV status code

Reimplemented in eZWebDAVContentServer, and eZWebDAVFileServer.

Definition at line 782 of file ezwebdavserver.php.

Constructor of eZWebDAVServer; disables PHP error messages.

Definition at line 80 of file ezwebdavserver.php.

Referenced by eZWebDAVContentServer\eZWebDAVContentServer(), and eZWebDAVFileServer\eZWebDAVFileServer().

Returns:
The XML body text for the current request.

Definition at line 671 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::get ( target)

Fetches the data for the element $target

Returns:
The contents of a given element, e.g. contents of a file.

Reimplemented in eZWebDAVFileServer, and eZWebDAVContentServer.

Definition at line 737 of file ezwebdavserver.php.

eZWebDAVServer::getCollectionContent ( collection,
depth = false,
properties = false 
)
Returns:
An array with elements that belongs to the collection $collection
Parameters:
$depthThe current depth, 0 for only current object, 1 for it's children
$propertiesWhich properties the client asked for, either an array with DAV property names, true for all properties or false for only property names.

Reimplemented in eZWebDAVFileServer, and eZWebDAVContentServer.

Definition at line 720 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::handle ( status) [protected]

Handles return values and sends necessary/corresponding headers.

Definition at line 790 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::head ( target)
Returns:
Information on a given element

Reimplemented in eZWebDAVContentServer, and eZWebDAVFileServer.

Definition at line 728 of file ezwebdavserver.php.

eZWebDAVServer::headers ( ) [protected]

This is called before each each request is processed and can be used to output some common headers.

Reimplemented in eZWebDAVContentServer.

Definition at line 696 of file ezwebdavserver.php.

Referenced by processClientRequest().

static eZWebDAVServer::isLoggingEnabled ( ) [static]
Returns:
true if WebDAV logging is enabled.

Definition at line 925 of file ezwebdavserver.php.

Referenced by appendLogEntry(), and eZWebDavCheckLogSetting().

eZWebDAVServer::mkcol ( target)

Create a new collection (folder) named $target.

Returns:
The WebDAV status code

Reimplemented in eZWebDAVContentServer, and eZWebDAVFileServer.

Definition at line 755 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::move ( source,
destination 
)

Moves the element $source to destination $destination

Returns:
The WebDAV status code

Reimplemented in eZWebDAVContentServer, and eZWebDAVFileServer.

Definition at line 773 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::options ( target)

Reports WebDAV options which information on what the server supports.

Returns:
An associative array with options, can contain:
  • methods - An array with methods it can handle, if not supplied it will use all possible methods.
  • versions - An array with versions this server supports, if not supplied it will use 1,2,<http://apache.org/dav/propset/fs/1>.

Reimplemented in eZWebDAVContentServer.

Definition at line 709 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::outputCollectionContent ( collection,
requestedProperties 
) [protected]

Generates the WebDAV XML from $collection and outputs using print().

Parameters:
$collectionAn array with elements (e.g dirs/files). Each element consists of:
  • ctime - The timestamp when the element was created
  • mtime - The timestamp when the element was last modified
  • mimetype - The type of element, use httpd/unix-directory for folder like entries
  • href - URL which points to the element
  • name - The name of the element
  • size - The size of the element in bytes, not needed for folders
Returns:
The WebDAV status code

Definition at line 343 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::outputOptions ( options) [protected]

Generates HTTP headers with information on what the server supports.

Parameters:
$optionsAn array with the various options the server supports
  • methods - An array with methods it can handle, if not supplied it will report all possible methods.
  • versions - An array with versions this server supports, if not supplied it will return 1,2,<http://apache.org/dav/propset/fs/1>.
Returns:
The WebDAV status code

Definition at line 310 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::outputSendDataToClient ( output,
headers_only = false 
) [protected]

Outputs the data $output using print().

Parameters:
$outputIs an array which can contain (both must be set):
  • data - String or byte data
  • file - The path to the file, the contents of the file will be output
Returns:
The WebDAV status code

Reimplemented in eZWebDAVContentServer.

Definition at line 532 of file ezwebdavserver.php.

Referenced by processClientRequest().

Server process function. Dumps a custom header, sets the path and finally checks what the clients wants. Calls the appropriate virtual function (based on the client request).

Reimplemented in eZWebDAVContentServer.

Definition at line 104 of file ezwebdavserver.php.

eZWebDAVServer::processURL ( url) [protected]

This method will be called on all intercepted URLs and can be reimplemented to clean up the URL for further processing. A typical usage is when the server is running without rewrite rules and will have the .php file in the path.

Returns:
The new URL which can safely be passed to the operation methods.

Reimplemented in eZWebDAVContentServer.

Definition at line 686 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::put ( target,
tempFile 
)

Tries to create/overwrite an element named $target with contents taken from $tempFile.

Returns:
The WebDAV status code

Reimplemented in eZWebDAVContentServer, and eZWebDAVFileServer.

Definition at line 746 of file ezwebdavserver.php.

Referenced by processClientRequest().

eZWebDAVServer::recode ( string,
fromCharset,
toCharset,
stop = false 
) [static]
Returns:
recoded $string form $fromCharset to $toCharset

Definition at line 1029 of file ezwebdavserver.php.

Referenced by outputCollectionContent().

static eZWebDAVServer::rootDirectory ( ) [static]

Definition at line 1060 of file ezwebdavserver.php.

Definition at line 85 of file ezwebdavserver.php.

Sets charset for outputted xml by 'userAgent'

Definition at line 939 of file ezwebdavserver.php.

Referenced by eZWebDAVServer().

Sets charset for outputted xml.

Definition at line 960 of file ezwebdavserver.php.

Referenced by setupXMLOutputCharset().

eZWebDAVServer::storeUploadedFile ( target) [protected]

Will try to store the uploaded to a temporary location using $target for name.

Returns:
The name of the temp file or false if it failed.

Definition at line 633 of file ezwebdavserver.php.

Referenced by processClientRequest().

static eZWebDAVServer::tempDirectory ( ) [static]
Returns:
the path to the WebDAV temporary directory

If the directory does not exist yet, it will be created first.

Definition at line 1044 of file ezwebdavserver.php.

Referenced by storeUploadedFile().

Returns:
pattern for 'preg_match'. The pattern is built from 'userAgentSettings'.

Definition at line 996 of file ezwebdavserver.php.

Referenced by setupXMLOutputCharset().

Returns:
a list of different settings for known user-agents.

Definition at line 1018 of file ezwebdavserver.php.

Referenced by setupXMLOutputCharset(), and userAgentPattern().

Returns:
The XML body text for the current request.

Definition at line 660 of file ezwebdavserver.php.

Referenced by processClientRequest().

Returns:
charset for outputted xml

Definition at line 975 of file ezwebdavserver.php.

Referenced by outputCollectionContent(), and setXMLOutputCharset().


Member Data Documentation

eZWebDAVServer::$ServerRootDir = ""

Definition at line 1071 of file ezwebdavserver.php.

eZWebDAVServer::$XMLBodyRead = false

Definition at line 1072 of file ezwebdavserver.php.

eZWebDAVServer::$XMLOutputCharset = 'utf-8'

Definition at line 1073 of file ezwebdavserver.php.

const eZWebDAVServer::CTIME_FORMAT = "Y-m-d\\TH:i:s\\Z"

Definition at line 71 of file ezwebdavserver.php.

Referenced by outputCollectionContent().

Definition at line 65 of file ezwebdavserver.php.

Referenced by handle().

Definition at line 64 of file ezwebdavserver.php.

Referenced by handle().

Definition at line 63 of file ezwebdavserver.php.

Referenced by handle().

Definition at line 66 of file ezwebdavserver.php.

Referenced by handle().

const eZWebDAVServer::MTIME_FORMAT = "D, d M Y H:i:s"

Definition at line 72 of file ezwebdavserver.php.

Referenced by outputCollectionContent().

Definition at line 56 of file ezwebdavserver.php.

Referenced by handle().

const eZWebDAVServer::TEMP_FILE_PREFIX = "eZWebDAVUpload_"

Definition at line 75 of file ezwebdavserver.php.


The documentation for this class was generated from the following file: