eZPublish  4.7
eZWebDAVServer Class Reference

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

+ Inheritance diagram for eZWebDAVServer:

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

Member Function Documentation

eZWebDAVServer::copy (   $source,
  $destination 
)

Copies the element $source to destination $destination

Returns
The WebDAV status code

Referenced by processClientRequest(), and storeUploadedFile().

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

Referenced by outputCollectionContent(), and setupXMLOutputCharset().

eZWebDAVServer::delete (   $target)

Removes the element $target.

Returns
The WebDAV status code
eZWebDAVServer::eZWebDAVServer ( )

Constructor of eZWebDAVServer; disables PHP error messages.

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

eZWebDAVServer::flushXMLBody ( )
Returns
The XML body text for the current request.

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.
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.

Referenced by processClientRequest().

eZWebDAVServer::handle (   $status)
protected

Handles return values and sends necessary/corresponding headers.

Referenced by processClientRequest().

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

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

Referenced by processClientRequest().

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

Referenced by appendLogEntry(), and eZWebDavCheckLogSetting().

eZWebDAVServer::mkcol (   $target)

Create a new collection (folder) named $target.

Returns
The WebDAV status code

Referenced by processClientRequest().

eZWebDAVServer::move (   $source,
  $destination 
)

Moves the element $source to destination $destination

Returns
The WebDAV status code

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.

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

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

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

Referenced by eZWebDAVContentServer\outputSendDataToClient(), and processClientRequest().

eZWebDAVServer::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).

Referenced by eZWebDAVContentServer\processClientRequest().

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.

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

Referenced by processClientRequest().

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

Referenced by outputCollectionContent().

static eZWebDAVServer::rootDirectory ( )
static
eZWebDAVServer::setServerRoot (   $rootDir)
eZWebDAVServer::setupXMLOutputCharset ( )

Sets charset for outputted xml by 'userAgent'

Referenced by eZWebDAVServer().

eZWebDAVServer::setXMLOutputCharset (   $charset)

Sets charset for outputted xml.

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.

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.

Referenced by storeUploadedFile().

eZWebDAVServer::userAgentPattern ( )
static
Returns
pattern for 'preg_match'. The pattern is built from 'userAgentSettings'.

Referenced by setupXMLOutputCharset().

eZWebDAVServer::userAgentSettings ( )
static
Returns
a list of different settings for known user-agents.

Referenced by setupXMLOutputCharset(), and userAgentPattern().

eZWebDAVServer::xmlBody ( )
Returns
The XML body text for the current request.

Referenced by processClientRequest().

eZWebDAVServer::XMLOutputCharset ( )
Returns
charset for outputted xml

Referenced by outputCollectionContent(), and setXMLOutputCharset().

Member Data Documentation

eZWebDAVServer::$ServerRootDir = ""
eZWebDAVServer::$XMLBodyRead = false
eZWebDAVServer::$XMLOutputCharset = 'utf-8'

Referenced by XMLOutputCharset().

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

Referenced by outputCollectionContent().

const eZWebDAVServer::FAILED_BAD_GATEWAY = 36

Referenced by handle().

const eZWebDAVServer::FAILED_LOCKED = 35

Referenced by handle().

const eZWebDAVServer::FAILED_PRECONDITION = 34

Referenced by handle().

const eZWebDAVServer::FAILED_STORAGE_FULL = 37

Referenced by handle().

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

Referenced by outputCollectionContent().

const eZWebDAVServer::OK = 10
const eZWebDAVServer::OK_OVERWRITE = 13

Referenced by handle().

const eZWebDAVServer::OK_SILENT = 11
const eZWebDAVServer::TEMP_FILE_PREFIX = "eZWebDAVUpload_"

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