/usr/share/php/sabre21/Sabre/CalDAV/Subscriptions/Plugin.php is in php-sabre-dav-2.1 2.1.10-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | <?php
namespace Sabre\CalDAV\Subscriptions;
use
Sabre\DAV\INode,
Sabre\DAV\PropFind,
Sabre\DAV\ServerPlugin,
Sabre\DAV\Server;
/**
* This plugin adds calendar-subscription support to your CalDAV server.
*
* Some clients support 'managed subscriptions' server-side. This is basically
* a list of subscription urls a user is using.
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class Plugin extends ServerPlugin {
/**
* This initializes the plugin.
*
* This function is called by Sabre\DAV\Server, after
* addPlugin is called.
*
* This method should set up the required event subscriptions.
*
* @param Server $server
* @return void
*/
function initialize(Server $server) {
$server->resourceTypeMapping['Sabre\\CalDAV\\Subscriptions\\ISubscription'] =
'{http://calendarserver.org/ns/}subscribed';
$server->propertyMap['{http://calendarserver.org/ns/}source'] =
'Sabre\\DAV\\Property\\Href';
$server->on('propFind', [$this, 'propFind'], 150);
}
/**
* 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
*/
function getFeatures() {
return ['calendarserver-subscribed'];
}
/**
* Triggered after properties have been fetched.
*
* @return void
*/
function propFind(PropFind $propFind, INode $node) {
// There's a bunch of properties that must appear as a self-closing
// xml-element. This event handler ensures that this will be the case.
$props = [
'{http://calendarserver.org/ns/}subscribed-strip-alarms',
'{http://calendarserver.org/ns/}subscribed-strip-attachments',
'{http://calendarserver.org/ns/}subscribed-strip-todos',
];
foreach($props as $prop) {
if ($propFind->getStatus($prop)===200) {
$propFind->set($prop, '', 200);
}
}
}
}
|