summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorThomas Müller <DeepDiver1975@users.noreply.github.com>2016-07-21 15:58:46 +0200
committerGitHub <noreply@github.com>2016-07-21 15:58:46 +0200
commit9f2117613d41a81e703eded9cbb5be260c5b4b5e (patch)
treed8485743feae3ad4be05cfbfcd51c6db8ba26c85 /apps/dav/lib
parent1550ae93ef3b63ef80247669cf2390fa76c917db (diff)
downloadnextcloud-server-9f2117613d41a81e703eded9cbb5be260c5b4b5e.tar.gz
nextcloud-server-9f2117613d41a81e703eded9cbb5be260c5b4b5e.zip
Add all properties while creating a subscription (#25318) (#25335)
Fixes #24469
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index ce494082976..7f051426c36 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -1079,22 +1079,27 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'lastmodified' => time(),
];
- foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
- if (isset($properties[$xmlName])) {
+ $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
+ foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
+ if (array_key_exists($xmlName, $properties)) {
$values[$dbName] = $properties[$xmlName];
- $fieldNames[] = $dbName;
+ if (in_array($dbName, $propertiesBoolean)) {
+ $values[$dbName] = true;
+ }
}
}
+ $valuesToInsert = array();
+
$query = $this->db->getQueryBuilder();
+
+ foreach (array_keys($values) as $name) {
+ $valuesToInsert[$name] = $query->createNamedParameter($values[$name]);
+ }
+
$query->insert('calendarsubscriptions')
- ->values([
- 'principaluri' => $query->createNamedParameter($values['principaluri']),
- 'uri' => $query->createNamedParameter($values['uri']),
- 'source' => $query->createNamedParameter($values['source']),
- 'lastmodified' => $query->createNamedParameter($values['lastmodified']),
- ])
+ ->values($valuesToInsert)
->execute();
return $this->db->lastInsertId('*PREFIX*calendarsubscriptions');