mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
Remote Synchronization (CardDAV) improvements:
now it supports address book url auto detection (and works with Google contacts, icloud and etc.)
This commit is contained in:
parent
92f2caf700
commit
1fb553e77e
249 changed files with 1338 additions and 1453 deletions
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* BadRequest
|
||||
*
|
||||
* The BadRequest is thrown when the user submitted an invalid HTTP request
|
||||
* BadRequest
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class BadRequest extends \SabreForRainLoop\DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 400;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* Conflict
|
||||
*
|
||||
* A 409 Conflict is thrown when a user tried to make a directory over an existing
|
||||
* file or in a parent directory that doesn't exist.
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Conflict extends \SabreForRainLoop\DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 409;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
use SabreForRainLoop\DAV;
|
||||
|
||||
/**
|
||||
* ConflictingLock
|
||||
*
|
||||
* Similar to the Locked exception, this exception thrown when a LOCK request
|
||||
* was made, on a resource which was already locked
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class ConflictingLock extends Locked {
|
||||
|
||||
/**
|
||||
* This method allows the exception to include additional information into the WebDAV error response
|
||||
*
|
||||
* @param DAV\Server $server
|
||||
* @param \DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(DAV\Server $server, \DOMElement $errorNode) {
|
||||
|
||||
if ($this->lock) {
|
||||
$error = $errorNode->ownerDocument->createElementNS('DAV:','d:no-conflicting-lock');
|
||||
$errorNode->appendChild($error);
|
||||
if (!is_object($this->lock)) var_dump($this->lock);
|
||||
$error->appendChild($errorNode->ownerDocument->createElementNS('DAV:','d:href',$this->lock->uri));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* FileNotFound
|
||||
*
|
||||
* Deprecated: Warning, this class is deprecated and will be removed in a
|
||||
* future version of SabreDAV. Please use SabreForRainLoop\DAV\Exception\NotFound instead.
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @deprecated Use SabreForRainLoop\DAV\Exception\NotFound instead
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class FileNotFound extends NotFound {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* Forbidden
|
||||
*
|
||||
* This exception is thrown whenever a user tries to do an operation he's not allowed to
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Forbidden extends \SabreForRainLoop\DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 403;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* InsufficientStorage
|
||||
*
|
||||
* This Exception can be thrown, when for example a harddisk is full or a quota is exceeded
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class InsufficientStorage extends \SabreForRainLoop\DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 507;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class InvalidResourceType extends Forbidden {
|
||||
|
||||
/**
|
||||
* This method allows the exception to include additional information into the WebDAV error response
|
||||
*
|
||||
* @param DAV\Server $server
|
||||
* @param \DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(\SabreForRainLoop\DAV\Server $server,\DOMElement $errorNode) {
|
||||
|
||||
$error = $errorNode->ownerDocument->createElementNS('DAV:','d:valid-resourcetype');
|
||||
$errorNode->appendChild($error);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
use SabreForRainLoop\DAV;
|
||||
|
||||
/**
|
||||
* LockTokenMatchesRequestUri
|
||||
*
|
||||
* This exception is thrown by UNLOCK if a supplied lock-token is invalid
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class LockTokenMatchesRequestUri extends Conflict {
|
||||
|
||||
/**
|
||||
* Creates the exception
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->message = 'The locktoken supplied does not match any locks on this entity';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows the exception to include additional information into the WebDAV error response
|
||||
*
|
||||
* @param DAV\Server $server
|
||||
* @param \DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(DAV\Server $server,\DOMElement $errorNode) {
|
||||
|
||||
$error = $errorNode->ownerDocument->createElementNS('DAV:','d:lock-token-matches-request-uri');
|
||||
$errorNode->appendChild($error);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
use SabreForRainLoop\DAV;
|
||||
|
||||
/**
|
||||
* Locked
|
||||
*
|
||||
* The 423 is thrown when a client tried to access a resource that was locked, without supplying a valid lock token
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Locked extends DAV\Exception {
|
||||
|
||||
/**
|
||||
* Lock information
|
||||
*
|
||||
* @var SabreForRainLoop\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 DAV\Locks\LockInfo $lock
|
||||
*/
|
||||
public function __construct(DAV\Locks\LockInfo $lock = null) {
|
||||
|
||||
$this->lock = $lock;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 423;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows the exception to include additional information into the WebDAV error response
|
||||
*
|
||||
* @param DAV\Server $server
|
||||
* @param \DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(DAV\Server $server,\DOMElement $errorNode) {
|
||||
|
||||
if ($this->lock) {
|
||||
$error = $errorNode->ownerDocument->createElementNS('DAV:','d:lock-token-submitted');
|
||||
$errorNode->appendChild($error);
|
||||
|
||||
$href = $errorNode->ownerDocument->createElementNS('DAV:','d:href');
|
||||
$href->appendChild($errorNode->ownerDocument->createTextNode($this->lock->uri));
|
||||
$error->appendChild(
|
||||
$href
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* MethodNotAllowed
|
||||
*
|
||||
* The 405 is thrown when a client tried to create a directory on an already existing directory
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class MethodNotAllowed extends \SabreForRainLoop\DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 405;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows the exception to return any extra HTTP response headers.
|
||||
*
|
||||
* The headers must be returned as an array.
|
||||
*
|
||||
* @param \SabreForRainLoop\DAV\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function getHTTPHeaders(\SabreForRainLoop\DAV\Server $server) {
|
||||
|
||||
$methods = $server->getAllowedMethods($server->getRequestUri());
|
||||
|
||||
return array(
|
||||
'Allow' => strtoupper(implode(', ',$methods)),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
use SabreForRainLoop\DAV;
|
||||
|
||||
/**
|
||||
* NotAuthenticated
|
||||
*
|
||||
* This exception is thrown when the client did not provide valid
|
||||
* authentication credentials.
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class NotAuthenticated extends DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 401;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* NotFound
|
||||
*
|
||||
* This Exception is thrown when a Node couldn't be found. It returns HTTP error code 404
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class NotFound extends \SabreForRainLoop\DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 404;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* NotImplemented
|
||||
*
|
||||
* This exception is thrown when the client tried to call an unsupported HTTP method or other feature
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class NotImplemented extends \SabreForRainLoop\DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 501;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
use SabreForRainLoop\DAV;
|
||||
|
||||
/**
|
||||
* Payment Required
|
||||
*
|
||||
* The PaymentRequired exception may be thrown in a case where a user must pay
|
||||
* to access a certain resource or operation.
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class PaymentRequired extends DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 402;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
use SabreForRainLoop\DAV;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* request to not execute (the condition of the header failed)
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class PreconditionFailed extends 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
|
||||
*/
|
||||
public $header = null;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 412;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows the exception to include additional information into the WebDAV error response
|
||||
*
|
||||
* @param DAV\Server $server
|
||||
* @param \DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(DAV\Server $server,\DOMElement $errorNode) {
|
||||
|
||||
if ($this->header) {
|
||||
$prop = $errorNode->ownerDocument->createElement('s:header');
|
||||
$prop->nodeValue = $this->header;
|
||||
$errorNode->appendChild($prop);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
use SabreForRainLoop\DAV;
|
||||
|
||||
/**
|
||||
* ReportNotSupported
|
||||
*
|
||||
* This exception is thrown when the client requested an unknown report through the REPORT method
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class ReportNotSupported extends Forbidden {
|
||||
|
||||
/**
|
||||
* This method allows the exception to include additional information into the WebDAV error response
|
||||
*
|
||||
* @param DAV\Server $server
|
||||
* @param \DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(DAV\Server $server,\DOMElement $errorNode) {
|
||||
|
||||
$error = $errorNode->ownerDocument->createElementNS('DAV:','d:supported-report');
|
||||
$errorNode->appendChild($error);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
use SabreForRainLoop\DAV;
|
||||
|
||||
/**
|
||||
* RequestedRangeNotSatisfiable
|
||||
*
|
||||
* This exception is normally thrown when the user
|
||||
* request a range that is out of the entity bounds.
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class RequestedRangeNotSatisfiable extends DAV\Exception {
|
||||
|
||||
/**
|
||||
* returns the http statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 416;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
use SabreForRainLoop\DAV;
|
||||
|
||||
/**
|
||||
* ServiceUnavailable
|
||||
*
|
||||
* This exception is thrown in case the service
|
||||
* is currently not available (e.g. down for maintenance).
|
||||
*
|
||||
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class ServiceUnavailable extends DAV\Exception {
|
||||
|
||||
/**
|
||||
* Returns the HTTP statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 503;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace SabreForRainLoop\DAV\Exception;
|
||||
|
||||
/**
|
||||
* UnSupportedMediaType
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class UnsupportedMediaType extends \SabreForRainLoop\DAV\Exception {
|
||||
|
||||
/**
|
||||
* returns the http statuscode for this exception
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHTTPCode() {
|
||||
|
||||
return 415;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue