Moodle  2.2.1
http://www.collinsharper.com
webdav_client Class Reference

Public Member Functions

 __construct ($server= '', $user= '', $pass= '', $auth=false)
 __set ($key, $value)
 set_protocol ($version)
 iso8601totime ($iso8601)
 open ()
 close ()
 check_webdav ()
 options ()
 mkcol ($path)
 get ($path, &$buffer)
 put ($path, $data)
 put_file ($path, $filename)
 get_file ($srcpath, $localpath)
 copy_file ($src_path, $dst_path, $overwrite)
 copy_coll ($src_path, $dst_path, $overwrite)
 move ($src_path, $dst_path, $overwrite)
 lock ($path)
 unlock ($path, $locktoken)
 delete ($path)
 ls ($path)
 gpi ($path)
 is_file ($path)
 is_dir ($path)
 mput ($filelist)
 mget ($filelist)

Detailed Description

Definition at line 36 of file webdavlib.php.


Constructor & Destructor Documentation

__construct ( server = '',
user = '',
pass = '',
auth = false 
)

#@- Constructor - Initialise class variables

Definition at line 82 of file webdavlib.php.


Member Function Documentation

__set ( key,
value 
)

Definition at line 92 of file webdavlib.php.

Check's if server is a webdav compliant server. True if server returns a DAV Element in Header and when schema 1,2 is supported.

Returns:
bool true if server is webdav server. Otherwise false.

Definition at line 185 of file webdavlib.php.

Here is the call graph for this function:

close ( )

Closes an open socket.

Definition at line 173 of file webdavlib.php.

copy_coll ( src_path,
dst_path,
overwrite 
)

Public method copy_coll

Copies a collection on a webdav server

Duplicates a collection on the webdav server (serverside). All work is done on the webdav server. If you set param overwrite as true, the target will be overwritten.

Parameters:
stringsrc_path, string dest_path, bool overwrite
Returns:
int status code (look at rfc 2518). false on error.

Definition at line 467 of file webdavlib.php.

copy_file ( src_path,
dst_path,
overwrite 
)

Public method copy_file

Copies a file on a webdav server

Duplicates a file on the webdav server (serverside). All work is done on the webdav server. If you set param overwrite as true, the target will be overwritten.

Parameters:
stringsrc_path, string dest_path, bool overwrite
Returns:
int status code (look at rfc 2518). false on error.

Definition at line 419 of file webdavlib.php.

delete ( path)

Public method delete

deletes a collection/directory on a webdav server

Parameters:
stringpath
Returns:
int status code (look at rfc 2518). false on error.

Definition at line 687 of file webdavlib.php.

get ( path,
&$  buffer 
)

Public method get

Gets a file from a webdav collection.

Parameters:
stringpath, string &buffer
Returns:
status code and &$buffer (by reference) with response data from server on success. False on error.

Definition at line 265 of file webdavlib.php.

get_file ( srcpath,
localpath 
)

Public method get_file

Gets a file from a collection into local filesystem.

fopen() is used.

Parameters:
stringsrcpath, string localpath
Returns:
true on success. false on error.

Definition at line 387 of file webdavlib.php.

Here is the caller graph for this function:

gpi ( path)

Public method gpi

Get's path information from webdav server for one element.

Parameters:
stringpath
Returns:
array dirinfo. false on error

Definition at line 848 of file webdavlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

is_dir ( path)

Public method is_dir

Gather whether a path points to a directory

Parameters:
stringpath return bool true or false

Definition at line 898 of file webdavlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

is_file ( path)

Public method is_file

Gathers whether a path points to a file or not.

Parameters:
stringpath
Returns:
bool true or false

Definition at line 880 of file webdavlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

iso8601totime ( iso8601)

Convert ISO 8601 Date and Time Profile used in RFC 2518 to an unix timestamp. private

Parameters:
stringiso8601
Returns:
unixtimestamp on sucess. Otherwise false.

Definition at line 117 of file webdavlib.php.

lock ( path)

Public method lock

Locks a file or collection.

Lock uses this->_user as lock owner.

Parameters:
stringpath
Returns:
int status code (look at rfc 2518). false on error.

Definition at line 576 of file webdavlib.php.

ls ( path)

Public method ls

Get's directory information from webdav server into flat a array using PROPFIND

All filenames are UTF-8 encoded. Have a look at _propfind_startElement what keys are used in array returned.

Parameters:
stringpath
Returns:
array dirinfo, false on error

Definition at line 760 of file webdavlib.php.

Here is the caller graph for this function:

mget ( filelist)

Public method mget

Gets multiple files and directories.

FileList must be in format array("remotepath" => "localpath"). Filenames are UTF-8 encoded.

Parameters:
arrayfilelist
Returns:
bool true on succes, other int status code on error

Definition at line 976 of file webdavlib.php.

Here is the call graph for this function:

mkcol ( path)

Public method mkcol

Creates a new collection/directory on a webdav server

Parameters:
stringpath
Returns:
int status code received as reponse from webdav server (see rfc 2518)

seems to be http ... proceed just return what server gave us rfc 2518 says: 201 (Created) - The collection or structured resource was created in its entirety. 403 (Forbidden) - This indicates at least one of two conditions: 1) the server does not allow the creation of collections at the given location in its namespace, or 2) the parent collection of the Request-URI exists but cannot accept members. 405 (Method Not Allowed) - MKCOL can only be executed on a deleted/non-existent resource. 409 (Conflict) - A collection cannot be made at the Request-URI until one or more intermediate collections have been created. 415 (Unsupported Media Type)- The server does not support the request type of the body. 507 (Insufficient Storage) - The resource does not have sufficient space to record the state of the resource after the execution of this method.

Definition at line 228 of file webdavlib.php.

Here is the caller graph for this function:

move ( src_path,
dst_path,
overwrite 
)

Public method move

Moves a file or collection on webdav server (serverside)

If you set param overwrite as true, the target will be overwritten.

Parameters:
stringsrc_path, string dest_path, bool overwrite
Returns:
int status code (look at rfc 2518). false on error.

Definition at line 521 of file webdavlib.php.

mput ( filelist)

Public method mput

Puts multiple files and/or directories onto a webdav server.

Filenames should be allready UTF-8 encoded. Param fileList must be in format array("localpath" => "destpath").

Parameters:
arrayfilelist
Returns:
bool true on success. otherwise int status code on error

Definition at line 922 of file webdavlib.php.

Here is the call graph for this function:

open ( )

Open's a socket to a webdav server

Returns:
bool true on success. Otherwise false.

Definition at line 154 of file webdavlib.php.

options ( )

Get options from webdav server.

Returns:
array with all header fields returned from webdav server. false if server does not speak http.

Definition at line 204 of file webdavlib.php.

Here is the caller graph for this function:

put ( path,
data 
)

Public method put

Puts a file into a collection. Data is putted as one chunk!

Parameters:
stringpath, string data
Returns:
int status-code read from webdavserver. False on error.

Definition at line 297 of file webdavlib.php.

put_file ( path,
filename 
)

Public method put_file

Read a file as stream and puts it chunk by chunk into webdav server collection.

Look at php documenation for legal filenames with fopen(); The filename will be translated into utf-8 if not allready in utf-8.

Parameters:
stringtargetpath, string filename
Returns:
int status code. False on error.

Definition at line 336 of file webdavlib.php.

Here is the caller graph for this function:

set_protocol ( version)

Set which HTTP protocol will be used. Value 1 defines that HTTP/1.1 should be used (Keeps Connection to webdav server alive). Otherwise HTTP/1.0 will be used.

Parameters:
intversion

Definition at line 103 of file webdavlib.php.

unlock ( path,
locktoken 
)

Public method unlock

Unlocks a file or collection.

Parameters:
stringpath, string locktoken
Returns:
int status code (look at rfc 2518). false on error.

Definition at line 661 of file webdavlib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations