[Pkg-owncloud-commits] [php-sabredav] 36/64: filter calendar objects by component type (VEVENT, VTODO or VJOURNAL)
David Prévot
taffit at moszumanska.debian.org
Thu Dec 11 15:13:25 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag 2.2.0alpha1
in repository php-sabredav.
commit 72591180e47db54ddb786ab02a523a0f8ec42bb2
Author: Armin Hackmann <armin at fruux.com>
Date: Mon Nov 24 14:45:40 2014 +0100
filter calendar objects by component type (VEVENT, VTODO or VJOURNAL)
---
lib/CalDAV/ICSExportPlugin.php | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/lib/CalDAV/ICSExportPlugin.php b/lib/CalDAV/ICSExportPlugin.php
index b90f44b..ae6746b 100644
--- a/lib/CalDAV/ICSExportPlugin.php
+++ b/lib/CalDAV/ICSExportPlugin.php
@@ -99,6 +99,7 @@ class ICSExportPlugin extends DAV\ServerPlugin {
$start = null;
$end = null;
$expand = false;
+ $componentType = false;
if (isset($queryParams['start'])) {
if (!ctype_digit($queryParams['start'])) {
throw new BadRequest('The start= parameter must contain a unix timestamp');
@@ -116,6 +117,13 @@ class ICSExportPlugin extends DAV\ServerPlugin {
throw new BadRequest('If you\'d like to expand recurrences, you must specify both a start= and end= parameter.');
}
$expand = true;
+ $componentType = 'VEVENT';
+ }
+ if (isset($queryParams['componentType'])) {
+ if (!in_array($queryParams['componentType'], ['VEVENT', 'VTODO', 'VJOURNAL'])) {
+ throw new BadRequest('You are not allowed to search for components of type: ' . $queryParams['componentType'] . ' here');
+ }
+ $componentType = $queryParams['componentType'];
}
$format = \Sabre\HTTP\Util::Negotiate(
@@ -135,7 +143,7 @@ class ICSExportPlugin extends DAV\ServerPlugin {
$format = 'text/calendar';
}
- $this->generateResponse($path, $start, $end, $expand, $format, $properties, $response);
+ $this->generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, $response);
// Returning false to break the event chain
return false;
@@ -149,16 +157,17 @@ class ICSExportPlugin extends DAV\ServerPlugin {
* @param DateTime|null $start
* @param DateTime|null $end
* @param bool $expand
+ * @param string $componentType
* @param string $format
* @param array $properties
* @param ResponseInterface $response
*/
- protected function generateResponse($path, $start, $end, $expand, $format, $properties, ResponseInterface $response) {
+ protected function generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, ResponseInterface $response) {
$calDataProp = '{' . Plugin::NS_CALDAV . '}calendar-data';
$blobs = [];
- if ($start || $end) {
+ if ($start || $end || $componentType) {
// If there was a start or end filter, we need to enlist
// calendarQuery for speed.
@@ -167,7 +176,7 @@ class ICSExportPlugin extends DAV\ServerPlugin {
'name' => 'VCALENDAR',
'comp-filters' => [
[
- 'name' => 'VEVENT',
+ 'name' => $componentType,
'comp-filters' => [],
'prop-filters' => [],
'is-not-defined' => false,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list