summaryrefslogtreecommitdiffstats
path: root/3rdparty/Sabre/DAV
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/Sabre/DAV')
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php14
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php32
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/Apache.php22
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/File.php33
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/PDO.php35
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/IBackend.php12
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Plugin.php60
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/GuessContentType.php26
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php31
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/Plugin.php488
-rwxr-xr-x3rdparty/Sabre/DAV/Browser/assets/favicon.icobin0 -> 4286 bytes
-rwxr-xr-x3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.pngbin0 -> 7232 bytes
-rwxr-xr-x3rdparty/Sabre/DAV/Browser/assets/icons/calendar.pngbin0 -> 4388 bytes
-rwxr-xr-x3rdparty/Sabre/DAV/Browser/assets/icons/card.pngbin0 -> 5695 bytes
-rwxr-xr-x3rdparty/Sabre/DAV/Browser/assets/icons/collection.pngbin0 -> 3474 bytes
-rwxr-xr-x3rdparty/Sabre/DAV/Browser/assets/icons/file.pngbin0 -> 2837 bytes
-rwxr-xr-x3rdparty/Sabre/DAV/Browser/assets/icons/parent.pngbin0 -> 3474 bytes
-rwxr-xr-x3rdparty/Sabre/DAV/Browser/assets/icons/principal.pngbin0 -> 5480 bytes
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Client.php163
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Collection.php60
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Directory.php2
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception.php25
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/BadRequest.php10
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/Conflict.php4
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/ConflictingLock.php12
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/FileNotFound.php19
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/Forbidden.php6
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/InsufficientStorage.php6
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/InvalidResourceType.php14
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php12
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/Locked.php26
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php11
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/NotAuthenticated.php8
-rwxr-xr-x3rdparty/Sabre/DAV/Exception/NotFound.php28
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/NotImplemented.php8
-rwxr-xr-x3rdparty/Sabre/DAV/Exception/PaymentRequired.php28
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/PreconditionFailed.php36
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php6
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php10
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php10
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FS/Directory.php79
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FS/File.php40
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FS/Node.php37
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FSExt/Directory.php85
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FSExt/File.php33
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FSExt/Node.php118
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/File.php38
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/ICollection.php62
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/IExtendedCollection.php8
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/IFile.php48
-rw-r--r--3rdparty/Sabre/DAV/ILockable.php38
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/INode.php22
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/IProperties.php16
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/IQuota.php10
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Backend/Abstract.php34
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Backend/FS.php62
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Backend/File.php64
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Backend/PDO.php66
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/LockInfo.php38
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Plugin.php227
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Mount/Plugin.php33
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Node.php16
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/ObjectTree.php63
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property.php6
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/GetLastModified.php36
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/Href.php50
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/HrefList.php46
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/IHref.php10
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/LockDiscovery.php44
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/ResourceType.php56
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/Response.php65
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/ResponseList.php31
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/SupportedLock.php22
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/SupportedReportSet.php39
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Server.php506
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/ServerPlugin.php38
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/SimpleCollection.php47
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/SimpleDirectory.php4
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/SimpleFile.php57
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/StringUtil.php34
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php104
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Tree.php77
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Tree/Filesystem.php57
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/URLUtil.php62
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/UUIDUtil.php20
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Version.php6
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/XMLUtil.php45
-rwxr-xr-x3rdparty/Sabre/DAV/includes.php97
88 files changed, 2227 insertions, 1826 deletions
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php b/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php
index 11bab8c7af7..1e89b84f9a1 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php
@@ -8,9 +8,9 @@
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author James David Low (http://jameslow.com/)
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
abstract class Sabre_DAV_Auth_Backend_AbstractBasic implements Sabre_DAV_Auth_IBackend {
@@ -28,6 +28,8 @@ abstract class Sabre_DAV_Auth_Backend_AbstractBasic implements Sabre_DAV_Auth_IB
* This method should return true or false depending on if login
* succeeded.
*
+ * @param string $username
+ * @param string $password
* @return bool
*/
abstract protected function validateUserPass($username, $password);
@@ -47,13 +49,15 @@ abstract class Sabre_DAV_Auth_Backend_AbstractBasic implements Sabre_DAV_Auth_IB
/**
* Authenticates the user based on the current request.
*
- * If authentication is succesful, true must be returned.
+ * If authentication is successful, true must be returned.
* If authentication fails, an exception must be thrown.
*
+ * @param Sabre_DAV_Server $server
+ * @param string $realm
* @throws Sabre_DAV_Exception_NotAuthenticated
* @return bool
*/
- public function authenticate(Sabre_DAV_Server $server,$realm) {
+ public function authenticate(Sabre_DAV_Server $server, $realm) {
$auth = new Sabre_HTTP_BasicAuth();
$auth->setHTTPRequest($server->httpRequest);
@@ -75,5 +79,5 @@ abstract class Sabre_DAV_Auth_Backend_AbstractBasic implements Sabre_DAV_Auth_IB
}
-}
+}
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php b/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php
index 5bdc72753ec..9833928b976 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php
@@ -4,12 +4,12 @@
* HTTP Digest authentication backend class
*
* This class can be used by authentication objects wishing to use HTTP Digest
- * Most of the digest logic is handled, implementors just need to worry about
- * the getDigestHash method
+ * Most of the digest logic is handled, implementors just need to worry about
+ * the getDigestHash method
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -17,7 +17,7 @@ abstract class Sabre_DAV_Auth_Backend_AbstractDigest implements Sabre_DAV_Auth_I
/**
* This variable holds the currently logged in username.
- *
+ *
* @var array|null
*/
protected $currentUser;
@@ -25,24 +25,26 @@ abstract class Sabre_DAV_Auth_Backend_AbstractDigest implements Sabre_DAV_Auth_I
/**
* Returns a users digest hash based on the username and realm.
*
- * If the user was not known, null must be returned.
- *
+ * If the user was not known, null must be returned.
+ *
* @param string $realm
- * @param string $username
- * @return string|null
+ * @param string $username
+ * @return string|null
*/
- abstract public function getDigestHash($realm,$username);
+ abstract public function getDigestHash($realm, $username);
/**
* Authenticates the user based on the current request.
*
- * If authentication is succesful, true must be returned.
+ * If authentication is successful, true must be returned.
* If authentication fails, an exception must be thrown.
*
+ * @param Sabre_DAV_Server $server
+ * @param string $realm
* @throws Sabre_DAV_Exception_NotAuthenticated
- * @return bool
+ * @return bool
*/
- public function authenticate(Sabre_DAV_Server $server,$realm) {
+ public function authenticate(Sabre_DAV_Server $server, $realm) {
$digest = new Sabre_HTTP_DigestAuth();
@@ -83,9 +85,9 @@ abstract class Sabre_DAV_Auth_Backend_AbstractDigest implements Sabre_DAV_Auth_I
}
/**
- * Returns the currently logged in username.
- *
- * @return string|null
+ * Returns the currently logged in username.
+ *
+ * @return string|null
*/
public function getCurrentUser() {
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/Apache.php b/3rdparty/Sabre/DAV/Auth/Backend/Apache.php
index 6bcd76bdcb0..d4294ea4d86 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/Apache.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/Apache.php
@@ -4,34 +4,36 @@
* Apache authenticator
*
* This authentication backend assumes that authentication has been
- * conifgured in apache, rather than within SabreDAV.
+ * configured in apache, rather than within SabreDAV.
*
* Make sure apache is properly configured for this to work.
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Auth_Backend_Apache implements Sabre_DAV_Auth_IBackend {
/**
- * Current apache user
- *
- * @var string
+ * Current apache user
+ *
+ * @var string
*/
protected $remoteUser;
-
+
/**
* Authenticates the user based on the current request.
*
- * If authentication is succesful, true must be returned.
+ * If authentication is successful, true must be returned.
* If authentication fails, an exception must be thrown.
*
- * @return bool
+ * @param Sabre_DAV_Server $server
+ * @param string $realm
+ * @return bool
*/
- public function authenticate(Sabre_DAV_Server $server,$realm) {
+ public function authenticate(Sabre_DAV_Server $server, $realm) {
$remoteUser = $server->httpRequest->getRawServerValue('REMOTE_USER');
if (is_null($remoteUser)) {
@@ -47,7 +49,7 @@ class Sabre_DAV_Auth_Backend_Apache implements Sabre_DAV_Auth_IBackend {
* Returns information about the currently logged in user.
*
* If nobody is currently logged in, this method should return null.
- *
+ *
* @return array|null
*/
public function getCurrentUser() {
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/File.php b/3rdparty/Sabre/DAV/Auth/Backend/File.php
index db1f04c4772..de308d64a67 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/File.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/File.php
@@ -4,29 +4,28 @@
* This is an authentication backend that uses a file to manage passwords.
*
* The backend file must conform to Apache's htdigest format
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Auth_Backend_File extends Sabre_DAV_Auth_Backend_AbstractDigest {
/**
- * List of users
- *
+ * List of users
+ *
* @var array
*/
protected $users = array();
/**
- * Creates the backend object.
+ * Creates the backend object.
*
* If the filename argument is passed in, it will parse out the specified file fist.
- *
- * @param string $filename
- * @return void
+ *
+ * @param string|null $filename
*/
public function __construct($filename=null) {
@@ -38,22 +37,22 @@ class Sabre_DAV_Auth_Backend_File extends Sabre_DAV_Auth_Backend_AbstractDigest
/**
* Loads an htdigest-formatted file. This method can be called multiple times if
* more than 1 file is used.
- *
- * @param string $filename
+ *
+ * @param string $filename
* @return void
*/
public function loadFile($filename) {
foreach(file($filename,FILE_IGNORE_NEW_LINES) as $line) {
- if (substr_count($line, ":") !== 2)
+ if (substr_count($line, ":") !== 2)
throw new Sabre_DAV_Exception('Malformed htdigest file. Every line should contain 2 colons');
-
+
list($username,$realm,$A1) = explode(':',$line);
if (!preg_match('/^[a-zA-Z0-9]{32}$/', $A1))
throw new Sabre_DAV_Exception('Malformed htdigest file. Invalid md5 hash');
-
+
$this->users[$realm . ':' . $username] = $A1;
}
@@ -62,10 +61,10 @@ class Sabre_DAV_Auth_Backend_File extends Sabre_DAV_Auth_Backend_AbstractDigest
/**
* Returns a users' information
- *
- * @param string $realm
- * @param string $username
- * @return string
+ *
+ * @param string $realm
+ * @param string $username
+ * @return string
*/
public function getDigestHash($realm, $username) {
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/PDO.php b/3rdparty/Sabre/DAV/Auth/Backend/PDO.php
index 0301503601e..eac18a23fbb 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/PDO.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/PDO.php
@@ -4,38 +4,37 @@
* This is an authentication backend that uses a file to manage passwords.
*
* The backend file must conform to Apache's htdigest format
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Auth_Backend_PDO extends Sabre_DAV_Auth_Backend_AbstractDigest {
/**
- * Reference to PDO connection
- *
- * @var PDO
+ * Reference to PDO connection
+ *
+ * @var PDO
*/
protected $pdo;
/**
- * PDO table name we'll be using
- *
+ * PDO table name we'll be using
+ *
* @var string
*/
protected $tableName;
/**
- * Creates the backend object.
+ * Creates the backend object.
*
* If the filename argument is passed in, it will parse out the specified file fist.
- *
- * @param string $filename
- * @param string $tableName The PDO table name to use
- * @return void
+ *
+ * @param PDO $pdo
+ * @param string $tableName The PDO table name to use
*/
public function __construct(PDO $pdo, $tableName = 'users') {
@@ -45,15 +44,15 @@ class Sabre_DAV_Auth_Backend_PDO extends Sabre_DAV_Auth_Backend_AbstractDigest {
}
/**
- * Returns the digest hash for a user.
- *
- * @param string $realm
- * @param string $username
- * @return string|null
+ * Returns the digest hash for a user.
+ *
+ * @param string $realm
+ * @param string $username
+ * @return string|null
*/
public function getDigestHash($realm,$username) {
- $stmt = $this->pdo->prepare('SELECT username, digesta1 FROM `'.$this->tableName.'` WHERE username = ?');
+ $stmt = $this->pdo->prepare('SELECT username, digesta1 FROM '.$this->tableName.' WHERE username = ?');
$stmt->execute(array($username));
$result = $stmt->fetchAll();
diff --git a/3rdparty/Sabre/DAV/Auth/IBackend.php b/3rdparty/Sabre/DAV/Auth/IBackend.php
index 1f67af4c2d9..5be5d1bc93d 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/IBackend.php
+++ b/3rdparty/Sabre/DAV/Auth/IBackend.php
@@ -5,7 +5,7 @@
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -14,18 +14,20 @@ interface Sabre_DAV_Auth_IBackend {
/**
* Authenticates the user based on the current request.
*
- * If authentication is succesful, true must be returned.
+ * If authentication is successful, true must be returned.
* If authentication fails, an exception must be thrown.
*
- * @return bool
+ * @param Sabre_DAV_Server $server
+ * @param string $realm
+ * @return bool
*/
- function authenticate(Sabre_DAV_Server $server,$realm);
+ function authenticate(Sabre_DAV_Server $server,$realm);
/**
* Returns information about the currently logged in username.
*
* If nobody is currently logged in, this method should return null.
- *
+ *
* @return string|null
*/
function getCurrentUser();
diff --git a/3rdparty/Sabre/DAV/Auth/Plugin.php b/3rdparty/Sabre/DAV/Auth/Plugin.php
index f3718fcf469..55a4e391674 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Plugin.php
+++ b/3rdparty/Sabre/DAV/Auth/Plugin.php
@@ -2,48 +2,47 @@
/**
* This plugin provides Authentication for a WebDAV server.
- *
+ *
* It relies on a Backend object, which provides user information.
*
* Additionally, it provides support for:
* * {DAV:}current-user-principal property from RFC5397
* * {DAV:}principal-collection-set property from RFC3744
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Auth_Plugin extends Sabre_DAV_ServerPlugin {
/**
- * Reference to main server object
- *
- * @var Sabre_DAV_Server
+ * Reference to main server object
+ *
+ * @var Sabre_DAV_Server
*/
private $server;
/**
* Authentication backend
- *
- * @var Sabre_DAV_Auth_Backend_Abstract
+ *
+ * @var Sabre_DAV_Auth_IBackend
*/
private $authBackend;
/**
- * The authentication realm.
- *
- * @var string
+ * The authentication realm.
+ *
+ * @var string
*/
private $realm;
/**
- * __construct
- *
- * @param Sabre_DAV_Auth_Backend_Abstract $authBackend
- * @param string $realm
- * @return void
+ * __construct
+ *
+ * @param Sabre_DAV_Auth_IBackend $authBackend
+ * @param string $realm
*/
public function __construct(Sabre_DAV_Auth_IBackend $authBackend, $realm) {
@@ -53,9 +52,9 @@ class Sabre_DAV_Auth_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
- * Initializes the plugin. This function is automatically called by the server
- *
- * @param Sabre_DAV_Server $server
+ * Initializes the plugin. This function is automatically called by the server
+ *
+ * @param Sabre_DAV_Server $server
* @return void
*/
public function initialize(Sabre_DAV_Server $server) {
@@ -67,11 +66,11 @@ class Sabre_DAV_Auth_Plugin extends Sabre_DAV_ServerPlugin {
/**
* Returns a plugin name.
- *
+ *
* Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
+ * using Sabre_DAV_Server::getPlugin
+ *
+ * @return string
*/
public function getPluginName() {
@@ -81,10 +80,10 @@ class Sabre_DAV_Auth_Plugin extends Sabre_DAV_ServerPlugin {
/**
* Returns the current users' principal uri.
- *
- * If nobody is logged in, this will return null.
- *
- * @return string|null
+ *
+ * If nobody is logged in, this will return null.
+ *
+ * @return string|null
*/
public function getCurrentUser() {
@@ -97,10 +96,11 @@ class Sabre_DAV_Auth_Plugin extends Sabre_DAV_ServerPlugin {
/**
* This method is called before any HTTP method and forces users to be authenticated
- *
+ *
* @param string $method
+ * @param string $uri
* @throws Sabre_DAV_Exception_NotAuthenticated
- * @return bool
+ * @return bool
*/
public function beforeMethod($method, $uri) {
diff --git a/3rdparty/Sabre/DAV/Browser/GuessContentType.php b/3rdparty/Sabre/DAV/Browser/GuessContentType.php
index ee8c698d782..b6c00d461cb 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/GuessContentType.php
+++ b/3rdparty/Sabre/DAV/Browser/GuessContentType.php
@@ -10,10 +10,10 @@
* There's really no accurate, fast and portable way to determine the contenttype
* so this extension does what the rest of the world does, and guesses it based
* on the file extension.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -43,9 +43,9 @@ class Sabre_DAV_Browser_GuessContentType extends Sabre_DAV_ServerPlugin {
);
/**
- * Initializes the plugin
- *
- * @param Sabre_DAV_Server $server
+ * Initializes the plugin
+ *
+ * @param Sabre_DAV_Server $server
* @return void
*/
public function initialize(Sabre_DAV_Server $server) {
@@ -57,16 +57,16 @@ class Sabre_DAV_Browser_GuessContentType extends Sabre_DAV_ServerPlugin {
}
/**
- * Handler for teh afterGetProperties event
- *
- * @param string $path
- * @param array $properties
+ * Handler for teh afterGetProperties event
+ *
+ * @param string $path
+ * @param array $properties
* @return void
*/
public function afterGetProperties($path, &$properties) {
if (array_key_exists('{DAV:}getcontenttype', $properties[404])) {
-
+
list(, $fileName) = Sabre_DAV_URLUtil::splitPath($path);
$contentType = $this->getContentType($fileName);
@@ -81,9 +81,9 @@ class Sabre_DAV_Browser_GuessContentType extends Sabre_DAV_ServerPlugin {
/**
* Simple method to return the contenttype
- *
- * @param string $fileName
- * @return string
+ *
+ * @param string $fileName
+ * @return string
*/
protected function getContentType($fileName) {
diff --git a/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php b/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php
index a66b57a3a90..15884887641 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php
+++ b/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php
@@ -1,30 +1,30 @@
<?php
/**
- * This is a simple plugin that will map any GET request for non-files to
+ * This is a simple plugin that will map any GET request for non-files to
* PROPFIND allprops-requests.
*
* This should allow easy debugging of PROPFIND
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Browser_MapGetToPropFind extends Sabre_DAV_ServerPlugin {
/**
- * reference to server class
- *
- * @var Sabre_DAV_Server
+ * reference to server class
+ *
+ * @var Sabre_DAV_Server
*/
protected $server;
/**
- * Initializes the plugin and subscribes to events
- *
- * @param Sabre_DAV_Server $server
+ * Initializes the plugin and subscribes to events
+ *
+ * @param Sabre_DAV_Server $server
* @return void
*/
public function initialize(Sabre_DAV_Server $server) {
@@ -34,21 +34,22 @@ class Sabre_DAV_Browser_MapGetToPropFind extends Sabre_DAV_ServerPlugin {
}
/**
- * This method intercepts GET requests to non-files, and changes it into an HTTP PROPFIND request
- *
- * @param string $method
- * @return bool
+ * This method intercepts GET requests to non-files, and changes it into an HTTP PROPFIND request
+ *
+ * @param string $method
+ * @param string $uri
+ * @return bool
*/
public function httpGetInterceptor($method, $uri) {
if ($method!='GET') return true;
-
+
$node = $this->server->tree->getNodeForPath($uri);
if ($node instanceof Sabre_DAV_IFile) return;
$this->server->invokeMethod('PROPFIND',$uri);
return false;
-
+
}
}
diff --git a/3rdparty/Sabre/DAV/Browser/Plugin.php b/3rdparty/Sabre/DAV/Browser/Plugin.php
index cd5617babb1..09bbdd2ae02 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/Plugin.php
+++ b/3rdparty/Sabre/DAV/Browser/Plugin.php
@@ -6,77 +6,126 @@
* This plugin provides a html representation, so that a WebDAV server may be accessed
* using a browser.
*
- * The class intercepts GET requests to collection resources and generates a simple
- * html index.
- *
+ * The class intercepts GET requests to collection resources and generates a simple
+ * html index.
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
/**
- * reference to server class
- *
- * @var Sabre_DAV_Server
+ * List of default icons for nodes.
+ *
+ * This is an array with class / interface names as keys, and asset names
+ * as values.
+ *
+ * The evaluation order is reversed. The last item in the list gets
+ * precendence.
+ *
+ * @var array
+ */
+ public $iconMap = array(
+ 'Sabre_DAV_IFile' => 'icons/file',
+ 'Sabre_DAV_ICollection' => 'icons/collection',
+ 'Sabre_DAVACL_IPrincipal' => 'icons/principal',
+ 'Sabre_CalDAV_ICalendar' => 'icons/calendar',
+ 'Sabre_CardDAV_IAddressBook' => 'icons/addressbook',
+ 'Sabre_CardDAV_ICard' => 'icons/card',
+ );
+
+ /**
+ * The file extension used for all icons
+ *
+ * @var string
+ */
+ public $iconExtension = '.png';
+
+ /**
+ * reference to server class
+ *
+ * @var Sabre_DAV_Server
*/
protected $server;
/**
- * enableEditing
- *
- * @var bool
+ * enablePost turns on the 'actions' panel, which allows people to create
+ * folders and upload files straight from a browser.
+ *
+ * @var bool
*/
protected $enablePost = true;
/**
+ * By default the browser plugin will generate a favicon and other images.
+ * To turn this off, set this property to false.
+ *
+ * @var bool
+ */
+ protected $enableAssets = true;
+
+ /**
* Creates the object.
*
* By default it will allow file creation and uploads.
* Specify the first argument as false to disable this
- *
- * @param bool $enablePost
- * @return void
+ *
+ * @param bool $enablePost
+ * @param bool $enableAssets
*/
- public function __construct($enablePost=true) {
+ public function __construct($enablePost=true, $enableAssets = true) {
- $this->enablePost = $enablePost;
+ $this->enablePost = $enablePost;
+ $this->enableAssets = $enableAssets;
}
/**
- * Initializes the plugin and subscribes to events
- *
- * @param Sabre_DAV_Server $server
+ * Initializes the plugin and subscribes to events
+ *
+ * @param Sabre_DAV_Server $server
* @return void
*/
public function initialize(Sabre_DAV_Server $server) {
$this->server = $server;
$this->server->subscribeEvent('beforeMethod',array($this,'httpGetInterceptor'));
+ $this->server->subscribeEvent('onHTMLActionsPanel', array($this, 'htmlActionsPanel'),200);
if ($this->enablePost) $this->server->subscribeEvent('unknownMethod',array($this,'httpPOSTHandler'));
}
/**
- * This method intercepts GET requests to collections and returns the html
- *
- * @param string $method
- * @return bool
+ * This method intercepts GET requests to collections and returns the html
+ *
+ * @param string $method
+ * @param string $uri
+ * @return bool
*/
public function httpGetInterceptor($method, $uri) {
- if ($method!='GET') return true;
+ if ($method !== 'GET') return true;
+
+ // We're not using straight-up $_GET, because we want everything to be
+ // unit testable.
+ $getVars = array();
+ parse_str($this->server->httpRequest->getQueryString(), $getVars);
+
+ if (isset($getVars['sabreAction']) && $getVars['sabreAction'] === 'asset' && isset($getVars['assetName'])) {
+ $this->serveAsset($getVars['assetName']);
+ return false;
+ }
- try {
+ try {
$node = $this->server->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
- // We're simply stopping when the file isn't found to not interfere
+ } catch (Sabre_DAV_Exception_NotFound $e) {
+ // We're simply stopping when the file isn't found to not interfere
// with other plugins.
return;
}
- if ($node instanceof Sabre_DAV_IFile)
+ if ($node instanceof Sabre_DAV_IFile)
return;
$this->server->httpResponse->sendStatus(200);
@@ -87,57 +136,71 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
);
return false;
-
+
}
/**
- * Handles POST requests for tree operations
- *
- * This method is not yet used.
- *
- * @param string $method
+ * Handles POST requests for tree operations.
+ *
+ * @param string $method
+ * @param string $uri
* @return bool
*/
public function httpPOSTHandler($method, $uri) {
- if ($method!='POST') return true;
- if (isset($_POST['sabreAction'])) switch($_POST['sabreAction']) {
+ if ($method!='POST') return;
+ $contentType = $this->server->httpRequest->getHeader('Content-Type');
+ list($contentType) = explode(';', $contentType);
+ if ($contentType !== 'application/x-www-form-urlencoded' &&
+ $contentType !== 'multipart/form-data') {
+ return;
+ }
+ $postVars = $this->server->httpRequest->getPostVars();
- case 'mkcol' :
- if (isset($_POST['name']) && trim($_POST['name'])) {
- // Using basename() because we won't allow slashes
- list(, $folderName) = Sabre_DAV_URLUtil::splitPath(trim($_POST['name']));
- $this->server->createDirectory($uri . '/' . $folderName);
- }
- break;
- case 'put' :
- if ($_FILES) $file = current($_FILES);
- else break;
- $newName = trim($file['name']);
- list(, $newName) = Sabre_DAV_URLUtil::splitPath(trim($file['name']));
- if (isset($_POST['name']) && trim($_POST['name']))
- $newName = trim($_POST['name']);
-
- // Making sure we only have a 'basename' component
- list(, $newName) = Sabre_DAV_URLUtil::splitPath($newName);
-
-
- if (is_uploaded_file($file['tmp_name'])) {
- $parent = $this->server->tree->getNodeForPath(trim($uri,'/'));
- $parent->createFile($newName,fopen($file['tmp_name'],'r'));
- }
+ if (!isset($postVars['sabreAction']))
+ return;
+
+ if ($this->server->broadcastEvent('onBrowserPostAction', array($uri, $postVars['sabreAction'], $postVars))) {
+
+ switch($postVars['sabreAction']) {
+
+ case 'mkcol' :
+ if (isset($postVars['name']) && trim($postVars['name'])) {
+ // Using basename() because we won't allow slashes
+ list(, $folderName) = Sabre_DAV_URLUtil::splitPath(trim($postVars['name']));
+ $this->server->createDirectory($uri . '/' . $folderName);
+ }
+ break;
+ case 'put' :
+ if ($_FILES) $file = current($_FILES);
+ else break;
+
+ list(, $newName) = Sabre_DAV_URLUtil::splitPath(trim($file['name']));
+ if (isset($postVars['name']) && trim($postVars['name']))
+ $newName = trim($postVars['name']);
+
+ // Making sure we only have a 'basename' component
+ list(, $newName) = Sabre_DAV_URLUtil::splitPath($newName);
+
+ if (is_uploaded_file($file['tmp_name'])) {
+ $this->server->createFile($uri . '/' . $newName, fopen($file['tmp_name'],'r'));
+ }
+ break;
+
+ }
}
$this->server->httpResponse->setHeader('Location',$this->server->httpRequest->getUri());
+ $this->server->httpResponse->sendStatus(302);
return false;
}
/**
- * Escapes a string for html.
- *
- * @param string $value
- * @return void
+ * Escapes a string for html.
+ *
+ * @param string $value
+ * @return string
*/
public function escapeHTML($value) {
@@ -146,118 +209,199 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
- * Generates the html directory index for a given url
+ * Generates the html directory index for a given url
*
- * @param string $path
- * @return string
+ * @param string $path
+ * @return string
*/
public function generateDirectoryIndex($path) {
+ $version = '';
+ if (Sabre_DAV_Server::$exposeVersion) {
+ $version = Sabre_DAV_Version::VERSION ."-". Sabre_DAV_Version::STABILITY;
+ }
+
$html = "<html>
<head>
- <title>Index for " . $this->escapeHTML($path) . "/ - SabreDAV " . Sabre_DAV_Version::VERSION . "</title>
- <style type=\"text/css\"> body { Font-family: arial}</style>
-</head>
+ <title>Index for " . $this->escapeHTML($path) . "/ - SabreDAV " . $version . "</title>
+ <style type=\"text/css\">
+ body { Font-family: arial}
+ h1 { font-size: 150% }
+ </style>
+ ";
+
+ if ($this->enableAssets) {
+ $html.='<link rel="shortcut icon" href="'.$this->getAssetUrl('favicon.ico').'" type="image/vnd.microsoft.icon" />';
+ }
+
+ $html .= "</head>
<body>
<h1>Index for " . $this->escapeHTML($path) . "/</h1>
<table>
- <tr><th>Name</th><th>Type</th><th>Size</th><th>Last modified</th></tr>
- <tr><td colspan=\"4\"><hr /></td></tr>";
-
- $files = $this->server->getPropertiesForPath($path,array(
- '{DAV:}displayname',
- '{DAV:}resourcetype',
- '{DAV:}getcontenttype',
- '{DAV:}getcontentlength',
- '{DAV:}getlastmodified',
- ),1);
+ <tr><th width=\"24\"></th><th>Name</th><th>Type</th><th>Size</th><th>Last modified</th></tr>
+ <tr><td colspan=\"5\"><hr /></td></tr>";
- $parent = $this->server->tree->getNodeForPath($path);
+ $files = $this->server->getPropertiesForPath($path,array(
+ '{DAV:}displayname',
+ '{DAV:}resourcetype',
+ '{DAV:}getcontenttype',
+ '{DAV:}getcontentlength',
+ '{DAV:}getlastmodified',
+ ),1);
+ $parent = $this->server->tree->getNodeForPath($path);
- if ($path) {
- list($parentUri) = Sabre_DAV_URLUtil::splitPath($path);
- $fullPath = Sabre_DAV_URLUtil::encodePath($this->server->getBaseUri() . $parentUri);
+ if ($path) {
- $html.= "<tr>
-<td><a href=\"{$fullPath}\">..</a></td>
-<td>[parent]</td>
-<td></td>
-<td></td>
-</tr>";
+ list($parentUri) = Sabre_DAV_URLUtil::splitPath($path);
+ $fullPath = Sabre_DAV_URLUtil::encodePath($this->server->getBaseUri() . $parentUri);
- }
+ $icon = $this->enableAssets?'<a href="' . $fullPath . '"><img src="' . $this->getAssetUrl('icons/parent' . $this->iconExtension) . '" width="24" alt="Parent" /></a>':'';
+ $html.= "<tr>
+ <td>$icon</td>
+ <td><a href=\"{$fullPath}\">..</a></td>
+ <td>[parent]</td>
+ <td></td>
+ <td></td>
+ </tr>";
- foreach($files as $k=>$file) {
+ }
- // This is the current directory, we can skip it
- if (rtrim($file['href'],'/')==$path) continue;
+ foreach($files as $file) {
+
+ // This is the current directory, we can skip it
+ if (rtrim($file['href'],'/')==$path) continue;
+
+ list(, $name) = Sabre_DAV_URLUtil::splitPath($file['href']);
+
+ $type = null;
+
+
+ if (isset($file[200]['{DAV:}resourcetype'])) {
+ $type = $file[200]['{DAV:}resourcetype']->getValue();
+
+ // resourcetype can have multiple values
+ if (!is_array($type)) $type = array($type);
+
+ foreach($type as $k=>$v) {
+
+ // Some name mapping is preferred
+ switch($v) {
+ case '{DAV:}collection' :
+ $type[$k] = 'Collection';
+ break;
+ case '{DAV:}principal' :
+ $type[$k] = 'Principal';
+ break;
+ case '{urn:ietf:params:xml:ns:carddav}addressbook' :
+ $type[$k] = 'Addressbook';
+ break;
+ case '{urn:ietf:params:xml:ns:caldav}calendar' :
+ $type[$k] = 'Calendar';
+ break;
+ case '{urn:ietf:params:xml:ns:caldav}schedule-inbox' :
+ $type[$k] = 'Schedule Inbox';
+ break;
+ case '{urn:ietf:params:xml:ns:caldav}schedule-outbox' :
+ $type[$k] = 'Schedule Outbox';
+ break;
+ case '{http://calendarserver.org/ns/}calendar-proxy-read' :
+ $type[$k] = 'Proxy-Read';
+ break;
+ case '{http://calendarserver.org/ns/}calendar-proxy-write' :
+ $type[$k] = 'Proxy-Write';
+ break;
+ }
- list(, $name) = Sabre_DAV_URLUtil::splitPath($file['href']);
+ }
+ $type = implode(', ', $type);
+ }
- $type = null;
+ // If no resourcetype was found, we attempt to use
+ // the contenttype property
+ if (!$type && isset($file[200]['{DAV:}getcontenttype'])) {
+ $type = $file[200]['{DAV:}getcontenttype'];
+ }
+ if (!$type) $type = 'Unknown';
+ $size = isset($file[200]['{DAV:}getcontentlength'])?(int)$file[200]['{DAV:}getcontentlength']:'';
+ $lastmodified = isset($file[200]['{DAV:}getlastmodified'])?$file[200]['{DAV:}getlastmodified']->getTime()->format(DateTime::ATOM):'';
- if (isset($file[200]['{DAV:}resourcetype'])) {
- $type = $file[200]['{DAV:}resourcetype']->getValue();
+ $fullPath = Sabre_DAV_URLUtil::encodePath('/' . trim($this->server->getBaseUri() . ($path?$path . '/':'') . $name,'/'));
- // resourcetype can have multiple values
- if (!is_array($type)) $type = array($type);
+ $displayName = isset($file[200]['{DAV:}displayname'])?$file[200]['{DAV:}displayname']:$name;
- foreach($type as $k=>$v) {
+ $displayName = $this->escapeHTML($displayName);
+ $type = $this->escapeHTML($type);
- // Some name mapping is preferred
- switch($v) {
- case '{DAV:}collection' :
- $type[$k] = 'Collection';
- break;
- case '{DAV:}principal' :
- $type[$k] = 'Principal';
- break;
- case '{urn:ietf:params:xml:ns:carddav}addressbook' :
- $type[$k] = 'Addressbook';
- break;
- case '{urn:ietf:params:xml:ns:caldav}calendar' :
- $type[$k] = 'Calendar';
+ $icon = '';
+
+ if ($this->enableAssets) {
+ $node = $parent->getChild($name);
+ foreach(array_reverse($this->iconMap) as $class=>$iconName) {
+
+ if ($node instanceof $class) {
+ $icon = '<a href="' . $fullPath . '"><img src="' . $this->getAssetUrl($iconName . $this->iconExtension) . '" alt="" width="24" /></a>';
break;
+ }
+
+
}
}
- $type = implode(', ', $type);
- }
- // If no resourcetype was found, we attempt to use
- // the contenttype property
- if (!$type && isset($file[200]['{DAV:}getcontenttype'])) {
- $type = $file[200]['{DAV:}getcontenttype'];
+ $html.= "<tr>
+ <td>$icon</td>
+ <td><a href=\"{$fullPath}\">{$displayName}</a></td>
+ <td>{$type}</td>
+ <td>{$size}</td>
+ <td>{$lastmodified}</td>
+ </tr>";
+
}
- if (!$type) $type = 'Unknown';
- $size = isset($file[200]['{DAV:}getcontentlength'])?(int)$file[200]['{DAV:}getcontentlength']:'';
- $lastmodified = isset($file[200]['{DAV:}getlastmodified'])?$file[200]['{DAV:}getlastmodified']->getTime()->format(DateTime::ATOM):'';
+ $html.= "<tr><td colspan=\"5\"><hr /></td></tr>";
+
+ $output = '';
- $fullPath = Sabre_DAV_URLUtil::encodePath('/' . trim($this->server->getBaseUri() . ($path?$path . '/':'') . $name,'/'));
+ if ($this->enablePost) {
+ $this->server->broadcastEvent('onHTMLActionsPanel',array($parent, &$output));
+ }
- $displayName = isset($file[200]['{DAV:}displayname'])?$file[200]['{DAV:}displayname']:$name;
+ $html.=$output;
- $name = $this->escapeHTML($name);
- $displayName = $this->escapeHTML($displayName);
- $type = $this->escapeHTML($type);
+ $html.= "</table>
+ <address>Generated by SabreDAV " . $version . " (c)2007-2012 <a href=\"http://code.google.com/p/sabredav/\">http://code.google.com/p/sabredav/</a></address>
+ </body>
+ </html>";
- $html.= "<tr>
-<td><a href=\"{$fullPath}\">{$displayName}</a></td>
-<td>{$type}</td>
-<td>{$size}</td>
-<td>{$lastmodified}</td>
-</tr>";
+ return $html;
}
- $html.= "<tr><td colspan=\"4\"><hr /></td></tr>";
+ /**
+ * This method is used to generate the 'actions panel' output for
+ * collections.
+ *
+ * This specifically generates the interfaces for creating new files, and
+ * creating new directories.
+ *
+ * @param Sabre_DAV_INode $node
+ * @param mixed $output
+ * @return void
+ */
+ public function htmlActionsPanel(Sabre_DAV_INode $node, &$output) {
+
+ if (!$node instanceof Sabre_DAV_ICollection)
+ return;
+
+ // We also know fairly certain that if an object is a non-extended
+ // SimpleCollection, we won't need to show the panel either.
+ if (get_class($node)==='Sabre_DAV_SimpleCollection')
+ return;
- if ($this->enablePost && $parent instanceof Sabre_DAV_ICollection) {
- $html.= '<tr><td><form method="post" action="">
+ $output.= '<tr><td colspan="2"><form method="post" action="">
<h3>Create new folder</h3>
<input type="hidden" name="sabreAction" value="mkcol" />
Name: <input type="text" name="name" /><br />
@@ -270,15 +414,75 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
File: <input type="file" name="file" /><br />
<input type="submit" value="upload" />
</form>
- </td></tr>';
- }
+ </td></tr>';
+
+ }
- $html.= "</table>
- <address>Generated by SabreDAV " . Sabre_DAV_Version::VERSION ."-". Sabre_DAV_Version::STABILITY . " (c)2007-2011 <a href=\"http://code.google.com/p/sabredav/\">http://code.google.com/p/sabredav/</a></address>
-</body>
-</html>";
+ /**
+ * This method takes a path/name of an asset and turns it into url
+ * suiteable for http access.
+ *
+ * @param string $assetName
+ * @return string
+ */
+ protected function getAssetUrl($assetName) {
- return $html;
+ return $this->server->getBaseUri() . '?sabreAction=asset&assetName=' . urlencode($assetName);
+
+ }
+
+ /**
+ * This method returns a local pathname to an asset.
+ *
+ * @param string $assetName
+ * @return string
+ */
+ protected function getLocalAssetPath($assetName) {
+
+ // Making sure people aren't trying to escape from the base path.
+ $assetSplit = explode('/', $assetName);
+ if (in_array('..',$assetSplit)) {
+ throw new Sabre_DAV_Exception('Incorrect asset path');
+ }
+ $path = __DIR__ . '/assets/' . $assetName;
+ return $path;
+
+ }
+
+ /**
+ * This method reads an asset from disk and generates a full http response.
+ *
+ * @param string $assetName
+ * @return void
+ */
+ protected function serveAsset($assetName) {
+
+ $assetPath = $this->getLocalAssetPath($assetName);
+ if (!file_exists($assetPath)) {
+ throw new Sabre_DAV_Exception_NotFound('Could not find an asset with this name');
+ }
+ // Rudimentary mime type detection
+ switch(strtolower(substr($assetPath,strpos($assetPath,'.')+1))) {
+
+ case 'ico' :
+ $mime = 'image/vnd.microsoft.icon';
+ break;
+
+ case 'png' :
+ $mime = 'image/png';
+ break;
+
+ default:
+ $mime = 'application/octet-stream';
+ break;
+
+ }
+
+ $this->server->httpResponse->setHeader('Content-Type', $mime);
+ $this->server->httpResponse->setHeader('Content-Length', filesize($assetPath));
+ $this->server->httpResponse->setHeader('Cache-Control', 'public, max-age=1209600');
+ $this->server->httpResponse->sendStatus(200);
+ $this->server->httpResponse->sendBody(fopen($assetPath,'r'));
}
diff --git a/3rdparty/Sabre/DAV/Browser/assets/favicon.ico b/3rdparty/Sabre/DAV/Browser/assets/favicon.ico
new file mode 100755
index 00000000000..2b2c10a22cc
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Browser/assets/favicon.ico
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png b/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png
new file mode 100755
index 00000000000..c9acc84172d
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png b/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png
new file mode 100755
index 00000000000..3ecd6a800a0
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/card.png b/3rdparty/Sabre/DAV/Browser/assets/icons/card.png
new file mode 100755
index 00000000000..2ce954866d8
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/card.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png b/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png
new file mode 100755
index 00000000000..156fa64fd50
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/file.png b/3rdparty/Sabre/DAV/Browser/assets/icons/file.png
new file mode 100755
index 00000000000..3b98551cec3
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/file.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png b/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png
new file mode 100755
index 00000000000..156fa64fd50
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png b/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png
new file mode 100755
index 00000000000..f8988f828e6
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Client.php b/3rdparty/Sabre/DAV/Client.php
index fc6a6fff083..a8320dd9782 100644..100755
--- a/3rdparty/Sabre/DAV/Client.php
+++ b/3rdparty/Sabre/DAV/Client.php
@@ -3,14 +3,14 @@
/**
* SabreDAV DAV client
*
- * This client wraps around Curl to provide a convenient API to a WebDAV
+ * This client wraps around Curl to provide a convenient API to a WebDAV
* server.
*
* NOTE: This class is experimental, it's api will likely change in the future.
- *
+ *
* @package Sabre
* @subpackage DAVClient
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -26,22 +26,22 @@ class Sabre_DAV_Client {
/**
* Constructor
*
- * Settings are provided through the 'settings' argument. The following
+ * Settings are provided through the 'settings' argument. The following
* settings are supported:
*
* * baseUri
* * userName (optional)
* * password (optional)
* * proxy (optional)
- *
- * @param array $settings
+ *
+ * @param array $settings
*/
public function __construct(array $settings) {
if (!isset($settings['baseUri'])) {
throw new InvalidArgumentException('A baseUri must be provided');
}
-
+
$validSettings = array(
'baseUri',
'userName',
@@ -62,23 +62,23 @@ class Sabre_DAV_Client {
/**
* Does a PROPFIND request
*
- * The list of requested properties must be specified as an array, in clark
- * notation.
+ * The list of requested properties must be specified as an array, in clark
+ * notation.
*
- * The returned array will contain a list of filenames as keys, and
+ * The returned array will contain a list of filenames as keys, and
* properties as values.
*
- * The properties array will contain the list of properties. Only properties
- * that are actually returned from the server (without error) will be
+ * The properties array will contain the list of properties. Only properties
+ * that are actually returned from the server (without error) will be
* returned, anything else is discarded.
*
- * Depth should be either 0 or 1. A depth of 1 will cause a request to be
+ * Depth should be either 0 or 1. A depth of 1 will cause a request to be
* made to the server to also return all child resources.
*
- * @param string $url
- * @param array $properties
- * @param int $depth
- * @return array
+ * @param string $url
+ * @param array $properties
+ * @param int $depth
+ * @return array
*/
public function propFind($url, array $properties, $depth = 0) {
@@ -132,14 +132,14 @@ class Sabre_DAV_Client {
/**
* Updates a list of properties on the server
*
- * The list of properties must have clark-notation properties for the keys,
- * and the actual (string) value for the value. If the value is null, an
- * attempt is made to delete the property.
+ * The list of properties must have clark-notation properties for the keys,
+ * and the actual (string) value for the value. If the value is null, an
+ * attempt is made to delete the property.
*
- * @todo Must be building the request using the DOM, and does not yet
- * support complex properties.
- * @param string $url
- * @param array $properties
+ * @todo Must be building the request using the DOM, and does not yet
+ * support complex properties.
+ * @param string $url
+ * @param array $properties
* @return void
*/
public function propPatch($url, array $properties) {
@@ -175,7 +175,7 @@ class Sabre_DAV_Client {
$body.=" <x:" . $elementName . " xmlns:x=\"" . $namespace . "\">";
}
// Shitty.. i know
- $body.=htmlspecialchars($propValue, ENT_NOQUOTES, 'UTF-8');
+ $body.=htmlspecialchars($propValue, ENT_NOQUOTES, 'UTF-8');
if ($namespace === 'DAV:') {
$body.='</d:' . $elementName . '>' . "\n";
} else {
@@ -189,7 +189,7 @@ class Sabre_DAV_Client {
$body.= '</d:propertyupdate>';
- $response = $this->request('PROPPATCH', $url, $body, array(
+ $this->request('PROPPATCH', $url, $body, array(
'Content-Type' => 'application/xml'
));
@@ -198,11 +198,11 @@ class Sabre_DAV_Client {
/**
* Performs an HTTP options request
*
- * This method returns all the features from the 'DAV:' header as an array.
- * If there was no DAV header, or no contents this method will return an
- * empty array.
- *
- * @return array
+ * This method returns all the features from the 'DAV:' header as an array.
+ * If there was no DAV header, or no contents this method will return an
+ * empty array.
+ *
+ * @return array
*/
public function options() {
@@ -222,20 +222,20 @@ class Sabre_DAV_Client {
/**
* Performs an actual HTTP request, and returns the result.
*
- * If the specified url is relative, it will be expanded based on the base
+ * If the specified url is relative, it will be expanded based on the base
* url.
*
* The returned array contains 3 keys:
* * body - the response body
* * httpCode - a HTTP code (200, 404, etc)
- * * headers - a list of response http headers. The header names have
+ * * headers - a list of response http headers. The header names have
* been lowercased.
*
- * @param string $method
- * @param string $url
- * @param string $body
- * @param array $headers
- * @return array
+ * @param string $method
+ * @param string $url
+ * @param string $body
+ * @param array $headers
+ * @return array
*/
public function request($method, $url = '', $body = null, $headers = array()) {
@@ -243,14 +243,37 @@ class Sabre_DAV_Client {
$curlSettings = array(
CURLOPT_RETURNTRANSFER => true,
- CURLOPT_CUSTOMREQUEST => $method,
- CURLOPT_POSTFIELDS => $body,
// Return headers as part of the response
- CURLOPT_HEADER => true
+ CURLOPT_HEADER => true,
+ CURLOPT_POSTFIELDS => $body,
+ // Automatically follow redirects
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_MAXREDIRS => 5,
);
+ switch ($method) {
+ case 'PUT':
+ $curlSettings[CURLOPT_PUT] = true;
+ break;
+ case 'HEAD' :
+
+ // do not read body with HEAD requests (this is neccessary because cURL does not ignore the body with HEAD
+ // requests when the Content-Length header is given - which in turn is perfectly valid according to HTTP
+ // specs...) cURL does unfortunately return an error in this case ("transfer closed transfer closed with
+ // ... bytes remaining to read") this can be circumvented by explicitly telling cURL to ignore the
+ // response body
+ $curlSettings[CURLOPT_NOBODY] = true;
+ $curlSettings[CURLOPT_CUSTOMREQUEST] = 'HEAD';
+ break;
+
+ default:
+ $curlSettings[CURLOPT_CUSTOMREQUEST] = $method;
+ break;
+
+ }
+
// Adding HTTP headers
- $nHeaders = array();
+ $nHeaders = array();
foreach($headers as $key=>$value) {
$nHeaders[] = $key . ': ' . $value;
@@ -277,17 +300,17 @@ class Sabre_DAV_Client {
$headerBlob = substr($response, 0, $curlInfo['header_size']);
$response = substr($response, $curlInfo['header_size']);
- // In the case of 100 Continue, or redirects we'll have multiple lists
- // of headers for each separate HTTP response. We can easily split this
+ // In the case of 100 Continue, or redirects we'll have multiple lists
+ // of headers for each separate HTTP response. We can easily split this
// because they are separated by \r\n\r\n
$headerBlob = explode("\r\n\r\n", trim($headerBlob, "\r\n"));
-
+
// We only care about the last set of headers
$headerBlob = $headerBlob[count($headerBlob)-1];
// Splitting headers
$headerBlob = explode("\r\n", $headerBlob);
-
+
$headers = array();
foreach($headerBlob as $header) {
$parts = explode(':', $header, 2);
@@ -304,10 +327,17 @@ class Sabre_DAV_Client {
if ($curlErrNo) {
throw new Sabre_DAV_Exception('[CURL] Error while making request: ' . $curlError . ' (error code: ' . $curlErrNo . ')');
- }
+ }
if ($response['statusCode']>=400) {
- throw new Sabre_DAV_Exception('HTTP error response. (errorcode ' . $response['statusCode'] . ')');
+ switch ($response['statusCode']) {
+ case 404:
+ throw new Sabre_DAV_Exception_NotFound('Resource ' . $url . ' not found.');
+ break;
+
+ default:
+ throw new Sabre_DAV_Exception('HTTP error response. (errorcode ' . $response['statusCode'] . ')');
+ }
}
return $response;
@@ -317,12 +347,12 @@ class Sabre_DAV_Client {
/**
* Wrapper for all curl functions.
*
- * The only reason this was split out in a separate method, is so it
- * becomes easier to unittest.
+ * The only reason this was split out in a separate method, is so it
+ * becomes easier to unittest.
*
* @param string $url
- * @param array $settings
- * @return
+ * @param array $settings
+ * @return array
*/
protected function curlRequest($url, $settings) {
@@ -339,20 +369,20 @@ class Sabre_DAV_Client {
}
/**
- * Returns the full url based on the given url (which may be relative). All
- * urls are expanded based on the base url as given by the server.
- *
- * @param string $url
- * @return string
+ * Returns the full url based on the given url (which may be relative). All
+ * urls are expanded based on the base url as given by the server.
+ *
+ * @param string $url
+ * @return string
*/
protected function getAbsoluteUrl($url) {
- // If the url starts with http:// or https://, the url is already absolute.
+ // If the url starts with http:// or https://, the url is already absolute.
if (preg_match('/^http(s?):\/\//', $url)) {
return $url;
}
- // If the url starts with a slash, we must calculate the url based off
+ // If the url starts with a slash, we must calculate the url based off
// the root of the base url.
if (strpos($url,'/') === 0) {
$parts = parse_url($this->baseUri);
@@ -366,7 +396,7 @@ class Sabre_DAV_Client {
/**
* Parses a WebDAV multistatus response body
- *
+ *
* This method returns an array with the following structure
*
* array(
@@ -387,7 +417,7 @@ class Sabre_DAV_Client {
*
*
* @param string $body xml body
- * @return array
+ * @return array
*/
public function parseMultiStatus($body) {
@@ -397,14 +427,13 @@ class Sabre_DAV_Client {
if ($responseXML===false) {
throw new InvalidArgumentException('The passed data is not valid XML');
}
-
- $responseXML->registerXPathNamespace('d','DAV:');
+
+ $responseXML->registerXPathNamespace('d', 'urn:DAV');
$propResult = array();
foreach($responseXML->xpath('d:response') as $response) {
-
- $response->registerXPathNamespace('d','DAV:');
+ $response->registerXPathNamespace('d', 'urn:DAV');
$href = $response->xpath('d:href');
$href = (string)$href[0];
@@ -412,11 +441,11 @@ class Sabre_DAV_Client {
foreach($response->xpath('d:propstat') as $propStat) {
- $propStat->registerXPathNamespace('d','DAV:');
+ $propStat->registerXPathNamespace('d', 'urn:DAV');
$status = $propStat->xpath('d:status');
list($httpVersion, $statusCode, $message) = explode(' ', (string)$status[0],3);
- $properties[$statusCode] = Sabre_DAV_XMLUtil::parseProperties(dom_import_simplexml($propStat), $this->propertyMap);
+ $properties[$statusCode] = Sabre_DAV_XMLUtil::parseProperties(dom_import_simplexml($propStat), $this->propertyMap);
}
diff --git a/3rdparty/Sabre/DAV/Collection.php b/3rdparty/Sabre/DAV/Collection.php
index 9da04c12792..776c22531b2 100644..100755
--- a/3rdparty/Sabre/DAV/Collection.php
+++ b/3rdparty/Sabre/DAV/Collection.php
@@ -4,12 +4,12 @@
* Collection class
*
* This is a helper class, that should aid in getting collections classes setup.
- * Most of its methods are implemented, and throw permission denied exceptions
- *
+ * Most of its methods are implemented, and throw permission denied exceptions
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
abstract class Sabre_DAV_Collection extends Sabre_DAV_Node implements Sabre_DAV_ICollection {
@@ -17,12 +17,12 @@ abstract class Sabre_DAV_Collection extends Sabre_DAV_Node implements Sabre_DAV_
/**
* Returns a child object, by its name.
*
- * This method makes use of the getChildren method to grab all the child nodes, and compares the name.
+ * This method makes use of the getChildren method to grab all the child nodes, and compares the name.
* Generally its wise to override this, as this can usually be optimized
- *
+ *
* @param string $name
- * @throws Sabre_DAV_Exception_FileNotFound
- * @return Sabre_DAV_INode
+ * @throws Sabre_DAV_Exception_NotFound
+ * @return Sabre_DAV_INode
*/
public function getChild($name) {
@@ -31,7 +31,7 @@ abstract class Sabre_DAV_Collection extends Sabre_DAV_Node implements Sabre_DAV_
if ($child->getName()==$name) return $child;
}
- throw new Sabre_DAV_Exception_FileNotFound('File not found: ' . $name);
+ throw new Sabre_DAV_Exception_NotFound('File not found: ' . $name);
}
@@ -39,9 +39,9 @@ abstract class Sabre_DAV_Collection extends Sabre_DAV_Node implements Sabre_DAV_
* Checks is a child-node exists.
*
* It is generally a good idea to try and override this. Usually it can be optimized.
- *
- * @param string $name
- * @return bool
+ *
+ * @param string $name
+ * @return bool
*/
public function childExists($name) {
@@ -50,7 +50,7 @@ abstract class Sabre_DAV_Collection extends Sabre_DAV_Node implements Sabre_DAV_
$this->getChild($name);
return true;
- } catch(Sabre_DAV_Exception_FileNotFound $e) {
+ } catch(Sabre_DAV_Exception_NotFound $e) {
return false;
@@ -59,12 +59,28 @@ abstract class Sabre_DAV_Collection extends Sabre_DAV_Node implements Sabre_DAV_
}
/**
- * Creates a new file in the directory
- *
- * @param string $name Name of the file
- * @param resource $data Initial payload, passed as a readable stream resource.
- * @throws Sabre_DAV_Exception_Forbidden
- * @return void
+ * Creates a new file in the directory
+ *
+ * Data will either be supplied as a stream resource, or in certain cases
+ * as a string. Keep in mind that you may have to support either.
+ *
+ * After succesful creation of the file, you may choose to return the ETag
+ * of the new file here.
+ *
+ * The returned ETag must be surrounded by double-quotes (The quotes should
+ * be part of the actual string).
+ *
+ * If you cannot accurately determine the ETag, you should not return it.
+ * If you don't store the file exactly as-is (you're transforming it
+ * somehow) you should also not return an ETag.
+ *
+ * This means that if a subsequent GET to this new file does not exactly
+ * return the same contents of what was submitted here, you are strongly
+ * recommended to omit the ETag.
+ *
+ * @param string $name Name of the file
+ * @param resource|string $data Initial payload
+ * @return null|string
*/
public function createFile($name, $data = null) {
@@ -73,9 +89,9 @@ abstract class Sabre_DAV_Collection extends Sabre_DAV_Node implements Sabre_DAV_
}
/**
- * Creates a new subdirectory
- *
- * @param string $name
+ * Creates a new subdirectory
+ *
+ * @param string $name
* @throws Sabre_DAV_Exception_Forbidden
* @return void
*/
diff --git a/3rdparty/Sabre/DAV/Directory.php b/3rdparty/Sabre/DAV/Directory.php
index 86af4827b3e..6db8febc02e 100644..100755
--- a/3rdparty/Sabre/DAV/Directory.php
+++ b/3rdparty/Sabre/DAV/Directory.php
@@ -8,7 +8,7 @@
* @package Sabre
* @subpackage DAV
* @deprecated Use Sabre_DAV_Collection instead
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
diff --git a/3rdparty/Sabre/DAV/Exception.php b/3rdparty/Sabre/DAV/Exception.php
index 61f8b87c0a6..a2cd6cf5820 100644..100755
--- a/3rdparty/Sabre/DAV/Exception.php
+++ b/3rdparty/Sabre/DAV/Exception.php
@@ -7,42 +7,42 @@
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
/**
- * Main Exception class.
+ * Main Exception class.
*
- * This class defines a getHTTPCode method, which should return the appropriate HTTP code for the Exception occured.
+ * This class defines a getHTTPCode method, which should return the appropriate HTTP code for the Exception occurred.
* The default for this is 500.
*
* This class also allows you to generate custom xml data for your exceptions. This will be displayed
* in the 'error' element in the failing response.
*/
-class Sabre_DAV_Exception extends Exception {
+class Sabre_DAV_Exception extends Exception {
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
- public function getHTTPCode() {
+ public function getHTTPCode() {
return 500;
}
/**
- * This method allows the exception to include additonal information into the WebDAV error response
+ * This method allows the exception to include additional information into the WebDAV error response
*
* @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
+ * @param DOMElement $errorNode
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
+
}
@@ -50,14 +50,15 @@ class Sabre_DAV_Exception extends Exception {
* This method allows the exception to return any extra HTTP response headers.
*
* The headers must be returned as an array.
- *
- * @return array
+ *
+ * @param Sabre_DAV_Server $server
+ * @return array
*/
public function getHTTPHeaders(Sabre_DAV_Server $server) {
return array();
- }
+ }
}
diff --git a/3rdparty/Sabre/DAV/Exception/BadRequest.php b/3rdparty/Sabre/DAV/Exception/BadRequest.php
index 7025bb10317..b198648a754 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/BadRequest.php
+++ b/3rdparty/Sabre/DAV/Exception/BadRequest.php
@@ -4,24 +4,24 @@
* BadRequest
*
* The BadRequest is thrown when the user submitted an invalid HTTP request
- * BadRequest
- *
+ * BadRequest
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_BadRequest extends Sabre_DAV_Exception {
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
public function getHTTPCode() {
- return 400;
+ return 400;
}
diff --git a/3rdparty/Sabre/DAV/Exception/Conflict.php b/3rdparty/Sabre/DAV/Exception/Conflict.php
index 7eaa08178ae..6b0bd1fad73 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/Conflict.php
+++ b/3rdparty/Sabre/DAV/Exception/Conflict.php
@@ -8,14 +8,14 @@
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_Conflict extends Sabre_DAV_Exception {
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
diff --git a/3rdparty/Sabre/DAV/Exception/ConflictingLock.php b/3rdparty/Sabre/DAV/Exception/ConflictingLock.php
index 279f63dfde7..6121868e69e 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/ConflictingLock.php
+++ b/3rdparty/Sabre/DAV/Exception/ConflictingLock.php
@@ -1,28 +1,28 @@
<?php
/**
- * ConflictingLock
+ * ConflictingLock
*
- * Similar to Exception_Locked, this exception thrown when a LOCK request
+ * Similar to Exception_Locked, this exception thrown when a LOCK request
* was made, on a resource which was already locked
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_ConflictingLock extends Sabre_DAV_Exception_Locked {
/**
- * This method allows the exception to include additonal information into the WebDAV error response
+ * This method allows the exception to include additional information into the WebDAV error response
*
* @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
+ * @param DOMElement $errorNode
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
+
if ($this->lock) {
$error = $errorNode->ownerDocument->createElementNS('DAV:','d:no-conflicting-lock');
$errorNode->appendChild($error);
diff --git a/3rdparty/Sabre/DAV/Exception/FileNotFound.php b/3rdparty/Sabre/DAV/Exception/FileNotFound.php
index b20e4a2fb3f..d76e400c93b 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/FileNotFound.php
+++ b/3rdparty/Sabre/DAV/Exception/FileNotFound.php
@@ -3,26 +3,17 @@
/**
* FileNotFound
*
- * This Exception is thrown when a Node couldn't be found. It returns HTTP error code 404
+ * Deprecated: Warning, this class is deprecated and will be removed in a
+ * future version of SabreDAV. Please use Sabre_DAV_Exception_NotFound instead.
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @deprecated Use Sabre_DAV_Exception_NotFound instead
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
-class Sabre_DAV_Exception_FileNotFound extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 404;
-
- }
+class Sabre_DAV_Exception_FileNotFound extends Sabre_DAV_Exception_NotFound {
}
diff --git a/3rdparty/Sabre/DAV/Exception/Forbidden.php b/3rdparty/Sabre/DAV/Exception/Forbidden.php
index 167f3c2760a..20b1056e31b 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/Forbidden.php
+++ b/3rdparty/Sabre/DAV/Exception/Forbidden.php
@@ -4,17 +4,17 @@
* Forbidden
*
* This exception is thrown whenever a user tries to do an operation he's not allowed to
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_Forbidden extends Sabre_DAV_Exception {
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
diff --git a/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php b/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php
index 15007cdd352..1a15089b0a3 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php
+++ b/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php
@@ -1,20 +1,20 @@
<?php
/**
- * InsufficientStorage
+ * InsufficientStorage
*
* This Exception can be thrown, when for example a harddisk is full or a quota is exceeded
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_InsufficientStorage extends Sabre_DAV_Exception {
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
diff --git a/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php b/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php
index f06810a25ef..2230f1d0811 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php
+++ b/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php
@@ -1,26 +1,26 @@
<?php
/**
- * InvalidResourceType
+ * InvalidResourceType
*
* This exception is thrown when the user tried to create a new collection, with
* a special resourcetype value that was not recognized by the server.
*
* See RFC5689 section 3.3
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
-class Sabre_DAV_Exception_InvalidResourceType extends Sabre_DAV_Exception_Forbidden {
+class Sabre_DAV_Exception_InvalidResourceType extends Sabre_DAV_Exception_Forbidden {
/**
- * This method allows the exception to include additonal information into the WebDAV error response
+ * This method allows the exception to include additional information into the WebDAV error response
*
* @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
+ * @param DOMElement $errorNode
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
@@ -29,5 +29,5 @@ class Sabre_DAV_Exception_InvalidResourceType extends Sabre_DAV_Exception_Forbid
$errorNode->appendChild($error);
}
-
+
}
diff --git a/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php b/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php
index 47032cffc75..80ab7aff65a 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php
+++ b/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php
@@ -1,13 +1,13 @@
<?php
/**
- * LockTokenMatchesRequestUri
+ * LockTokenMatchesRequestUri
+ *
+ * This exception is thrown by UNLOCK if a supplied lock-token is invalid
*
- * This exception is thrown by UNLOCK if a supplied lock-token is invalid
- *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -23,10 +23,10 @@ class Sabre_DAV_Exception_LockTokenMatchesRequestUri extends Sabre_DAV_Exception
}
/**
- * This method allows the exception to include additonal information into the WebDAV error response
+ * This method allows the exception to include additional information into the WebDAV error response
*
* @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
+ * @param DOMElement $errorNode
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
diff --git a/3rdparty/Sabre/DAV/Exception/Locked.php b/3rdparty/Sabre/DAV/Exception/Locked.php
index b4bb2e0378c..976365ac1f8 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/Locked.php
+++ b/3rdparty/Sabre/DAV/Exception/Locked.php
@@ -1,32 +1,32 @@
<?php
/**
- * Locked
+ * Locked
*
* The 423 is thrown when a client tried to access a resource that was locked, without supplying a valid lock token
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_Locked extends Sabre_DAV_Exception {
/**
- * Lock information
- *
- * @var Sabre_DAV_Locks_LockInfo
+ * Lock information
+ *
+ * @var Sabre_DAV_Locks_LockInfo
*/
protected $lock;
/**
* Creates the exception
- *
+ *
* A LockInfo object should be passed if the user should be informed
* which lock actually has the file locked.
- *
- * @param Sabre_DAV_Locks_LockInfo $lock
+ *
+ * @param Sabre_DAV_Locks_LockInfo $lock
*/
public function __construct(Sabre_DAV_Locks_LockInfo $lock = null) {
@@ -35,7 +35,7 @@ class Sabre_DAV_Exception_Locked extends Sabre_DAV_Exception {
}
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
@@ -46,14 +46,14 @@ class Sabre_DAV_Exception_Locked extends Sabre_DAV_Exception {
}
/**
- * This method allows the exception to include additonal information into the WebDAV error response
+ * This method allows the exception to include additional information into the WebDAV error response
*
* @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
+ * @param DOMElement $errorNode
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
+
if ($this->lock) {
$error = $errorNode->ownerDocument->createElementNS('DAV:','d:lock-token-submitted');
$errorNode->appendChild($error);
diff --git a/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php b/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php
index 02c145ffeb6..31875751505 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php
+++ b/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php
@@ -4,17 +4,17 @@
* MethodNotAllowed
*
* The 405 is thrown when a client tried to create a directory on an already existing directory
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_MethodNotAllowed extends Sabre_DAV_Exception {
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
@@ -28,8 +28,9 @@ class Sabre_DAV_Exception_MethodNotAllowed extends Sabre_DAV_Exception {
* This method allows the exception to return any extra HTTP response headers.
*
* The headers must be returned as an array.
- *
- * @return array
+ *
+ * @param Sabre_DAV_Server $server
+ * @return array
*/
public function getHTTPHeaders(Sabre_DAV_Server $server) {
diff --git a/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php b/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php
index 1faffddfa00..87ca624429f 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php
+++ b/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php
@@ -5,22 +5,22 @@
*
* This exception is thrown when the client did not provide valid
* authentication credentials.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_NotAuthenticated extends Sabre_DAV_Exception {
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
public function getHTTPCode() {
-
+
return 401;
}
diff --git a/3rdparty/Sabre/DAV/Exception/NotFound.php b/3rdparty/Sabre/DAV/Exception/NotFound.php
new file mode 100755
index 00000000000..2b9da560d23
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Exception/NotFound.php
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * NotFound
+ *
+ * This Exception is thrown when a Node couldn't be found. It returns HTTP error code 404
+ *
+ * @package Sabre
+ * @subpackage DAV
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class Sabre_DAV_Exception_NotFound extends Sabre_DAV_Exception {
+
+ /**
+ * Returns the HTTP statuscode for this exception
+ *
+ * @return int
+ */
+ public function getHTTPCode() {
+
+ return 404;
+
+ }
+
+}
+
diff --git a/3rdparty/Sabre/DAV/Exception/NotImplemented.php b/3rdparty/Sabre/DAV/Exception/NotImplemented.php
index cd7f609b09d..d017a19f559 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/NotImplemented.php
+++ b/3rdparty/Sabre/DAV/Exception/NotImplemented.php
@@ -4,22 +4,22 @@
* NotImplemented
*
* This exception is thrown when the client tried to call an unsupported HTTP method or other feature
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_NotImplemented extends Sabre_DAV_Exception {
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
public function getHTTPCode() {
-
+
return 501;
}
diff --git a/3rdparty/Sabre/DAV/Exception/PaymentRequired.php b/3rdparty/Sabre/DAV/Exception/PaymentRequired.php
new file mode 100755
index 00000000000..4982f45a4b5
--- /dev/null
+++ b/3rdparty/Sabre/DAV/Exception/PaymentRequired.php
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * Payment Required
+ *
+ * The PaymentRequired exception may be thrown in a case where a user must pay
+ * to access a certain resource or operation.
+ *
+ * @package Sabre
+ * @subpackage DAV
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class Sabre_DAV_Exception_PaymentRequired extends Sabre_DAV_Exception {
+
+ /**
+ * Returns the HTTP statuscode for this exception
+ *
+ * @return int
+ */
+ public function getHTTPCode() {
+
+ return 402;
+
+ }
+
+}
diff --git a/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php b/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php
index ebcb9f5b9ac..213e9c52317 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php
+++ b/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php
@@ -1,15 +1,15 @@
<?php
/**
- * PreconditionFailed
+ * PreconditionFailed
*
- * This exception is normally thrown when a client submitted a conditional request,
- * like for example an If, If-None-Match or If-Match header, which caused the HTTP
+ * This exception is normally thrown when a client submitted a conditional request,
+ * like for example an If, If-None-Match or If-Match header, which caused the HTTP
* request to not execute (the condition of the header failed)
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -17,47 +17,47 @@ class Sabre_DAV_Exception_PreconditionFailed extends Sabre_DAV_Exception {
/**
* When this exception is thrown, the header-name might be set.
- *
+ *
* This allows the exception-catching code to determine which HTTP header
* caused the exception.
- *
- * @var string
+ *
+ * @var string
*/
public $header = null;
/**
- * Create the exception
- *
- * @param string $message
- * @param string $header
+ * Create the exception
+ *
+ * @param string $message
+ * @param string $header
*/
public function __construct($message, $header=null) {
parent::__construct($message);
$this->header = $header;
- }
+ }
/**
- * Returns the HTTP statuscode for this exception
+ * Returns the HTTP statuscode for this exception
*
* @return int
*/
public function getHTTPCode() {
- return 412;
+ return 412;
}
/**
- * This method allows the exception to include additonal information into the WebDAV error response
+ * This method allows the exception to include additional information into the WebDAV error response
*
* @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
+ * @param DOMElement $errorNode
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
+
if ($this->header) {
$prop = $errorNode->ownerDocument->createElement('s:header');
$prop->nodeValue = $this->header;
diff --git a/3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php b/3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php
index e4ed601b16c..e86800f3038 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php
+++ b/3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php
@@ -7,17 +7,17 @@
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_ReportNotImplemented extends Sabre_DAV_Exception_NotImplemented {
/**
- * This method allows the exception to include additonal information into the WebDAV error response
+ * This method allows the exception to include additional information into the WebDAV error response
*
* @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
+ * @param DOMElement $errorNode
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
diff --git a/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php b/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php
index 37abbd729d1..29ee3654a7e 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php
+++ b/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php
@@ -1,21 +1,21 @@
<?php
/**
- * RequestedRangeNotSatisfiable
+ * RequestedRangeNotSatisfiable
*
- * This exception is normally thrown when the user
+ * This exception is normally thrown when the user
* request a range that is out of the entity bounds.
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Exception_RequestedRangeNotSatisfiable extends Sabre_DAV_Exception {
/**
- * returns the http statuscode for this exception
+ * returns the http statuscode for this exception
*
* @return int
*/
diff --git a/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php b/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php
index 4c37d8997cf..9a4693b21a8 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php
+++ b/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php
@@ -3,19 +3,19 @@
/**
* UnSupportedMediaType
*
- * The 415 Unsupported Media Type status code is generally sent back when the client
+ * The 415 Unsupported Media Type status code is generally sent back when the client
* tried to call an HTTP method, with a body the server didn't understand
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
-class Sabre_DAV_Exception_UnsupportedMediaType extends Sabre_DAV_Exception {
+class Sabre_DAV_Exception_UnsupportedMediaType extends Sabre_DAV_Exception {
/**
- * returns the http statuscode for this exception
+ * returns the http statuscode for this exception
*
* @return int
*/
diff --git a/3rdparty/Sabre/DAV/FS/Directory.php b/3rdparty/Sabre/DAV/FS/Directory.php
index ebd6a6c505e..3af2d755583 100644..100755
--- a/3rdparty/Sabre/DAV/FS/Directory.php
+++ b/3rdparty/Sabre/DAV/FS/Directory.php
@@ -1,24 +1,39 @@
<?php
/**
- * Directory class
- *
+ * Directory class
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_ICollection, Sabre_DAV_IQuota {
/**
- * Creates a new file in the directory
- *
- * data is a readable stream resource
+ * Creates a new file in the directory
*
- * @param string $name Name of the file
- * @param resource $data Initial payload
- * @return void
+ * Data will either be supplied as a stream resource, or in certain cases
+ * as a string. Keep in mind that you may have to support either.
+ *
+ * After succesful creation of the file, you may choose to return the ETag
+ * of the new file here.
+ *
+ * The returned ETag must be surrounded by double-quotes (The quotes should
+ * be part of the actual string).
+ *
+ * If you cannot accurately determine the ETag, you should not return it.
+ * If you don't store the file exactly as-is (you're transforming it
+ * somehow) you should also not return an ETag.
+ *
+ * This means that if a subsequent GET to this new file does not exactly
+ * return the same contents of what was submitted here, you are strongly
+ * recommended to omit the ETag.
+ *
+ * @param string $name Name of the file
+ * @param resource|string $data Initial payload
+ * @return null|string
*/
public function createFile($name, $data = null) {
@@ -28,9 +43,9 @@ class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_ICol
}
/**
- * Creates a new subdirectory
- *
- * @param string $name
+ * Creates a new subdirectory
+ *
+ * @param string $name
* @return void
*/
public function createDirectory($name) {
@@ -41,17 +56,17 @@ class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_ICol
}
/**
- * Returns a specific child node, referenced by its name
- *
- * @param string $name
- * @throws Sabre_DAV_Exception_FileNotFound
- * @return Sabre_DAV_INode
+ * Returns a specific child node, referenced by its name
+ *
+ * @param string $name
+ * @throws Sabre_DAV_Exception_NotFound
+ * @return Sabre_DAV_INode
*/
public function getChild($name) {
$path = $this->path . '/' . $name;
- if (!file_exists($path)) throw new Sabre_DAV_Exception_FileNotFound('File with name ' . $path . ' could not be located');
+ if (!file_exists($path)) throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
if (is_dir($path)) {
@@ -66,9 +81,9 @@ class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_ICol
}
/**
- * Returns an array with all the child nodes
- *
- * @return Sabre_DAV_INode[]
+ * Returns an array with all the child nodes
+ *
+ * @return Sabre_DAV_INode[]
*/
public function getChildren() {
@@ -79,10 +94,10 @@ class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_ICol
}
/**
- * Checks if a child exists.
- *
- * @param string $name
- * @return bool
+ * Checks if a child exists.
+ *
+ * @param string $name
+ * @return bool
*/
public function childExists($name) {
@@ -92,8 +107,8 @@ class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_ICol
}
/**
- * Deletes all files in this directory, and then itself
- *
+ * Deletes all files in this directory, and then itself
+ *
* @return void
*/
public function delete() {
@@ -104,16 +119,16 @@ class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_ICol
}
/**
- * Returns available diskspace information
- *
- * @return array
+ * Returns available diskspace information
+ *
+ * @return array
*/
public function getQuotaInfo() {
return array(
disk_total_space($this->path)-disk_free_space($this->path),
disk_free_space($this->path)
- );
+ );
}
diff --git a/3rdparty/Sabre/DAV/FS/File.php b/3rdparty/Sabre/DAV/FS/File.php
index 262187d7e8a..6a8039fe303 100644..100755
--- a/3rdparty/Sabre/DAV/FS/File.php
+++ b/3rdparty/Sabre/DAV/FS/File.php
@@ -1,21 +1,21 @@
<?php
/**
- * File class
- *
+ * File class
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_FS_File extends Sabre_DAV_FS_Node implements Sabre_DAV_IFile {
/**
- * Updates the data
- *
- * @param resource $data
- * @return void
+ * Updates the data
+ *
+ * @param resource $data
+ * @return void
*/
public function put($data) {
@@ -24,9 +24,9 @@ class Sabre_DAV_FS_File extends Sabre_DAV_FS_Node implements Sabre_DAV_IFile {
}
/**
- * Returns the data
- *
- * @return string
+ * Returns the data
+ *
+ * @return string
*/
public function get() {
@@ -37,7 +37,7 @@ class Sabre_DAV_FS_File extends Sabre_DAV_FS_Node implements Sabre_DAV_IFile {
/**
* Delete the current file
*
- * @return void
+ * @return void
*/
public function delete() {
@@ -46,12 +46,12 @@ class Sabre_DAV_FS_File extends Sabre_DAV_FS_Node implements Sabre_DAV_IFile {
}
/**
- * Returns the size of the node, in bytes
- *
- * @return int
+ * Returns the size of the node, in bytes
+ *
+ * @return int
*/
public function getSize() {
-
+
return filesize($this->path);
}
@@ -60,10 +60,10 @@ class Sabre_DAV_FS_File extends Sabre_DAV_FS_Node implements Sabre_DAV_IFile {
* Returns the ETag for a file
*
* An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
- * The ETag is an arbritrary string, but MUST be surrounded by double-quotes.
+ * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
*
* Return null if the ETag can not effectively be determined
- *
+ *
* @return mixed
*/
public function getETag() {
@@ -77,8 +77,8 @@ class Sabre_DAV_FS_File extends Sabre_DAV_FS_Node implements Sabre_DAV_IFile {
*
* If null is returned, we'll assume application/octet-stream
*
- * @return mixed
- */
+ * @return mixed
+ */
public function getContentType() {
return null;
diff --git a/3rdparty/Sabre/DAV/FS/Node.php b/3rdparty/Sabre/DAV/FS/Node.php
index b8d7bcfe846..1283e9d0fdc 100644..100755
--- a/3rdparty/Sabre/DAV/FS/Node.php
+++ b/3rdparty/Sabre/DAV/FS/Node.php
@@ -1,30 +1,29 @@
<?php
/**
- * Base node-class
+ * Base node-class
+ *
+ * The node class implements the method used by both the File and the Directory classes
*
- * The node class implements the method used by both the File and the Directory classes
- *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
abstract class Sabre_DAV_FS_Node implements Sabre_DAV_INode {
/**
* The path to the current node
- *
- * @var string
+ *
+ * @var string
*/
- protected $path;
+ protected $path;
/**
- * Sets up the node, expects a full path name
- *
- * @param string $path
- * @return void
+ * Sets up the node, expects a full path name
+ *
+ * @param string $path
*/
public function __construct($path) {
@@ -35,9 +34,9 @@ abstract class Sabre_DAV_FS_Node implements Sabre_DAV_INode {
/**
- * Returns the name of the node
- *
- * @return string
+ * Returns the name of the node
+ *
+ * @return string
*/
public function getName() {
@@ -59,7 +58,7 @@ abstract class Sabre_DAV_FS_Node implements Sabre_DAV_INode {
$newPath = $parentPath . '/' . $newName;
rename($this->path,$newPath);
-
+
$this->path = $newPath;
}
@@ -67,9 +66,9 @@ abstract class Sabre_DAV_FS_Node implements Sabre_DAV_INode {
/**
- * Returns the last modification time, as a unix timestamp
- *
- * @return int
+ * Returns the last modification time, as a unix timestamp
+ *
+ * @return int
*/
public function getLastModified() {
diff --git a/3rdparty/Sabre/DAV/FSExt/Directory.php b/3rdparty/Sabre/DAV/FSExt/Directory.php
index c43d4385ac7..540057183b3 100644..100755
--- a/3rdparty/Sabre/DAV/FSExt/Directory.php
+++ b/3rdparty/Sabre/DAV/FSExt/Directory.php
@@ -1,22 +1,39 @@
<?php
/**
- * Directory class
- *
+ * Directory class
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_FSExt_Directory extends Sabre_DAV_FSExt_Node implements Sabre_DAV_ICollection, Sabre_DAV_IQuota {
/**
- * Creates a new file in the directory
- *
- * @param string $name Name of the file
- * @param resource $data Initial payload
- * @return void
+ * Creates a new file in the directory
+ *
+ * Data will either be supplied as a stream resource, or in certain cases
+ * as a string. Keep in mind that you may have to support either.
+ *
+ * After succesful creation of the file, you may choose to return the ETag
+ * of the new file here.
+ *
+ * The returned ETag must be surrounded by double-quotes (The quotes should
+ * be part of the actual string).
+ *
+ * If you cannot accurately determine the ETag, you should not return it.
+ * If you don't store the file exactly as-is (you're transforming it
+ * somehow) you should also not return an ETag.
+ *
+ * This means that if a subsequent GET to this new file does not exactly
+ * return the same contents of what was submitted here, you are strongly
+ * recommended to omit the ETag.
+ *
+ * @param string $name Name of the file
+ * @param resource|string $data Initial payload
+ * @return null|string
*/
public function createFile($name, $data = null) {
@@ -25,12 +42,14 @@ class Sabre_DAV_FSExt_Directory extends Sabre_DAV_FSExt_Node implements Sabre_DA
$newPath = $this->path . '/' . $name;
file_put_contents($newPath,$data);
+ return '"' . md5_file($newPath) . '"';
+
}
/**
- * Creates a new subdirectory
- *
- * @param string $name
+ * Creates a new subdirectory
+ *
+ * @param string $name
* @return void
*/
public function createDirectory($name) {
@@ -43,18 +62,18 @@ class Sabre_DAV_FSExt_Directory extends Sabre_DAV_FSExt_Node implements Sabre_DA
}
/**
- * Returns a specific child node, referenced by its name
- *
- * @param string $name
- * @throws Sabre_DAV_Exception_FileNotFound
- * @return Sabre_DAV_INode
+ * Returns a specific child node, referenced by its name
+ *
+ * @param string $name
+ * @throws Sabre_DAV_Exception_NotFound
+ * @return Sabre_DAV_INode
*/
public function getChild($name) {
$path = $this->path . '/' . $name;
- if (!file_exists($path)) throw new Sabre_DAV_Exception_FileNotFound('File could not be located');
- if ($name=='.' || $name=='..') throw new Sabre_DAV_Exception_Forbidden('Permission denied to . and ..');
+ if (!file_exists($path)) throw new Sabre_DAV_Exception_NotFound('File could not be located');
+ if ($name=='.' || $name=='..') throw new Sabre_DAV_Exception_Forbidden('Permission denied to . and ..');
if (is_dir($path)) {
@@ -69,10 +88,10 @@ class Sabre_DAV_FSExt_Directory extends Sabre_DAV_FSExt_Node implements Sabre_DA
}
/**
- * Checks if a child exists.
- *
- * @param string $name
- * @return bool
+ * Checks if a child exists.
+ *
+ * @param string $name
+ * @return bool
*/
public function childExists($name) {
@@ -85,9 +104,9 @@ class Sabre_DAV_FSExt_Directory extends Sabre_DAV_FSExt_Node implements Sabre_DA
}
/**
- * Returns an array with all the child nodes
- *
- * @return Sabre_DAV_INode[]
+ * Returns an array with all the child nodes
+ *
+ * @return Sabre_DAV_INode[]
*/
public function getChildren() {
@@ -98,9 +117,9 @@ class Sabre_DAV_FSExt_Directory extends Sabre_DAV_FSExt_Node implements Sabre_DA
}
/**
- * Deletes all files in this directory, and then itself
- *
- * @return void
+ * Deletes all files in this directory, and then itself
+ *
+ * @return bool
*/
public function delete() {
@@ -118,16 +137,16 @@ class Sabre_DAV_FSExt_Directory extends Sabre_DAV_FSExt_Node implements Sabre_DA
}
/**
- * Returns available diskspace information
- *
- * @return array
+ * Returns available diskspace information
+ *
+ * @return array
*/
public function getQuotaInfo() {
return array(
disk_total_space($this->path)-disk_free_space($this->path),
disk_free_space($this->path)
- );
+ );
}
diff --git a/3rdparty/Sabre/DAV/FSExt/File.php b/3rdparty/Sabre/DAV/FSExt/File.php
index 7a8e7a11f21..b93ce5aee21 100644..100755
--- a/3rdparty/Sabre/DAV/FSExt/File.php
+++ b/3rdparty/Sabre/DAV/FSExt/File.php
@@ -1,34 +1,35 @@
<?php
/**
- * File class
- *
+ * File class
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_FSExt_File extends Sabre_DAV_FSExt_Node implements Sabre_DAV_IFile {
/**
- * Updates the data
+ * Updates the data
*
* data is a readable stream resource.
*
- * @param resource $data
- * @return void
+ * @param resource $data
+ * @return void
*/
public function put($data) {
file_put_contents($this->path,$data);
+ return '"' . md5_file($this->path) . '"';
}
/**
* Returns the data
*
- * @return string
+ * @return string
*/
public function get() {
@@ -39,7 +40,7 @@ class Sabre_DAV_FSExt_File extends Sabre_DAV_FSExt_Node implements Sabre_DAV_IFi
/**
* Delete the current file
*
- * @return void
+ * @return bool
*/
public function delete() {
@@ -52,9 +53,11 @@ class Sabre_DAV_FSExt_File extends Sabre_DAV_FSExt_Node implements Sabre_DAV_IFi
* Returns the ETag for a file
*
* An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
- * The ETag is an arbritrary string, but MUST be surrounded by double-quotes.
+ * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
*
* Return null if the ETag can not effectively be determined
+ *
+ * @return string|null
*/
public function getETag() {
@@ -66,7 +69,9 @@ class Sabre_DAV_FSExt_File extends Sabre_DAV_FSExt_Node implements Sabre_DAV_IFi
* Returns the mime-type for a file
*
* If null is returned, we'll assume application/octet-stream
- */
+ *
+ * @return string|null
+ */
public function getContentType() {
return null;
@@ -74,9 +79,9 @@ class Sabre_DAV_FSExt_File extends Sabre_DAV_FSExt_Node implements Sabre_DAV_IFi
}
/**
- * Returns the size of the file, in bytes
- *
- * @return int
+ * Returns the size of the file, in bytes
+ *
+ * @return int
*/
public function getSize() {
diff --git a/3rdparty/Sabre/DAV/FSExt/Node.php b/3rdparty/Sabre/DAV/FSExt/Node.php
index 9e36222bfd3..68ca06beb7e 100644..100755
--- a/3rdparty/Sabre/DAV/FSExt/Node.php
+++ b/3rdparty/Sabre/DAV/FSExt/Node.php
@@ -1,95 +1,28 @@
<?php
/**
- * Base node-class
+ * Base node-class
+ *
+ * The node class implements the method used by both the File and the Directory classes
*
- * The node class implements the method used by both the File and the Directory classes
- *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
-abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_DAV_ILockable, Sabre_DAV_IProperties {
-
- /**
- * Returns all the locks on this node
- *
- * @return array
- */
- function getLocks() {
-
- $resourceData = $this->getResourceData();
- $locks = $resourceData['locks'];
- foreach($locks as $k=>$lock) {
- if (time() > $lock->timeout + $lock->created) unset($locks[$k]);
- }
- return $locks;
-
- }
-
- /**
- * Locks this node
- *
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return void
- */
- function lock(Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- // We're making the lock timeout 30 minutes
- $lockInfo->timeout = 1800;
- $lockInfo->created = time();
-
- $resourceData = $this->getResourceData();
- if (!isset($resourceData['locks'])) $resourceData['locks'] = array();
- $current = null;
- foreach($resourceData['locks'] as $k=>$lock) {
- if ($lock->token === $lockInfo->token) $current = $k;
- }
- if (!is_null($current)) $resourceData['locks'][$current] = $lockInfo;
- else $resourceData['locks'][] = $lockInfo;
-
- $this->putResourceData($resourceData);
-
- }
-
- /**
- * Removes a lock from this node
- *
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- function unlock(Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- //throw new Sabre_DAV_Exception('bla');
- $resourceData = $this->getResourceData();
- foreach($resourceData['locks'] as $k=>$lock) {
-
- if ($lock->token === $lockInfo->token) {
-
- unset($resourceData['locks'][$k]);
- $this->putResourceData($resourceData);
- return true;
-
- }
- }
- return false;
-
- }
+abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_DAV_IProperties {
/**
* Updates properties on this node,
*
- * @param array $mutations
+ * @param array $properties
* @see Sabre_DAV_IProperties::updateProperties
- * @return bool|array
+ * @return bool|array
*/
public function updateProperties($properties) {
$resourceData = $this->getResourceData();
-
- $result = array();
foreach($properties as $propertyName=>$propertyValue) {
@@ -101,11 +34,11 @@ abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_D
} else {
$resourceData['properties'][$propertyName] = $propertyValue;
}
-
+
}
$this->putResourceData($resourceData);
- return true;
+ return true;
}
/**
@@ -114,8 +47,8 @@ abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_D
* The properties list is a list of propertynames the client requested, encoded as xmlnamespace#tagName, for example: http://www.example.org/namespace#author
* If the array is empty, all properties should be returned
*
- * @param array $properties
- * @return void
+ * @param array $properties
+ * @return array
*/
function getProperties($properties) {
@@ -134,9 +67,9 @@ abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_D
}
/**
- * Returns the path to the resource file
- *
- * @return string
+ * Returns the path to the resource file
+ *
+ * @return string
*/
protected function getResourceInfoPath() {
@@ -146,14 +79,14 @@ abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_D
}
/**
- * Returns all the stored resource information
- *
- * @return array
+ * Returns all the stored resource information
+ *
+ * @return array
*/
protected function getResourceData() {
$path = $this->getResourceInfoPath();
- if (!file_exists($path)) return array('locks'=>array(), 'properties' => array());
+ if (!file_exists($path)) return array('properties' => array());
// opening up the file, and creating a shared lock
$handle = fopen($path,'r');
@@ -171,20 +104,19 @@ abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_D
// Unserializing and checking if the resource file contains data for this file
$data = unserialize($data);
if (!isset($data[$this->getName()])) {
- return array('locks'=>array(), 'properties' => array());
+ return array('properties' => array());
}
$data = $data[$this->getName()];
- if (!isset($data['locks'])) $data['locks'] = array();
if (!isset($data['properties'])) $data['properties'] = array();
return $data;
}
/**
- * Updates the resource information
- *
- * @param array $newData
+ * Updates the resource information
+ *
+ * @param array $newData
* @return void
*/
protected function putResourceData(array $newData) {
@@ -238,6 +170,9 @@ abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_D
}
+ /**
+ * @return bool
+ */
public function deleteResourceData() {
// When we're deleting this node, we also need to delete any resource information
@@ -264,6 +199,7 @@ abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_D
fwrite($handle,serialize($data));
fclose($handle);
+ return true;
}
public function delete() {
diff --git a/3rdparty/Sabre/DAV/File.php b/3rdparty/Sabre/DAV/File.php
index b74bd9525b3..3126bd8d364 100644..100755
--- a/3rdparty/Sabre/DAV/File.php
+++ b/3rdparty/Sabre/DAV/File.php
@@ -4,12 +4,12 @@
* File class
*
* This is a helper class, that should aid in getting file classes setup.
- * Most of its methods are implemented, and throw permission denied exceptions
- *
+ * Most of its methods are implemented, and throw permission denied exceptions
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
abstract class Sabre_DAV_File extends Sabre_DAV_Node implements Sabre_DAV_IFile {
@@ -18,33 +18,33 @@ abstract class Sabre_DAV_File extends Sabre_DAV_Node implements Sabre_DAV_IFile
* Updates the data
*
* data is a readable stream resource.
- *
- * @param resource $data
- * @return void
+ *
+ * @param resource $data
+ * @return void
*/
- public function put($data) {
+ public function put($data) {
throw new Sabre_DAV_Exception_Forbidden('Permission denied to change data');
}
/**
- * Returns the data
+ * Returns the data
*
* This method may either return a string or a readable stream resource
*
- * @return mixed
+ * @return mixed
*/
- public function get() {
+ public function get() {
throw new Sabre_DAV_Exception_Forbidden('Permission denied to read this file');
}
-
+
/**
- * Returns the size of the file, in bytes.
- *
- * @return int
+ * Returns the size of the file, in bytes.
+ *
+ * @return int
*/
public function getSize() {
@@ -56,9 +56,11 @@ abstract class Sabre_DAV_File extends Sabre_DAV_Node implements Sabre_DAV_IFile
* Returns the ETag for a file
*
* An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
- * The ETag is an arbritrary string, but MUST be surrounded by double-quotes.
+ * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
*
* Return null if the ETag can not effectively be determined
+ *
+ * @return string|null
*/
public function getETag() {
@@ -70,7 +72,9 @@ abstract class Sabre_DAV_File extends Sabre_DAV_Node implements Sabre_DAV_IFile
* Returns the mime-type for a file
*
* If null is returned, we'll assume application/octet-stream
- */
+ *
+ * @return string|null
+ */
public function getContentType() {
return null;
diff --git a/3rdparty/Sabre/DAV/ICollection.php b/3rdparty/Sabre/DAV/ICollection.php
index 0667d88899d..4626038a66e 100644..100755
--- a/3rdparty/Sabre/DAV/ICollection.php
+++ b/3rdparty/Sabre/DAV/ICollection.php
@@ -3,54 +3,70 @@
/**
* The ICollection Interface
*
- * This interface should be implemented by each class that represents a collection
- *
+ * This interface should be implemented by each class that represents a collection
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_DAV_ICollection extends Sabre_DAV_INode {
/**
- * Creates a new file in the directory
- *
- * data is a readable stream resource
+ * Creates a new file in the directory
*
- * @param string $name Name of the file
- * @param resource $data Initial payload
- * @return void
+ * Data will either be supplied as a stream resource, or in certain cases
+ * as a string. Keep in mind that you may have to support either.
+ *
+ * After succesful creation of the file, you may choose to return the ETag
+ * of the new file here.
+ *
+ * The returned ETag must be surrounded by double-quotes (The quotes should
+ * be part of the actual string).
+ *
+ * If you cannot accurately determine the ETag, you should not return it.
+ * If you don't store the file exactly as-is (you're transforming it
+ * somehow) you should also not return an ETag.
+ *
+ * This means that if a subsequent GET to this new file does not exactly
+ * return the same contents of what was submitted here, you are strongly
+ * recommended to omit the ETag.
+ *
+ * @param string $name Name of the file
+ * @param resource|string $data Initial payload
+ * @return null|string
*/
function createFile($name, $data = null);
/**
- * Creates a new subdirectory
- *
- * @param string $name
+ * Creates a new subdirectory
+ *
+ * @param string $name
* @return void
*/
function createDirectory($name);
/**
- * Returns a specific child node, referenced by its name
- *
- * @param string $name
- * @return Sabre_DAV_INode
+ * Returns a specific child node, referenced by its name
+ *
+ * @param string $name
+ * @return Sabre_DAV_INode
*/
function getChild($name);
/**
- * Returns an array with all the child nodes
- *
- * @return Sabre_DAV_INode[]
+ * Returns an array with all the child nodes
+ *
+ * @return Sabre_DAV_INode[]
*/
function getChildren();
/**
- * Checks if a child-node with the specified name exists
- *
- * @return bool
+ * Checks if a child-node with the specified name exists
+ *
+ * @param string $name
+ * @return bool
*/
function childExists($name);
diff --git a/3rdparty/Sabre/DAV/IExtendedCollection.php b/3rdparty/Sabre/DAV/IExtendedCollection.php
index b8db1ab2f26..6ec345f9a62 100644..100755
--- a/3rdparty/Sabre/DAV/IExtendedCollection.php
+++ b/3rdparty/Sabre/DAV/IExtendedCollection.php
@@ -5,11 +5,11 @@
*
* This interface can be used to create special-type of collection-resources
* as defined by RFC 5689.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_DAV_IExtendedCollection extends Sabre_DAV_ICollection {
@@ -17,7 +17,7 @@ interface Sabre_DAV_IExtendedCollection extends Sabre_DAV_ICollection {
/**
* Creates a new collection
*
- * @param string $name
+ * @param string $name
* @param array $resourceType
* @param array $properties
* @return void
diff --git a/3rdparty/Sabre/DAV/IFile.php b/3rdparty/Sabre/DAV/IFile.php
index 446ec86187b..478f822ae71 100644..100755
--- a/3rdparty/Sabre/DAV/IFile.php
+++ b/3rdparty/Sabre/DAV/IFile.php
@@ -1,34 +1,48 @@
<?php
/**
- * This interface represents a file or leaf in the tree.
+ * This interface represents a file in the directory tree
+ *
+ * A file is a bit of a broad definition. In general it implies that on
+ * this specific node a PUT or GET method may be performed, to either update,
+ * or retrieve the contents of the file.
*
- * The nature of a file is, as you might be aware of, that it doesn't contain sub-nodes and has contents
- *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_DAV_IFile extends Sabre_DAV_INode {
/**
- * Updates the data
- *
+ * Updates the data
+ *
* The data argument is a readable stream resource.
*
- * @param resource $data
- * @return void
+ * After a succesful put operation, you may choose to return an ETag. The
+ * etag must always be surrounded by double-quotes. These quotes must
+ * appear in the actual string you're returning.
+ *
+ * Clients may use the ETag from a PUT request to later on make sure that
+ * when they update the file, the contents haven't changed in the mean
+ * time.
+ *
+ * If you don't plan to store the file byte-by-byte, and you return a
+ * different object on a subsequent GET you are strongly recommended to not
+ * return an ETag, and just return null.
+ *
+ * @param resource $data
+ * @return string|null
*/
function put($data);
/**
- * Returns the data
- *
+ * Returns the data
+ *
* This method may either return a string or a readable stream resource
*
- * @return mixed
+ * @return mixed
*/
function get();
@@ -36,7 +50,7 @@ interface Sabre_DAV_IFile extends Sabre_DAV_INode {
* Returns the mime-type for a file
*
* If null is returned, we'll assume application/octet-stream
- *
+ *
* @return void
*/
function getContentType();
@@ -47,15 +61,15 @@ interface Sabre_DAV_IFile extends Sabre_DAV_INode {
* An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
*
* Return null if the ETag can not effectively be determined
- *
+ *
* @return void
*/
function getETag();
/**
- * Returns the size of the node, in bytes
- *
- * @return int
+ * Returns the size of the node, in bytes
+ *
+ * @return int
*/
function getSize();
diff --git a/3rdparty/Sabre/DAV/ILockable.php b/3rdparty/Sabre/DAV/ILockable.php
deleted file mode 100644
index f9fb3a70251..00000000000
--- a/3rdparty/Sabre/DAV/ILockable.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * Implement this class to support locking
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_ILockable extends Sabre_DAV_INode {
-
- /**
- * Returns an array with locks currently on the node
- *
- * @return Sabre_DAV_Locks_LockInfo[]
- */
- function getLocks();
-
- /**
- * Creates a new lock on the file.
- *
- * @param Sabre_DAV_Locks_LockInfo $lockInfo The lock information
- * @return void
- */
- function lock(Sabre_DAV_Locks_LockInfo $lockInfo);
-
- /**
- * Unlocks a file
- *
- * @param Sabre_DAV_Locks_LockInfo $lockInfo The lock information
- * @return void
- */
- function unlock(Sabre_DAV_Locks_LockInfo $lockInfo);
-
-}
-
diff --git a/3rdparty/Sabre/DAV/INode.php b/3rdparty/Sabre/DAV/INode.php
index c0b96bf5377..c57d3923105 100644..100755
--- a/3rdparty/Sabre/DAV/INode.php
+++ b/3rdparty/Sabre/DAV/INode.php
@@ -2,11 +2,11 @@
/**
* The INode interface is the base interface, and the parent class of both ICollection and IFile
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_DAV_INode {
@@ -14,14 +14,16 @@ interface Sabre_DAV_INode {
/**
* Deleted the current node
*
- * @return void
+ * @return void
*/
function delete();
/**
- * Returns the name of the node
- *
- * @return string
+ * Returns the name of the node.
+ *
+ * This is used to generate the url.
+ *
+ * @return string
*/
function getName();
@@ -34,9 +36,9 @@ interface Sabre_DAV_INode {
function setName($name);
/**
- * Returns the last modification time, as a unix timestamp
- *
- * @return int
+ * Returns the last modification time, as a unix timestamp
+ *
+ * @return int
*/
function getLastModified();
diff --git a/3rdparty/Sabre/DAV/IProperties.php b/3rdparty/Sabre/DAV/IProperties.php
index af17cad24af..38eaab16dad 100644..100755
--- a/3rdparty/Sabre/DAV/IProperties.php
+++ b/3rdparty/Sabre/DAV/IProperties.php
@@ -4,11 +4,11 @@
* IProperties interface
*
* Implement this interface to support custom WebDAV properties requested and sent from clients.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_DAV_IProperties extends Sabre_DAV_INode {
@@ -26,7 +26,7 @@ interface Sabre_DAV_IProperties extends Sabre_DAV_INode {
* If the operation was successful, true can be returned.
* If the operation failed, false can be returned.
*
- * Deletion of a non-existant property is always succesful.
+ * Deletion of a non-existent property is always successful.
*
* Lastly, it is optional to return detailed information about any
* failures. In this case an array should be returned with the following
@@ -41,12 +41,12 @@ interface Sabre_DAV_IProperties extends Sabre_DAV_INode {
* )
* )
*
- * In this example it was forbidden to update {DAV:}displayname.
+ * In this example it was forbidden to update {DAV:}displayname.
* (403 Forbidden), which in turn also caused {DAV:}owner to fail
* (424 Failed Dependency) because the request needs to be atomic.
*
- * @param array $mutations
- * @return bool|array
+ * @param array $mutations
+ * @return bool|array
*/
function updateProperties($mutations);
@@ -58,7 +58,7 @@ interface Sabre_DAV_IProperties extends Sabre_DAV_INode {
*
* If the array is empty, it means 'all properties' were requested.
*
- * @param array $properties
+ * @param array $properties
* @return void
*/
function getProperties($properties);
diff --git a/3rdparty/Sabre/DAV/IQuota.php b/3rdparty/Sabre/DAV/IQuota.php
index 8ff1a4597f8..3fe4c4eced4 100644..100755
--- a/3rdparty/Sabre/DAV/IQuota.php
+++ b/3rdparty/Sabre/DAV/IQuota.php
@@ -4,13 +4,13 @@
* IQuota interface
*
* Implement this interface to add the ability to return quota information. The ObjectTree
- * will check for quota information on any given node. If the information is not available it will
+ * will check for quota information on any given node. If the information is not available it will
* attempt to fetch the information from the root node.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_DAV_IQuota extends Sabre_DAV_ICollection {
@@ -21,7 +21,7 @@ interface Sabre_DAV_IQuota extends Sabre_DAV_ICollection {
* This method MUST return an array with 2 values, the first being the total used space,
* the second the available space (in bytes)
*/
- function getQuotaInfo();
+ function getQuotaInfo();
}
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php b/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php
index b09f93ddac7..127e643a2b9 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php
+++ b/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php
@@ -4,45 +4,45 @@
* The Lock manager allows you to handle all file-locks centrally.
*
* This is an alternative approach to doing this on a per-node basis
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
abstract class Sabre_DAV_Locks_Backend_Abstract {
/**
- * Returns a list of Sabre_DAV_Locks_LockInfo objects
- *
+ * Returns a list of Sabre_DAV_Locks_LockInfo objects
+ *
* This method should return all the locks for a particular uri, including
* locks that might be set on a parent uri.
*
* If returnChildLocks is set to true, this method should also look for
* any locks in the subtree of the uri for locks.
*
- * @param string $uri
+ * @param string $uri
* @param bool $returnChildLocks
- * @return array
+ * @return array
*/
abstract function getLocks($uri, $returnChildLocks);
/**
- * Locks a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
+ * Locks a uri
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
abstract function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo);
/**
- * Removes a lock from a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
+ * Removes a lock from a uri
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
abstract function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo);
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/FS.php b/3rdparty/Sabre/DAV/Locks/Backend/FS.php
index 8653f55b1c6..02cab87fc82 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Backend/FS.php
+++ b/3rdparty/Sabre/DAV/Locks/Backend/FS.php
@@ -1,28 +1,30 @@
<?php
/**
- * The Lock manager allows you to handle all file-locks centrally.
+ * This Lock Backend stores all its data in the filesystem in separate file per
+ * node.
*
- * This Lock Manager is now deprecated. It has a bug that allows parent
- * collections to be deletes when children deeper in the tree are locked.
+ * This Lock Manager is now deprecated. It has a bug that allows parent
+ * collections to be deletes when children deeper in the tree are locked.
+ *
+ * This also means that using this backend means you will not pass the Neon
+ * Litmus test.
*
* You are recommended to use either the PDO or the File backend instead.
*
- * This Lock Manager stores all its data in the filesystem.
- *
* @package Sabre
* @subpackage DAV
* @deprecated
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Locks_Backend_FS extends Sabre_DAV_Locks_Backend_Abstract {
/**
- * The default data directory
- *
- * @var string
+ * The default data directory
+ *
+ * @var string
*/
private $dataDir;
@@ -40,17 +42,17 @@ class Sabre_DAV_Locks_Backend_FS extends Sabre_DAV_Locks_Backend_Abstract {
/**
- * Returns a list of Sabre_DAV_Locks_LockInfo objects
- *
+ * Returns a list of Sabre_DAV_Locks_LockInfo objects
+ *
* This method should return all the locks for a particular uri, including
* locks that might be set on a parent uri.
*
* If returnChildLocks is set to true, this method should also look for
* any locks in the subtree of the uri for locks.
*
- * @param string $uri
+ * @param string $uri
* @param bool $returnChildLocks
- * @return array
+ * @return array
*/
public function getLocks($uri, $returnChildLocks) {
@@ -59,15 +61,15 @@ class Sabre_DAV_Locks_Backend_FS extends Sabre_DAV_Locks_Backend_Abstract {
foreach(explode('/',$uri) as $uriPart) {
- // weird algorithm that can probably be improved, but we're traversing the path top down
- if ($currentPath) $currentPath.='/';
+ // weird algorithm that can probably be improved, but we're traversing the path top down
+ if ($currentPath) $currentPath.='/';
$currentPath.=$uriPart;
$uriLocks = $this->getData($currentPath);
foreach($uriLocks as $uriLock) {
- // Unless we're on the leaf of the uri-tree we should ingore locks with depth 0
+ // Unless we're on the leaf of the uri-tree we should ignore locks with depth 0
if($uri==$currentPath || $uriLock->depth!=0) {
$uriLock->uri = $currentPath;
$lockList[] = $uriLock;
@@ -79,18 +81,18 @@ class Sabre_DAV_Locks_Backend_FS extends Sabre_DAV_Locks_Backend_Abstract {
// Checking if we can remove any of these locks
foreach($lockList as $k=>$lock) {
- if (time() > $lock->timeout + $lock->created) unset($lockList[$k]);
+ if (time() > $lock->timeout + $lock->created) unset($lockList[$k]);
}
return $lockList;
}
/**
- * Locks a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
+ * Locks a uri
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
public function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
@@ -109,11 +111,11 @@ class Sabre_DAV_Locks_Backend_FS extends Sabre_DAV_Locks_Backend_Abstract {
}
/**
- * Removes a lock from a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
+ * Removes a lock from a uri
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
@@ -136,7 +138,7 @@ class Sabre_DAV_Locks_Backend_FS extends Sabre_DAV_Locks_Backend_Abstract {
* Returns the stored data for a uri
*
* @param string $uri
- * @return array
+ * @return array
*/
protected function getData($uri) {
@@ -167,7 +169,7 @@ class Sabre_DAV_Locks_Backend_FS extends Sabre_DAV_Locks_Backend_Abstract {
* Updates the lock information
*
* @param string $uri
- * @param array $newData
+ * @param array $newData
* @return void
*/
protected function putData($uri,array $newData) {
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/File.php b/3rdparty/Sabre/DAV/Locks/Backend/File.php
index f65b20c4306..c33f963514b 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Backend/File.php
+++ b/3rdparty/Sabre/DAV/Locks/Backend/File.php
@@ -3,30 +3,30 @@
/**
* The Lock manager allows you to handle all file-locks centrally.
*
- * This Lock Manager stores all its data in a single file.
+ * This Lock Manager stores all its data in a single file.
*
* Note that this is not nearly as robust as a database, you are encouraged
* to use the PDO backend instead.
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Locks_Backend_File extends Sabre_DAV_Locks_Backend_Abstract {
/**
* The storage file
- *
- * @var string
+ *
+ * @var string
*/
private $locksFile;
/**
* Constructor
*
- * @param string $locksFile path to file
+ * @param string $locksFile path to file
*/
public function __construct($locksFile) {
@@ -35,24 +35,24 @@ class Sabre_DAV_Locks_Backend_File extends Sabre_DAV_Locks_Backend_Abstract {
}
/**
- * Returns a list of Sabre_DAV_Locks_LockInfo objects
- *
+ * Returns a list of Sabre_DAV_Locks_LockInfo objects
+ *
* This method should return all the locks for a particular uri, including
* locks that might be set on a parent uri.
*
* If returnChildLocks is set to true, this method should also look for
* any locks in the subtree of the uri for locks.
*
- * @param string $uri
+ * @param string $uri
* @param bool $returnChildLocks
- * @return array
+ * @return array
*/
public function getLocks($uri, $returnChildLocks) {
$newLocks = array();
- $currentPath = '';
$locks = $this->getData();
+
foreach($locks as $lock) {
if ($lock->uri === $uri ||
@@ -70,29 +70,35 @@ class Sabre_DAV_Locks_Backend_File extends Sabre_DAV_Locks_Backend_Abstract {
// Checking if we can remove any of these locks
foreach($newLocks as $k=>$lock) {
- if (time() > $lock->timeout + $lock->created) unset($newLocks[$k]);
+ if (time() > $lock->timeout + $lock->created) unset($newLocks[$k]);
}
return $newLocks;
}
/**
- * Locks a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
+ * Locks a uri
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
- public function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
+ public function lock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
// We're making the lock timeout 30 minutes
$lockInfo->timeout = 1800;
$lockInfo->created = time();
$lockInfo->uri = $uri;
- $locks = $this->getLocks($uri,false);
+ $locks = $this->getData();
+
foreach($locks as $k=>$lock) {
- if ($lock->token == $lockInfo->token) unset($locks[$k]);
+ if (
+ ($lock->token == $lockInfo->token) ||
+ (time() > $lock->timeout + $lock->created)
+ ) {
+ unset($locks[$k]);
+ }
}
$locks[] = $lockInfo;
$this->putData($locks);
@@ -101,15 +107,15 @@ class Sabre_DAV_Locks_Backend_File extends Sabre_DAV_Locks_Backend_Abstract {
}
/**
- * Removes a lock from a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
+ * Removes a lock from a uri
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
- public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
+ public function unlock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
- $locks = $this->getLocks($uri,false);
+ $locks = $this->getData();
foreach($locks as $k=>$lock) {
if ($lock->token == $lockInfo->token) {
@@ -127,7 +133,7 @@ class Sabre_DAV_Locks_Backend_File extends Sabre_DAV_Locks_Backend_Abstract {
/**
* Loads the lockdata from the filesystem.
*
- * @return array
+ * @return array
*/
protected function getData() {
@@ -153,7 +159,7 @@ class Sabre_DAV_Locks_Backend_File extends Sabre_DAV_Locks_Backend_Abstract {
/**
* Saves the lockdata
*
- * @param array $newData
+ * @param array $newData
* @return void
*/
protected function putData(array $newData) {
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/PDO.php b/3rdparty/Sabre/DAV/Locks/Backend/PDO.php
index c3923af19d3..acce80638ec 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Backend/PDO.php
+++ b/3rdparty/Sabre/DAV/Locks/Backend/PDO.php
@@ -5,34 +5,34 @@
*
* This Lock Manager stores all its data in a database. You must pass a PDO
* connection object in the constructor.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Locks_Backend_PDO extends Sabre_DAV_Locks_Backend_Abstract {
/**
- * The PDO connection object
- *
- * @var pdo
+ * The PDO connection object
+ *
+ * @var pdo
*/
private $pdo;
/**
- * The PDO tablename this backend uses.
- *
+ * The PDO tablename this backend uses.
+ *
* @var string
*/
protected $tableName;
/**
- * Constructor
- *
+ * Constructor
+ *
* @param PDO $pdo
- * @param string $tableName
+ * @param string $tableName
*/
public function __construct(PDO $pdo, $tableName = 'locks') {
@@ -42,24 +42,24 @@ class Sabre_DAV_Locks_Backend_PDO extends Sabre_DAV_Locks_Backend_Abstract {
}
/**
- * Returns a list of Sabre_DAV_Locks_LockInfo objects
- *
+ * Returns a list of Sabre_DAV_Locks_LockInfo objects
+ *
* This method should return all the locks for a particular uri, including
* locks that might be set on a parent uri.
*
* If returnChildLocks is set to true, this method should also look for
* any locks in the subtree of the uri for locks.
*
- * @param string $uri
+ * @param string $uri
* @param bool $returnChildLocks
- * @return array
+ * @return array
*/
public function getLocks($uri, $returnChildLocks) {
- // NOTE: the following 10 lines or so could be easily replaced by
- // pure sql. MySQL's non-standard string concatination prevents us
+ // NOTE: the following 10 lines or so could be easily replaced by
+ // pure sql. MySQL's non-standard string concatenation prevents us
// from doing this though.
- $query = 'SELECT owner, token, timeout, created, scope, depth, uri FROM `'.$this->tableName.'` WHERE ((created + timeout) > CAST(? AS UNSIGNED INTEGER)) AND ((uri = ?)';
+ $query = 'SELECT owner, token, timeout, created, scope, depth, uri FROM '.$this->tableName.' WHERE ((created + timeout) > CAST(? AS UNSIGNED INTEGER)) AND ((uri = ?)';
$params = array(time(),$uri);
// We need to check locks for every part in the uri.
@@ -112,11 +112,11 @@ class Sabre_DAV_Locks_Backend_PDO extends Sabre_DAV_Locks_Backend_Abstract {
}
/**
- * Locks a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
+ * Locks a uri
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
public function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
@@ -127,15 +127,15 @@ class Sabre_DAV_Locks_Backend_PDO extends Sabre_DAV_Locks_Backend_Abstract {
$locks = $this->getLocks($uri,false);
$exists = false;
- foreach($locks as $k=>$lock) {
+ foreach($locks as $lock) {
if ($lock->token == $lockInfo->token) $exists = true;
}
-
+
if ($exists) {
- $stmt = $this->pdo->prepare('UPDATE `'.$this->tableName.'` SET owner = ?, timeout = ?, scope = ?, depth = ?, uri = ?, created = ? WHERE token = ?');
+ $stmt = $this->pdo->prepare('UPDATE '.$this->tableName.' SET owner = ?, timeout = ?, scope = ?, depth = ?, uri = ?, created = ? WHERE token = ?');
$stmt->execute(array($lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,$lockInfo->token));
} else {
- $stmt = $this->pdo->prepare('INSERT INTO `'.$this->tableName.'` (owner,timeout,scope,depth,uri,created,token) VALUES (?,?,?,?,?,?,?)');
+ $stmt = $this->pdo->prepare('INSERT INTO '.$this->tableName.' (owner,timeout,scope,depth,uri,created,token) VALUES (?,?,?,?,?,?,?)');
$stmt->execute(array($lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,$lockInfo->token));
}
@@ -146,15 +146,15 @@ class Sabre_DAV_Locks_Backend_PDO extends Sabre_DAV_Locks_Backend_Abstract {
/**
- * Removes a lock from a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
+ * Removes a lock from a uri
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
- $stmt = $this->pdo->prepare('DELETE FROM `'.$this->tableName.'` WHERE uri = ? AND token = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->tableName.' WHERE uri = ? AND token = ?');
$stmt->execute(array($uri,$lockInfo->token));
return $stmt->rowCount()===1;
diff --git a/3rdparty/Sabre/DAV/Locks/LockInfo.php b/3rdparty/Sabre/DAV/Locks/LockInfo.php
index 6a064466f40..9df014a4281 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/LockInfo.php
+++ b/3rdparty/Sabre/DAV/Locks/LockInfo.php
@@ -5,11 +5,11 @@
*
* An object of the LockInfo class holds all the information relevant to a
* single lock.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Locks_LockInfo {
@@ -30,37 +30,37 @@ class Sabre_DAV_Locks_LockInfo {
const TIMEOUT_INFINITE = -1;
/**
- * The owner of the lock
- *
- * @var string
+ * The owner of the lock
+ *
+ * @var string
*/
public $owner;
/**
- * The locktoken
- *
- * @var string
+ * The locktoken
+ *
+ * @var string
*/
public $token;
/**
- * How long till the lock is expiring
- *
- * @var int
+ * How long till the lock is expiring
+ *
+ * @var int
*/
public $timeout;
/**
- * UNIX Timestamp of when this lock was created
- *
- * @var int
+ * UNIX Timestamp of when this lock was created
+ *
+ * @var int
*/
public $created;
/**
- * Exclusive or shared lock
- *
- * @var int
+ * Exclusive or shared lock
+ *
+ * @var int
*/
public $scope = self::EXCLUSIVE;
@@ -72,7 +72,7 @@ class Sabre_DAV_Locks_LockInfo {
/**
* The uri this lock locks
*
- * TODO: This value is not always set
+ * TODO: This value is not always set
* @var mixed
*/
public $uri;
diff --git a/3rdparty/Sabre/DAV/Locks/Plugin.php b/3rdparty/Sabre/DAV/Locks/Plugin.php
index 461e2847e0a..fd956950b8a 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Plugin.php
+++ b/3rdparty/Sabre/DAV/Locks/Plugin.php
@@ -9,38 +9,37 @@
* $lockBackend = new Sabre_DAV_Locks_Backend_File('./mylockdb');
* $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
* $server->addPlugin($lockPlugin);
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
/**
- * locksBackend
- *
- * @var Sabre_DAV_Locks_Backend_Abstract
+ * locksBackend
+ *
+ * @var Sabre_DAV_Locks_Backend_Abstract
*/
private $locksBackend;
/**
* server
- *
- * @var Sabre_DAV_Server
+ *
+ * @var Sabre_DAV_Server
*/
private $server;
/**
- * __construct
- *
- * @param Sabre_DAV_Locks_Backend_Abstract $locksBackend
- * @return void
+ * __construct
+ *
+ * @param Sabre_DAV_Locks_Backend_Abstract $locksBackend
*/
public function __construct(Sabre_DAV_Locks_Backend_Abstract $locksBackend = null) {
- $this->locksBackend = $locksBackend;
+ $this->locksBackend = $locksBackend;
}
@@ -48,8 +47,8 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
* Initializes the plugin
*
* This method is automatically called by the Server class after addPlugin.
- *
- * @param Sabre_DAV_Server $server
+ *
+ * @param Sabre_DAV_Server $server
* @return void
*/
public function initialize(Sabre_DAV_Server $server) {
@@ -63,11 +62,11 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
/**
* Returns a plugin name.
- *
+ *
* Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
+ * using Sabre_DAV_Server::getPlugin
+ *
+ * @return string
*/
public function getPluginName() {
@@ -76,20 +75,21 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
- * This method is called by the Server if the user used an HTTP method
+ * This method is called by the Server if the user used an HTTP method
* the server didn't recognize.
*
* This plugin intercepts the LOCK and UNLOCK methods.
- *
- * @param string $method
- * @return bool
+ *
+ * @param string $method
+ * @param string $uri
+ * @return bool
*/
public function unknownMethod($method, $uri) {
- switch($method) {
+ switch($method) {
- case 'LOCK' : $this->httpLock($uri); return false;
- case 'UNLOCK' : $this->httpUnlock($uri); return false;
+ case 'LOCK' : $this->httpLock($uri); return false;
+ case 'UNLOCK' : $this->httpUnlock($uri); return false;
}
@@ -98,26 +98,20 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
/**
* This method is called after most properties have been found
* it allows us to add in any Lock-related properties
- *
- * @param string $path
- * @param array $properties
- * @return bool
+ *
+ * @param string $path
+ * @param array $newProperties
+ * @return bool
*/
- public function afterGetProperties($path,&$newProperties) {
+ public function afterGetProperties($path, &$newProperties) {
foreach($newProperties[404] as $propName=>$discard) {
- $node = null;
-
switch($propName) {
case '{DAV:}supportedlock' :
$val = false;
if ($this->locksBackend) $val = true;
- else {
- if (!$node) $node = $this->server->tree->getNodeForPath($path);
- if ($node instanceof Sabre_DAV_ILockable) $val = true;
- }
$newProperties[200][$propName] = new Sabre_DAV_Property_SupportedLock($val);
unset($newProperties[404][$propName]);
break;
@@ -141,10 +135,10 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
* handled.
*
* This plugin uses that feature to intercept access to locked resources.
- *
+ *
* @param string $method
* @param string $uri
- * @return bool
+ * @return bool
*/
public function beforeMethod($method, $uri) {
@@ -187,18 +181,17 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
* Use this method to tell the server this plugin defines additional
* HTTP methods.
*
- * This method is passed a uri. It should only return HTTP methods that are
+ * This method is passed a uri. It should only return HTTP methods that are
* available for the specified uri.
*
* @param string $uri
- * @return array
+ * @return array
*/
public function getHTTPMethods($uri) {
- if ($this->locksBackend ||
- $this->server->tree->getNodeForPath($uri) instanceof Sabre_DAV_ILocks) {
+ if ($this->locksBackend)
return array('LOCK','UNLOCK');
- }
+
return array();
}
@@ -208,8 +201,8 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
*
* In this case this is only the number 2. The 2 in the Dav: header
* indicates the server supports locks.
- *
- * @return array
+ *
+ * @return array
*/
public function getFeatures() {
@@ -218,49 +211,23 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
- * Returns all lock information on a particular uri
- *
+ * Returns all lock information on a particular uri
+ *
* This function should return an array with Sabre_DAV_Locks_LockInfo objects. If there are no locks on a file, return an empty array.
*
- * Additionally there is also the possibility of locks on parent nodes, so we'll need to traverse every part of the tree
+ * Additionally there is also the possibility of locks on parent nodes, so we'll need to traverse every part of the tree
* If the $returnChildLocks argument is set to true, we'll also traverse all the children of the object
* for any possible locks and return those as well.
*
- * @param string $uri
+ * @param string $uri
* @param bool $returnChildLocks
- * @return array
+ * @return array
*/
public function getLocks($uri, $returnChildLocks = false) {
$lockList = array();
- $currentPath = '';
- foreach(explode('/',$uri) as $uriPart) {
- $uriLocks = array();
- if ($currentPath) $currentPath.='/';
- $currentPath.=$uriPart;
-
- try {
-
- $node = $this->server->tree->getNodeForPath($currentPath);
- if ($node instanceof Sabre_DAV_ILockable) $uriLocks = $node->getLocks();
-
- } catch (Sabre_DAV_Exception_FileNotFound $e){
- // In case the node didn't exist, this could be a lock-null request
- }
-
- foreach($uriLocks as $uriLock) {
-
- // Unless we're on the leaf of the uri-tree we should ignore locks with depth 0
- if($uri==$currentPath || $uriLock->depth!=0) {
- $uriLock->uri = $currentPath;
- $lockList[] = $uriLock;
- }
-
- }
-
- }
- if ($this->locksBackend)
+ if ($this->locksBackend)
$lockList = array_merge($lockList,$this->locksBackend->getLocks($uri, $returnChildLocks));
return $lockList;
@@ -271,13 +238,13 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
* Locks an uri
*
* The WebDAV lock request can be operated to either create a new lock on a file, or to refresh an existing lock
- * If a new lock is created, a full XML body should be supplied, containing information about the lock such as the type
+ * If a new lock is created, a full XML body should be supplied, containing information about the lock such as the type
* of lock (shared or exclusive) and the owner of the lock
*
* If a lock is to be refreshed, no body should be supplied and there should be a valid If header containing the lock
*
- * Additionally, a lock can be requested for a non-existant file. In these case we're obligated to create an empty file as per RFC4918:S7.3
- *
+ * Additionally, a lock can be requested for a non-existent file. In these case we're obligated to create an empty file as per RFC4918:S7.3
+ *
* @param string $uri
* @return void
*/
@@ -297,7 +264,7 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
if ($body = $this->server->httpRequest->getBody(true)) {
// This is a new lock request
$lockInfo = $this->parseLockRequest($body);
- $lockInfo->depth = $this->server->getHTTPDepth();
+ $lockInfo->depth = $this->server->getHTTPDepth();
$lockInfo->uri = $uri;
if($lastLock && $lockInfo->scope != Sabre_DAV_Locks_LockInfo::SHARED) throw new Sabre_DAV_Exception_ConflictingLock($lastLock);
@@ -306,11 +273,11 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
// This must have been a lock refresh
$lockInfo = $lastLock;
- // The resource could have been locked through another uri.
+ // The resource could have been locked through another uri.
if ($uri!=$lockInfo->uri) $uri = $lockInfo->uri;
} else {
-
+
// There was neither a lock refresh nor a new lock request
throw new Sabre_DAV_Exception_BadRequest('An xml body is required for lock requests');
@@ -322,16 +289,16 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
// If we got this far.. we should go check if this node actually exists. If this is not the case, we need to create it first
try {
- $node = $this->server->tree->getNodeForPath($uri);
-
+ $this->server->tree->getNodeForPath($uri);
+
// We need to call the beforeWriteContent event for RFC3744
$this->server->broadcastEvent('beforeWriteContent',array($uri));
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
-
+ } catch (Sabre_DAV_Exception_NotFound $e) {
+
// It didn't, lets create it
- $this->server->createFile($uri,fopen('php://memory','r'));
- $newFile = true;
+ $this->server->createFile($uri,fopen('php://memory','r'));
+ $newFile = true;
}
@@ -362,7 +329,7 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
$locks = $this->getLocks($uri);
- // Windows sometimes forgets to include < and > in the Lock-Token
+ // Windows sometimes forgets to include < and > in the Lock-Token
// header
if ($lockToken[0]!=='<') $lockToken = '<' . $lockToken . '>';
@@ -370,7 +337,6 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
if ('<opaquelocktoken:' . $lock->token . '>' == $lockToken) {
- $this->server->broadcastEvent('beforeUnlock',array($uri, $lock));
$this->unlockNode($uri,$lock);
$this->server->httpResponse->setHeader('Content-Length','0');
$this->server->httpResponse->sendStatus(204);
@@ -390,21 +356,15 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
*
* All the locking information is supplied in the lockInfo object. The object has a suggested timeout, but this can be safely ignored
* It is important that if the existing timeout is ignored, the property is overwritten, as this needs to be sent back to the client
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return void
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
public function lockNode($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
if (!$this->server->broadcastEvent('beforeLock',array($uri,$lockInfo))) return;
- try {
- $node = $this->server->tree->getNodeForPath($uri);
- if ($node instanceof Sabre_DAV_ILockable) return $node->lock($lockInfo);
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
- // In case the node didn't exist, this could be a lock-null request
- }
if ($this->locksBackend) return $this->locksBackend->lock($uri,$lockInfo);
throw new Sabre_DAV_Exception_MethodNotAllowed('Locking support is not enabled for this resource. No Locking backend was found so if you didn\'t expect this error, please check your configuration.');
@@ -414,29 +374,22 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
* Unlocks a uri
*
* This method removes a lock from a uri. It is assumed all the supplied information is correct and verified
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return void
+ *
+ * @param string $uri
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return bool
*/
public function unlockNode($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
if (!$this->server->broadcastEvent('beforeUnlock',array($uri,$lockInfo))) return;
- try {
- $node = $this->server->tree->getNodeForPath($uri);
- if ($node instanceof Sabre_DAV_ILockable) return $node->unlock($lockInfo);
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
- // In case the node didn't exist, this could be a lock-null request
- }
-
if ($this->locksBackend) return $this->locksBackend->unlock($uri,$lockInfo);
}
/**
- * Returns the contents of the HTTP Timeout header.
- *
+ * Returns the contents of the HTTP Timeout header.
+ *
* The method formats the header into an integer.
*
* @return int
@@ -444,7 +397,7 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
public function getTimeoutHeader() {
$header = $this->server->httpRequest->getHeader('Timeout');
-
+
if ($header) {
if (stripos($header,'second-')===0) $header = (int)(substr($header,7));
@@ -462,16 +415,16 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
- * Generates the response for successfull LOCK requests
- *
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return string
+ * Generates the response for successful LOCK requests
+ *
+ * @param Sabre_DAV_Locks_LockInfo $lockInfo
+ * @return string
*/
protected function generateLockResponse(Sabre_DAV_Locks_LockInfo $lockInfo) {
$dom = new DOMDocument('1.0','utf-8');
$dom->formatOutput = true;
-
+
$prop = $dom->createElementNS('DAV:','d:prop');
$dom->appendChild($prop);
@@ -484,10 +437,10 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
return $dom->saveXML();
}
-
+
/**
* validateLock should be called when a write operation is about to happen
- * It will check if the requested url is locked, and see if the correct lock tokens are passed
+ * It will check if the requested url is locked, and see if the correct lock tokens are passed
*
* @param mixed $urls List of relevant urls. Can be an array, a string or nothing at all for the current request uri
* @param mixed $lastLock This variable will be populated with the last checked lock object (Sabre_DAV_Locks_LockInfo)
@@ -511,13 +464,13 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
$locks = $this->getLocks($url, $checkChildLocks);
- // If there were no conditions, but there were locks, we fail
+ // If there were no conditions, but there were locks, we fail
if (!$conditions && $locks) {
reset($locks);
$lastLock = current($locks);
return false;
}
-
+
// If there were no locks or conditions, we go to the next url
if (!$locks && !$conditions) continue;
@@ -542,7 +495,7 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
// key 2 can contain an etag
if ($conditionToken[2]) {
- $uri = $conditionUri?$conditionUri:$this->server->getRequestUri();
+ $uri = $conditionUri?$conditionUri:$this->server->getRequestUri();
$node = $this->server->tree->getNodeForPath($uri);
$etagValid = $node->getETag()==$conditionToken[2];
@@ -609,23 +562,23 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
* This method is created to extract information from the WebDAV HTTP 'If:' header
*
* The If header can be quite complex, and has a bunch of features. We're using a regex to extract all relevant information
- * The function will return an array, containg structs with the following keys
+ * The function will return an array, containing structs with the following keys
*
- * * uri - the uri the condition applies to. If this is returned as an
+ * * uri - the uri the condition applies to. If this is returned as an
* empty string, this implies it's referring to the request url.
- * * tokens - The lock token. another 2 dimensional array containg 2 elements (0 = true/false.. If this is a negative condition its set to false, 1 = the actual token)
+ * * tokens - The lock token. another 2 dimensional array containing 2 elements (0 = true/false.. If this is a negative condition its set to false, 1 = the actual token)
* * etag - an etag, if supplied
- *
- * @return void
+ *
+ * @return array
*/
public function getIfConditions() {
- $header = $this->server->httpRequest->getHeader('If');
+ $header = $this->server->httpRequest->getHeader('If');
if (!$header) return array();
$matches = array();
- $regex = '/(?:\<(?P<uri>.*?)\>\s)?\((?P<not>Not\s)?(?:\<(?P<token>[^\>]*)\>)?(?:\s?)(?:\[(?P<etag>[^\]]*)\])?\)/im';
+ $regex = '/(?:\<(?P<uri>.*?)\>\s)?\((?P<not>Not\s)?(?:\<(?P<token>[^\>]*)\>)?(?:\s?)(?:\[(?P<etag>[^\]]*)\])?\)/im';
preg_match_all($regex,$header,$matches,PREG_SET_ORDER);
$conditions = array();
@@ -636,7 +589,7 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
'uri' => $match['uri'],
'tokens' => array(
array($match['not']?0:1,$match['token'],isset($match['etag'])?$match['etag']:'')
- ),
+ ),
);
if (!$condition['uri'] && count($conditions)) $conditions[count($conditions)-1]['tokens'][] = array(
@@ -655,9 +608,9 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
- * Parses a webdav lock xml body, and returns a new Sabre_DAV_Locks_LockInfo object
- *
- * @param string $body
+ * Parses a webdav lock xml body, and returns a new Sabre_DAV_Locks_LockInfo object
+ *
+ * @param string $body
* @return Sabre_DAV_Locks_LockInfo
*/
protected function parseLockRequest($body) {
diff --git a/3rdparty/Sabre/DAV/Mount/Plugin.php b/3rdparty/Sabre/DAV/Mount/Plugin.php
index f93a1aa25a1..b37a90ae993 100644..100755
--- a/3rdparty/Sabre/DAV/Mount/Plugin.php
+++ b/3rdparty/Sabre/DAV/Mount/Plugin.php
@@ -4,25 +4,25 @@
* This plugin provides support for RFC4709: Mounting WebDAV servers
*
* Simply append ?mount to any collection to generate the davmount response.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
*/
class Sabre_DAV_Mount_Plugin extends Sabre_DAV_ServerPlugin {
/**
- * Reference to Server class
- *
- * @var Sabre_DAV_Server
+ * Reference to Server class
+ *
+ * @var Sabre_DAV_Server
*/
private $server;
/**
- * Initializes the plugin and registers event handles
- *
- * @param Sabre_DAV_Server $server
+ * Initializes the plugin and registers event handles
+ *
+ * @param Sabre_DAV_Server $server
* @return void
*/
public function initialize(Sabre_DAV_Server $server) {
@@ -35,9 +35,10 @@ class Sabre_DAV_Mount_Plugin extends Sabre_DAV_ServerPlugin {
/**
* 'beforeMethod' event handles. This event handles intercepts GET requests ending
* with ?mount
- *
- * @param string $method
- * @return void
+ *
+ * @param string $method
+ * @param string $uri
+ * @return bool
*/
public function beforeMethod($method, $uri) {
@@ -57,13 +58,13 @@ class Sabre_DAV_Mount_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
- * Generates the davmount response
- *
- * @param string $uri absolute uri
+ * Generates the davmount response
+ *
+ * @param string $uri absolute uri
* @return void
*/
public function davMount($uri) {
-
+
$this->server->httpResponse->sendStatus(200);
$this->server->httpResponse->setHeader('Content-Type','application/davmount+xml');
ob_start();
diff --git a/3rdparty/Sabre/DAV/Node.php b/3rdparty/Sabre/DAV/Node.php
index 0510df5fdf2..070b7176afd 100644..100755
--- a/3rdparty/Sabre/DAV/Node.php
+++ b/3rdparty/Sabre/DAV/Node.php
@@ -3,22 +3,22 @@
/**
* Node class
*
- * This is a helper class, that should aid in getting nodes setup.
- *
+ * This is a helper class, that should aid in getting nodes setup.
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
abstract class Sabre_DAV_Node implements Sabre_DAV_INode {
/**
- * Returns the last modification time
+ * Returns the last modification time
*
* In this case, it will simply return the current time
*
- * @return int
+ * @return int
*/
public function getLastModified() {
@@ -30,7 +30,7 @@ abstract class Sabre_DAV_Node implements Sabre_DAV_INode {
* Deleted the current node
*
* @throws Sabre_DAV_Exception_Forbidden
- * @return void
+ * @return void
*/
public function delete() {
@@ -40,7 +40,7 @@ abstract class Sabre_DAV_Node implements Sabre_DAV_INode {
/**
* Renames the node
- *
+ *
* @throws Sabre_DAV_Exception_Forbidden
* @param string $name The new name
* @return void
diff --git a/3rdparty/Sabre/DAV/ObjectTree.php b/3rdparty/Sabre/DAV/ObjectTree.php
index f12a3683705..bce51463900 100644..100755
--- a/3rdparty/Sabre/DAV/ObjectTree.php
+++ b/3rdparty/Sabre/DAV/ObjectTree.php
@@ -3,27 +3,27 @@
/**
* ObjectTree class
*
- * This implementation of the Tree class makes use of the INode, IFile and ICollection API's
- *
+ * This implementation of the Tree class makes use of the INode, IFile and ICollection API's
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
/**
- * The root node
- *
+ * The root node
+ *
* @var Sabre_DAV_ICollection
*/
protected $rootNode;
/**
- * This is the node cache. Accessed nodes are stored here
- *
- * @var array
+ * This is the node cache. Accessed nodes are stored here
+ *
+ * @var array
*/
protected $cache = array();
@@ -31,9 +31,8 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
* Creates the object
*
* This method expects the rootObject to be passed as a parameter
- *
- * @param Sabre_DAV_ICollection $rootNode
- * @return void
+ *
+ * @param Sabre_DAV_ICollection $rootNode
*/
public function __construct(Sabre_DAV_ICollection $rootNode) {
@@ -42,10 +41,10 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
}
/**
- * Returns the INode object for the requested path
- *
- * @param string $path
- * @return Sabre_DAV_INode
+ * Returns the INode object for the requested path
+ *
+ * @param string $path
+ * @return Sabre_DAV_INode
*/
public function getNodeForPath($path) {
@@ -54,17 +53,17 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
//if (!$path || $path=='.') return $this->rootNode;
$currentNode = $this->rootNode;
- $i=0;
- // We're splitting up the path variable into folder/subfolder components and traverse to the correct node..
+
+ // We're splitting up the path variable into folder/subfolder components and traverse to the correct node..
foreach(explode('/',$path) as $pathPart) {
// If this part of the path is just a dot, it actually means we can skip it
if ($pathPart=='.' || $pathPart=='') continue;
if (!($currentNode instanceof Sabre_DAV_ICollection))
- throw new Sabre_DAV_Exception_FileNotFound('Could not find node at path: ' . $path);
+ throw new Sabre_DAV_Exception_NotFound('Could not find node at path: ' . $path);
- $currentNode = $currentNode->getChild($pathPart);
+ $currentNode = $currentNode->getChild($pathPart);
}
@@ -76,8 +75,8 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
/**
* This function allows you to check if a node exists.
*
- * @param string $path
- * @return bool
+ * @param string $path
+ * @return bool
*/
public function nodeExists($path) {
@@ -92,7 +91,7 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
if (!$parentNode instanceof Sabre_DAV_ICollection) return false;
return $parentNode->childExists($base);
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
+ } catch (Sabre_DAV_Exception_NotFound $e) {
return false;
@@ -101,10 +100,10 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
}
/**
- * Returns a list of childnodes for a given path.
- *
- * @param string $path
- * @return array
+ * Returns a list of childnodes for a given path.
+ *
+ * @param string $path
+ * @return array
*/
public function getChildren($path) {
@@ -127,14 +126,14 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
* * node creations
* * copy
* * move
- * * renaming nodes
- *
+ * * renaming nodes
+ *
* If Tree classes implement a form of caching, this will allow
* them to make sure caches will be expired.
- *
+ *
* If a path is passed, it is assumed that the entire subtree is dirty
*
- * @param string $path
+ * @param string $path
* @return void
*/
public function markDirty($path) {
@@ -145,7 +144,7 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
foreach($this->cache as $nodePath=>$node) {
if ($nodePath == $path || strpos($nodePath,$path.'/')===0)
unset($this->cache[$nodePath]);
-
+
}
}
diff --git a/3rdparty/Sabre/DAV/Property.php b/3rdparty/Sabre/DAV/Property.php
index 577535b0127..1cfada3236c 100644..100755
--- a/3rdparty/Sabre/DAV/Property.php
+++ b/3rdparty/Sabre/DAV/Property.php
@@ -4,16 +4,16 @@
* Abstract property class
*
* Extend this class to create custom complex properties
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
abstract class Sabre_DAV_Property {
- abstract function serialize(Sabre_DAV_Server $server, DOMElement $prop);
+ abstract function serialize(Sabre_DAV_Server $server, DOMElement $prop);
static function unserialize(DOMElement $prop) {
diff --git a/3rdparty/Sabre/DAV/Property/GetLastModified.php b/3rdparty/Sabre/DAV/Property/GetLastModified.php
index 4a812629971..bd63f573140 100644..100755
--- a/3rdparty/Sabre/DAV/Property/GetLastModified.php
+++ b/3rdparty/Sabre/DAV/Property/GetLastModified.php
@@ -2,33 +2,32 @@
/**
* This property represents the {DAV:}getlastmodified property.
- *
+ *
* Although this is normally a simple property, windows requires us to add
* some new attributes.
*
- * This class uses unix timestamps internally, and converts them to RFC 1123 times for
+ * This class uses unix timestamps internally, and converts them to RFC 1123 times for
* serialization
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Property_GetLastModified extends Sabre_DAV_Property {
/**
- * time
- *
- * @var int
+ * time
+ *
+ * @var int
*/
public $time;
/**
- * __construct
- *
- * @param int|DateTime $time
- * @return void
+ * __construct
+ *
+ * @param int|DateTime $time
*/
public function __construct($time) {
@@ -46,9 +45,10 @@ class Sabre_DAV_Property_GetLastModified extends Sabre_DAV_Property {
}
/**
- * serialize
- *
- * @param DOMElement $prop
+ * serialize
+ *
+ * @param Sabre_DAV_Server $server
+ * @param DOMElement $prop
* @return void
*/
public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
@@ -56,14 +56,14 @@ class Sabre_DAV_Property_GetLastModified extends Sabre_DAV_Property {
$doc = $prop->ownerDocument;
$prop->setAttribute('xmlns:b','urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/');
$prop->setAttribute('b:dt','dateTime.rfc1123');
- $prop->nodeValue = $this->time->format(DateTime::RFC1123);
+ $prop->nodeValue = Sabre_HTTP_Util::toHTTPDate($this->time);
}
/**
- * getTime
- *
- * @return DateTime
+ * getTime
+ *
+ * @return DateTime
*/
public function getTime() {
diff --git a/3rdparty/Sabre/DAV/Property/Href.php b/3rdparty/Sabre/DAV/Property/Href.php
index 3294ff2ac68..dac564f24d7 100644..100755
--- a/3rdparty/Sabre/DAV/Property/Href.php
+++ b/3rdparty/Sabre/DAV/Property/Href.php
@@ -3,36 +3,36 @@
/**
* Href property
*
- * The href property represpents a url within a {DAV:}href element.
+ * The href property represents a url within a {DAV:}href element.
* This is used by many WebDAV extensions, but not really within the WebDAV core spec
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Property_Href extends Sabre_DAV_Property implements Sabre_DAV_Property_IHref {
/**
- * href
- *
- * @var string
+ * href
+ *
+ * @var string
*/
private $href;
/**
- * Automatically prefix the url with the server base directory
- *
- * @var bool
+ * Automatically prefix the url with the server base directory
+ *
+ * @var bool
*/
private $autoPrefix = true;
/**
- * __construct
- *
- * @param string $href
- * @return void
+ * __construct
+ *
+ * @param string $href
+ * @param bool $autoPrefix
*/
public function __construct($href, $autoPrefix = true) {
@@ -42,9 +42,9 @@ class Sabre_DAV_Property_Href extends Sabre_DAV_Property implements Sabre_DAV_Pr
}
/**
- * Returns the uri
- *
- * @return string
+ * Returns the uri
+ *
+ * @return string
*/
public function getHref() {
@@ -56,12 +56,12 @@ class Sabre_DAV_Property_Href extends Sabre_DAV_Property implements Sabre_DAV_Pr
* Serializes this property.
*
* It will additionally prepend the href property with the server's base uri.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $dom
+ *
+ * @param Sabre_DAV_Server $server
+ * @param DOMElement $dom
* @return void
*/
- public function serialize(Sabre_DAV_Server $server,DOMElement $dom) {
+ public function serialize(Sabre_DAV_Server $server, DOMElement $dom) {
$prefix = $server->xmlNamespaces['DAV:'];
@@ -72,13 +72,13 @@ class Sabre_DAV_Property_Href extends Sabre_DAV_Property implements Sabre_DAV_Pr
}
/**
- * Unserializes this property from a DOM Element
+ * Unserializes this property from a DOM Element
*
* This method returns an instance of this class.
* It will only decode {DAV:}href values. For non-compatible elements null will be returned.
*
- * @param DOMElement $dom
- * @return Sabre_DAV_Property_Href
+ * @param DOMElement $dom
+ * @return Sabre_DAV_Property_Href
*/
static function unserialize(DOMElement $dom) {
@@ -86,6 +86,6 @@ class Sabre_DAV_Property_Href extends Sabre_DAV_Property implements Sabre_DAV_Pr
return new self($dom->firstChild->textContent,false);
}
- }
+ }
}
diff --git a/3rdparty/Sabre/DAV/Property/HrefList.php b/3rdparty/Sabre/DAV/Property/HrefList.php
index 76a5512901c..7a52272e885 100644..100755
--- a/3rdparty/Sabre/DAV/Property/HrefList.php
+++ b/3rdparty/Sabre/DAV/Property/HrefList.php
@@ -3,35 +3,35 @@
/**
* HrefList property
*
- * This property contains multiple {DAV:}href elements, each containing a url.
- *
+ * This property contains multiple {DAV:}href elements, each containing a url.
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Property_HrefList extends Sabre_DAV_Property {
/**
- * hrefs
- *
- * @var array
+ * hrefs
+ *
+ * @var array
*/
private $hrefs;
/**
- * Automatically prefix the url with the server base directory
- *
- * @var bool
+ * Automatically prefix the url with the server base directory
+ *
+ * @var bool
*/
private $autoPrefix = true;
/**
- * __construct
- *
+ * __construct
+ *
* @param array $hrefs
- * @param bool $autoPrefix
+ * @param bool $autoPrefix
*/
public function __construct(array $hrefs, $autoPrefix = true) {
@@ -41,9 +41,9 @@ class Sabre_DAV_Property_HrefList extends Sabre_DAV_Property {
}
/**
- * Returns the uris
- *
- * @return array
+ * Returns the uris
+ *
+ * @return array
*/
public function getHrefs() {
@@ -55,9 +55,9 @@ class Sabre_DAV_Property_HrefList extends Sabre_DAV_Property {
* Serializes this property.
*
* It will additionally prepend the href property with the server's base uri.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $dom
+ *
+ * @param Sabre_DAV_Server $server
+ * @param DOMElement $dom
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $dom) {
@@ -73,13 +73,13 @@ class Sabre_DAV_Property_HrefList extends Sabre_DAV_Property {
}
/**
- * Unserializes this property from a DOM Element
+ * Unserializes this property from a DOM Element
*
* This method returns an instance of this class.
* It will only decode {DAV:}href values.
*
- * @param DOMElement $dom
- * @return Sabre_DAV_Property_Href
+ * @param DOMElement $dom
+ * @return Sabre_DAV_Property_Href
*/
static function unserialize(DOMElement $dom) {
@@ -91,6 +91,6 @@ class Sabre_DAV_Property_HrefList extends Sabre_DAV_Property {
}
return new self($hrefs, false);
- }
+ }
}
diff --git a/3rdparty/Sabre/DAV/Property/IHref.php b/3rdparty/Sabre/DAV/Property/IHref.php
index 29d76a44fcd..5c0409064cb 100644..100755
--- a/3rdparty/Sabre/DAV/Property/IHref.php
+++ b/3rdparty/Sabre/DAV/Property/IHref.php
@@ -9,16 +9,16 @@
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_DAV_Property_IHref {
/**
- * getHref
- *
- * @return string
+ * getHref
+ *
+ * @return string
*/
function getHref();
diff --git a/3rdparty/Sabre/DAV/Property/LockDiscovery.php b/3rdparty/Sabre/DAV/Property/LockDiscovery.php
index 05c7470b4ed..2ded5649a44 100644..100755
--- a/3rdparty/Sabre/DAV/Property/LockDiscovery.php
+++ b/3rdparty/Sabre/DAV/Property/LockDiscovery.php
@@ -4,26 +4,26 @@
* Represents {DAV:}lockdiscovery property
*
* This property contains all the open locks on a given resource
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Property_LockDiscovery extends Sabre_DAV_Property {
/**
- * locks
- *
- * @var array
+ * locks
+ *
+ * @var array
*/
public $locks;
-
+
/**
- * Should we show the locktoken as well?
- *
- * @var bool
+ * Should we show the locktoken as well?
+ *
+ * @var bool
*/
public $revealLockToken;
@@ -36,13 +36,12 @@ class Sabre_DAV_Property_LockDiscovery extends Sabre_DAV_Property {
static public $hideLockRoot = false;
/**
- * __construct
- *
- * @param array $locks
- * @param bool $revealLockToken
- * @return void
+ * __construct
+ *
+ * @param array $locks
+ * @param bool $revealLockToken
*/
- public function __construct($locks,$revealLockToken = false) {
+ public function __construct($locks, $revealLockToken = false) {
$this->locks = $locks;
$this->revealLockToken = $revealLockToken;
@@ -50,12 +49,13 @@ class Sabre_DAV_Property_LockDiscovery extends Sabre_DAV_Property {
}
/**
- * serialize
- *
- * @param DOMElement $prop
+ * serialize
+ *
+ * @param Sabre_DAV_Server $server
+ * @param DOMElement $prop
* @return void
*/
- public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
+ public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
$doc = $prop->ownerDocument;
@@ -74,7 +74,7 @@ class Sabre_DAV_Property_LockDiscovery extends Sabre_DAV_Property {
$lockType->appendChild($doc->createElementNS('DAV:','d:write'));
- /* {DAV:}lockroot */
+ /* {DAV:}lockroot */
if (!self::$hideLockRoot) {
$lockRoot = $doc->createElementNS('DAV:','d:lockroot');
$activeLock->appendChild($lockRoot);
@@ -91,7 +91,7 @@ class Sabre_DAV_Property_LockDiscovery extends Sabre_DAV_Property {
$activeLock->appendChild($lockToken);
$lockToken->appendChild($doc->createElementNS('DAV:','d:href','opaquelocktoken:' . $lock->token));
}
-
+
$activeLock->appendChild($doc->createElementNS('DAV:','d:owner',$lock->owner));
}
diff --git a/3rdparty/Sabre/DAV/Property/ResourceType.php b/3rdparty/Sabre/DAV/Property/ResourceType.php
index 2c606c22d60..f6269611e54 100644..100755
--- a/3rdparty/Sabre/DAV/Property/ResourceType.php
+++ b/3rdparty/Sabre/DAV/Property/ResourceType.php
@@ -4,28 +4,27 @@
* This class represents the {DAV:}resourcetype property
*
* Normally for files this is empty, and for collection {DAV:}collection.
- * However, other specs define different values for this.
- *
+ * However, other specs define different values for this.
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Property_ResourceType extends Sabre_DAV_Property {
/**
- * resourceType
- *
+ * resourceType
+ *
* @var array
*/
public $resourceType = array();
/**
- * __construct
- *
- * @param mixed $resourceType
- * @return void
+ * __construct
+ *
+ * @param mixed $resourceType
*/
public function __construct($resourceType = array()) {
@@ -33,7 +32,7 @@ class Sabre_DAV_Property_ResourceType extends Sabre_DAV_Property {
$this->resourceType = array();
elseif ($resourceType === Sabre_DAV_Server::NODE_DIRECTORY)
$this->resourceType = array('{DAV:}collection');
- elseif (is_array($resourceType))
+ elseif (is_array($resourceType))
$this->resourceType = $resourceType;
else
$this->resourceType = array($resourceType);
@@ -41,25 +40,26 @@ class Sabre_DAV_Property_ResourceType extends Sabre_DAV_Property {
}
/**
- * serialize
- *
- * @param DOMElement $prop
+ * serialize
+ *
+ * @param Sabre_DAV_Server $server
+ * @param DOMElement $prop
* @return void
*/
- public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
+ public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
$propName = null;
$rt = $this->resourceType;
-
+
foreach($rt as $resourceType) {
- if (preg_match('/^{([^}]*)}(.*)$/',$resourceType,$propName)) {
-
+ if (preg_match('/^{([^}]*)}(.*)$/',$resourceType,$propName)) {
+
if (isset($server->xmlNamespaces[$propName[1]])) {
$prop->appendChild($prop->ownerDocument->createElement($server->xmlNamespaces[$propName[1]] . ':' . $propName[2]));
} else {
$prop->appendChild($prop->ownerDocument->createElementNS($propName[1],'custom:' . $propName[2]));
}
-
+
}
}
@@ -69,8 +69,8 @@ class Sabre_DAV_Property_ResourceType extends Sabre_DAV_Property {
* Returns the values in clark-notation
*
* For example array('{DAV:}collection')
- *
- * @return array
+ *
+ * @return array
*/
public function getValue() {
@@ -79,10 +79,10 @@ class Sabre_DAV_Property_ResourceType extends Sabre_DAV_Property {
}
/**
- * Checks if the principal contains a certain value
- *
- * @param string $type
- * @return bool
+ * Checks if the principal contains a certain value
+ *
+ * @param string $type
+ * @return bool
*/
public function is($type) {
@@ -104,10 +104,10 @@ class Sabre_DAV_Property_ResourceType extends Sabre_DAV_Property {
}
/**
- * Unserializes a DOM element into a ResourceType property.
- *
- * @param DOMElement $dom
- * @return void
+ * Unserializes a DOM element into a ResourceType property.
+ *
+ * @param DOMElement $dom
+ * @return Sabre_DAV_Property_ResourceType
*/
static public function unserialize(DOMElement $dom) {
diff --git a/3rdparty/Sabre/DAV/Property/Response.php b/3rdparty/Sabre/DAV/Property/Response.php
index 7d3a2db0387..88afbcfb26d 100644..100755
--- a/3rdparty/Sabre/DAV/Property/Response.php
+++ b/3rdparty/Sabre/DAV/Property/Response.php
@@ -1,53 +1,52 @@
<?php
/**
- * Response property
- *
+ * Response property
+ *
* This class represents the {DAV:}response XML element.
- * This is used by the Server class to encode individual items within a multistatus
+ * This is used by the Server class to encode individual items within a multistatus
* response.
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Property_Response extends Sabre_DAV_Property implements Sabre_DAV_Property_IHref {
/**
- * Url for the response
- *
- * @var string
+ * Url for the response
+ *
+ * @var string
*/
private $href;
/**
- * Propertylist, ordered by HTTP status code
- *
- * @var array
+ * Propertylist, ordered by HTTP status code
+ *
+ * @var array
*/
private $responseProperties;
/**
* The responseProperties argument is a list of properties
* within an array with keys representing HTTP status codes
- *
- * @param string $href
- * @param array $responseProperties
- * @return void
+ *
+ * @param string $href
+ * @param array $responseProperties
*/
- public function __construct($href,array $responseProperties) {
+ public function __construct($href, array $responseProperties) {
$this->href = $href;
- $this->responseProperties = $responseProperties;
+ $this->responseProperties = $responseProperties;
}
/**
- * Returns the url
- *
- * @return string
+ * Returns the url
+ *
+ * @return string
*/
public function getHref() {
@@ -56,9 +55,9 @@ class Sabre_DAV_Property_Response extends Sabre_DAV_Property implements Sabre_DA
}
/**
- * Returns the property list
- *
- * @return array
+ * Returns the property list
+ *
+ * @return array
*/
public function getResponseProperties() {
@@ -67,19 +66,19 @@ class Sabre_DAV_Property_Response extends Sabre_DAV_Property implements Sabre_DA
}
/**
- * serialize
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $dom
+ * serialize
+ *
+ * @param Sabre_DAV_Server $server
+ * @param DOMElement $dom
* @return void
*/
- public function serialize(Sabre_DAV_Server $server,DOMElement $dom) {
+ public function serialize(Sabre_DAV_Server $server, DOMElement $dom) {
$document = $dom->ownerDocument;
$properties = $this->responseProperties;
-
+
$xresponse = $document->createElement('d:response');
- $dom->appendChild($xresponse);
+ $dom->appendChild($xresponse);
$uri = Sabre_DAV_URLUtil::encodePath($this->href);
@@ -87,7 +86,7 @@ class Sabre_DAV_Property_Response extends Sabre_DAV_Property implements Sabre_DA
$uri = $server->getBaseUri() . $uri;
$xresponse->appendChild($document->createElement('d:href',$uri));
-
+
// The properties variable is an array containing properties, grouped by
// HTTP status
foreach($properties as $httpStatus=>$propertyGroup) {
@@ -111,7 +110,7 @@ class Sabre_DAV_Property_Response extends Sabre_DAV_Property implements Sabre_DA
$propName = null;
preg_match('/^{([^}]*)}(.*)$/',$propertyName,$propName);
-
+
// special case for empty namespaces
if ($propName[1]=='') {
@@ -125,7 +124,7 @@ class Sabre_DAV_Property_Response extends Sabre_DAV_Property implements Sabre_DA
$nsList[$propName[1]] = 'x' . count($nsList);
}
- // If the namespace was defined in the top-level xml namespaces, it means
+ // If the namespace was defined in the top-level xml namespaces, it means
// there was already a namespace declaration, and we don't have to worry about it.
if (isset($server->xmlNamespaces[$propName[1]])) {
$currentProperty = $document->createElement($nsList[$propName[1]] . ':' . $propName[2]);
diff --git a/3rdparty/Sabre/DAV/Property/ResponseList.php b/3rdparty/Sabre/DAV/Property/ResponseList.php
index cd70b12861d..cae923afbf9 100644..100755
--- a/3rdparty/Sabre/DAV/Property/ResponseList.php
+++ b/3rdparty/Sabre/DAV/Property/ResponseList.php
@@ -1,33 +1,32 @@
<?php
/**
- * ResponseList property
- *
+ * ResponseList property
+ *
* This class represents multiple {DAV:}response XML elements.
- * This is used by the Server class to encode items within a multistatus
+ * This is used by the Server class to encode items within a multistatus
* response.
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Property_ResponseList extends Sabre_DAV_Property {
/**
- * Response objects.
- *
- * @var array
+ * Response objects.
+ *
+ * @var array
*/
private $responses;
/**
- * The only valid argument is a list of Sabre_DAV_Property_Response
+ * The only valid argument is a list of Sabre_DAV_Property_Response
* objects.
- *
- * @param array $responses;
- * @return void
+ *
+ * @param array $responses;
*/
public function __construct($responses) {
@@ -41,10 +40,10 @@ class Sabre_DAV_Property_ResponseList extends Sabre_DAV_Property {
}
/**
- * serialize
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $dom
+ * serialize
+ *
+ * @param Sabre_DAV_Server $server
+ * @param DOMElement $dom
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $dom) {
diff --git a/3rdparty/Sabre/DAV/Property/SupportedLock.php b/3rdparty/Sabre/DAV/Property/SupportedLock.php
index 01e63f58d9d..4e3aaf23a1a 100644..100755
--- a/3rdparty/Sabre/DAV/Property/SupportedLock.php
+++ b/3rdparty/Sabre/DAV/Property/SupportedLock.php
@@ -5,27 +5,26 @@
*
* This property contains information about what kind of locks
* this server supports.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Property_SupportedLock extends Sabre_DAV_Property {
/**
- * supportsLocks
- *
+ * supportsLocks
+ *
* @var mixed
*/
public $supportsLocks = false;
/**
- * __construct
- *
- * @param mixed $supportsLocks
- * @return void
+ * __construct
+ *
+ * @param mixed $supportsLocks
*/
public function __construct($supportsLocks) {
@@ -34,9 +33,10 @@ class Sabre_DAV_Property_SupportedLock extends Sabre_DAV_Property {
}
/**
- * serialize
- *
- * @param DOMElement $prop
+ * serialize
+ *
+ * @param Sabre_DAV_Server $server
+ * @param DOMElement $prop
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
diff --git a/3rdparty/Sabre/DAV/Property/SupportedReportSet.php b/3rdparty/Sabre/DAV/Property/SupportedReportSet.php
index acd9219c0f7..e62699f3b5a 100644..100755
--- a/3rdparty/Sabre/DAV/Property/SupportedReportSet.php
+++ b/3rdparty/Sabre/DAV/Property/SupportedReportSet.php
@@ -5,18 +5,18 @@
*
* This property is defined in RFC3253, but since it's
* so common in other webdav-related specs, it is part of the core server.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Property_SupportedReportSet extends Sabre_DAV_Property {
/**
- * List of reports
- *
+ * List of reports
+ *
* @var array
*/
protected $reports = array();
@@ -28,13 +28,12 @@ class Sabre_DAV_Property_SupportedReportSet extends Sabre_DAV_Property {
* should be valid report-types in clark-notation.
*
* Either a string or an array of strings must be passed.
- *
- * @param mixed $reports
- * @return void
+ *
+ * @param mixed $reports
*/
public function __construct($reports = null) {
- if (!is_null($reports))
+ if (!is_null($reports))
$this->addReport($reports);
}
@@ -44,8 +43,8 @@ class Sabre_DAV_Property_SupportedReportSet extends Sabre_DAV_Property {
*
* The report must be a string in clark-notation.
* Multiple reports can be specified as an array.
- *
- * @param mixed $report
+ *
+ * @param mixed $report
* @return void
*/
public function addReport($report) {
@@ -54,7 +53,7 @@ class Sabre_DAV_Property_SupportedReportSet extends Sabre_DAV_Property {
foreach($report as $r) {
- if (!preg_match('/^{([^}]*)}(.*)$/',$r))
+ if (!preg_match('/^{([^}]*)}(.*)$/',$r))
throw new Sabre_DAV_Exception('Reportname must be in clark-notation');
$this->reports[] = $r;
@@ -65,8 +64,8 @@ class Sabre_DAV_Property_SupportedReportSet extends Sabre_DAV_Property {
/**
* Returns the list of supported reports
- *
- * @return array
+ *
+ * @return array
*/
public function getValue() {
@@ -75,16 +74,16 @@ class Sabre_DAV_Property_SupportedReportSet extends Sabre_DAV_Property {
}
/**
- * Serializes the node
+ * Serializes the node
*
* @param Sabre_DAV_Server $server
- * @param DOMElement $prop
+ * @param DOMElement $prop
* @return void
*/
- public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
+ public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
foreach($this->reports as $reportName) {
-
+
$supportedReport = $prop->ownerDocument->createElement('d:supported-report');
$prop->appendChild($supportedReport);
@@ -92,9 +91,9 @@ class Sabre_DAV_Property_SupportedReportSet extends Sabre_DAV_Property {
$supportedReport->appendChild($report);
preg_match('/^{([^}]*)}(.*)$/',$reportName,$matches);
-
+
list(, $namespace, $element) = $matches;
-
+
$prefix = isset($server->xmlNamespaces[$namespace])?$server->xmlNamespaces[$namespace]:null;
if ($prefix) {
diff --git a/3rdparty/Sabre/DAV/Server.php b/3rdparty/Sabre/DAV/Server.php
index 3d76d4f1918..4284c127b6e 100644..100755
--- a/3rdparty/Sabre/DAV/Server.php
+++ b/3rdparty/Sabre/DAV/Server.php
@@ -2,11 +2,11 @@
/**
* Main DAV server class
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Server {
@@ -26,9 +26,6 @@ class Sabre_DAV_Server {
*/
const NODE_DIRECTORY = 2;
- const PROP_SET = 1;
- const PROP_REMOVE = 2;
-
/**
* XML namespace for all SabreDAV related elements
*/
@@ -36,42 +33,42 @@ class Sabre_DAV_Server {
/**
* The tree object
- *
- * @var Sabre_DAV_Tree
+ *
+ * @var Sabre_DAV_Tree
*/
public $tree;
/**
- * The base uri
- *
- * @var string
+ * The base uri
+ *
+ * @var string
*/
- protected $baseUri = null;
+ protected $baseUri = null;
/**
- * httpResponse
- *
- * @var Sabre_HTTP_Response
+ * httpResponse
+ *
+ * @var Sabre_HTTP_Response
*/
public $httpResponse;
/**
* httpRequest
- *
- * @var Sabre_HTTP_Request
+ *
+ * @var Sabre_HTTP_Request
*/
public $httpRequest;
/**
- * The list of plugins
- *
- * @var array
+ * The list of plugins
+ *
+ * @var array
*/
protected $plugins = array();
/**
- * This array contains a list of callbacks we should call when certain events are triggered
- *
+ * This array contains a list of callbacks we should call when certain events are triggered
+ *
* @var array
*/
protected $eventSubscriptions = array();
@@ -81,7 +78,7 @@ class Sabre_DAV_Server {
*
* If you are defining your own custom namespace, add it here to reduce
* bandwidth and improve legibility of xml bodies.
- *
+ *
* @var array
*/
public $xmlNamespaces = array(
@@ -90,9 +87,9 @@ class Sabre_DAV_Server {
);
/**
- * The propertymap can be used to map properties from
+ * The propertymap can be used to map properties from
* requests to property classes.
- *
+ *
* @var array
*/
public $propertyMap = array(
@@ -125,23 +122,32 @@ class Sabre_DAV_Server {
* This is a flag that allow or not showing file, line and code
* of the exception in the returned XML
*
- * @var bool
+ * @var bool
*/
public $debugExceptions = false;
/**
- * This property allows you to automatically add the 'resourcetype' value
+ * This property allows you to automatically add the 'resourcetype' value
* based on a node's classname or interface.
*
- * The preset ensures that {DAV:}collection is automaticlly added for nodes
+ * The preset ensures that {DAV:}collection is automaticlly added for nodes
* implementing Sabre_DAV_ICollection.
- *
+ *
* @var array
*/
public $resourceTypeMapping = array(
'Sabre_DAV_ICollection' => '{DAV:}collection',
);
+ /**
+ * If this setting is turned off, SabreDAV's version number will be hidden
+ * from various places.
+ *
+ * Some people feel this is a good security measure.
+ *
+ * @var bool
+ */
+ static public $exposeVersion = true;
/**
* Sets up the server
@@ -150,14 +156,13 @@ class Sabre_DAV_Server {
* use it as the directory tree. If a Sabre_DAV_INode is passed, it
* will create a Sabre_DAV_ObjectTree and use the node as the root.
*
- * If nothing is passed, a Sabre_DAV_SimpleCollection is created in
+ * If nothing is passed, a Sabre_DAV_SimpleCollection is created in
* a Sabre_DAV_ObjectTree.
*
* If an array is passed, we automatically create a root node, and use
- * the nodes in the array as top-level children.
- *
- * @param Sabre_DAV_Tree $tree The tree object
- * @return void
+ * the nodes in the array as top-level children.
+ *
+ * @param Sabre_DAV_Tree|Sabre_DAV_INode|null $treeOrNode The tree object
*/
public function __construct($treeOrNode = null) {
@@ -190,7 +195,7 @@ class Sabre_DAV_Server {
}
/**
- * Starts the DAV Server
+ * Starts the DAV Server
*
* @return void
*/
@@ -218,7 +223,9 @@ class Sabre_DAV_Server {
$error->appendChild($DOM->createElement('s:stacktrace',$e->getTraceAsString()));
}
- $error->appendChild($DOM->createElement('s:sabredav-version',Sabre_DAV_Version::VERSION));
+ if (self::$exposeVersion) {
+ $error->appendChild($DOM->createElement('s:sabredav-version',Sabre_DAV_Version::VERSION));
+ }
if($e instanceof Sabre_DAV_Exception) {
@@ -233,7 +240,7 @@ class Sabre_DAV_Server {
}
$headers['Content-Type'] = 'application/xml; charset=utf-8';
-
+
$this->httpResponse->sendStatus($httpCode);
$this->httpResponse->setHeaders($headers);
$this->httpResponse->sendBody($DOM->saveXML());
@@ -244,24 +251,24 @@ class Sabre_DAV_Server {
/**
* Sets the base server uri
- *
+ *
* @param string $uri
* @return void
*/
public function setBaseUri($uri) {
// If the baseUri does not end with a slash, we must add it
- if ($uri[strlen($uri)-1]!=='/')
+ if ($uri[strlen($uri)-1]!=='/')
$uri.='/';
- $this->baseUri = $uri;
+ $this->baseUri = $uri;
}
/**
* Returns the base responding uri
- *
- * @return string
+ *
+ * @return string
*/
public function getBaseUri() {
@@ -272,11 +279,11 @@ class Sabre_DAV_Server {
/**
* This method attempts to detect the base uri.
- * Only the PATH_INFO variable is considered.
- *
- * If this variable is not set, the root (/) is assumed.
+ * Only the PATH_INFO variable is considered.
*
- * @return void
+ * If this variable is not set, the root (/) is assumed.
+ *
+ * @return string
*/
public function guessBaseUri() {
@@ -303,21 +310,21 @@ class Sabre_DAV_Server {
return rtrim($baseUri,'/') . '/';
}
- throw new Sabre_DAV_Exception('The REQUEST_URI ('. $uri . ') did not end with the contents of PATH_INFO (' . $pathInfo . '). This server might be misconfigured.');
+ throw new Sabre_DAV_Exception('The REQUEST_URI ('. $uri . ') did not end with the contents of PATH_INFO (' . $pathInfo . '). This server might be misconfigured.');
- }
+ }
- // The last fallback is that we're just going to assume the server root.
+ // The last fallback is that we're just going to assume the server root.
return '/';
}
/**
* Adds a plugin to the server
- *
+ *
* For more information, console the documentation of Sabre_DAV_ServerPlugin
*
- * @param Sabre_DAV_ServerPlugin $plugin
+ * @param Sabre_DAV_ServerPlugin $plugin
* @return void
*/
public function addPlugin(Sabre_DAV_ServerPlugin $plugin) {
@@ -333,11 +340,11 @@ class Sabre_DAV_Server {
* This function returns null if the plugin was not found.
*
* @param string $name
- * @return Sabre_DAV_ServerPlugin
+ * @return Sabre_DAV_ServerPlugin
*/
public function getPlugin($name) {
- if (isset($this->plugins[$name]))
+ if (isset($this->plugins[$name]))
return $this->plugins[$name];
// This is a fallback and deprecated.
@@ -350,9 +357,9 @@ class Sabre_DAV_Server {
}
/**
- * Returns all plugins
- *
- * @return array
+ * Returns all plugins
+ *
+ * @return array
*/
public function getPlugins() {
@@ -361,7 +368,6 @@ class Sabre_DAV_Server {
}
-
/**
* Subscribe to an event.
*
@@ -371,9 +377,9 @@ class Sabre_DAV_Server {
*
* This is for example used to make sure that the authentication plugin
* is triggered before anything else. If it's not needed to change this
- * number, it is recommended to ommit.
- *
- * @param string $event
+ * number, it is recommended to ommit.
+ *
+ * @param string $event
* @param callback $callback
* @param int $priority
* @return void
@@ -398,7 +404,7 @@ class Sabre_DAV_Server {
*
* @param string $eventName
* @param array $arguments
- * @return bool
+ * @return bool
*/
public function broadcastEvent($eventName,$arguments = array()) {
@@ -418,7 +424,7 @@ class Sabre_DAV_Server {
}
/**
- * Handles a http request, and execute a method based on its name
+ * Handles a http request, and execute a method based on its name
*
* @param string $method
* @param string $uri
@@ -426,7 +432,7 @@ class Sabre_DAV_Server {
*/
public function invokeMethod($method, $uri) {
- $method = strtoupper($method);
+ $method = strtoupper($method);
if (!$this->broadcastEvent('beforeMethod',array($method, $uri))) return;
@@ -453,7 +459,7 @@ class Sabre_DAV_Server {
if ($this->broadcastEvent('unknownMethod',array($method, $uri))) {
// Unsupported method
- throw new Sabre_DAV_Exception_NotImplemented();
+ throw new Sabre_DAV_Exception_NotImplemented('There was no handler found for this "' . $method . '" method');
}
}
@@ -461,9 +467,9 @@ class Sabre_DAV_Server {
}
// {{{ HTTP Method implementations
-
+
/**
- * HTTP OPTIONS
+ * HTTP OPTIONS
*
* @param string $uri
* @return void
@@ -476,11 +482,13 @@ class Sabre_DAV_Server {
$features = array('1','3', 'extended-mkcol');
foreach($this->plugins as $plugin) $features = array_merge($features,$plugin->getFeatures());
-
+
$this->httpResponse->setHeader('DAV',implode(', ',$features));
$this->httpResponse->setHeader('MS-Author-Via','DAV');
$this->httpResponse->setHeader('Accept-Ranges','bytes');
- $this->httpResponse->setHeader('X-Sabre-Version',Sabre_DAV_Version::VERSION);
+ if (self::$exposeVersion) {
+ $this->httpResponse->setHeader('X-Sabre-Version',Sabre_DAV_Version::VERSION);
+ }
$this->httpResponse->setHeader('Content-Length',0);
$this->httpResponse->sendStatus(200);
@@ -492,13 +500,13 @@ class Sabre_DAV_Server {
* This method simply fetches the contents of a uri, like normal
*
* @param string $uri
- * @return void
+ * @return bool
*/
protected function httpGet($uri) {
$node = $this->tree->getNodeForPath($uri,0);
- if (!$this->checkPreconditions(true)) return false;
+ if (!$this->checkPreconditions(true)) return false;
if (!($node instanceof Sabre_DAV_IFile)) throw new Sabre_DAV_Exception_NotImplemented('GET is only implemented on File objects');
$body = $node->get();
@@ -535,7 +543,7 @@ class Sabre_DAV_Server {
} else {
$nodeSize = null;
}
-
+
$this->httpResponse->setHeaders($httpHeaders);
$range = $this->getHTTPRange();
@@ -545,12 +553,12 @@ class Sabre_DAV_Server {
// If ifRange is set, and range is specified, we first need to check
// the precondition.
if ($nodeSize && $range && $ifRange) {
-
+
// if IfRange is parsable as a date we'll treat it as a DateTime
// otherwise, we must treat it as an etag.
try {
$ifRangeDate = new DateTime($ifRange);
-
+
// It's a date. We must check if the entity is modified since
// the specified date.
if (!isset($httpHeaders['Last-Modified'])) $ignoreRangeHeader = true;
@@ -560,8 +568,8 @@ class Sabre_DAV_Server {
}
} catch (Exception $e) {
-
- // It's an entity. We can do a simple comparison.
+
+ // It's an entity. We can do a simple comparison.
if (!isset($httpHeaders['ETag'])) $ignoreRangeHeader = true;
elseif ($httpHeaders['ETag']!==$ifRange) $ignoreRangeHeader = true;
}
@@ -575,7 +583,7 @@ class Sabre_DAV_Server {
$start = $range[0];
$end = $range[1]?$range[1]:$nodeSize-1;
- if($start >= $nodeSize)
+ if($start >= $nodeSize)
throw new Sabre_DAV_Exception_RequestedRangeNotSatisfiable('The start offset (' . $range[0] . ') exceeded the size of the entity (' . $nodeSize . ')');
if($end < $start) throw new Sabre_DAV_Exception_RequestedRangeNotSatisfiable('The end offset (' . $range[1] . ') is lower than the start offset (' . $range[0] . ')');
@@ -625,7 +633,7 @@ class Sabre_DAV_Server {
$node = $this->tree->getNodeForPath($uri);
/* This information is only collection for File objects.
- * Ideally we want to throw 405 Method Not Allowed for every
+ * Ideally we want to throw 405 Method Not Allowed for every
* non-file, but MS Office does not like this
*/
if ($node instanceof Sabre_DAV_IFile) {
@@ -640,7 +648,7 @@ class Sabre_DAV_Server {
}
/**
- * HTTP Delete
+ * HTTP Delete
*
* The HTTP delete method, deletes a given uri
*
@@ -651,6 +659,7 @@ class Sabre_DAV_Server {
if (!$this->broadcastEvent('beforeUnbind',array($uri))) return;
$this->tree->delete($uri);
+ $this->broadcastEvent('afterUnbind',array($uri));
$this->httpResponse->sendStatus(204);
$this->httpResponse->setHeader('Content-Length','0');
@@ -659,13 +668,13 @@ class Sabre_DAV_Server {
/**
- * WebDAV PROPFIND
+ * WebDAV PROPFIND
*
* This WebDAV method requests information about an uri resource, or a list of resources
* If a client wants to receive the properties for a single resource it will add an HTTP Depth: header with a 0 value
* If the value is 1, it means that it also expects a list of sub-resources (e.g.: files in a directory)
*
- * The request body contains an XML data structure that has a list of properties the client understands
+ * The request body contains an XML data structure that has a list of properties the client understands
* The response body is also an xml document, containing information about every uri resource and the requested properties
*
* It has to return a HTTP 207 Multi-status status code
@@ -679,7 +688,7 @@ class Sabre_DAV_Server {
$requestedProperties = $this->parsePropfindRequest($this->httpRequest->getBody(true));
$depth = $this->getHTTPDepth(1);
- // The only two options for the depth of a propfind is 0 or 1
+ // The only two options for the depth of a propfind is 0 or 1
if ($depth!=0) $depth = 1;
$newProperties = $this->getPropertiesForPath($uri,$requestedProperties,$depth);
@@ -688,8 +697,8 @@ class Sabre_DAV_Server {
$this->httpResponse->sendStatus(207);
$this->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- // Normally this header is only needed for OPTIONS responses, however..
- // iCal seems to also depend on these being set for PROPFIND. Since
+ // Normally this header is only needed for OPTIONS responses, however..
+ // iCal seems to also depend on these being set for PROPFIND. Since
// this is not harmful, we'll add it.
$features = array('1','3', 'extended-mkcol');
foreach($this->plugins as $plugin) $features = array_merge($features,$plugin->getFeatures());
@@ -712,7 +721,7 @@ class Sabre_DAV_Server {
protected function httpPropPatch($uri) {
$newProperties = $this->parsePropPatchRequest($this->httpRequest->getBody(true));
-
+
$result = $this->updateProperties($uri, $newProperties);
$this->httpResponse->sendStatus(207);
@@ -725,14 +734,14 @@ class Sabre_DAV_Server {
}
/**
- * HTTP PUT method
- *
+ * HTTP PUT method
+ *
* This HTTP method updates a file, or creates a new one.
*
- * If a new resource was created, a 201 Created status code should be returned. If an existing resource is updated, it's a 200 Ok
+ * If a new resource was created, a 201 Created status code should be returned. If an existing resource is updated, it's a 204 No Content
*
* @param string $uri
- * @return void
+ * @return bool
*/
protected function httpPut($uri) {
@@ -768,13 +777,13 @@ class Sabre_DAV_Server {
// Intercepting the Finder problem
if (($expected = $this->httpRequest->getHeader('X-Expected-Entity-Length')) && $expected > 0) {
-
+
/**
- Many webservers will not cooperate well with Finder PUT requests,
+ Many webservers will not cooperate well with Finder PUT requests,
because it uses 'Chunked' transfer encoding for the request body.
- The symptom of this problem is that Finder sends files to the
- server, but they arrive as 0-lenght files in PHP.
+ The symptom of this problem is that Finder sends files to the
+ server, but they arrive as 0-length files in PHP.
If we don't do anything, the user might think they are uploading
files successfully, but they end up empty on the server. Instead,
@@ -808,29 +817,36 @@ class Sabre_DAV_Server {
}
- if ($this->tree->nodeExists($uri)) {
+ if ($this->tree->nodeExists($uri)) {
$node = $this->tree->getNodeForPath($uri);
-
+
// Checking If-None-Match and related headers.
if (!$this->checkPreconditions()) return;
-
+
// If the node is a collection, we'll deny it
if (!($node instanceof Sabre_DAV_IFile)) throw new Sabre_DAV_Exception_Conflict('PUT is not allowed on non-files.');
- if (!$this->broadcastEvent('beforeWriteContent',array($this->getRequestUri()))) return false;
+ if (!$this->broadcastEvent('beforeWriteContent',array($uri, $node, &$body))) return false;
+
+ $etag = $node->put($body);
+
+ $this->broadcastEvent('afterWriteContent',array($uri, $node));
- $node->put($body);
$this->httpResponse->setHeader('Content-Length','0');
+ if ($etag) $this->httpResponse->setHeader('ETag',$etag);
$this->httpResponse->sendStatus(204);
} else {
+ $etag = null;
// If we got here, the resource didn't exist yet.
- if (!$this->createFile($this->getRequestUri(),$body)) {
+ if (!$this->createFile($this->getRequestUri(),$body,$etag)) {
// For one reason or another the file was not created.
return;
}
+
$this->httpResponse->setHeader('Content-Length','0');
+ if ($etag) $this->httpResponse->setHeader('ETag', $etag);
$this->httpResponse->sendStatus(201);
}
@@ -855,7 +871,7 @@ class Sabre_DAV_Server {
$contentType = $this->httpRequest->getHeader('Content-Type');
if (strpos($contentType,'application/xml')!==0 && strpos($contentType,'text/xml')!==0) {
- // We must throw 415 for unsupport mkcol bodies
+ // We must throw 415 for unsupported mkcol bodies
throw new Sabre_DAV_Exception_UnsupportedMediaType('The request body for the MKCOL request must have an xml Content-Type');
}
@@ -863,7 +879,7 @@ class Sabre_DAV_Server {
$dom = Sabre_DAV_XMLUtil::loadDOMDocument($requestBody);
if (Sabre_DAV_XMLUtil::toClarkNotation($dom->firstChild)!=='{DAV:}mkcol') {
- // We must throw 415 for unsupport mkcol bodies
+ // We must throw 415 for unsupported mkcol bodies
throw new Sabre_DAV_Exception_UnsupportedMediaType('The request body for the MKCOL request must be a {DAV:}mkcol request construct.');
}
@@ -875,7 +891,7 @@ class Sabre_DAV_Server {
$properties = array_merge($properties, Sabre_DAV_XMLUtil::parseProperties($childNode, $this->propertyMap));
}
- if (!isset($properties['{DAV:}resourcetype']))
+ if (!isset($properties['{DAV:}resourcetype']))
throw new Sabre_DAV_Exception_BadRequest('The mkcol request must include a {DAV:}resourcetype property');
$resourceType = $properties['{DAV:}resourcetype']->getValue();
@@ -918,19 +934,21 @@ class Sabre_DAV_Server {
$moveInfo = $this->getCopyAndMoveInfo();
// If the destination is part of the source tree, we must fail
- if ($moveInfo['destination']==$uri)
+ if ($moveInfo['destination']==$uri)
throw new Sabre_DAV_Exception_Forbidden('Source and destination uri are identical.');
if ($moveInfo['destinationExists']) {
if (!$this->broadcastEvent('beforeUnbind',array($moveInfo['destination']))) return false;
$this->tree->delete($moveInfo['destination']);
+ $this->broadcastEvent('afterUnbind',array($moveInfo['destination']));
}
if (!$this->broadcastEvent('beforeUnbind',array($uri))) return false;
if (!$this->broadcastEvent('beforeBind',array($moveInfo['destination']))) return false;
$this->tree->move($uri,$moveInfo['destination']);
+ $this->broadcastEvent('afterUnbind',array($uri));
$this->broadcastEvent('afterBind',array($moveInfo['destination']));
// If a resource was overwritten we should send a 204, otherwise a 201
@@ -946,13 +964,13 @@ class Sabre_DAV_Server {
* A lot of the actual request processing is done in getCopyMoveInfo
*
* @param string $uri
- * @return void
+ * @return bool
*/
protected function httpCopy($uri) {
$copyInfo = $this->getCopyAndMoveInfo();
// If the destination is part of the source tree, we must fail
- if ($copyInfo['destination']==$uri)
+ if ($copyInfo['destination']==$uri)
throw new Sabre_DAV_Exception_Forbidden('Source and destination uri are identical.');
if ($copyInfo['destinationExists']) {
@@ -998,13 +1016,13 @@ class Sabre_DAV_Server {
}
// }}}
- // {{{ HTTP/WebDAV protocol helpers
+ // {{{ HTTP/WebDAV protocol helpers
/**
- * Returns an array with all the supported HTTP methods for a specific uri.
+ * Returns an array with all the supported HTTP methods for a specific uri.
*
- * @param string $uri
- * @return array
+ * @param string $uri
+ * @return array
*/
public function getAllowedMethods($uri) {
@@ -1023,13 +1041,13 @@ class Sabre_DAV_Server {
// The MKCOL is only allowed on an unmapped uri
try {
- $node = $this->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
+ $this->tree->getNodeForPath($uri);
+ } catch (Sabre_DAV_Exception_NotFound $e) {
$methods[] = 'MKCOL';
}
// We're also checking if any of the plugins register any new methods
- foreach($this->plugins as $plugin) $methods = array_merge($methods,$plugin->getHTTPMethods($uri));
+ foreach($this->plugins as $plugin) $methods = array_merge($methods, $plugin->getHTTPMethods($uri));
array_unique($methods);
return $methods;
@@ -1037,8 +1055,8 @@ class Sabre_DAV_Server {
}
/**
- * Gets the uri for the request, keeping the base uri into consideration
- *
+ * Gets the uri for the request, keeping the base uri into consideration
+ *
* @return string
*/
public function getRequestUri() {
@@ -1048,9 +1066,9 @@ class Sabre_DAV_Server {
}
/**
- * Calculates the uri for a request, making sure that the base uri is stripped out
- *
- * @param string $uri
+ * Calculates the uri for a request, making sure that the base uri is stripped out
+ *
+ * @param string $uri
* @throws Sabre_DAV_Exception_Forbidden A permission denied exception is thrown whenever there was an attempt to supply a uri outside of the base uri
* @return string
*/
@@ -1068,9 +1086,9 @@ class Sabre_DAV_Server {
return trim(Sabre_DAV_URLUtil::decodePath(substr($uri,strlen($this->getBaseUri()))),'/');
- // A special case, if the baseUri was accessed without a trailing
- // slash, we'll accept it as well.
- } elseif ($uri.'/' === $this->getBaseUri()) {
+ // A special case, if the baseUri was accessed without a trailing
+ // slash, we'll accept it as well.
+ } elseif ($uri.'/' === $this->getBaseUri()) {
return '';
@@ -1086,10 +1104,10 @@ class Sabre_DAV_Server {
* Returns the HTTP depth header
*
* This method returns the contents of the HTTP depth request header. If the depth header was 'infinity' it will return the Sabre_DAV_Server::DEPTH_INFINITY object
- * It is possible to supply a default depth value, which is used when the depth header has invalid content, or is completely non-existant
- *
- * @param mixed $default
- * @return int
+ * It is possible to supply a default depth value, which is used when the depth header has invalid content, or is completely non-existent
+ *
+ * @param mixed $default
+ * @return int
*/
public function getHTTPDepth($default = self::DEPTH_INFINITY) {
@@ -1100,7 +1118,7 @@ class Sabre_DAV_Server {
if ($depth == 'infinity') return self::DEPTH_INFINITY;
-
+
// If its an unknown value. we'll grab the default
if (!ctype_digit($depth)) return $default;
@@ -1118,14 +1136,14 @@ class Sabre_DAV_Server {
* The second number is the offset of the last byte in the range.
*
* If the second offset is null, it should be treated as the offset of the last byte of the entity
- * If the first offset is null, the second offset should be used to retrieve the last x bytes of the entity
+ * If the first offset is null, the second offset should be used to retrieve the last x bytes of the entity
*
- * return $mixed
+ * @return array|null
*/
public function getHTTPRange() {
$range = $this->httpRequest->getHeader('range');
- if (is_null($range)) return null;
+ if (is_null($range)) return null;
// Matching "Range: bytes=1234-5678: both numbers are optional
@@ -1143,15 +1161,15 @@ class Sabre_DAV_Server {
/**
* Returns information about Copy and Move requests
- *
- * This function is created to help getting information about the source and the destination for the
- * WebDAV MOVE and COPY HTTP request. It also validates a lot of information and throws proper exceptions
- *
+ *
+ * This function is created to help getting information about the source and the destination for the
+ * WebDAV MOVE and COPY HTTP request. It also validates a lot of information and throws proper exceptions
+ *
* The returned value is an array with the following keys:
* * destination - Destination path
- * * destinationExists - Wether or not the destination is an existing url (and should therefore be overwritten)
+ * * destinationExists - Whether or not the destination is an existing url (and should therefore be overwritten)
*
- * @return array
+ * @return array
*/
public function getCopyAndMoveInfo() {
@@ -1170,7 +1188,7 @@ class Sabre_DAV_Server {
try {
$destinationParent = $this->tree->getNodeForPath($destinationDir);
if (!($destinationParent instanceof Sabre_DAV_ICollection)) throw new Sabre_DAV_Exception_UnsupportedMediaType('The destination node is not a collection');
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
+ } catch (Sabre_DAV_Exception_NotFound $e) {
// If the destination parent node is not found, we throw a 409
throw new Sabre_DAV_Exception_Conflict('The destination node is not found');
@@ -1179,12 +1197,12 @@ class Sabre_DAV_Server {
try {
$destinationNode = $this->tree->getNodeForPath($destination);
-
+
// If this succeeded, it means the destination already exists
// we'll need to throw precondition failed in case overwrite is false
if (!$overwrite) throw new Sabre_DAV_Exception_PreconditionFailed('The destination node already exists, and the overwrite header is set to false','Overwrite');
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
+ } catch (Sabre_DAV_Exception_NotFound $e) {
// Destination didn't exist, we're all good
$destinationNode = false;
@@ -1220,22 +1238,50 @@ class Sabre_DAV_Server {
}
/**
+ * A kid-friendly way to fetch properties for a node's children.
+ *
+ * The returned array will be indexed by the path of the of child node.
+ * Only properties that are actually found will be returned.
+ *
+ * The parent node will not be returned.
+ *
+ * @param string $path
+ * @param array $propertyNames
+ * @return array
+ */
+ public function getPropertiesForChildren($path, $propertyNames) {
+
+ $result = array();
+ foreach($this->getPropertiesForPath($path,$propertyNames,1) as $k=>$row) {
+
+ // Skipping the parent path
+ if ($k === 0) continue;
+
+ $result[$row['href']] = $row[200];
+
+ }
+ return $result;
+
+ }
+
+ /**
* Returns a list of HTTP headers for a particular resource
*
- * The generated http headers are based on properties provided by the
+ * The generated http headers are based on properties provided by the
* resource. The method basically provides a simple mapping between
* DAV property and HTTP header.
*
* The headers are intended to be used for HEAD and GET requests.
- *
+ *
* @param string $path
+ * @return array
*/
public function getHTTPHeaders($path) {
$propertyMap = array(
'{DAV:}getcontenttype' => 'Content-Type',
'{DAV:}getcontentlength' => 'Content-Length',
- '{DAV:}getlastmodified' => 'Last-Modified',
+ '{DAV:}getlastmodified' => 'Last-Modified',
'{DAV:}getetag' => 'ETag',
);
@@ -1245,40 +1291,40 @@ class Sabre_DAV_Server {
foreach($propertyMap as $property=>$header) {
if (!isset($properties[$property])) continue;
- if (is_scalar($properties[$property])) {
+ if (is_scalar($properties[$property])) {
$headers[$header] = $properties[$property];
- // GetLastModified gets special cased
+ // GetLastModified gets special cased
} elseif ($properties[$property] instanceof Sabre_DAV_Property_GetLastModified) {
- $headers[$header] = $properties[$property]->getTime()->format(DateTime::RFC1123);
+ $headers[$header] = Sabre_HTTP_Util::toHTTPDate($properties[$property]->getTime());
}
}
return $headers;
-
+
}
/**
* Returns a list of properties for a given path
- *
+ *
* The path that should be supplied should have the baseUrl stripped out
* The list of properties should be supplied in Clark notation. If the list is empty
* 'allprops' is assumed.
*
* If a depth of 1 is requested child elements will also be returned.
*
- * @param string $path
+ * @param string $path
* @param array $propertyNames
- * @param int $depth
+ * @param int $depth
* @return array
*/
- public function getPropertiesForPath($path,$propertyNames = array(),$depth = 0) {
+ public function getPropertiesForPath($path, $propertyNames = array(), $depth = 0) {
if ($depth!=0) $depth = 1;
$returnPropertyList = array();
-
+
$parentNode = $this->tree->getNodeForPath($path);
$nodes = array(
$path => $parentNode
@@ -1286,11 +1332,11 @@ class Sabre_DAV_Server {
if ($depth==1 && $parentNode instanceof Sabre_DAV_ICollection) {
foreach($this->tree->getChildren($path) as $childNode)
$nodes[$path . '/' . $childNode->getName()] = $childNode;
- }
-
+ }
+
// If the propertyNames array is empty, it means all properties are requested.
// We shouldn't actually return everything we know though, and only return a
- // sensible list.
+ // sensible list.
$allProperties = count($propertyNames)==0;
foreach($nodes as $myPath=>$node) {
@@ -1315,8 +1361,8 @@ class Sabre_DAV_Server {
);
}
- // If the resourceType was not part of the list, we manually add it
- // and mark it for removal. We need to know the resourcetype in order
+ // If the resourceType was not part of the list, we manually add it
+ // and mark it for removal. We need to know the resourcetype in order
// to make certain decisions about the entry.
// WebDAV dictates we should add a / and the end of href's for collections
$removeRT = false;
@@ -1326,32 +1372,39 @@ class Sabre_DAV_Server {
}
$result = $this->broadcastEvent('beforeGetProperties',array($myPath, $node, &$currentPropertyNames, &$newProperties));
- // If this method explicitly returned false, we must ignore this
- // node as it is inacessible.
+ // If this method explicitly returned false, we must ignore this
+ // node as it is inaccessible.
if ($result===false) continue;
if (count($currentPropertyNames) > 0) {
- if ($node instanceof Sabre_DAV_IProperties)
+ if ($node instanceof Sabre_DAV_IProperties)
$newProperties['200'] = $newProperties[200] + $node->getProperties($currentPropertyNames);
}
foreach($currentPropertyNames as $prop) {
-
+
if (isset($newProperties[200][$prop])) continue;
switch($prop) {
case '{DAV:}getlastmodified' : if ($node->getLastModified()) $newProperties[200][$prop] = new Sabre_DAV_Property_GetLastModified($node->getLastModified()); break;
- case '{DAV:}getcontentlength' : if ($node instanceof Sabre_DAV_IFile) $newProperties[200][$prop] = (int)$node->getSize(); break;
- case '{DAV:}quota-used-bytes' :
+ case '{DAV:}getcontentlength' :
+ if ($node instanceof Sabre_DAV_IFile) {
+ $size = $node->getSize();
+ if (!is_null($size)) {
+ $newProperties[200][$prop] = (int)$node->getSize();
+ }
+ }
+ break;
+ case '{DAV:}quota-used-bytes' :
if ($node instanceof Sabre_DAV_IQuota) {
$quotaInfo = $node->getQuotaInfo();
$newProperties[200][$prop] = $quotaInfo[0];
}
break;
- case '{DAV:}quota-available-bytes' :
+ case '{DAV:}quota-available-bytes' :
if ($node instanceof Sabre_DAV_IQuota) {
$quotaInfo = $node->getQuotaInfo();
$newProperties[200][$prop] = $quotaInfo[1];
@@ -1364,7 +1417,7 @@ class Sabre_DAV_Server {
foreach($this->plugins as $plugin) {
$reports = array_merge($reports, $plugin->getSupportedReportSet($myPath));
}
- $newProperties[200][$prop] = new Sabre_DAV_Property_SupportedReportSet($reports);
+ $newProperties[200][$prop] = new Sabre_DAV_Property_SupportedReportSet($reports);
break;
case '{DAV:}resourcetype' :
$newProperties[200]['{DAV:}resourcetype'] = new Sabre_DAV_Property_ResourceType();
@@ -1379,14 +1432,14 @@ class Sabre_DAV_Server {
if (!$allProperties && !isset($newProperties[200][$prop])) $newProperties[404][$prop] = null;
}
-
+
$this->broadcastEvent('afterGetProperties',array(trim($myPath,'/'),&$newProperties));
- $newProperties['href'] = trim($myPath,'/');
+ $newProperties['href'] = trim($myPath,'/');
// Its is a WebDAV recommendation to add a trailing slash to collectionnames.
// Apple's iCal also requires a trailing slash for principals (rfc 3744).
- // Therefore we add a trailing / for any non-file. This might need adjustments
+ // Therefore we add a trailing / for any non-file. This might need adjustments
// if we find there are other edge cases.
if ($myPath!='' && isset($newProperties[200]['{DAV:}resourcetype']) && count($newProperties[200]['{DAV:}resourcetype']->getValue())>0) $newProperties['href'] .='/';
@@ -1397,7 +1450,7 @@ class Sabre_DAV_Server {
$returnPropertyList[] = $newProperties;
}
-
+
return $returnPropertyList;
}
@@ -1406,27 +1459,31 @@ class Sabre_DAV_Server {
* This method is invoked by sub-systems creating a new file.
*
* Currently this is done by HTTP PUT and HTTP LOCK (in the Locks_Plugin).
- * It was important to get this done through a centralized function,
+ * It was important to get this done through a centralized function,
* allowing plugins to intercept this using the beforeCreateFile event.
*
* This method will return true if the file was actually created
- *
- * @param string $uri
- * @param resource $data
- * @return bool
+ *
+ * @param string $uri
+ * @param resource $data
+ * @param string $etag
+ * @return bool
*/
- public function createFile($uri,$data) {
+ public function createFile($uri,$data, &$etag = null) {
list($dir,$name) = Sabre_DAV_URLUtil::splitPath($uri);
if (!$this->broadcastEvent('beforeBind',array($uri))) return false;
- if (!$this->broadcastEvent('beforeCreateFile',array($uri,$data))) return false;
$parent = $this->tree->getNodeForPath($dir);
- $parent->createFile($name,$data);
+
+ if (!$this->broadcastEvent('beforeCreateFile',array($uri, &$data, $parent))) return false;
+
+ $etag = $parent->createFile($name,$data);
$this->tree->markDirty($dir);
$this->broadcastEvent('afterBind',array($uri));
+ $this->broadcastEvent('afterCreateFile',array($uri, $parent));
return true;
}
@@ -1434,7 +1491,7 @@ class Sabre_DAV_Server {
/**
* This method is invoked by sub-systems creating a new directory.
*
- * @param string $uri
+ * @param string $uri
* @return void
*/
public function createDirectory($uri) {
@@ -1447,14 +1504,14 @@ class Sabre_DAV_Server {
* Use this method to create a new collection
*
* The {DAV:}resourcetype is specified using the resourceType array.
- * At the very least it must contain {DAV:}collection.
+ * At the very least it must contain {DAV:}collection.
*
* The properties array can contain a list of additional properties.
- *
- * @param string $uri The new uri
- * @param array $resourceType The resourceType(s)
+ *
+ * @param string $uri The new uri
+ * @param array $resourceType The resourceType(s)
* @param array $properties A list of properties
- * @return void
+ * @return array|null
*/
public function createCollection($uri, array $resourceType, array $properties) {
@@ -1471,7 +1528,7 @@ class Sabre_DAV_Server {
$parent = $this->tree->getNodeForPath($parentUri);
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
+ } catch (Sabre_DAV_Exception_NotFound $e) {
throw new Sabre_DAV_Exception_Conflict('Parent node does not exist');
@@ -1491,14 +1548,14 @@ class Sabre_DAV_Server {
// If we got here.. it means there's already a node on that url, and we need to throw a 405
throw new Sabre_DAV_Exception_MethodNotAllowed('The resource you tried to create already exists');
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
+ } catch (Sabre_DAV_Exception_NotFound $e) {
// This is correct
}
-
+
if (!$this->broadcastEvent('beforeBind',array($uri))) return;
- // There are 2 modes of operation. The standard collection
+ // There are 2 modes of operation. The standard collection
// creates the directory, and then updates properties
// the extended collection can create it directly.
if ($parent instanceof Sabre_DAV_IExtendedCollection) {
@@ -1513,7 +1570,7 @@ class Sabre_DAV_Server {
}
$parent->createDirectory($newName);
- $rollBack = false;
+ $rollBack = false;
$exception = null;
$errorResult = null;
@@ -1544,7 +1601,7 @@ class Sabre_DAV_Server {
return $errorResult;
}
-
+
}
$this->tree->markDirty($parentUri);
$this->broadcastEvent('afterBind',array($uri));
@@ -1557,29 +1614,29 @@ class Sabre_DAV_Server {
* The properties array must be a list of properties. Array-keys are
* property names in clarknotation, array-values are it's values.
* If a property must be deleted, the value should be null.
- *
- * Note that this request should either completely succeed, or
+ *
+ * Note that this request should either completely succeed, or
* completely fail.
*
* The response is an array with statuscodes for keys, which in turn
* contain arrays with propertynames. This response can be used
* to generate a multistatus body.
- *
- * @param string $uri
- * @param array $properties
- * @return array
+ *
+ * @param string $uri
+ * @param array $properties
+ * @return array
*/
public function updateProperties($uri, array $properties) {
// we'll start by grabbing the node, this will throw the appropriate
- // exceptions if it doesn't.
+ // exceptions if it doesn't.
$node = $this->tree->getNodeForPath($uri);
-
+
$result = array(
200 => array(),
403 => array(),
424 => array(),
- );
+ );
$remainingProperties = $properties;
$hasError = false;
@@ -1684,14 +1741,15 @@ class Sabre_DAV_Server {
* the appropriate HTTP response headers are already set.
*
* Normally this method will throw 412 Precondition Failed for failures
- * related to If-None-Match, If-Match and If-Unmodified Since. It will
+ * related to If-None-Match, If-Match and If-Unmodified Since. It will
* set the status to 304 Not Modified for If-Modified_since.
*
- * If the $handleAsGET argument is set to true, it will also return 304
+ * If the $handleAsGET argument is set to true, it will also return 304
* Not Modified for failure of the If-None-Match precondition. This is the
* desired behaviour for HTTP GET and HTTP HEAD requests.
*
- * @return bool
+ * @param bool $handleAsGET
+ * @return bool
*/
public function checkPreconditions($handleAsGET = false) {
@@ -1708,7 +1766,7 @@ class Sabre_DAV_Server {
// request succeed if a resource exists at that url.
try {
$node = $this->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
+ } catch (Sabre_DAV_Exception_NotFound $e) {
throw new Sabre_DAV_Exception_PreconditionFailed('An If-Match header was specified and the resource did not exist','If-Match');
}
@@ -1722,7 +1780,7 @@ class Sabre_DAV_Server {
// Stripping any extra spaces
$ifMatchItem = trim($ifMatchItem,' ');
-
+
$etag = $node->getETag();
if ($etag===$ifMatchItem) {
$haveMatch = true;
@@ -1744,7 +1802,7 @@ class Sabre_DAV_Server {
if (!$node) {
try {
$node = $this->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
+ } catch (Sabre_DAV_Exception_NotFound $e) {
$nodeExists = false;
}
}
@@ -1758,10 +1816,10 @@ class Sabre_DAV_Server {
$etag = $node->getETag();
foreach($ifNoneMatch as $ifNoneMatchItem) {
-
+
// Stripping any extra spaces
$ifNoneMatchItem = trim($ifNoneMatchItem,' ');
-
+
if ($etag===$ifNoneMatchItem) $haveMatch = true;
}
@@ -1781,7 +1839,7 @@ class Sabre_DAV_Server {
}
if (!$ifNoneMatch && ($ifModifiedSince = $this->httpRequest->getHeader('If-Modified-Since'))) {
-
+
// The If-Modified-Since header contains a date. We
// will only return the entity if it has been changed since
// that date. If it hasn't been changed, we return a 304
@@ -1799,23 +1857,24 @@ class Sabre_DAV_Server {
$lastMod = new DateTime('@' . $lastMod);
if ($lastMod <= $date) {
$this->httpResponse->sendStatus(304);
+ $this->httpResponse->setHeader('Last-Modified', Sabre_HTTP_Util::toHTTPDate($lastMod));
return false;
- }
+ }
}
}
}
if ($ifUnmodifiedSince = $this->httpRequest->getHeader('If-Unmodified-Since')) {
-
+
// The If-Unmodified-Since will allow allow the request if the
// entity has not changed since the specified date.
$date = Sabre_HTTP_Util::parseHTTPDate($ifUnmodifiedSince);
-
+
// We must only check the date if it's valid
if ($date) {
if (is_null($node)) {
$node = $this->tree->getNodeForPath($uri);
- }
+ }
$lastMod = $node->getLastModified();
if ($lastMod) {
$lastMod = new DateTime('@' . $lastMod);
@@ -1830,16 +1889,15 @@ class Sabre_DAV_Server {
}
- // }}}
- // {{{ XML Readers & Writers
-
-
+ // }}}
+ // {{{ XML Readers & Writers
+
+
/**
- * Generates a WebDAV propfind response body based on a list of nodes
- *
+ * Generates a WebDAV propfind response body based on a list of nodes
+ *
* @param array $fileProperties The list with nodes
- * @param array $requestedProperties The properties that should be returned
- * @return string
+ * @return string
*/
public function generateMultiStatus(array $fileProperties) {
@@ -1859,7 +1917,7 @@ class Sabre_DAV_Server {
$href = $entry['href'];
unset($entry['href']);
-
+
$response = new Sabre_DAV_Property_Response($href,$entry);
$response->serialize($this,$multiStatus);
@@ -1878,7 +1936,7 @@ class Sabre_DAV_Server {
* The keys in the returned array contain the property name (e.g.: {DAV:}displayname,
* and the value contains the property value. If a property is to be removed the value
* will be null.
- *
+ *
* @param string $body xml body
* @return array list of properties in need of updating or deletion
*/
@@ -1886,17 +1944,17 @@ class Sabre_DAV_Server {
//We'll need to change the DAV namespace declaration to something else in order to make it parsable
$dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
-
+
$newProperties = array();
foreach($dom->firstChild->childNodes as $child) {
- if ($child->nodeType !== XML_ELEMENT_NODE) continue;
+ if ($child->nodeType !== XML_ELEMENT_NODE) continue;
$operation = Sabre_DAV_XMLUtil::toClarkNotation($child);
if ($operation!=='{DAV:}set' && $operation!=='{DAV:}remove') continue;
-
+
$innerProperties = Sabre_DAV_XMLUtil::parseProperties($child, $this->propertyMap);
foreach($innerProperties as $propertyName=>$propertyValue) {
@@ -1920,9 +1978,9 @@ class Sabre_DAV_Server {
*
* This will either be a list of properties, or an empty array; in which case
* an {DAV:}allprop was requested.
- *
- * @param string $body
- * @return array
+ *
+ * @param string $body
+ * @return array
*/
public function parsePropFindRequest($body) {
@@ -1931,7 +1989,7 @@ class Sabre_DAV_Server {
$dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
$elem = $dom->getElementsByTagNameNS('urn:DAV','propfind')->item(0);
- return array_keys(Sabre_DAV_XMLUtil::parseProperties($elem));
+ return array_keys(Sabre_DAV_XMLUtil::parseProperties($elem));
}
diff --git a/3rdparty/Sabre/DAV/ServerPlugin.php b/3rdparty/Sabre/DAV/ServerPlugin.php
index 6909f600c21..131863d13fb 100644..100755
--- a/3rdparty/Sabre/DAV/ServerPlugin.php
+++ b/3rdparty/Sabre/DAV/ServerPlugin.php
@@ -3,12 +3,12 @@
/**
* The baseclass for all server plugins.
*
- * Plugins can modify or extend the servers behaviour.
- *
+ * Plugins can modify or extend the servers behaviour.
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
abstract class Sabre_DAV_ServerPlugin {
@@ -20,18 +20,18 @@ abstract class Sabre_DAV_ServerPlugin {
* addPlugin is called.
*
* This method should set up the requires event subscriptions.
- *
- * @param Sabre_DAV_Server $server
+ *
+ * @param Sabre_DAV_Server $server
* @return void
*/
abstract public function initialize(Sabre_DAV_Server $server);
-
+
/**
- * This method should return a list of server-features.
+ * This method should return a list of server-features.
*
* This is for example 'versioning' and is added to the DAV: header
* in an OPTIONS response.
- *
+ *
* @return array
*/
public function getFeatures() {
@@ -44,11 +44,11 @@ abstract class Sabre_DAV_ServerPlugin {
* Use this method to tell the server this plugin defines additional
* HTTP methods.
*
- * This method is passed a uri. It should only return HTTP methods that are
+ * This method is passed a uri. It should only return HTTP methods that are
* available for the specified uri.
*
* @param string $uri
- * @return array
+ * @return array
*/
public function getHTTPMethods($uri) {
@@ -58,11 +58,11 @@ abstract class Sabre_DAV_ServerPlugin {
/**
* Returns a plugin name.
- *
+ *
* Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
+ * using Sabre_DAV_Server::getPlugin
+ *
+ * @return string
*/
public function getPluginName() {
@@ -74,11 +74,11 @@ abstract class Sabre_DAV_ServerPlugin {
* Returns a list of reports this plugin supports.
*
* This will be used in the {DAV:}supported-report-set property.
- * Note that you still need to subscribe to the 'report' event to actually
- * implement them
- *
+ * Note that you still need to subscribe to the 'report' event to actually
+ * implement them
+ *
* @param string $uri
- * @return array
+ * @return array
*/
public function getSupportedReportSet($uri) {
diff --git a/3rdparty/Sabre/DAV/SimpleCollection.php b/3rdparty/Sabre/DAV/SimpleCollection.php
index 223d05fed55..4acf971caa5 100644..100755
--- a/3rdparty/Sabre/DAV/SimpleCollection.php
+++ b/3rdparty/Sabre/DAV/SimpleCollection.php
@@ -8,23 +8,23 @@
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_SimpleCollection extends Sabre_DAV_Collection {
/**
- * List of childnodes
+ * List of childnodes
*
* @var array
*/
protected $children = array();
/**
- * Name of this resource
- *
- * @var string
+ * Name of this resource
+ *
+ * @var string
*/
protected $name;
@@ -33,10 +33,9 @@ class Sabre_DAV_SimpleCollection extends Sabre_DAV_Collection {
*
* The name of the node must be passed, child nodes can also be bassed.
* This nodes must be instances of Sabre_DAV_INode
- *
- * @param string $name
- * @param array $children
- * @return void
+ *
+ * @param string $name
+ * @param array $children
*/
public function __construct($name,array $children = array()) {
@@ -51,9 +50,9 @@ class Sabre_DAV_SimpleCollection extends Sabre_DAV_Collection {
}
/**
- * Adds a new childnode to this collection
- *
- * @param Sabre_DAV_INode $child
+ * Adds a new childnode to this collection
+ *
+ * @param Sabre_DAV_INode $child
* @return void
*/
public function addChild(Sabre_DAV_INode $child) {
@@ -63,9 +62,9 @@ class Sabre_DAV_SimpleCollection extends Sabre_DAV_Collection {
}
/**
- * Returns the name of the collection
- *
- * @return string
+ * Returns the name of the collection
+ *
+ * @return string
*/
public function getName() {
@@ -76,24 +75,24 @@ class Sabre_DAV_SimpleCollection extends Sabre_DAV_Collection {
/**
* Returns a child object, by its name.
*
- * This method makes use of the getChildren method to grab all the child nodes, and compares the name.
+ * This method makes use of the getChildren method to grab all the child nodes, and compares the name.
* Generally its wise to override this, as this can usually be optimized
- *
+ *
* @param string $name
- * @throws Sabre_DAV_Exception_FileNotFound
- * @return Sabre_DAV_INode
+ * @throws Sabre_DAV_Exception_NotFound
+ * @return Sabre_DAV_INode
*/
public function getChild($name) {
if (isset($this->children[$name])) return $this->children[$name];
- throw new Sabre_DAV_Exception_FileNotFound('File not found: ' . $name . ' in \'' . $this->getName() . '\'');
+ throw new Sabre_DAV_Exception_NotFound('File not found: ' . $name . ' in \'' . $this->getName() . '\'');
}
/**
- * Returns a list of children for this collection
- *
- * @return array
+ * Returns a list of children for this collection
+ *
+ * @return array
*/
public function getChildren() {
diff --git a/3rdparty/Sabre/DAV/SimpleDirectory.php b/3rdparty/Sabre/DAV/SimpleDirectory.php
index 516a3aa907c..621222ebc53 100644..100755
--- a/3rdparty/Sabre/DAV/SimpleDirectory.php
+++ b/3rdparty/Sabre/DAV/SimpleDirectory.php
@@ -11,8 +11,8 @@
* @package Sabre
* @subpackage DAV
* @deprecated Use Sabre_DAV_SimpleCollection instead.
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_SimpleDirectory extends Sabre_DAV_SimpleCollection {
diff --git a/3rdparty/Sabre/DAV/SimpleFile.php b/3rdparty/Sabre/DAV/SimpleFile.php
index 304dff1c5ec..58330d6861d 100644..100755
--- a/3rdparty/Sabre/DAV/SimpleFile.php
+++ b/3rdparty/Sabre/DAV/SimpleFile.php
@@ -3,47 +3,48 @@
/**
* SimpleFile
*
- * The 'SimpleFile' class is used to easily add read-only immutable files to
- * the directory structure. One usecase would be to add a 'readme.txt' to a
+ * The 'SimpleFile' class is used to easily add read-only immutable files to
+ * the directory structure. One usecase would be to add a 'readme.txt' to a
* root of a webserver with some standard content.
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
/**
- * File contents
+ * File contents
*
- * @var string
+ * @var string
*/
protected $contents = array();
/**
- * Name of this resource
- *
- * @var string
+ * Name of this resource
+ *
+ * @var string
*/
protected $name;
/**
* A mimetype, such as 'text/plain' or 'text/html'
- *
- * @var string
+ *
+ * @var string
*/
protected $mimeType;
/**
* Creates this node
*
- * The name of the node must be passed, as well as the contents of the
+ * The name of the node must be passed, as well as the contents of the
* file.
- *
- * @param string $name
- * @param string $contents
+ *
+ * @param string $name
+ * @param string $contents
+ * @param string|null $mimeType
*/
public function __construct($name, $contents, $mimeType = null) {
@@ -57,8 +58,8 @@ class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
* Returns the node name for this file.
*
* This name is used to construct the url.
- *
- * @return string
+ *
+ * @return string
*/
public function getName() {
@@ -67,7 +68,7 @@ class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
}
/**
- * Returns the data
+ * Returns the data
*
* This method may either return a string or a readable stream resource
*
@@ -75,14 +76,14 @@ class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
*/
public function get() {
- return $this->contents;
+ return $this->contents;
}
/**
- * Returns the size of the file, in bytes.
- *
- * @return int
+ * Returns the size of the file, in bytes.
+ *
+ * @return int
*/
public function getSize() {
@@ -94,13 +95,14 @@ class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
* Returns the ETag for a file
*
* An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
- * The ETag is an arbritrary string, but MUST be surrounded by double-quotes.
+ * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
*
* Return null if the ETag can not effectively be determined
+ * @return string
*/
public function getETag() {
- return '"' . md5($this->contents) . '"';
+ return '"' . md5($this->contents) . '"';
}
@@ -108,13 +110,12 @@ class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
* Returns the mime-type for a file
*
* If null is returned, we'll assume application/octet-stream
- */
+ * @return string
+ */
public function getContentType() {
- return $this->mimeType;
+ return $this->mimeType;
}
}
-
-?>
diff --git a/3rdparty/Sabre/DAV/StringUtil.php b/3rdparty/Sabre/DAV/StringUtil.php
index 440cf6866ca..b126a94c825 100644..100755
--- a/3rdparty/Sabre/DAV/StringUtil.php
+++ b/3rdparty/Sabre/DAV/StringUtil.php
@@ -3,14 +3,14 @@
/**
* String utility
*
- * This class is mainly used to implement the 'text-match' filter, used by both
- * the CalDAV calendar-query REPORT, and CardDAV addressbook-query REPORT.
+ * This class is mainly used to implement the 'text-match' filter, used by both
+ * the CalDAV calendar-query REPORT, and CardDAV addressbook-query REPORT.
* Because they both need it, it was decided to put it in Sabre_DAV instead.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_StringUtil {
@@ -18,11 +18,11 @@ class Sabre_DAV_StringUtil {
/**
* Checks if a needle occurs in a haystack ;)
*
- * @param string $haystack
- * @param string $needle
- * @param string $collation
- * @param string $matchType
- * @return bool
+ * @param string $haystack
+ * @param string $needle
+ * @param string $collation
+ * @param string $matchType
+ * @return bool
*/
static public function textMatch($haystack, $needle, $collation, $matchType = 'contains') {
@@ -37,7 +37,7 @@ class Sabre_DAV_StringUtil {
case 'i;octet' :
// Do nothing
- break;
+ break;
case 'i;unicode-casemap' :
$haystack = mb_strtoupper($haystack, 'UTF-8');
@@ -63,18 +63,18 @@ class Sabre_DAV_StringUtil {
throw new Sabre_DAV_Exception_BadRequest('Match-type: ' . $matchType . ' is not supported');
}
-
+
}
/**
- * This method takes an input string, checks if it's not valid UTF-8 and
+ * This method takes an input string, checks if it's not valid UTF-8 and
* attempts to convert it to UTF-8 if it's not.
*
- * Note that currently this can only convert ISO-8559-1 to UTF-8 (latin-1),
+ * Note that currently this can only convert ISO-8559-1 to UTF-8 (latin-1),
* anything else will likely fail.
*
- * @param string $input
- * @return string
+ * @param string $input
+ * @return string
*/
static public function ensureUTF8($input) {
@@ -84,7 +84,7 @@ class Sabre_DAV_StringUtil {
return utf8_encode($input);
} else {
return $input;
- }
+ }
}
diff --git a/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php b/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php
index e8276af5613..36096e67775 100644..100755
--- a/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php
+++ b/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php
@@ -22,8 +22,8 @@
*
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
@@ -31,7 +31,7 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
/**
* This is the list of patterns we intercept.
* If new patterns are added, they must be valid patterns for preg_match.
- *
+ *
* @var array
*/
public $temporaryFilePatterns = array(
@@ -43,19 +43,19 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
'/^\.dat(.*)$/', // Smultron seems to create these
'/^~lock.(.*)#$/', // Windows 7 lockfiles
);
-
+
/**
* This is the directory where this plugin
* will store it's files.
- *
- * @var string
+ *
+ * @var string
*/
private $dataDir;
/**
* A reference to the main Server class
- *
- * @var Sabre_DAV_Server
+ *
+ * @var Sabre_DAV_Server
*/
private $server;
@@ -65,9 +65,8 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
* Make sure you specify a directory for your files. If you don't, we
* will use PHP's directory for session-storage instead, and you might
* not want that.
- *
- * @param string $dataDir
- * @return void
+ *
+ * @param string|null $dataDir
*/
public function __construct($dataDir = null) {
@@ -75,15 +74,15 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
if (!is_dir($dataDir)) mkdir($dataDir);
$this->dataDir = $dataDir;
- }
+ }
/**
* Initialize the plugin
*
* This is called automatically be the Server class after this plugin is
* added with Sabre_DAV_Server::addPlugin()
- *
- * @param Sabre_DAV_Server $server
+ *
+ * @param Sabre_DAV_Server $server
* @return void
*/
public function initialize(Sabre_DAV_Server $server) {
@@ -97,11 +96,12 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
/**
* This method is called before any HTTP method handler
*
- * This method intercepts any GET, DELETE, PUT and PROPFIND calls to
+ * This method intercepts any GET, DELETE, PUT and PROPFIND calls to
* filenames that are known to match the 'temporary file' regex.
- *
- * @param string $method
- * @return bool
+ *
+ * @param string $method
+ * @param string $uri
+ * @return bool
*/
public function beforeMethod($method, $uri) {
@@ -125,33 +125,33 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
/**
* This method is invoked if some subsystem creates a new file.
*
- * This is used to deal with HTTP LOCK requests which create a new
+ * This is used to deal with HTTP LOCK requests which create a new
* file.
- *
- * @param string $uri
- * @param resource $data
- * @return bool
+ *
+ * @param string $uri
+ * @param resource $data
+ * @return bool
*/
public function beforeCreateFile($uri,$data) {
if ($tempPath = $this->isTempFile($uri)) {
-
+
$hR = $this->server->httpResponse;
$hR->setHeader('X-Sabre-Temp','true');
file_put_contents($tempPath,$data);
return false;
}
- return true;
+ return true;
}
/**
* This method will check if the url matches the temporary file pattern
- * if it does, it will return an path based on $this->dataDir for the
+ * if it does, it will return an path based on $this->dataDir for the
* temporary file storage.
- *
- * @param string $path
- * @return boolean|string
+ *
+ * @param string $path
+ * @return boolean|string
*/
protected function isTempFile($path) {
@@ -161,7 +161,7 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
foreach($this->temporaryFilePatterns as $tempFile) {
if (preg_match($tempFile,$tempPath)) {
- return $this->dataDir . '/sabredav_' . md5($path) . '.tempfile';
+ return $this->getDataDir() . '/sabredav_' . md5($path) . '.tempfile';
}
}
@@ -175,9 +175,9 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
* This method handles the GET method for temporary files.
* If the file doesn't exist, it will return false which will kick in
* the regular system for the GET method.
- *
- * @param string $tempLocation
- * @return bool
+ *
+ * @param string $tempLocation
+ * @return bool
*/
public function httpGet($tempLocation) {
@@ -195,9 +195,9 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
/**
* This method handles the PUT method.
- *
- * @param string $tempLocation
- * @return bool
+ *
+ * @param string $tempLocation
+ * @return bool
*/
public function httpPut($tempLocation) {
@@ -205,7 +205,7 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
$hR->setHeader('X-Sabre-Temp','true');
$newFile = !file_exists($tempLocation);
-
+
if (!$newFile && ($this->server->httpRequest->getHeader('If-None-Match'))) {
throw new Sabre_DAV_Exception_PreconditionFailed('The resource already exists, and an If-None-Match header was supplied');
}
@@ -219,11 +219,11 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
/**
* This method handles the DELETE method.
*
- * If the file didn't exist, it will return false, which will make the
+ * If the file didn't exist, it will return false, which will make the
* standard HTTP DELETE handler kick in.
- *
- * @param string $tempLocation
- * @return bool
+ *
+ * @param string $tempLocation
+ * @return bool
*/
public function httpDelete($tempLocation) {
@@ -238,25 +238,26 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
}
/**
- * This method handles the PROPFIND method.
+ * This method handles the PROPFIND method.
*
* It's a very lazy method, it won't bother checking the request body
* for which properties were requested, and just sends back a default
* set of properties.
*
- * @param string $tempLocation
- * @return void
+ * @param string $tempLocation
+ * @param string $uri
+ * @return bool
*/
public function httpPropfind($tempLocation, $uri) {
if (!file_exists($tempLocation)) return true;
-
+
$hR = $this->server->httpResponse;
$hR->setHeader('X-Sabre-Temp','true');
$hR->sendStatus(207);
$hR->setHeader('Content-Type','application/xml; charset=utf-8');
- $requestedProps = $this->server->parsePropFindRequest($this->server->httpRequest->getBody(true));
+ $this->server->parsePropFindRequest($this->server->httpRequest->getBody(true));
$properties = array(
'href' => $uri,
@@ -264,7 +265,7 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
'{DAV:}getlastmodified' => new Sabre_DAV_Property_GetLastModified(filemtime($tempLocation)),
'{DAV:}getcontentlength' => filesize($tempLocation),
'{DAV:}resourcetype' => new Sabre_DAV_Property_ResourceType(null),
- '{'.Sabre_DAV_Server::NS_SABREDAV.'}tempFile' => true,
+ '{'.Sabre_DAV_Server::NS_SABREDAV.'}tempFile' => true,
),
);
@@ -276,4 +277,13 @@ class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
}
+ /**
+ * This method returns the directory where the temporary files should be stored.
+ *
+ * @return string
+ */
+ protected function getDataDir()
+ {
+ return $this->dataDir;
+ }
}
diff --git a/3rdparty/Sabre/DAV/Tree.php b/3rdparty/Sabre/DAV/Tree.php
index 98e6f62c9e5..50216394155 100644..100755
--- a/3rdparty/Sabre/DAV/Tree.php
+++ b/3rdparty/Sabre/DAV/Tree.php
@@ -1,34 +1,34 @@
<?php
/**
- * Abstract tree object
- *
+ * Abstract tree object
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
abstract class Sabre_DAV_Tree {
-
+
/**
* This function must return an INode object for a path
- * If a Path doesn't exist, thrown an Exception_FileNotFound
- *
- * @param string $path
- * @throws Exception_FileNotFound
- * @return Sabre_DAV_INode
+ * If a Path doesn't exist, thrown a Exception_NotFound
+ *
+ * @param string $path
+ * @throws Sabre_DAV_Exception_NotFound
+ * @return Sabre_DAV_INode
*/
abstract function getNodeForPath($path);
/**
* This function allows you to check if a node exists.
*
- * Implementors of this class should override this method to make
+ * Implementors of this class should override this method to make
* it cheaper.
- *
- * @param string $path
- * @return bool
+ *
+ * @param string $path
+ * @return bool
*/
public function nodeExists($path) {
@@ -37,7 +37,7 @@ abstract class Sabre_DAV_Tree {
$this->getNodeForPath($path);
return true;
- } catch (Sabre_DAV_Exception_FileNotFound $e) {
+ } catch (Sabre_DAV_Exception_NotFound $e) {
return false;
@@ -50,12 +50,12 @@ abstract class Sabre_DAV_Tree {
*
* @param string $sourcePath The source location
* @param string $destinationPath The full destination path
- * @return void
+ * @return void
*/
public function copy($sourcePath, $destinationPath) {
$sourceNode = $this->getNodeForPath($sourcePath);
-
+
// grab the dirname and basename components
list($destinationDir, $destinationName) = Sabre_DAV_URLUtil::splitPath($destinationPath);
@@ -67,9 +67,9 @@ abstract class Sabre_DAV_Tree {
}
/**
- * Moves a file from one location to another
- *
- * @param string $sourcePath The path to the file which should be moved
+ * Moves a file from one location to another
+ *
+ * @param string $sourcePath The path to the file which should be moved
* @param string $destinationPath The full destination path, so not just the destination parent node
* @return int
*/
@@ -91,26 +91,26 @@ abstract class Sabre_DAV_Tree {
}
/**
- * Deletes a node from the tree
- *
- * @param string $path
+ * Deletes a node from the tree
+ *
+ * @param string $path
* @return void
*/
public function delete($path) {
$node = $this->getNodeForPath($path);
$node->delete();
-
+
list($parent) = Sabre_DAV_URLUtil::splitPath($path);
$this->markDirty($parent);
}
/**
- * Returns a list of childnodes for a given path.
- *
- * @param string $path
- * @return array
+ * Returns a list of childnodes for a given path.
+ *
+ * @param string $path
+ * @return array
*/
public function getChildren($path) {
@@ -127,14 +127,14 @@ abstract class Sabre_DAV_Tree {
* * node creations
* * copy
* * move
- * * renaming nodes
- *
+ * * renaming nodes
+ *
* If Tree classes implement a form of caching, this will allow
* them to make sure caches will be expired.
- *
+ *
* If a path is passed, it is assumed that the entire subtree is dirty
*
- * @param string $path
+ * @param string $path
* @return void
*/
public function markDirty($path) {
@@ -143,10 +143,11 @@ abstract class Sabre_DAV_Tree {
}
/**
- * copyNode
- *
- * @param Sabre_DAV_INode $source
- * @param Sabre_DAV_ICollection $destination
+ * copyNode
+ *
+ * @param Sabre_DAV_INode $source
+ * @param Sabre_DAV_ICollection $destinationParent
+ * @param string $destinationName
* @return void
*/
protected function copyNode(Sabre_DAV_INode $source,Sabre_DAV_ICollection $destinationParent,$destinationName = null) {
@@ -163,14 +164,14 @@ abstract class Sabre_DAV_Tree {
fwrite($stream,$data);
rewind($stream);
$data = $stream;
- }
+ }
$destinationParent->createFile($destinationName,$data);
$destination = $destinationParent->getChild($destinationName);
} elseif ($source instanceof Sabre_DAV_ICollection) {
$destinationParent->createDirectory($destinationName);
-
+
$destination = $destinationParent->getChild($destinationName);
foreach($source->getChildren() as $child) {
diff --git a/3rdparty/Sabre/DAV/Tree/Filesystem.php b/3rdparty/Sabre/DAV/Tree/Filesystem.php
index 5c611047e07..85a9ee317be 100644..100755
--- a/3rdparty/Sabre/DAV/Tree/Filesystem.php
+++ b/3rdparty/Sabre/DAV/Tree/Filesystem.php
@@ -1,12 +1,12 @@
<?php
/**
- * Sabre_DAV_Tree_Filesystem
- *
+ * Sabre_DAV_Tree_Filesystem
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Tree_Filesystem extends Sabre_DAV_Tree {
@@ -14,7 +14,7 @@ class Sabre_DAV_Tree_Filesystem extends Sabre_DAV_Tree {
/**
* Base url on the filesystem.
*
- * @var string
+ * @var string
*/
protected $basePath;
@@ -22,9 +22,8 @@ class Sabre_DAV_Tree_Filesystem extends Sabre_DAV_Tree {
* Creates this tree
*
* Supply the path you'd like to share.
- *
- * @param string $basePath
- * @return void
+ *
+ * @param string $basePath
*/
public function __construct($basePath) {
@@ -33,16 +32,16 @@ class Sabre_DAV_Tree_Filesystem extends Sabre_DAV_Tree {
}
/**
- * Returns a new node for the given path
- *
- * @param string $path
- * @return void
+ * Returns a new node for the given path
+ *
+ * @param string $path
+ * @return Sabre_DAV_FS_Node
*/
public function getNodeForPath($path) {
$realPath = $this->getRealPath($path);
- if (!file_exists($realPath)) throw new Sabre_DAV_Exception_FileNotFound('File at location ' . $realPath . ' not found');
- if (is_dir($realPath)) {
+ if (!file_exists($realPath)) throw new Sabre_DAV_Exception_NotFound('File at location ' . $realPath . ' not found');
+ if (is_dir($realPath)) {
return new Sabre_DAV_FS_Directory($path);
} else {
return new Sabre_DAV_FS_File($path);
@@ -51,10 +50,10 @@ class Sabre_DAV_Tree_Filesystem extends Sabre_DAV_Tree {
}
/**
- * Returns the real filesystem path for a webdav url.
- *
- * @param string $publicPath
- * @return string
+ * Returns the real filesystem path for a webdav url.
+ *
+ * @param string $publicPath
+ * @return string
*/
protected function getRealPath($publicPath) {
@@ -67,24 +66,24 @@ class Sabre_DAV_Tree_Filesystem extends Sabre_DAV_Tree {
*
* This method must work recursively and delete the destination
* if it exists
- *
- * @param string $source
- * @param string $destination
+ *
+ * @param string $source
+ * @param string $destination
* @return void
*/
public function copy($source,$destination) {
$source = $this->getRealPath($source);
$destination = $this->getRealPath($destination);
- $this->realCopy($source,$destination);
+ $this->realCopy($source,$destination);
}
/**
- * Used by self::copy
- *
- * @param string $source
- * @param string $destination
+ * Used by self::copy
+ *
+ * @param string $source
+ * @param string $destination
* @return void
*/
protected function realCopy($source,$destination) {
@@ -107,9 +106,9 @@ class Sabre_DAV_Tree_Filesystem extends Sabre_DAV_Tree {
* Moves a file or directory recursively.
*
* If the destination exists, delete it first.
- *
- * @param string $source
- * @param string $destination
+ *
+ * @param string $source
+ * @param string $destination
* @return void
*/
public function move($source,$destination) {
diff --git a/3rdparty/Sabre/DAV/URLUtil.php b/3rdparty/Sabre/DAV/URLUtil.php
index 8f38749264b..794665a44f6 100644..100755
--- a/3rdparty/Sabre/DAV/URLUtil.php
+++ b/3rdparty/Sabre/DAV/URLUtil.php
@@ -11,11 +11,11 @@
* Specifically, it was found that GVFS (gnome's webdav client) does not like encoding of ( and
* ). Since these are reserved, but don't have a reserved meaning in url, these characters are
* kept as-is.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_URLUtil {
@@ -24,46 +24,42 @@ class Sabre_DAV_URLUtil {
* Encodes the path of a url.
*
* slashes (/) are treated as path-separators.
- *
- * @param string $path
- * @return string
+ *
+ * @param string $path
+ * @return string
*/
static function encodePath($path) {
- $valid_chars = '/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.~()';
- $newStr = '';
- for( $i=0; isset($path[$i]); ++$i ) {
- if( strpos($valid_chars,($c=$path[$i]))===false ) $newStr .= '%'.sprintf('%02x',ord($c));
- else $newStr .= $c;
- }
- return $newStr;
-
+ return preg_replace_callback('/([^A-Za-z0-9_\-\.~\(\)\/])/',function($match) {
+
+ return '%'.sprintf('%02x',ord($match[0]));
+
+ }, $path);
+
}
/**
* Encodes a 1 segment of a path
*
* Slashes are considered part of the name, and are encoded as %2f
- *
- * @param string $pathSegment
- * @return string
+ *
+ * @param string $pathSegment
+ * @return string
*/
static function encodePathSegment($pathSegment) {
- $valid_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.~()';
- $newStr = '';
- for( $i=0; isset($pathSegment[$i]); ++$i ) {
- if( strpos($valid_chars,($c=$pathSegment[$i]))===false ) $newStr .= '%'.sprintf('%02x',ord($c));
- else $newStr .= $c;
- }
- return $newStr;
+ return preg_replace_callback('/([^A-Za-z0-9_\-\.~\(\)])/',function($match) {
+
+ return '%'.sprintf('%02x',ord($match[0]));
+
+ }, $pathSegment);
}
/**
* Decodes a url-encoded path
*
- * @param string $path
- * @return string
+ * @param string $path
+ * @return string
*/
static function decodePath($path) {
@@ -74,17 +70,17 @@ class Sabre_DAV_URLUtil {
/**
* Decodes a url-encoded path segment
*
- * @param string $path
- * @return string
+ * @param string $path
+ * @return string
*/
static function decodePathSegment($path) {
- $path = urldecode($path);
+ $path = rawurldecode($path);
$encoding = mb_detect_encoding($path, array('UTF-8','ISO-8859-1'));
switch($encoding) {
- case 'ISO-8859-1' :
+ case 'ISO-8859-1' :
$path = utf8_encode($path);
}
@@ -94,7 +90,7 @@ class Sabre_DAV_URLUtil {
}
/**
- * Returns the 'dirname' and 'basename' for a path.
+ * Returns the 'dirname' and 'basename' for a path.
*
* The reason there is a custom function for this purpose, is because
* basename() is locale aware (behaviour changes if C locale or a UTF-8 locale is used)
@@ -108,8 +104,8 @@ class Sabre_DAV_URLUtil {
* If there is no dirname, it will return an empty string. Any / appearing at the end of the
* string is stripped off.
*
- * @param string $path
- * @return array
+ * @param string $path
+ * @return array
*/
static function splitPath($path) {
diff --git a/3rdparty/Sabre/DAV/UUIDUtil.php b/3rdparty/Sabre/DAV/UUIDUtil.php
index e42a536ad8a..f0eebe598e5 100644..100755
--- a/3rdparty/Sabre/DAV/UUIDUtil.php
+++ b/3rdparty/Sabre/DAV/UUIDUtil.php
@@ -4,13 +4,13 @@
* UUID Utility
*
* This class has static methods to generate and validate UUID's.
- * UUIDs are used a decent amount within various *DAV standards, so it made
+ * UUIDs are used a decent amount within various *DAV standards, so it made
* sense to include it.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_UUIDUtil {
@@ -18,10 +18,10 @@ class Sabre_DAV_UUIDUtil {
/**
* Returns a pseudo-random v4 UUID
*
- * This function is based on a comment by Andrew Moore on php.net
- *
+ * This function is based on a comment by Andrew Moore on php.net
+ *
* @see http://www.php.net/manual/en/function.uniqid.php#94959
- * @return void
+ * @return string
*/
static function getUUID() {
@@ -48,9 +48,9 @@ class Sabre_DAV_UUIDUtil {
/**
* Checks if a string is a valid UUID.
- *
- * @param string $uuid
- * @return bool
+ *
+ * @param string $uuid
+ * @return bool
*/
static function validateUUID($uuid) {
diff --git a/3rdparty/Sabre/DAV/Version.php b/3rdparty/Sabre/DAV/Version.php
index 6bece1985e4..5e5d15e4039 100644..100755
--- a/3rdparty/Sabre/DAV/Version.php
+++ b/3rdparty/Sabre/DAV/Version.php
@@ -2,10 +2,10 @@
/**
* This class contains the SabreDAV version constants.
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -14,7 +14,7 @@ class Sabre_DAV_Version {
/**
* Full version number
*/
- const VERSION = '1.5.4';
+ const VERSION = '1.6.2';
/**
* Stability : alpha, beta, stable
diff --git a/3rdparty/Sabre/DAV/XMLUtil.php b/3rdparty/Sabre/DAV/XMLUtil.php
index bd05be4b229..60eff3b159a 100644..100755
--- a/3rdparty/Sabre/DAV/XMLUtil.php
+++ b/3rdparty/Sabre/DAV/XMLUtil.php
@@ -2,32 +2,32 @@
/**
* XML utilities for WebDAV
- *
+ *
* @package Sabre
* @subpackage DAV
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_XMLUtil {
/**
* Returns the 'clark notation' for an element.
- *
+ *
* For example, and element encoded as:
* <b:myelem xmlns:b="http://www.example.org/" />
* will be returned as:
* {http://www.example.org}myelem
*
* This format is used throughout the SabreDAV sourcecode.
- * Elements encoded with the urn:DAV namespace will
+ * Elements encoded with the urn:DAV namespace will
* be returned as if they were in the DAV: namespace. This is to avoid
* compatibility problems.
*
* This function will return null if a nodetype other than an Element is passed.
*
- * @param DOMElement $dom
- * @return string
+ * @param DOMNode $dom
+ * @return string
*/
static function toClarkNotation(DOMNode $dom) {
@@ -35,21 +35,21 @@ class Sabre_DAV_XMLUtil {
// Mapping back to the real namespace, in case it was dav
if ($dom->namespaceURI=='urn:DAV') $ns = 'DAV:'; else $ns = $dom->namespaceURI;
-
+
// Mapping to clark notation
return '{' . $ns . '}' . $dom->localName;
}
/**
- * Parses a clark-notation string, and returns the namespace and element
+ * Parses a clark-notation string, and returns the namespace and element
* name components.
*
* If the string was invalid, it will throw an InvalidArgumentException.
- *
+ *
* @param string $str
- * @throws InvalidArgumentException
- * @return array
+ * @throws InvalidArgumentException
+ * @return array
*/
static function parseClarkNotation($str) {
@@ -70,6 +70,9 @@ class Sabre_DAV_XMLUtil {
*
* This is unfortunately needed, because the DAV: namespace violates the xml namespaces
* spec, and causes the DOM to throw errors
+ *
+ * @param string $xmlDocument
+ * @return array|string|null
*/
static function convertDAVNamespace($xmlDocument) {
@@ -83,17 +86,17 @@ class Sabre_DAV_XMLUtil {
* This method provides a generic way to load a DOMDocument for WebDAV use.
*
* This method throws a Sabre_DAV_Exception_BadRequest exception for any xml errors.
- * It does not preserve whitespace, and it converts the DAV: namespace to urn:DAV.
- *
+ * It does not preserve whitespace, and it converts the DAV: namespace to urn:DAV.
+ *
* @param string $xml
- * @throws Sabre_DAV_Exception_BadRequest
- * @return DOMDocument
+ * @throws Sabre_DAV_Exception_BadRequest
+ * @return DOMDocument
*/
static function loadDOMDocument($xml) {
if (empty($xml))
throw new Sabre_DAV_Exception_BadRequest('Empty XML document sent');
-
+
// The BitKinex client sends xml documents as UTF-16. PHP 5.3.1 (and presumably lower)
// does not support this, so we must intercept this and convert to UTF-8.
if (substr($xml,0,12) === "\x3c\x00\x3f\x00\x78\x00\x6d\x00\x6c\x00\x20\x00") {
@@ -111,7 +114,7 @@ class Sabre_DAV_XMLUtil {
// Retaining old error setting
$oldErrorSetting = libxml_use_internal_errors(true);
- // Clearing any previous errors
+ // Clearing any previous errors
libxml_clear_errors();
$dom = new DOMDocument();
@@ -135,7 +138,7 @@ class Sabre_DAV_XMLUtil {
/**
* Parses all WebDAV properties out of a DOM Element
*
- * Generally WebDAV properties are encloded in {DAV:}prop elements. This
+ * Generally WebDAV properties are enclosed in {DAV:}prop elements. This
* method helps by going through all these and pulling out the actual
* propertynames, making them array keys and making the property values,
* well.. the array values.
@@ -145,7 +148,7 @@ class Sabre_DAV_XMLUtil {
*
* Complex values are supported through the propertyMap argument. The
* propertyMap should have the clark-notation properties as it's keys, and
- * classnames as values.
+ * classnames as values.
*
* When any of these properties are found, the unserialize() method will be
* (statically) called. The result of this method is used as the value.
@@ -168,7 +171,7 @@ class Sabre_DAV_XMLUtil {
$propertyName = Sabre_DAV_XMLUtil::toClarkNotation($propNodeData);
if (isset($propertyMap[$propertyName])) {
- $propList[$propertyName] = call_user_func(array($propertyMap[$propertyName],'unserialize'),$propNodeData);
+ $propList[$propertyName] = call_user_func(array($propertyMap[$propertyName],'unserialize'),$propNodeData);
} else {
$propList[$propertyName] = $propNodeData->textContent;
}
diff --git a/3rdparty/Sabre/DAV/includes.php b/3rdparty/Sabre/DAV/includes.php
new file mode 100755
index 00000000000..6a4890677ea
--- /dev/null
+++ b/3rdparty/Sabre/DAV/includes.php
@@ -0,0 +1,97 @@
+<?php
+
+/**
+ * Sabre_DAV includes file
+ *
+ * Including this file will automatically include all files from the Sabre_DAV
+ * package.
+ *
+ * This often allows faster loadtimes, as autoload-speed is often quite slow.
+ *
+ * @package Sabre
+ * @subpackage DAV
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+
+// Begin includes
+include __DIR__ . '/Auth/IBackend.php';
+include __DIR__ . '/Client.php';
+include __DIR__ . '/Exception.php';
+include __DIR__ . '/INode.php';
+include __DIR__ . '/IProperties.php';
+include __DIR__ . '/Locks/Backend/Abstract.php';
+include __DIR__ . '/Locks/Backend/File.php';
+include __DIR__ . '/Locks/Backend/FS.php';
+include __DIR__ . '/Locks/Backend/PDO.php';
+include __DIR__ . '/Locks/LockInfo.php';
+include __DIR__ . '/Node.php';
+include __DIR__ . '/Property/IHref.php';
+include __DIR__ . '/Property.php';
+include __DIR__ . '/Server.php';
+include __DIR__ . '/ServerPlugin.php';
+include __DIR__ . '/StringUtil.php';
+include __DIR__ . '/TemporaryFileFilterPlugin.php';
+include __DIR__ . '/Tree.php';
+include __DIR__ . '/URLUtil.php';
+include __DIR__ . '/UUIDUtil.php';
+include __DIR__ . '/Version.php';
+include __DIR__ . '/XMLUtil.php';
+include __DIR__ . '/Auth/Backend/AbstractBasic.php';
+include __DIR__ . '/Auth/Backend/AbstractDigest.php';
+include __DIR__ . '/Auth/Backend/Apache.php';
+include __DIR__ . '/Auth/Backend/File.php';
+include __DIR__ . '/Auth/Backend/PDO.php';
+include __DIR__ . '/Auth/Plugin.php';
+include __DIR__ . '/Browser/GuessContentType.php';
+include __DIR__ . '/Browser/MapGetToPropFind.php';
+include __DIR__ . '/Browser/Plugin.php';
+include __DIR__ . '/Exception/BadRequest.php';
+include __DIR__ . '/Exception/Conflict.php';
+include __DIR__ . '/Exception/Forbidden.php';
+include __DIR__ . '/Exception/InsufficientStorage.php';
+include __DIR__ . '/Exception/InvalidResourceType.php';
+include __DIR__ . '/Exception/Locked.php';
+include __DIR__ . '/Exception/LockTokenMatchesRequestUri.php';
+include __DIR__ . '/Exception/MethodNotAllowed.php';
+include __DIR__ . '/Exception/NotAuthenticated.php';
+include __DIR__ . '/Exception/NotFound.php';
+include __DIR__ . '/Exception/NotImplemented.php';
+include __DIR__ . '/Exception/PaymentRequired.php';
+include __DIR__ . '/Exception/PreconditionFailed.php';
+include __DIR__ . '/Exception/ReportNotImplemented.php';
+include __DIR__ . '/Exception/RequestedRangeNotSatisfiable.php';
+include __DIR__ . '/Exception/UnsupportedMediaType.php';
+include __DIR__ . '/FS/Node.php';
+include __DIR__ . '/FSExt/Node.php';
+include __DIR__ . '/ICollection.php';
+include __DIR__ . '/IExtendedCollection.php';
+include __DIR__ . '/IFile.php';
+include __DIR__ . '/IQuota.php';
+include __DIR__ . '/Locks/Plugin.php';
+include __DIR__ . '/Mount/Plugin.php';
+include __DIR__ . '/ObjectTree.php';
+include __DIR__ . '/Property/GetLastModified.php';
+include __DIR__ . '/Property/Href.php';
+include __DIR__ . '/Property/HrefList.php';
+include __DIR__ . '/Property/LockDiscovery.php';
+include __DIR__ . '/Property/ResourceType.php';
+include __DIR__ . '/Property/Response.php';
+include __DIR__ . '/Property/ResponseList.php';
+include __DIR__ . '/Property/SupportedLock.php';
+include __DIR__ . '/Property/SupportedReportSet.php';
+include __DIR__ . '/Tree/Filesystem.php';
+include __DIR__ . '/Collection.php';
+include __DIR__ . '/Directory.php';
+include __DIR__ . '/Exception/ConflictingLock.php';
+include __DIR__ . '/Exception/FileNotFound.php';
+include __DIR__ . '/File.php';
+include __DIR__ . '/FS/Directory.php';
+include __DIR__ . '/FS/File.php';
+include __DIR__ . '/FSExt/Directory.php';
+include __DIR__ . '/FSExt/File.php';
+include __DIR__ . '/SimpleCollection.php';
+include __DIR__ . '/SimpleDirectory.php';
+include __DIR__ . '/SimpleFile.php';
+// End includes