aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-12-14 10:32:14 +0100
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-12-14 11:23:29 +0100
commit36d6b0f1e6eae58e20f35bb9d87671d338ea0a61 (patch)
tree5b615ccd1b9425476515f9786b0d81ba86fee903 /apps/dav/lib/CalDAV
parentafc4b0aea5103fad469bd27d1d199778f956291c (diff)
downloadnextcloud-server-36d6b0f1e6eae58e20f35bb9d87671d338ea0a61.tar.gz
nextcloud-server-36d6b0f1e6eae58e20f35bb9d87671d338ea0a61.zip
refactor: Use Http framework where possibleuseHttpFramework
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Diffstat (limited to 'apps/dav/lib/CalDAV')
-rw-r--r--apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php7
-rw-r--r--apps/dav/lib/CalDAV/Publishing/PublishPlugin.php5
-rw-r--r--apps/dav/lib/CalDAV/Search/SearchPlugin.php3
3 files changed, 9 insertions, 6 deletions
diff --git a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php
index b323673969b..cd0b58c53d2 100644
--- a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php
+++ b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php
@@ -7,6 +7,7 @@ namespace OCA\DAV\CalDAV\BirthdayCalendar;
use OCA\DAV\CalDAV\BirthdayService;
use OCA\DAV\CalDAV\CalendarHome;
+use OCP\AppFramework\Http;
use OCP\IConfig;
use OCP\IUser;
use Sabre\DAV\Server;
@@ -92,7 +93,7 @@ class EnablePlugin extends ServerPlugin {
*/
public function httpPost(RequestInterface $request, ResponseInterface $response) {
$node = $this->server->tree->getNodeForPath($this->server->getRequestUri());
- if (!($node instanceof CalendarHome)) {
+ if (!$node instanceof CalendarHome) {
return;
}
@@ -104,14 +105,14 @@ class EnablePlugin extends ServerPlugin {
$owner = substr($node->getOwner(), 17);
if ($owner !== $this->user->getUID()) {
- $this->server->httpResponse->setStatus(403);
+ $this->server->httpResponse->setStatus(Http::STATUS_FORBIDDEN);
return false;
}
$this->config->setUserValue($this->user->getUID(), 'dav', 'generateBirthdayCalendar', 'yes');
$this->birthdayService->syncUser($this->user->getUID());
- $this->server->httpResponse->setStatus(204);
+ $this->server->httpResponse->setStatus(Http::STATUS_NO_CONTENT);
return false;
}
diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
index 1916187af2b..db73a761b0d 100644
--- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
+++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
@@ -7,6 +7,7 @@ namespace OCA\DAV\CalDAV\Publishing;
use OCA\DAV\CalDAV\Calendar;
use OCA\DAV\CalDAV\Publishing\Xml\Publisher;
+use OCP\AppFramework\Http;
use OCP\IConfig;
use OCP\IURLGenerator;
use Sabre\CalDAV\Xml\Property\AllowedSharingModes;
@@ -179,7 +180,7 @@ class PublishPlugin extends ServerPlugin {
$node->setPublishStatus(true);
// iCloud sends back the 202, so we will too.
- $response->setStatus(202);
+ $response->setStatus(Http::STATUS_ACCEPTED);
// Adding this because sending a response body may cause issues,
// and I wanted some type of indicator the response was handled.
@@ -213,7 +214,7 @@ class PublishPlugin extends ServerPlugin {
$node->setPublishStatus(false);
- $response->setStatus(200);
+ $response->setStatus(Http::STATUS_OK);
// Adding this because sending a response body may cause issues,
// and I wanted some type of indicator the response was handled.
diff --git a/apps/dav/lib/CalDAV/Search/SearchPlugin.php b/apps/dav/lib/CalDAV/Search/SearchPlugin.php
index c69537523f2..602ce151e12 100644
--- a/apps/dav/lib/CalDAV/Search/SearchPlugin.php
+++ b/apps/dav/lib/CalDAV/Search/SearchPlugin.php
@@ -7,6 +7,7 @@ namespace OCA\DAV\CalDAV\Search;
use OCA\DAV\CalDAV\CalendarHome;
use OCA\DAV\CalDAV\Search\Xml\Request\CalendarSearchReport;
+use OCP\AppFramework\Http;
use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
@@ -133,7 +134,7 @@ class SearchPlugin extends ServerPlugin {
$prefer = $this->server->getHTTPPrefer();
- $this->server->httpResponse->setStatus(207);
+ $this->server->httpResponse->setStatus(Http::STATUS_MULTI_STATUS);
$this->server->httpResponse->setHeader('Content-Type',
'application/xml; charset=utf-8');
$this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');