Completed
Push — master ( a10c45...8e6d86 )
by Morris
13:50
created
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -114,17 +114,17 @@  discard block
 block discarded – undo
114 114
 		$subject = 'SabreDAV iTIP message';
115 115
 		switch (strtoupper($iTipMessage->method)) {
116 116
 			case 'REPLY' :
117
-				$subject = 'Re: ' . $summary;
117
+				$subject = 'Re: '.$summary;
118 118
 				break;
119 119
 			case 'REQUEST' :
120 120
 				$subject = $summary;
121 121
 				break;
122 122
 			case 'CANCEL' :
123
-				$subject = 'Cancelled: ' . $summary;
123
+				$subject = 'Cancelled: '.$summary;
124 124
 				break;
125 125
 		}
126 126
 
127
-		$contentType = 'text/calendar; charset=UTF-8; method=' . $iTipMessage->method;
127
+		$contentType = 'text/calendar; charset=UTF-8; method='.$iTipMessage->method;
128 128
 
129 129
 		$message = $this->mailer->createMessage();
130 130
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 				$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
140 140
 			}
141 141
 			$iTipMessage->scheduleStatus = '1.1; Scheduling message is sent via iMip';
142
-		} catch(\Exception $ex) {
142
+		} catch (\Exception $ex) {
143 143
 			$this->logger->logException($ex, ['app' => 'dav']);
144 144
 			$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
145 145
 		}
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 				$lastOccurrence = $firstOccurrence;
171 171
 			}
172 172
 		} else {
173
-			$it = new EventIterator($vObject, (string)$component->UID);
173
+			$it = new EventIterator($vObject, (string) $component->UID);
174 174
 			$maxDate = new \DateTime(self::MAX_DATE);
175 175
 			if ($it->isInfinite()) {
176 176
 				$lastOccurrence = $maxDate->getTimestamp();
177 177
 			} else {
178 178
 				$end = $it->getDtEnd();
179
-				while($it->valid() && $end < $maxDate) {
179
+				while ($it->valid() && $end < $maxDate) {
180 180
 					$end = $it->getDtEnd();
181 181
 					$it->next();
182 182
 
Please login to merge, or discard this patch.
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -48,146 +48,146 @@
 block discarded – undo
48 48
  */
49 49
 class IMipPlugin extends SabreIMipPlugin {
50 50
 
51
-	/** @var IMailer */
52
-	private $mailer;
53
-
54
-	/** @var ILogger */
55
-	private $logger;
56
-
57
-	/** @var ITimeFactory */
58
-	private $timeFactory;
59
-
60
-	const MAX_DATE = '2038-01-01';
61
-
62
-	/**
63
-	 * Creates the email handler.
64
-	 *
65
-	 * @param IMailer $mailer
66
-	 * @param ILogger $logger
67
-	 * @param ITimeFactory $timeFactory
68
-	 */
69
-	function __construct(IMailer $mailer, ILogger $logger, ITimeFactory $timeFactory) {
70
-		parent::__construct('');
71
-		$this->mailer = $mailer;
72
-		$this->logger = $logger;
73
-		$this->timeFactory = $timeFactory;
74
-	}
75
-
76
-	/**
77
-	 * Event handler for the 'schedule' event.
78
-	 *
79
-	 * @param ITip\Message $iTipMessage
80
-	 * @return void
81
-	 */
82
-	function schedule(ITip\Message $iTipMessage) {
83
-
84
-		// Not sending any emails if the system considers the update
85
-		// insignificant.
86
-		if (!$iTipMessage->significantChange) {
87
-			if (!$iTipMessage->scheduleStatus) {
88
-				$iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email';
89
-			}
90
-			return;
91
-		}
92
-
93
-		$summary = $iTipMessage->message->VEVENT->SUMMARY;
94
-
95
-		if (parse_url($iTipMessage->sender, PHP_URL_SCHEME) !== 'mailto') {
96
-			return;
97
-		}
98
-
99
-		if (parse_url($iTipMessage->recipient, PHP_URL_SCHEME) !== 'mailto') {
100
-			return;
101
-		}
102
-
103
-		// don't send out mails for events that already took place
104
-		if ($this->isEventInThePast($iTipMessage->message)) {
105
-			return;
106
-		}
107
-
108
-		$sender = substr($iTipMessage->sender, 7);
109
-		$recipient = substr($iTipMessage->recipient, 7);
110
-
111
-		$senderName = ($iTipMessage->senderName) ? $iTipMessage->senderName : null;
112
-		$recipientName = ($iTipMessage->recipientName) ? $iTipMessage->recipientName : null;
113
-
114
-		$subject = 'SabreDAV iTIP message';
115
-		switch (strtoupper($iTipMessage->method)) {
116
-			case 'REPLY' :
117
-				$subject = 'Re: ' . $summary;
118
-				break;
119
-			case 'REQUEST' :
120
-				$subject = $summary;
121
-				break;
122
-			case 'CANCEL' :
123
-				$subject = 'Cancelled: ' . $summary;
124
-				break;
125
-		}
126
-
127
-		$contentType = 'text/calendar; charset=UTF-8; method=' . $iTipMessage->method;
128
-
129
-		$message = $this->mailer->createMessage();
130
-
131
-		$message->setReplyTo([$sender => $senderName])
132
-			->setTo([$recipient => $recipientName])
133
-			->setSubject($subject)
134
-			->setBody($iTipMessage->message->serialize(), $contentType);
135
-		try {
136
-			$failed = $this->mailer->send($message);
137
-			if ($failed) {
138
-				$this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' =>  implode(', ', $failed)]);
139
-				$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
140
-			}
141
-			$iTipMessage->scheduleStatus = '1.1; Scheduling message is sent via iMip';
142
-		} catch(\Exception $ex) {
143
-			$this->logger->logException($ex, ['app' => 'dav']);
144
-			$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
145
-		}
146
-	}
147
-
148
-	/**
149
-	 * check if event took place in the past already
150
-	 * @param VCalendar $vObject
151
-	 * @return bool
152
-	 */
153
-	private function isEventInThePast(VCalendar $vObject) {
154
-		$component = $vObject->VEVENT;
155
-
156
-		$firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp();
157
-		// Finding the last occurrence is a bit harder
158
-		if (!isset($component->RRULE)) {
159
-			if (isset($component->DTEND)) {
160
-				$lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp();
161
-			} elseif (isset($component->DURATION)) {
162
-				$endDate = clone $component->DTSTART->getDateTime();
163
-				// $component->DTEND->getDateTime() returns DateTimeImmutable
164
-				$endDate = $endDate->add(DateTimeParser::parse($component->DURATION->getValue()));
165
-				$lastOccurrence = $endDate->getTimeStamp();
166
-			} elseif (!$component->DTSTART->hasTime()) {
167
-				$endDate = clone $component->DTSTART->getDateTime();
168
-				// $component->DTSTART->getDateTime() returns DateTimeImmutable
169
-				$endDate = $endDate->modify('+1 day');
170
-				$lastOccurrence = $endDate->getTimeStamp();
171
-			} else {
172
-				$lastOccurrence = $firstOccurrence;
173
-			}
174
-		} else {
175
-			$it = new EventIterator($vObject, (string)$component->UID);
176
-			$maxDate = new \DateTime(self::MAX_DATE);
177
-			if ($it->isInfinite()) {
178
-				$lastOccurrence = $maxDate->getTimestamp();
179
-			} else {
180
-				$end = $it->getDtEnd();
181
-				while($it->valid() && $end < $maxDate) {
182
-					$end = $it->getDtEnd();
183
-					$it->next();
184
-
185
-				}
186
-				$lastOccurrence = $end->getTimestamp();
187
-			}
188
-		}
189
-
190
-		$currentTime = $this->timeFactory->getTime();
191
-		return $lastOccurrence < $currentTime;
192
-	}
51
+    /** @var IMailer */
52
+    private $mailer;
53
+
54
+    /** @var ILogger */
55
+    private $logger;
56
+
57
+    /** @var ITimeFactory */
58
+    private $timeFactory;
59
+
60
+    const MAX_DATE = '2038-01-01';
61
+
62
+    /**
63
+     * Creates the email handler.
64
+     *
65
+     * @param IMailer $mailer
66
+     * @param ILogger $logger
67
+     * @param ITimeFactory $timeFactory
68
+     */
69
+    function __construct(IMailer $mailer, ILogger $logger, ITimeFactory $timeFactory) {
70
+        parent::__construct('');
71
+        $this->mailer = $mailer;
72
+        $this->logger = $logger;
73
+        $this->timeFactory = $timeFactory;
74
+    }
75
+
76
+    /**
77
+     * Event handler for the 'schedule' event.
78
+     *
79
+     * @param ITip\Message $iTipMessage
80
+     * @return void
81
+     */
82
+    function schedule(ITip\Message $iTipMessage) {
83
+
84
+        // Not sending any emails if the system considers the update
85
+        // insignificant.
86
+        if (!$iTipMessage->significantChange) {
87
+            if (!$iTipMessage->scheduleStatus) {
88
+                $iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email';
89
+            }
90
+            return;
91
+        }
92
+
93
+        $summary = $iTipMessage->message->VEVENT->SUMMARY;
94
+
95
+        if (parse_url($iTipMessage->sender, PHP_URL_SCHEME) !== 'mailto') {
96
+            return;
97
+        }
98
+
99
+        if (parse_url($iTipMessage->recipient, PHP_URL_SCHEME) !== 'mailto') {
100
+            return;
101
+        }
102
+
103
+        // don't send out mails for events that already took place
104
+        if ($this->isEventInThePast($iTipMessage->message)) {
105
+            return;
106
+        }
107
+
108
+        $sender = substr($iTipMessage->sender, 7);
109
+        $recipient = substr($iTipMessage->recipient, 7);
110
+
111
+        $senderName = ($iTipMessage->senderName) ? $iTipMessage->senderName : null;
112
+        $recipientName = ($iTipMessage->recipientName) ? $iTipMessage->recipientName : null;
113
+
114
+        $subject = 'SabreDAV iTIP message';
115
+        switch (strtoupper($iTipMessage->method)) {
116
+            case 'REPLY' :
117
+                $subject = 'Re: ' . $summary;
118
+                break;
119
+            case 'REQUEST' :
120
+                $subject = $summary;
121
+                break;
122
+            case 'CANCEL' :
123
+                $subject = 'Cancelled: ' . $summary;
124
+                break;
125
+        }
126
+
127
+        $contentType = 'text/calendar; charset=UTF-8; method=' . $iTipMessage->method;
128
+
129
+        $message = $this->mailer->createMessage();
130
+
131
+        $message->setReplyTo([$sender => $senderName])
132
+            ->setTo([$recipient => $recipientName])
133
+            ->setSubject($subject)
134
+            ->setBody($iTipMessage->message->serialize(), $contentType);
135
+        try {
136
+            $failed = $this->mailer->send($message);
137
+            if ($failed) {
138
+                $this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' =>  implode(', ', $failed)]);
139
+                $iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
140
+            }
141
+            $iTipMessage->scheduleStatus = '1.1; Scheduling message is sent via iMip';
142
+        } catch(\Exception $ex) {
143
+            $this->logger->logException($ex, ['app' => 'dav']);
144
+            $iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
145
+        }
146
+    }
147
+
148
+    /**
149
+     * check if event took place in the past already
150
+     * @param VCalendar $vObject
151
+     * @return bool
152
+     */
153
+    private function isEventInThePast(VCalendar $vObject) {
154
+        $component = $vObject->VEVENT;
155
+
156
+        $firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp();
157
+        // Finding the last occurrence is a bit harder
158
+        if (!isset($component->RRULE)) {
159
+            if (isset($component->DTEND)) {
160
+                $lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp();
161
+            } elseif (isset($component->DURATION)) {
162
+                $endDate = clone $component->DTSTART->getDateTime();
163
+                // $component->DTEND->getDateTime() returns DateTimeImmutable
164
+                $endDate = $endDate->add(DateTimeParser::parse($component->DURATION->getValue()));
165
+                $lastOccurrence = $endDate->getTimeStamp();
166
+            } elseif (!$component->DTSTART->hasTime()) {
167
+                $endDate = clone $component->DTSTART->getDateTime();
168
+                // $component->DTSTART->getDateTime() returns DateTimeImmutable
169
+                $endDate = $endDate->modify('+1 day');
170
+                $lastOccurrence = $endDate->getTimeStamp();
171
+            } else {
172
+                $lastOccurrence = $firstOccurrence;
173
+            }
174
+        } else {
175
+            $it = new EventIterator($vObject, (string)$component->UID);
176
+            $maxDate = new \DateTime(self::MAX_DATE);
177
+            if ($it->isInfinite()) {
178
+                $lastOccurrence = $maxDate->getTimestamp();
179
+            } else {
180
+                $end = $it->getDtEnd();
181
+                while($it->valid() && $end < $maxDate) {
182
+                    $end = $it->getDtEnd();
183
+                    $it->next();
184
+
185
+                }
186
+                $lastOccurrence = $end->getTimestamp();
187
+            }
188
+        }
189
+
190
+        $currentTime = $this->timeFactory->getTime();
191
+        return $lastOccurrence < $currentTime;
192
+    }
193 193
 }
Please login to merge, or discard this patch.
apps/dav/appinfo/v1/caldav.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 $server->addPlugin(new \Sabre\DAV\Sync\Plugin());
85 85
 $server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
86 86
 $server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin());
87
-$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( \OC::$server->getMailer(), \OC::$server->getLogger(), new \OC\AppFramework\Utility\TimeFactory()));
87
+$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin(\OC::$server->getMailer(), \OC::$server->getLogger(), new \OC\AppFramework\Utility\TimeFactory()));
88 88
 $server->addPlugin(new ExceptionLoggerPlugin('caldav', \OC::$server->getLogger()));
89 89
 
90 90
 // And off we go!
Please login to merge, or discard this patch.
apps/dav/lib/Server.php 1 patch
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -60,202 +60,202 @@
 block discarded – undo
60 60
 
61 61
 class Server {
62 62
 
63
-	/** @var IRequest */
64
-	private $request;
63
+    /** @var IRequest */
64
+    private $request;
65 65
 
66
-	/** @var  string */
67
-	private $baseUri;
66
+    /** @var  string */
67
+    private $baseUri;
68 68
 
69
-	/** @var Connector\Sabre\Server  */
70
-	private $server;
69
+    /** @var Connector\Sabre\Server  */
70
+    private $server;
71 71
 
72
-	public function __construct(IRequest $request, $baseUri) {
73
-		$this->request = $request;
74
-		$this->baseUri = $baseUri;
75
-		$logger = \OC::$server->getLogger();
76
-		$mailer = \OC::$server->getMailer();
77
-		$dispatcher = \OC::$server->getEventDispatcher();
78
-		$timezone = new TimeFactory();
72
+    public function __construct(IRequest $request, $baseUri) {
73
+        $this->request = $request;
74
+        $this->baseUri = $baseUri;
75
+        $logger = \OC::$server->getLogger();
76
+        $mailer = \OC::$server->getMailer();
77
+        $dispatcher = \OC::$server->getEventDispatcher();
78
+        $timezone = new TimeFactory();
79 79
 
80
-		$root = new RootCollection();
81
-		$this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
80
+        $root = new RootCollection();
81
+        $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
82 82
 
83
-		// Add maintenance plugin
84
-		$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig()));
83
+        // Add maintenance plugin
84
+        $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig()));
85 85
 
86
-		// Backends
87
-		$authBackend = new Auth(
88
-			\OC::$server->getSession(),
89
-			\OC::$server->getUserSession(),
90
-			\OC::$server->getRequest(),
91
-			\OC::$server->getTwoFactorAuthManager(),
92
-			\OC::$server->getBruteForceThrottler()
93
-		);
86
+        // Backends
87
+        $authBackend = new Auth(
88
+            \OC::$server->getSession(),
89
+            \OC::$server->getUserSession(),
90
+            \OC::$server->getRequest(),
91
+            \OC::$server->getTwoFactorAuthManager(),
92
+            \OC::$server->getBruteForceThrottler()
93
+        );
94 94
 
95
-		// Set URL explicitly due to reverse-proxy situations
96
-		$this->server->httpRequest->setUrl($this->request->getRequestUri());
97
-		$this->server->setBaseUri($this->baseUri);
95
+        // Set URL explicitly due to reverse-proxy situations
96
+        $this->server->httpRequest->setUrl($this->request->getRequestUri());
97
+        $this->server->setBaseUri($this->baseUri);
98 98
 
99
-		$this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
100
-		$authPlugin = new Plugin();
101
-		$authPlugin->addBackend(new PublicAuth());
102
-		$this->server->addPlugin($authPlugin);
99
+        $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
100
+        $authPlugin = new Plugin();
101
+        $authPlugin->addBackend(new PublicAuth());
102
+        $this->server->addPlugin($authPlugin);
103 103
 
104
-		// allow setup of additional auth backends
105
-		$event = new SabrePluginEvent($this->server);
106
-		$dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
104
+        // allow setup of additional auth backends
105
+        $event = new SabrePluginEvent($this->server);
106
+        $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
107 107
 
108
-		$bearerAuthBackend = new BearerAuth(
109
-			\OC::$server->getUserSession(),
110
-			\OC::$server->getSession(),
111
-			\OC::$server->getRequest()
112
-		);
113
-		$authPlugin->addBackend($bearerAuthBackend);
114
-		// because we are throwing exceptions this plugin has to be the last one
115
-		$authPlugin->addBackend($authBackend);
108
+        $bearerAuthBackend = new BearerAuth(
109
+            \OC::$server->getUserSession(),
110
+            \OC::$server->getSession(),
111
+            \OC::$server->getRequest()
112
+        );
113
+        $authPlugin->addBackend($bearerAuthBackend);
114
+        // because we are throwing exceptions this plugin has to be the last one
115
+        $authPlugin->addBackend($authBackend);
116 116
 
117
-		// debugging
118
-		if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
119
-			$this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
120
-		} else {
121
-			$this->server->addPlugin(new DummyGetResponsePlugin());
122
-		}
117
+        // debugging
118
+        if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
119
+            $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
120
+        } else {
121
+            $this->server->addPlugin(new DummyGetResponsePlugin());
122
+        }
123 123
 
124
-		$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
125
-		$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
126
-		$this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
124
+        $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
125
+        $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
126
+        $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
127 127
 
128
-		// acl
129
-		$acl = new DavAclPlugin();
130
-		$acl->principalCollectionSet = [
131
-			'principals/users', 'principals/groups'
132
-		];
133
-		$acl->defaultUsernamePath = 'principals/users';
134
-		$this->server->addPlugin($acl);
128
+        // acl
129
+        $acl = new DavAclPlugin();
130
+        $acl->principalCollectionSet = [
131
+            'principals/users', 'principals/groups'
132
+        ];
133
+        $acl->defaultUsernamePath = 'principals/users';
134
+        $this->server->addPlugin($acl);
135 135
 
136
-		// calendar plugins
137
-		$this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
138
-		$this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
139
-		$this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin());
140
-		$this->server->addPlugin(new IMipPlugin($mailer, $logger, $timezone));
141
-		$this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
142
-		$this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
143
-		$this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
144
-		$this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
145
-			\OC::$server->getConfig(),
146
-			\OC::$server->getURLGenerator()
147
-		));
136
+        // calendar plugins
137
+        $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
138
+        $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
139
+        $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin());
140
+        $this->server->addPlugin(new IMipPlugin($mailer, $logger, $timezone));
141
+        $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
142
+        $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
143
+        $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
144
+        $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
145
+            \OC::$server->getConfig(),
146
+            \OC::$server->getURLGenerator()
147
+        ));
148 148
 
149
-		// addressbook plugins
150
-		$this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
151
-		$this->server->addPlugin(new VCFExportPlugin());
152
-		$this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache'))));
149
+        // addressbook plugins
150
+        $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
151
+        $this->server->addPlugin(new VCFExportPlugin());
152
+        $this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache'))));
153 153
 
154
-		// system tags plugins
155
-		$this->server->addPlugin(new SystemTagPlugin(
156
-			\OC::$server->getSystemTagManager(),
157
-			\OC::$server->getGroupManager(),
158
-			\OC::$server->getUserSession()
159
-		));
154
+        // system tags plugins
155
+        $this->server->addPlugin(new SystemTagPlugin(
156
+            \OC::$server->getSystemTagManager(),
157
+            \OC::$server->getGroupManager(),
158
+            \OC::$server->getUserSession()
159
+        ));
160 160
 
161
-		// comments plugin
162
-		$this->server->addPlugin(new CommentsPlugin(
163
-			\OC::$server->getCommentsManager(),
164
-			\OC::$server->getUserSession()
165
-		));
161
+        // comments plugin
162
+        $this->server->addPlugin(new CommentsPlugin(
163
+            \OC::$server->getCommentsManager(),
164
+            \OC::$server->getUserSession()
165
+        ));
166 166
 
167
-		$this->server->addPlugin(new CopyEtagHeaderPlugin());
167
+        $this->server->addPlugin(new CopyEtagHeaderPlugin());
168 168
 
169
-		// allow setup of additional plugins
170
-		$dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event);
169
+        // allow setup of additional plugins
170
+        $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event);
171 171
 
172
-		// Some WebDAV clients do require Class 2 WebDAV support (locking), since
173
-		// we do not provide locking we emulate it using a fake locking plugin.
174
-		if($request->isUserAgent([
175
-			'/WebDAVFS/',
176
-			'/Microsoft Office OneNote 2013/',
177
-			'/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601
178
-		])) {
179
-			$this->server->addPlugin(new FakeLockerPlugin());
180
-		}
172
+        // Some WebDAV clients do require Class 2 WebDAV support (locking), since
173
+        // we do not provide locking we emulate it using a fake locking plugin.
174
+        if($request->isUserAgent([
175
+            '/WebDAVFS/',
176
+            '/Microsoft Office OneNote 2013/',
177
+            '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601
178
+        ])) {
179
+            $this->server->addPlugin(new FakeLockerPlugin());
180
+        }
181 181
 
182
-		if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
183
-			$this->server->addPlugin(new BrowserErrorPagePlugin());
184
-		}
182
+        if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
183
+            $this->server->addPlugin(new BrowserErrorPagePlugin());
184
+        }
185 185
 
186
-		// wait with registering these until auth is handled and the filesystem is setup
187
-		$this->server->on('beforeMethod', function () {
188
-			// custom properties plugin must be the last one
189
-			$userSession = \OC::$server->getUserSession();
190
-			$user = $userSession->getUser();
191
-			if ($user !== null) {
192
-				$view = \OC\Files\Filesystem::getView();
193
-				$this->server->addPlugin(
194
-					new FilesPlugin(
195
-						$this->server->tree,
196
-						\OC::$server->getConfig(),
197
-						$this->request,
198
-						\OC::$server->getPreviewManager(),
199
-						false,
200
-						!\OC::$server->getConfig()->getSystemValue('debug', false)
201
-					)
202
-				);
186
+        // wait with registering these until auth is handled and the filesystem is setup
187
+        $this->server->on('beforeMethod', function () {
188
+            // custom properties plugin must be the last one
189
+            $userSession = \OC::$server->getUserSession();
190
+            $user = $userSession->getUser();
191
+            if ($user !== null) {
192
+                $view = \OC\Files\Filesystem::getView();
193
+                $this->server->addPlugin(
194
+                    new FilesPlugin(
195
+                        $this->server->tree,
196
+                        \OC::$server->getConfig(),
197
+                        $this->request,
198
+                        \OC::$server->getPreviewManager(),
199
+                        false,
200
+                        !\OC::$server->getConfig()->getSystemValue('debug', false)
201
+                    )
202
+                );
203 203
 
204
-				$this->server->addPlugin(
205
-					new \Sabre\DAV\PropertyStorage\Plugin(
206
-						new CustomPropertiesBackend(
207
-							$this->server->tree,
208
-							\OC::$server->getDatabaseConnection(),
209
-							\OC::$server->getUserSession()->getUser()
210
-						)
211
-					)
212
-				);
213
-				if ($view !== null) {
214
-					$this->server->addPlugin(
215
-						new QuotaPlugin($view));
216
-				}
217
-				$this->server->addPlugin(
218
-					new TagsPlugin(
219
-						$this->server->tree, \OC::$server->getTagManager()
220
-					)
221
-				);
222
-				// TODO: switch to LazyUserFolder
223
-				$userFolder = \OC::$server->getUserFolder();
224
-				$this->server->addPlugin(new SharesPlugin(
225
-					$this->server->tree,
226
-					$userSession,
227
-					$userFolder,
228
-					\OC::$server->getShareManager()
229
-				));
230
-				$this->server->addPlugin(new CommentPropertiesPlugin(
231
-					\OC::$server->getCommentsManager(),
232
-					$userSession
233
-				));
234
-				$this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin());
235
-				if ($view !== null) {
236
-					$this->server->addPlugin(new FilesReportPlugin(
237
-						$this->server->tree,
238
-						$view,
239
-						\OC::$server->getSystemTagManager(),
240
-						\OC::$server->getSystemTagObjectMapper(),
241
-						\OC::$server->getTagManager(),
242
-						$userSession,
243
-						\OC::$server->getGroupManager(),
244
-						$userFolder
245
-					));
246
-					$this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend(
247
-						$this->server->tree,
248
-						$user,
249
-						\OC::$server->getRootFolder(),
250
-						\OC::$server->getShareManager(),
251
-						$view
252
-					)));
253
-				}
254
-			}
255
-		});
256
-	}
204
+                $this->server->addPlugin(
205
+                    new \Sabre\DAV\PropertyStorage\Plugin(
206
+                        new CustomPropertiesBackend(
207
+                            $this->server->tree,
208
+                            \OC::$server->getDatabaseConnection(),
209
+                            \OC::$server->getUserSession()->getUser()
210
+                        )
211
+                    )
212
+                );
213
+                if ($view !== null) {
214
+                    $this->server->addPlugin(
215
+                        new QuotaPlugin($view));
216
+                }
217
+                $this->server->addPlugin(
218
+                    new TagsPlugin(
219
+                        $this->server->tree, \OC::$server->getTagManager()
220
+                    )
221
+                );
222
+                // TODO: switch to LazyUserFolder
223
+                $userFolder = \OC::$server->getUserFolder();
224
+                $this->server->addPlugin(new SharesPlugin(
225
+                    $this->server->tree,
226
+                    $userSession,
227
+                    $userFolder,
228
+                    \OC::$server->getShareManager()
229
+                ));
230
+                $this->server->addPlugin(new CommentPropertiesPlugin(
231
+                    \OC::$server->getCommentsManager(),
232
+                    $userSession
233
+                ));
234
+                $this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin());
235
+                if ($view !== null) {
236
+                    $this->server->addPlugin(new FilesReportPlugin(
237
+                        $this->server->tree,
238
+                        $view,
239
+                        \OC::$server->getSystemTagManager(),
240
+                        \OC::$server->getSystemTagObjectMapper(),
241
+                        \OC::$server->getTagManager(),
242
+                        $userSession,
243
+                        \OC::$server->getGroupManager(),
244
+                        $userFolder
245
+                    ));
246
+                    $this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend(
247
+                        $this->server->tree,
248
+                        $user,
249
+                        \OC::$server->getRootFolder(),
250
+                        \OC::$server->getShareManager(),
251
+                        $view
252
+                    )));
253
+                }
254
+            }
255
+        });
256
+    }
257 257
 
258
-	public function exec() {
259
-		$this->server->exec();
260
-	}
258
+    public function exec() {
259
+        $this->server->exec();
260
+    }
261 261
 }
Please login to merge, or discard this patch.