Overview

Packages

  • None
  • Rpc

Classes

  • Horde_Rpc
  • Horde_Rpc_ActiveSync
  • Horde_Rpc_Exception
  • Horde_Rpc_Phpgw
  • Horde_Rpc_Soap
  • Horde_Rpc_Syncml
  • Horde_Rpc_Syncml_Wbxml
  • Horde_Rpc_Translation
  • Horde_Rpc_Webdav
  • Horde_Rpc_Webdav2
  • Horde_Rpc_Xmlrpc
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Rpc_Webdav

The Horde_Rpc_Webdav class provides a WebDAV implementation of the Horde RPC system.

Copyright 2008-2012 Horde LLC (http://www.horde.org/)

Derived from the HTTP_WebDAV_Server PEAR package: +------------------------------------------------------------------------+ | Portions Copyright 2002-2007 Christian Stocker, Hartmut Holzgraefe | | All rights reserved | | | | Redistribution and use in source and binary forms, with or without | | modification, are permitted provided that the following conditions | | are met: | | | | 1. Redistributions of source code must retain the above copyright | | notice, this list of conditions and the following disclaimer. | | 2. Redistributions in binary form must reproduce the above copyright | | notice, this list of conditions and the following disclaimer in | | the documentation and/or other materials provided with the | | distribution. | | 3. The names of the authors may not be used to endorse or promote | | products derived from this software without specific prior | | written permission. | | | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | POSSIBILITY OF SUCH DAMAGE. | +------------------------------------------------------------------------+

Portions Copyright 2004-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Horde_Rpc
Extended by Horde_Rpc_Webdav
Package: Rpc
Author: Chuck Hagenbuch chuck@horde.org
Author: Ben Klang ben@alkaloid.net
Author: Hartmut Holzgraefe
Author: Christian Stocker
Located at Horde/Rpc/Webdav.php
Methods summary
public Horde_Rpc
# __construct( Horde_Controller_Request_Http $request, array $params = array() )

WebDav server constructor.

WebDav server constructor.

Parameters

$request
request object
$params
<p>A hash containing any additional configuration or connection parameters a subclass might need.</p>

Returns

Horde_Rpc
An RPC server instance.

Overrides

Horde_Rpc::__construct()
public boolean
# authorize( )

WebDAV handles authentication internally, so bypass the system-level auth check by just returning true here.

WebDAV handles authentication internally, so bypass the system-level auth check by just returning true here.

Returns

boolean

Returns true if authentication is successful. Should send appropriate "not authorized" headers or other response codes/body if auth fails, and take care of exiting.

Overrides

Horde_Rpc::authorize()
public mixed
# getInput( )

If the webdav backend is used, the input should not be read, it is being read by HTTP_WebDAV_Server.

If the webdav backend is used, the input should not be read, it is being read by HTTP_WebDAV_Server.

Returns

mixed
The input - a string (default), a filehandle, etc.

Overrides

Horde_Rpc::getInput()
public string
# getResponse( string $request )

Sends an RPC request to the server and returns the result.

Sends an RPC request to the server and returns the result.

Parameters

$request
raw request string.

Returns

string
The XML encoded response from the server.

Overrides

Horde_Rpc::getResponse()
public string|boolean
# GET( array & $options )

GET implementation.

GET implementation.

Parameters

$options
<p>Array of input and output parameters. <br><strong>input</strong></p> <ul> <li> path - </ul> <br><strong>output</strong> <ul> <li> size - </ul>

Returns

string|boolean
HTTP-Statuscode.
public string|boolean
# PUT( array & $options )

PUT implementation.

PUT implementation.

Parameters

$options
$options Parameter passing array.

Returns

string|boolean
HTTP-Statuscode.
public string|boolean
# DELETE( array $options )

Performs a WebDAV DELETE.

Performs a WebDAV DELETE.

Deletes a single object from a database. The path passed in must be in [app]/[path] format.

Parameters

$options
<p>An array of parameters from the setup method in HTTP_WebDAV_Server.</p>

Returns

string|boolean
HTTP-Statuscode.

See

HTTP_WebDAV_Server::http_DELETE()
public boolean
# PROPFIND( array $options, array & $files )

PROPFIND method handler

PROPFIND method handler

Parameters

$options
General parameter passing array.
$files
$files Return array for file properties.

Returns

boolean
True on success.
public string
# MKCOL( array $options )

MKCOL method handler

MKCOL method handler

Parameters

$options

Returns

string
HTTP response string
public string
# MOVE( array $options )

MOVE method handler

MOVE method handler

Parameters

$options

Returns

string
HTTP response string
public mixed
# _list( array $options, boolean $properties )

Generates a response to a GET or PROPFIND request.

Generates a response to a GET or PROPFIND request.

Parameters

$options
Array of WebDAV options
$properties
<p>$propperties Whether to only return properties or actual data.</p>

Returns

mixed

Array of objects with properties if the request is a dir, array of file metadata + data if request is a file, false if the object is not found.

Throws

Horde_Exception
public array
# _getProps( array $reqprops, array $item )

Given a set of requested properties ($reqprops) and an items holding properties, return a list of properties and values from the item that were requested.

Given a set of requested properties ($reqprops) and an items holding properties, return a list of properties and values from the item that were requested.

Parameters

$reqprops
List of requested properties
$item
Item with properties to be filtered

Returns

array
List of filtered properties and values
public integer
# LOCK( array & $params )

Attempts to set a lock on a specified resource.

Attempts to set a lock on a specified resource.

Parameters

$params
<p>$params Reference to array of parameters. These parameters should be overwritten with the lock information.</p>

Returns

integer
HTTP status code
public integer
# UNLOCK( array & $params )

Attempts to remove a specified lock.

Attempts to remove a specified lock.

Parameters

$params
<p>$params Reference to array of parameters. These parameters should be overwritten with the lock information.</p>

Returns

integer
HTTP status code
public
# checkLock( mixed $resource )
public boolean
# check_auth( string $type, string $username, string $password )

Check authentication. We always return true here since we handle permissions based on the resource that's requested, but we do record the authenticated user for later use.

Check authentication. We always return true here since we handle permissions based on the resource that's requested, but we do record the authenticated user for later use.

Parameters

$type
Authentication type, e.g. "basic" or "digest"
$username
Transmitted username.
$password
Transmitted password.

Returns

boolean
Authentication status. Always true.
public integer
# _checkHTTPcode( integer $code )

Make sure the error code returned in the PEAR_Error object is a valid HTTP response code.

Make sure the error code returned in the PEAR_Error object is a valid HTTP response code.

This is necessary because in pre-Horde 3.2 apps the response codes are not sanitized. This backward compatibility check can be removed when we drop support for pre-3.2 apps. Intentionally, not every valid HTTP code is listed here. Only common ones are here to reduce the possibility of an invalid code being confused with a valid HTTP code.

Parameters

$code
Status code to check for validity.

Returns

integer

Either the original code if valid or 500 for internal server error.

public
# ServeRequest( )

Serve WebDAV HTTP request

Serve WebDAV HTTP request

dispatch WebDAV HTTP request to the apropriate method handler

public
# http_OPTIONS( )

OPTIONS method handler

OPTIONS method handler

The OPTIONS method handler creates a valid OPTIONS reply including Dav: and Allowed: headers based on the implemented methods found in the actual instance

public
# http_PROPFIND( )

PROPFIND method handler

PROPFIND method handler

public
# http_PROPPATCH( )

PROPPATCH method handler

PROPPATCH method handler

public
# http_MKCOL( )

MKCOL method handler

MKCOL method handler

public
# http_GET( )

GET method handler

GET method handler

Returns

void
public
# _get_ranges( array & $options )

parse HTTP Range: header

parse HTTP Range: header

Parameters

$options
array to store result in
public
# _multipart_byterange_header( string $mimetype = false, integer $from = false, integer $to = false, integer $total = false )

generate separator headers for multipart response

generate separator headers for multipart response

first and last call happen without parameters to generate the initial header and closing sequence, all calls inbetween require content mimetype, start and end byte position and optionaly the total byte length of the requested resource

Parameters

$mimetype
mimetype
$from
byte position
$to
byte position
$total
resource byte size
public
# http_HEAD( )

HEAD method handler

HEAD method handler

public
# http_PUT( )

PUT method handler

PUT method handler

public
# http_DELETE( )

DELETE method handler

DELETE method handler

public
# http_COPY( )

COPY method handler

COPY method handler

public
# http_MOVE( )

MOVE method handler

MOVE method handler

public
# http_LOCK( )

LOCK method handler

LOCK method handler

public
# http_UNLOCK( )

UNLOCK method handler

UNLOCK method handler

public
# _copymove( mixed $what )
public array
# _allow( )

check for implemented HTTP methods

check for implemented HTTP methods

Returns

array
something
public array
# mkprop( )

helper for property element creation

helper for property element creation

Returns

array
property array
public boolean
# _check_auth( )

check authentication if check is implemented

check authentication if check is implemented

Returns

boolean
true if authentication succeded or not necessary
public string
# _new_locktoken( )

create a new opaque lock token as defined in RFC2518

create a new opaque lock token as defined in RFC2518

Returns

string
new RFC2518 opaque lock token
public array
# _if_header_lexer( string $string, integer & $pos )

Parameters

$string
string to parse
$pos
parsing position

Returns

array
next token (type and value)
public array
# _if_header_parser( string $str )

parse If: header

parse If: header

Parameters

$str
string

Returns

array
URIs and their conditions
public
# _check_if_header_conditions( )

check if conditions from "If:" headers are meat

check if conditions from "If:" headers are meat

the "If:" header is an extension to HTTP/1.1 defined in RFC 2518 section 9.4

public
# _check_uri_condition( string $uri, string $condition )

Check a single URI condition parsed from an if-header

Check a single URI condition parsed from an if-header

Check a single URI condition parsed from an if-header

Parameters

$uri
URI to check
$condition
Condition to check for this URI

Returns

bool Condition check result
public
# _check_lock_status( string $path, boolean $exclusive_only = false )

Parameters

$path
of resource to check
$exclusive_only
lock?
public string
# lockdiscovery( string $path )

Generate lockdiscovery reply from checklock() result

Generate lockdiscovery reply from checklock() result

Parameters

$path
path to check

Returns

string
lockdiscovery response
public
# http_status( string $status )

set HTTP return status and mirror it in a private header

set HTTP return status and mirror it in a private header

Parameters

$status
code and message
public string
# _urlencode( string $url )

private minimalistic version of PHP urlencode()

private minimalistic version of PHP urlencode()

only blanks, percent and XML special chars must be encoded here full urlencode() encoding confuses some clients ...

Parameters

$url
to encode

Returns

string
encoded URL
public string
# _urldecode( string $path )

private version of PHP urldecode

private version of PHP urldecode

not really needed but added for completenes

Parameters

$path
to decode

Returns

string
decoded URL
public
# _slashify( string $path )

Slashify - make sure path ends in a slash

Slashify - make sure path ends in a slash

Parameters

$path
path

Returns

string directory path wiht trailing slash
public
# _unslashify( string $path )

Unslashify - make sure path doesn't in a slash

Unslashify - make sure path doesn't in a slash

Parameters

$path
path

Returns

string directory path wihtout trailing slash
public string
# _mergePaths( string $parent, string $child )

Merge two paths, make sure there is exactly one slash between them

Merge two paths, make sure there is exactly one slash between them

Parameters

$parent
path
$child
path

Returns

string
merged path
public
# _prop2xml( mixed $prop )
public integer
# bytes( string $str )

mbstring.func_overload save strlen version: counting the bytes not the chars

mbstring.func_overload save strlen version: counting the bytes not the chars

Parameters

$str

Returns

integer
public
# _parse_propfind( mixed $path )
public
# _startPropinfoElement( resource $parser, string $name, array $attrs )

start tag handler

start tag handler

Parameters

$parser
parser
$name
name
$attrs
attributes
public
# _endPropinfoElement( resource $parser, string $name )

end tag handler

end tag handler

Parameters

$parser
parser
$name
name
public
# _parse_lockinfo( mixed $path )
public
# _startLockElement( resource $parser, string $name, array $attrs )

tag start handler

tag start handler

Parameters

$parser
parser
$name
name
$attrs
attributes
public
# _lockData( resource $parser, string $data )

data handler

data handler

Parameters

$parser
parser
$data
data
public
# _endLockElement( resource $parser, string $name )

tag end handler

tag end handler

Parameters

$parser
parser
$name
name
public
# _parse_proppatch( mixed $path )
public
# _startProppatchElement( resource $parser, string $name, array $attrs )

tag start handler

tag start handler

Parameters

$parser
parser
$name
name
$attrs
attributes
public
# _endProppatchElement( resource $parser, string $name )

tag end handler

tag end handler

Parameters

$parser
parser
$name
name
public
# _proppatchData( resource $parser, string $data )

input data handler

input data handler

Parameters

$parser
parser
$data
data
Methods inherited from Horde_Rpc
factory(), getResponseContentType(), request(), sendOutput()
Constants summary
string CALDAVNS

CalDAV XML namespace

CalDAV XML namespace

# 'urn:ietf:params:xml:ns:caldav'
Properties summary
public string $http_auth_realm

Realm string to be used in authentification popups

Realm string to be used in authentification popups

# 'Horde WebDAV'
public string $dav_powered_by

String to be used in "X-Dav-Powered-By" header

String to be used in "X-Dav-Powered-By" header

# 'Horde WebDAV Server'
public boolean $parseSuccess

success state flag

success state flag

# false
public array $parseProps

found properties are collected here

found properties are collected here

# false
public integer $parseDepth

internal tag nesting depth counter

internal tag nesting depth counter

# 0
public string $locktype

lock type, currently only "write"

lock type, currently only "write"

# ""
public string $lockscope

lock scope, "shared" or "exclusive"

lock scope, "shared" or "exclusive"

# ""
public string $owner

lock owner information

lock owner information

# ""
public boolean $collect_owner

flag that is set during lock owner read

flag that is set during lock owner read

# false
public mixed $mode
#
public mixed $current
#
public string $uri

complete URI for this request

complete URI for this request

#
public string $base_uri

base URI for this request

base URI for this request

#
public string $path

URI path for this request

URI path for this request

#
public array $_if_header_uris

Remember parsed If: (RFC2518/9.4) header conditions

Remember parsed If: (RFC2518/9.4) header conditions

# array()
public string $_http_status

HTTP response status/message

HTTP response status/message

# "200 OK"
public array $_SERVER

Copy of $_SERVER superglobal array

Copy of $_SERVER superglobal array

Derived classes may extend the constructor to modify its contents

#
public array $ns_hash

Mapping of XML namespaces to their XML nickname

Mapping of XML namespaces to their XML nickname

# array('DAV:' => 'D')
public object $_xml

Xml_Element object

Xml_Element object

#
Properties inherited from Horde_Rpc
$_params, $_requestMissingAuthorization, $_requireAuthorization
API documentation generated by ApiGen