Version 3.2.3

This commit is contained in:
Neo committed 2025-12-19 00:34:03 -08:00
1 parent ae5c01cc78
commit 78706903a2
2641 files changed
+228363 -201264

No files matched your search

@@ -0,0 +1,75 @@
<?php
/**
* 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
* serialization
*
* @package Sabre
* @subpackage DAV
* @copyright Copyright (C) 2007-2010 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
*/
public $time;
/**
* __construct
*
* @param int|DateTime $time
* @return void
*/
public function __construct($time) {
if ($time instanceof DateTime) {
$this->time = $time;
} elseif (is_int($time) || ctype_digit($time)) {
$this->time = new DateTime('@' . $time);
} else {
$this->time = new DateTime($time);
}
// Setting timezone to UTC
$this->time->setTimezone(new DateTimeZone('UTC'));
}
/**
* serialize
*
* @param DOMElement $prop
* @return void
*/
public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
$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);
}
/**
* getTime
*
* @return DateTime
*/
public function getTime() {
return $this->time;
}
}
@@ -0,0 +1,91 @@
<?php
/**
* Href property
*
* The href property represpents 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-2010 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
*/
private $href;
/**
* Automatically prefix the url with the server base directory
*
* @var bool
*/
private $autoPrefix = true;
/**
* __construct
*
* @param string $href
* @return void
*/
public function __construct($href, $autoPrefix = true) {
$this->href = $href;
$this->autoPrefix = $autoPrefix;
}
/**
* Returns the uri
*
* @return string
*/
public function getHref() {
return $this->href;
}
/**
* Serializes this property.
*
* It will additionally prepend the href property with the server's base uri.
*
* @param Sabre_DAV_Server $server
* @param DOMElement $dom
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $dom) {
$prefix = $server->xmlNamespaces['DAV:'];
$elem = $dom->ownerDocument->createElement($prefix . ':href');
$elem->nodeValue = ($this->autoPrefix?$server->getBaseUri():'') . $this->href;
$dom->appendChild($elem);
}
/**
* 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
*/
static function unserialize(DOMElement $dom) {
if (Sabre_DAV_XMLUtil::toClarkNotation($dom->firstChild)==='{DAV:}href') {
return new self($dom->firstChild->textContent,false);
}
}
}
@@ -0,0 +1,25 @@
<?php
/**
* IHref interface
*
* Any property implementing this interface can expose a related url.
* This is used by certain subsystems to aquire more information about for example
* the owner of a file
*
* @package Sabre
* @subpackage DAV
* @copyright Copyright (C) 2007-2010 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
*/
function getHref();
}
@@ -0,0 +1,85 @@
<?php
/**
* Represents {DAV:}lockdiscovery property
*
* This property contains all the open locks on a given resource
*
* @package Sabre
* @subpackage DAV
* @copyright Copyright (C) 2007-2010 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
*/
public $locks;
/**
* Should we show the locktoken as well?
*
* @var bool
*/
public $revealLockToken;
/**
* __construct
*
* @param array $locks
* @param bool $revealLockToken
* @return void
*/
public function __construct($locks,$revealLockToken = false) {
$this->locks = $locks;
$this->revealLockToken = $revealLockToken;
}
/**
* serialize
*
* @param DOMElement $prop
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
$doc = $prop->ownerDocument;
foreach($this->locks as $lock) {
$activeLock = $doc->createElementNS('DAV:','d:activelock');
$prop->appendChild($activeLock);
$lockScope = $doc->createElementNS('DAV:','d:lockscope');
$activeLock->appendChild($lockScope);
$lockScope->appendChild($doc->createElementNS('DAV:','d:' . ($lock->scope==Sabre_DAV_Locks_LockInfo::EXCLUSIVE?'exclusive':'shared')));
$lockType = $doc->createElementNS('DAV:','d:locktype');
$activeLock->appendChild($lockType);
$lockType->appendChild($doc->createElementNS('DAV:','d:write'));
$activeLock->appendChild($doc->createElementNS('DAV:','d:depth',($lock->depth == Sabre_DAV_Server::DEPTH_INFINITY?'infinity':$lock->depth)));
$activeLock->appendChild($doc->createElementNS('DAV:','d:timeout','Second-' . $lock->timeout));
if ($this->revealLockToken) {
$lockToken = $doc->createElementNS('DAV:','d:locktoken');
$activeLock->appendChild($lockToken);
$lockToken->appendChild($doc->createElementNS('DAV:','d:href','opaquelocktoken:' . $lock->token));
}
$activeLock->appendChild($doc->createElementNS('DAV:','d:owner',$lock->owner));
}
}
}
@@ -0,0 +1,126 @@
<?php
/**
* Principal property
*
* The principal property represents a principal from RFC3744 (ACL).
* The property can be used to specify a principal or pseudo principals.
*
* @package Sabre
* @subpackage DAV
* @copyright Copyright (C) 2007-2010 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_Principal extends Sabre_DAV_Property implements Sabre_DAV_Property_IHref {
/**
* To specify a not-logged-in user, use the UNAUTHENTICTED principal
*/
const UNAUTHENTICATED = 1;
/**
* To specify any principal that is logged in, use AUTHENTICATED
*/
const AUTHENTICATED = 2;
/**
* Specific princpals can be specified with the HREF
*/
const HREF = 3;
/**
* Principal-type
*
* Must be one of the UNAUTHENTICATED, AUTHENTICATED or HREF constants.
*
* @var int
*/
private $type;
/**
* Url to principal
*
* This value is only used for the HREF principal type.
*
* @var string
*/
private $href;
/**
* Creates the property.
*
* The 'type' argument must be one of the type constants defined in this class.
*
* 'href' is only required for the HREF type.
*
* @param int $type
* @param string $href
* @return void
*/
public function __construct($type, $href = null) {
$this->type = $type;
if ($type===self::HREF && is_null($href)) {
throw new Sabre_DAV_Exception('The href argument must be specified for the HREF principal type.');
}
$this->href = $href;
}
/**
* Returns the principal type
*
* @return int
*/
public function getType() {
return $this->type;
}
/**
* Returns the principal uri.
*
* @return string
*/
public function getHref() {
return $this->href;
}
/**
* Serializes the property into a DOMElement.
*
* @param Sabre_DAV_Server $server
* @param DOMElement $node
* @return void
*/
public function serialize(Sabre_DAV_Server $server, DOMElement $node) {
$prefix = $server->xmlNamespaces['DAV:'];
switch($this->type) {
case self::UNAUTHENTICATED :
$node->appendChild(
$node->ownerDocument->createElement($prefix . ':unauthenticated')
);
break;
case self::AUTHENTICATED :
$node->appendChild(
$node->ownerDocument->createElement($prefix . ':authenticated')
);
break;
case self::HREF :
$href = $node->ownerDocument->createElement($prefix . ':href');
$href->nodeValue = $server->getBaseUri() . $this->href;
$node->appendChild($href);
break;
}
}
}
@@ -0,0 +1,80 @@
<?php
/**
* 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.
*
* @package Sabre
* @subpackage DAV
* @copyright Copyright (C) 2007-2010 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
*
* @var string
*/
public $resourceType = null;
/**
* __construct
*
* @param mixed $resourceType
* @return void
*/
public function __construct($resourceType = null) {
if ($resourceType === Sabre_DAV_Server::NODE_FILE)
$this->resourceType = null;
elseif ($resourceType === Sabre_DAV_Server::NODE_DIRECTORY)
$this->resourceType = '{DAV:}collection';
else
$this->resourceType = $resourceType;
}
/**
* serialize
*
* @param DOMElement $prop
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
$propName = null;
$rt = $this->resourceType;
if (!is_array($rt)) $rt = array($rt);
foreach($rt as $resourceType) {
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]));
}
}
}
}
/**
* Returns the value in clark-notation
*
* For example '{DAV:}collection'
*
* @return string
*/
public function getValue() {
return $this->resourceType;
}
}
@@ -0,0 +1,156 @@
<?php
/**
* Response property
*
* This class represents the {DAV:}response XML element.
* This is used by the Server class to encode individual items within a multistatus
* response.
*
* @package Sabre
* @subpackage DAV
* @copyright Copyright (C) 2007-2010 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
*/
private $href;
/**
* 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
*/
public function __construct($href,array $responseProperties) {
$this->href = $href;
$this->responseProperties = $responseProperties;
}
/**
* Returns the url
*
* @return string
*/
public function getHref() {
return $this->href;
}
/**
* Returns the property list
*
* @return array
*/
public function getResponseProperties() {
return $this->responseProperties;
}
/**
* serialize
*
* @param Sabre_DAV_Server $server
* @param DOMElement $dom
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $dom) {
$document = $dom->ownerDocument;
$properties = $this->responseProperties;
$xresponse = $document->createElement('d:response');
$dom->appendChild($xresponse);
$uri = Sabre_DAV_URLUtil::encodePath($this->href);
// Adding the baseurl to the beginning of the url
$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) {
// The 'href' is also in this array, and it's special cased.
// We will ignore it
if ($httpStatus=='href') continue;
// If there are no properties in this group, we can also just carry on
if (!count($propertyGroup)) continue;
$xpropstat = $document->createElement('d:propstat');
$xresponse->appendChild($xpropstat);
$xprop = $document->createElement('d:prop');
$xpropstat->appendChild($xprop);
$nsList = $server->xmlNamespaces;
foreach($propertyGroup as $propertyName=>$propertyValue) {
$propName = null;
preg_match('/^{([^}]*)}(.*)$/',$propertyName,$propName);
// special case for empty namespaces
if ($propName[1]=='') {
$currentProperty = $document->createElement($propName[2]);
$xprop->appendChild($currentProperty);
$currentProperty->setAttribute('xmlns','');
} else {
if (!isset($nsList[$propName[1]])) {
$nsList[$propName[1]] = 'x' . count($nsList);
}
// 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]);
} else {
$currentProperty = $document->createElementNS($propName[1],$nsList[$propName[1]].':' . $propName[2]);
}
$xprop->appendChild($currentProperty);
}
if (is_scalar($propertyValue)) {
$text = $document->createTextNode($propertyValue);
$currentProperty->appendChild($text);
} elseif ($propertyValue instanceof Sabre_DAV_Property) {
$propertyValue->serialize($server,$currentProperty);
} elseif (!is_null($propertyValue)) {
throw new Sabre_DAV_Exception('Unknown property value type: ' . gettype($propertyValue) . ' for property: ' . $propertyName);
}
}
$xpropstat->appendChild($document->createElement('d:status',$server->httpResponse->getStatusMessage($httpStatus)));
}
}
}
@@ -0,0 +1,76 @@
<?php
/**
* This class represents the {DAV:}supportedlock property
*
* This property contains information about what kind of locks
* this server supports.
*
* @package Sabre
* @subpackage DAV
* @copyright Copyright (C) 2007-2010 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
*
* @var mixed
*/
public $supportsLocks = false;
/**
* __construct
*
* @param mixed $supportsLocks
* @return void
*/
public function __construct($supportsLocks) {
$this->supportsLocks = $supportsLocks;
}
/**
* serialize
*
* @param DOMElement $prop
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
$doc = $prop->ownerDocument;
if (!$this->supportsLocks) return null;
$lockEntry1 = $doc->createElementNS('DAV:','d:lockentry');
$lockEntry2 = $doc->createElementNS('DAV:','d:lockentry');
$prop->appendChild($lockEntry1);
$prop->appendChild($lockEntry2);
$lockScope1 = $doc->createElementNS('DAV:','d:lockscope');
$lockScope2 = $doc->createElementNS('DAV:','d:lockscope');
$lockType1 = $doc->createElementNS('DAV:','d:locktype');
$lockType2 = $doc->createElementNS('DAV:','d:locktype');
$lockEntry1->appendChild($lockScope1);
$lockEntry1->appendChild($lockType1);
$lockEntry2->appendChild($lockScope2);
$lockEntry2->appendChild($lockType2);
$lockScope1->appendChild($doc->createElementNS('DAV:','d:exclusive'));
$lockScope2->appendChild($doc->createElementNS('DAV:','d:shared'));
$lockType1->appendChild($doc->createElementNS('DAV:','d:write'));
$lockType2->appendChild($doc->createElementNS('DAV:','d:write'));
//$frag->appendXML('<d:lockentry><d:lockscope><d:exclusive /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
//$frag->appendXML('<d:lockentry><d:lockscope><d:shared /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
}
}
@@ -0,0 +1,110 @@
<?php
/**
* supported-report-set property.
*
* 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-2010 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
*
* @var array
*/
protected $reports = array();
/**
* Creates the property
*
* Any reports passed in the constructor
* should be valid report-types in clark-notation.
*
* Either a string or an array of strings must be passed.
*
* @param mixed $reports
* @return void
*/
public function __construct($report = null) {
if (!is_null($report))
$this->addReport($reports);
}
/**
* Adds a report to this property
*
* The report must be a string in clark-notation.
* Multiple reports can be specified as an array.
*
* @param mixed $report
* @return void
*/
public function addReport($report) {
if (!is_array($report)) $report = array($report);
foreach($report as $r) {
if (!preg_match('/^{([^}]*)}(.*)$/',$r))
throw new Sabre_DAV_Exception('Reportname must be in clark-notation');
$this->reports[] = $r;
}
}
/**
* Returns the list of supported reports
*
* @return array
*/
public function getValue() {
return $this->reports;
}
/**
* Serializes the node
*
* @param Sabre_DAV_Server $server
* @param DOMElement $prop
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
foreach($this->reports as $reportName) {
$supportedReport = $prop->ownerDocument->createElement('d:supported-report');
$prop->appendChild($supportedReport);
$report = $prop->ownerDocument->createElement('d:report');
$supportedReport->appendChild($report);
preg_match('/^{([^}]*)}(.*)$/',$reportName,$matches);
list(, $namespace, $element) = $matches;
$prefix = isset($server->xmlNamespaces[$namespace])?$server->xmlNamespaces[$namespace]:null;
if ($prefix) {
$report->appendChild($prop->ownerDocument->createElement($prefix . ':' . $element));
} else {
$report->appendChild($prop->ownerDocument->createElementNS($namespace, 'x:' . $element));
}
}
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com/">IP.Board</a>
</body>
</html>