aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector/Sabre
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/dav/lib/Connector/Sabre
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre')
-rw-r--r--apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php1
-rw-r--r--apps/dav/lib/Connector/Sabre/Auth.php22
-rw-r--r--apps/dav/lib/Connector/Sabre/BearerAuth.php4
-rw-r--r--apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php4
-rw-r--r--apps/dav/lib/Connector/Sabre/ChecksumList.php1
-rw-r--r--apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php6
-rw-r--r--apps/dav/lib/Connector/Sabre/DavAclPlugin.php6
-rw-r--r--apps/dav/lib/Connector/Sabre/Directory.php4
-rw-r--r--apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/Exception/FileLocked.php4
-rw-r--r--apps/dav/lib/Connector/Sabre/Exception/Forbidden.php1
-rw-r--r--apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php4
-rw-r--r--apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php1
-rw-r--r--apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php11
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php5
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php8
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesReportPlugin.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/Node.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/ObjectTree.php1
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php8
-rw-r--r--apps/dav/lib/Connector/Sabre/QuotaPlugin.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/ServerFactory.php5
-rw-r--r--apps/dav/lib/Connector/Sabre/SharesPlugin.php1
-rw-r--r--apps/dav/lib/Connector/Sabre/TagList.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/TagsPlugin.php4
27 files changed, 37 insertions, 83 deletions
diff --git a/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php b/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php
index ee15d137b63..28264b05057 100644
--- a/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php
@@ -72,7 +72,6 @@ class AppEnabledPlugin extends ServerPlugin {
* @return void
*/
public function initialize(\Sabre\DAV\Server $server) {
-
$this->server = $server;
$this->server->on('beforeMethod:*', [$this, 'checkAppEnabled'], 30);
}
diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php
index 15ea9447ffd..8457670be6b 100644
--- a/apps/dav/lib/Connector/Sabre/Auth.php
+++ b/apps/dav/lib/Connector/Sabre/Auth.php
@@ -50,8 +50,6 @@ use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
class Auth extends AbstractBasic {
-
-
const DAV_AUTHENTICATED = 'AUTHENTICATED_TO_DAV_BACKEND';
/** @var ISession */
@@ -173,12 +171,12 @@ class Auth extends AbstractBasic {
*/
private function requiresCSRFCheck() {
// GET requires no check at all
- if($this->request->getMethod() === 'GET') {
+ if ($this->request->getMethod() === 'GET') {
return false;
}
// Official Nextcloud clients require no checks
- if($this->request->isUserAgent([
+ if ($this->request->isUserAgent([
IRequest::USER_AGENT_CLIENT_DESKTOP,
IRequest::USER_AGENT_CLIENT_ANDROID,
IRequest::USER_AGENT_CLIENT_IOS,
@@ -187,17 +185,17 @@ class Auth extends AbstractBasic {
}
// If not logged-in no check is required
- if(!$this->userSession->isLoggedIn()) {
+ if (!$this->userSession->isLoggedIn()) {
return false;
}
// POST always requires a check
- if($this->request->getMethod() === 'POST') {
+ if ($this->request->getMethod() === 'POST') {
return true;
}
// If logged-in AND DAV authenticated no check is required
- if($this->userSession->isLoggedIn() &&
+ if ($this->userSession->isLoggedIn() &&
$this->isDavAuthenticated($this->userSession->getUser()->getUID())) {
return false;
}
@@ -214,10 +212,10 @@ class Auth extends AbstractBasic {
private function auth(RequestInterface $request, ResponseInterface $response) {
$forcedLogout = false;
- if(!$this->request->passesCSRFCheck() &&
+ if (!$this->request->passesCSRFCheck() &&
$this->requiresCSRFCheck()) {
// In case of a fail with POST we need to recheck the credentials
- if($this->request->getMethod() === 'POST') {
+ if ($this->request->getMethod() === 'POST') {
$forcedLogout = true;
} else {
$response->setStatus(401);
@@ -225,10 +223,10 @@ class Auth extends AbstractBasic {
}
}
- if($forcedLogout) {
+ if ($forcedLogout) {
$this->userSession->logout();
} else {
- if($this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) {
+ if ($this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) {
throw new \Sabre\DAV\Exception\NotAuthenticated('2FA challenge not passed.');
}
if (
@@ -254,7 +252,7 @@ class Auth extends AbstractBasic {
}
$data = parent::check($request, $response);
- if($data[0] === true) {
+ if ($data[0] === true) {
$startPos = strrpos($data[1], '/') + 1;
$user = $this->userSession->getUser()->getUID();
$data[1] = substr_replace($data[1], $user, $startPos);
diff --git a/apps/dav/lib/Connector/Sabre/BearerAuth.php b/apps/dav/lib/Connector/Sabre/BearerAuth.php
index 61945a51d7b..cc01874e541 100644
--- a/apps/dav/lib/Connector/Sabre/BearerAuth.php
+++ b/apps/dav/lib/Connector/Sabre/BearerAuth.php
@@ -72,10 +72,10 @@ class BearerAuth extends AbstractBearer {
public function validateBearerToken($bearerToken) {
\OC_Util::setupFS();
- if(!$this->userSession->isLoggedIn()) {
+ if (!$this->userSession->isLoggedIn()) {
$this->userSession->tryTokenLogin($this->request);
}
- if($this->userSession->isLoggedIn()) {
+ if ($this->userSession->isLoggedIn()) {
return $this->setupUserFs($this->userSession->getUser()->getUID());
}
diff --git a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php
index 1ddebe06ee1..b64feb22f48 100644
--- a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php
@@ -65,7 +65,7 @@ class BlockLegacyClientPlugin extends ServerPlugin {
*/
public function beforeHandler(RequestInterface $request) {
$userAgent = $request->getHeader('User-Agent');
- if($userAgent === null) {
+ if ($userAgent === null) {
return;
}
@@ -74,7 +74,7 @@ class BlockLegacyClientPlugin extends ServerPlugin {
// Match on the mirall version which is in scheme "Mozilla/5.0 (%1) mirall/%2" or
// "mirall/%1" for older releases
preg_match("/(?:mirall\\/)([\d.]+)/i", $userAgent, $versionMatches);
- if(isset($versionMatches[1]) &&
+ if (isset($versionMatches[1]) &&
version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1) {
throw new \Sabre\DAV\Exception\Forbidden('Unsupported client version.');
}
diff --git a/apps/dav/lib/Connector/Sabre/ChecksumList.php b/apps/dav/lib/Connector/Sabre/ChecksumList.php
index 2fb8a0293e7..f5c0a3d9b01 100644
--- a/apps/dav/lib/Connector/Sabre/ChecksumList.php
+++ b/apps/dav/lib/Connector/Sabre/ChecksumList.php
@@ -64,7 +64,6 @@ class ChecksumList implements XmlSerializable {
* @return void
*/
function xmlSerialize(Writer $writer) {
-
foreach ($this->checksums as $checksum) {
$writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum);
}
diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
index 51d453e3f2a..31ea282308e 100644
--- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
@@ -32,7 +32,6 @@ use Sabre\DAV\PropFind;
use Sabre\DAV\ServerPlugin;
class CommentPropertiesPlugin extends ServerPlugin {
-
const PROPERTY_NAME_HREF = '{http://owncloud.org/ns}comments-href';
const PROPERTY_NAME_COUNT = '{http://owncloud.org/ns}comments-count';
const PROPERTY_NAME_UNREAD = '{http://owncloud.org/ns}comments-unread';
@@ -134,7 +133,7 @@ class CommentPropertiesPlugin extends ServerPlugin {
public function getCommentsLink(Node $node) {
$href = $this->server->getBaseUri();
$entryPoint = strpos($href, '/remote.php/');
- if($entryPoint === false) {
+ if ($entryPoint === false) {
// in case we end up somewhere else, unexpectedly.
return null;
}
@@ -152,7 +151,7 @@ class CommentPropertiesPlugin extends ServerPlugin {
*/
public function getUnreadCount(Node $node) {
$user = $this->userSession->getUser();
- if(is_null($user)) {
+ if (is_null($user)) {
return null;
}
@@ -160,5 +159,4 @@ class CommentPropertiesPlugin extends ServerPlugin {
return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId(), $lastRead);
}
-
}
diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
index ebe6d4cefab..67be788eb04 100644
--- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
@@ -50,11 +50,11 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin {
function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
$access = parent::checkPrivileges($uri, $privileges, $recursion, false);
- if($access === false && $throwExceptions) {
+ if ($access === false && $throwExceptions) {
/** @var INode $node */
$node = $this->server->tree->getNodeForPath($uri);
- switch(get_class($node)) {
+ switch (get_class($node)) {
case AddressBook::class:
$type = 'Addressbook';
break;
@@ -77,7 +77,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin {
public function propFind(PropFind $propFind, INode $node) {
// If the node is neither readable nor writable then fail unless its of
// the standard user-principal
- if(!($node instanceof User)) {
+ if (!($node instanceof User)) {
$path = $propFind->getPath();
$readPermissions = $this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false);
$writePermissions = $this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, false);
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php
index 71b7e33d284..0e4ddd1f232 100644
--- a/apps/dav/lib/Connector/Sabre/Directory.php
+++ b/apps/dav/lib/Connector/Sabre/Directory.php
@@ -118,7 +118,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
* @throws \Sabre\DAV\Exception\ServiceUnavailable
*/
public function createFile($name, $data = null) {
-
try {
// for chunked upload also updating a existing file is a "createFile"
// because we create all the chunks before re-assemble them to the existing file.
@@ -131,7 +130,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
) {
throw new \Sabre\DAV\Exception\Forbidden();
}
-
} else {
// For non-chunked upload it is enough to check if we can create a new file
if (!$this->fileView->isCreatable($this->path)) {
@@ -293,7 +291,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
// TODO: resolve chunk file name here and implement "updateFile"
$path = $this->path . '/' . $name;
return $this->fileView->file_exists($path);
-
}
/**
@@ -304,7 +301,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
* @throws \Sabre\DAV\Exception\Forbidden
*/
public function delete() {
-
if ($this->path === '' || $this->path === '/' || !$this->info->isDeletable()) {
throw new \Sabre\DAV\Exception\Forbidden();
}
diff --git a/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php b/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php
index 970524dca1c..36b114b88fb 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php
@@ -39,9 +39,6 @@ class EntityTooLarge extends \Sabre\DAV\Exception {
* @return int
*/
public function getHTTPCode() {
-
return 413;
-
}
-
}
diff --git a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
index 13af4d888bb..2db4faf50d7 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
@@ -29,9 +29,8 @@ namespace OCA\DAV\Connector\Sabre\Exception;
use Exception;
class FileLocked extends \Sabre\DAV\Exception {
-
public function __construct($message = "", $code = 0, Exception $previous = null) {
- if($previous instanceof \OCP\Files\LockNotAcquiredException) {
+ if ($previous instanceof \OCP\Files\LockNotAcquiredException) {
$message = sprintf('Target file %s is locked by another process.', $previous->path);
}
parent::__construct($message, $code, $previous);
@@ -43,7 +42,6 @@ class FileLocked extends \Sabre\DAV\Exception {
* @return int
*/
public function getHTTPCode() {
-
return 423;
}
}
diff --git a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php
index 94ff9a05123..46659737e87 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php
@@ -23,7 +23,6 @@
namespace OCA\DAV\Connector\Sabre\Exception;
class Forbidden extends \Sabre\DAV\Exception\Forbidden {
-
const NS_OWNCLOUD = 'http://owncloud.org/ns';
/**
diff --git a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php
index a330653e05c..2871fd83e09 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php
@@ -26,7 +26,6 @@ namespace OCA\DAV\Connector\Sabre\Exception;
use Sabre\DAV\Exception;
class InvalidPath extends Exception {
-
const NS_OWNCLOUD = 'http://owncloud.org/ns';
/**
@@ -50,9 +49,7 @@ class InvalidPath extends Exception {
* @return int
*/
public function getHTTPCode() {
-
return 400;
-
}
/**
@@ -76,5 +73,4 @@ class InvalidPath extends Exception {
$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
$errorNode->appendChild($error);
}
-
}
diff --git a/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php b/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php
index 5851ed8158a..c3e417b20ad 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php
@@ -29,7 +29,6 @@ use Sabre\DAV\Exception\NotAuthenticated;
use Sabre\DAV\Server;
class PasswordLoginForbidden extends NotAuthenticated {
-
const NS_OWNCLOUD = 'http://owncloud.org/ns';
public function getHTTPCode() {
@@ -52,5 +51,4 @@ class PasswordLoginForbidden extends NotAuthenticated {
$error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'password login forbidden');
$errorNode->appendChild($error);
}
-
}
diff --git a/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php b/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php
index cb39b3ca423..700625a2299 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php
@@ -39,9 +39,6 @@ class UnsupportedMediaType extends \Sabre\DAV\Exception {
* @return int
*/
public function getHTTPCode() {
-
return 415;
-
}
-
}
diff --git a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
index dc65837c746..9a6b19ea3fa 100644
--- a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
@@ -103,7 +103,6 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
* @return void
*/
public function initialize(\Sabre\DAV\Server $server) {
-
$server->on('exception', [$this, 'logException'], 10);
}
diff --git a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php
index 62c9915cc4e..bca15e15688 100644
--- a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php
@@ -104,11 +104,11 @@ class FakeLockerPlugin extends ServerPlugin {
* @param array $conditions
*/
public function validateTokens(RequestInterface $request, &$conditions) {
- foreach($conditions as &$fileCondition) {
- if(isset($fileCondition['tokens'])) {
- foreach($fileCondition['tokens'] as &$token) {
- if(isset($token['token'])) {
- if(substr($token['token'], 0, 16) === 'opaquelocktoken:') {
+ foreach ($conditions as &$fileCondition) {
+ if (isset($fileCondition['tokens'])) {
+ foreach ($fileCondition['tokens'] as &$token) {
+ if (isset($token['token'])) {
+ if (substr($token['token'], 0, 16) === 'opaquelocktoken:') {
$token['validToken'] = true;
}
}
@@ -126,7 +126,6 @@ class FakeLockerPlugin extends ServerPlugin {
*/
public function fakeLockProvider(RequestInterface $request,
ResponseInterface $response) {
-
$lockInfo = new LockInfo();
$lockInfo->token = md5($request->getPath());
$lockInfo->uri = $request->getPath();
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index d025ba2aaca..2c108819e9f 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -70,7 +70,6 @@ use Sabre\DAV\Exception\ServiceUnavailable;
use Sabre\DAV\IFile;
class File extends Node implements IFile {
-
protected $request;
/**
@@ -175,7 +174,6 @@ class File extends Node implements IFile {
}
if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) {
-
if (!is_resource($data)) {
$tmpData = fopen('php://temp', 'r+');
if ($data !== null) {
@@ -199,7 +197,6 @@ class File extends Node implements IFile {
$result = feof($wrappedData);
}
}
-
} else {
$target = $partStorage->fopen($internalPartPath, 'wb');
if ($target === false) {
@@ -230,7 +227,6 @@ class File extends Node implements IFile {
throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $count . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.');
}
}
-
} catch (\Exception $e) {
$context = [];
@@ -332,7 +328,6 @@ class File extends Node implements IFile {
$this->fileView->putFileInfo($this->path, ['checksum' => '']);
$this->refreshInfo();
}
-
} catch (StorageNotAvailableException $e) {
throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage(), 0, $e);
}
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index 890e65a7fa5..5f2bbdd12e3 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -252,7 +252,9 @@ class FilesPlugin extends ServerPlugin {
function httpGet(RequestInterface $request, ResponseInterface $response) {
// Only handle valid files
$node = $this->tree->getNodeForPath($request->getPath());
- if (!($node instanceof IFile)) return;
+ if (!($node instanceof IFile)) {
+ return;
+ }
// adds a 'Content-Disposition: attachment' header in case no disposition
// header has been set before
@@ -290,7 +292,6 @@ class FilesPlugin extends ServerPlugin {
* @return void
*/
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) {
-
$httpRequest = $this->server->httpRequest;
if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
@@ -412,7 +413,6 @@ class FilesPlugin extends ServerPlugin {
$propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function () use ($node) {
return $node->getFileInfo()->getUploadTime();
});
-
}
if ($node instanceof \OCA\DAV\Connector\Sabre\Directory) {
@@ -433,7 +433,6 @@ class FilesPlugin extends ServerPlugin {
* @return array
*/
protected function ncPermissions2ocmPermissions($ncPermissions) {
-
$ocmPermissions = [];
if ($ncPermissions & Constants::PERMISSION_SHARE) {
@@ -450,7 +449,6 @@ class FilesPlugin extends ServerPlugin {
}
return $ocmPermissions;
-
}
/**
diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
index 4c7c689bde3..617847626cc 100644
--- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
@@ -151,7 +151,6 @@ class FilesReportPlugin extends ServerPlugin {
* @return void
*/
public function initialize(\Sabre\DAV\Server $server) {
-
$server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';
$this->server = $server;
@@ -282,7 +281,6 @@ class FilesReportPlugin extends ServerPlugin {
if ($filterRule['name'] === $ns . 'favorite') {
$favoriteFilter = true;
}
-
}
if ($favoriteFilter !== null) {
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index 1dd209a8303..83f90fa4ba2 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -323,7 +323,7 @@ abstract class Node implements \Sabre\DAV\INode {
$shares = $this->shareManager->getSharedWith($user, $shareType, $this, -1);
foreach ($shares as $share) {
$note = $share->getNote();
- if($share->getShareOwner() !== $user && !empty($note)) {
+ if ($share->getShareOwner() !== $user && !empty($note)) {
return $note;
}
}
@@ -416,5 +416,4 @@ abstract class Node implements \Sabre\DAV\INode {
return (int)$mtimeFromRequest;
}
-
}
diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php
index e3a7dccffdc..e292744cd2f 100644
--- a/apps/dav/lib/Connector/Sabre/ObjectTree.php
+++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php
@@ -181,7 +181,6 @@ class ObjectTree extends CachingTree {
$this->cache[$path] = $node;
return $node;
-
}
/**
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php
index 2acc783eecf..b6a96053cb3 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -132,7 +132,7 @@ class Principal implements BackendInterface {
$principals = [];
if ($prefixPath === $this->principalPrefix) {
- foreach($this->userManager->search('') as $user) {
+ foreach ($this->userManager->search('') as $user) {
$principals[] = $this->userToPrincipal($user);
}
}
@@ -206,7 +206,7 @@ class Principal implements BackendInterface {
if ($this->hasGroups || $needGroups) {
$userGroups = $this->groupManager->getUserGroups($user);
- foreach($userGroups as $userGroup) {
+ foreach ($userGroups as $userGroup) {
$groups[] = 'principals/groups/' . urlencode($userGroup->getGID());
}
}
@@ -477,9 +477,9 @@ class Principal implements BackendInterface {
try {
$circle = \OCA\Circles\Api\v1\Circles::detailsCircle($circleUniqueId, true);
- } catch(QueryException $ex) {
+ } catch (QueryException $ex) {
return null;
- } catch(CircleDoesNotExistException $ex) {
+ } catch (CircleDoesNotExistException $ex) {
return null;
}
diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
index f6da755aaf7..92187b92daf 100644
--- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
@@ -72,7 +72,6 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin {
* @return void
*/
public function initialize(\Sabre\DAV\Server $server) {
-
$this->server = $server;
$server->on('beforeWriteContent', [$this, 'beforeWriteContent'], 10);
@@ -153,7 +152,7 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin {
if ($length) {
list($parentPath, $newName) = \Sabre\Uri\split($path);
- if(is_null($parentPath)) {
+ if (is_null($parentPath)) {
$parentPath = '';
}
$req = $this->server->httpRequest;
diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php
index f740284f271..0f7f753b86f 100644
--- a/apps/dav/lib/Connector/Sabre/ServerFactory.php
+++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php
@@ -128,7 +128,7 @@ class ServerFactory {
$server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
// Some WebDAV clients do require Class 2 WebDAV support (locking), since
// we do not provide locking we emulate it using a fake locking plugin.
- if($this->request->isUserAgent([
+ if ($this->request->isUserAgent([
'/WebDAVFS/',
'/OneNote/',
'/Microsoft-WebDAV-MiniRedir/',
@@ -173,7 +173,7 @@ class ServerFactory {
);
$server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view, true));
- if($this->userSession->isLoggedIn()) {
+ if ($this->userSession->isLoggedIn()) {
$server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager));
$server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
$objectTree,
@@ -216,7 +216,6 @@ class ServerFactory {
foreach ($pluginManager->getAppPlugins() as $appPlugin) {
$server->addPlugin($appPlugin);
}
-
}, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request
return $server;
}
diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php
index ef1e7236c9b..ee4246011bf 100644
--- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php
@@ -35,7 +35,6 @@ use Sabre\DAV\PropFind;
* Sabre Plugin to provide share-related properties
*/
class SharesPlugin extends \Sabre\DAV\ServerPlugin {
-
const NS_OWNCLOUD = 'http://owncloud.org/ns';
const NS_NEXTCLOUD = 'http://nextcloud.org/ns';
const SHARETYPES_PROPERTYNAME = '{http://owncloud.org/ns}share-types';
diff --git a/apps/dav/lib/Connector/Sabre/TagList.php b/apps/dav/lib/Connector/Sabre/TagList.php
index e3f248ee3e2..72c3fb31b07 100644
--- a/apps/dav/lib/Connector/Sabre/TagList.php
+++ b/apps/dav/lib/Connector/Sabre/TagList.php
@@ -56,9 +56,7 @@ class TagList implements Element {
* @return array
*/
public function getTags() {
-
return $this->tags;
-
}
/**
@@ -117,7 +115,6 @@ class TagList implements Element {
* @return void
*/
function xmlSerialize(Writer $writer) {
-
foreach ($this->tags as $tag) {
$writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag);
}
diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php
index 83995a31e57..33698810cfb 100644
--- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php
@@ -52,8 +52,7 @@ namespace OCA\DAV\Connector\Sabre;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
-class TagsPlugin extends \Sabre\DAV\ServerPlugin
-{
+class TagsPlugin extends \Sabre\DAV\ServerPlugin {
// namespace
const NS_OWNCLOUD = 'http://owncloud.org/ns';
@@ -114,7 +113,6 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin
* @return void
*/
public function initialize(\Sabre\DAV\Server $server) {
-
$server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';
$server->xml->elementMap[self::TAGS_PROPERTYNAME] = TagList::class;