@@ -27,5 +27,5 @@ |
||
27 | 27 | * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher |
28 | 28 | */ |
29 | 29 | abstract class BasicEmitter implements Emitter { |
30 | - use EmitterTrait; |
|
30 | + use EmitterTrait; |
|
31 | 31 | } |
@@ -36,12 +36,12 @@ |
||
36 | 36 | * @since 18.0.0 |
37 | 37 | */ |
38 | 38 | interface IFileCheck extends IEntityCheck { |
39 | - /** |
|
40 | - * @param IStorage $storage |
|
41 | - * @param string $path |
|
42 | - * @param bool $isDir |
|
43 | - * @since 18.0.0 |
|
44 | - */ |
|
45 | - public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void; |
|
39 | + /** |
|
40 | + * @param IStorage $storage |
|
41 | + * @param string $path |
|
42 | + * @param bool $isDir |
|
43 | + * @since 18.0.0 |
|
44 | + */ |
|
45 | + public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void; |
|
46 | 46 | |
47 | 47 | } |
@@ -35,54 +35,54 @@ |
||
35 | 35 | **/ |
36 | 36 | interface IMimeTypeDetector { |
37 | 37 | |
38 | - /** |
|
39 | - * detect mimetype only based on filename, content of file is not used |
|
40 | - * @param string $path |
|
41 | - * @return string |
|
42 | - * @since 8.2.0 |
|
43 | - */ |
|
44 | - public function detectPath($path); |
|
38 | + /** |
|
39 | + * detect mimetype only based on filename, content of file is not used |
|
40 | + * @param string $path |
|
41 | + * @return string |
|
42 | + * @since 8.2.0 |
|
43 | + */ |
|
44 | + public function detectPath($path); |
|
45 | 45 | |
46 | - /** |
|
47 | - * detect mimetype only based on the content of file |
|
48 | - * @param string $path |
|
49 | - * @return string |
|
50 | - * @since 18.0.0 |
|
51 | - */ |
|
52 | - public function detectContent(string $path): string; |
|
46 | + /** |
|
47 | + * detect mimetype only based on the content of file |
|
48 | + * @param string $path |
|
49 | + * @return string |
|
50 | + * @since 18.0.0 |
|
51 | + */ |
|
52 | + public function detectContent(string $path): string; |
|
53 | 53 | |
54 | - /** |
|
55 | - * detect mimetype based on both filename and content |
|
56 | - * |
|
57 | - * @param string $path |
|
58 | - * @return string |
|
59 | - * @since 8.2.0 |
|
60 | - */ |
|
61 | - public function detect($path); |
|
54 | + /** |
|
55 | + * detect mimetype based on both filename and content |
|
56 | + * |
|
57 | + * @param string $path |
|
58 | + * @return string |
|
59 | + * @since 8.2.0 |
|
60 | + */ |
|
61 | + public function detect($path); |
|
62 | 62 | |
63 | - /** |
|
64 | - * Get a secure mimetype that won't expose potential XSS. |
|
65 | - * |
|
66 | - * @param string $mimeType |
|
67 | - * @return string |
|
68 | - * @since 8.2.0 |
|
69 | - */ |
|
70 | - public function getSecureMimeType($mimeType); |
|
63 | + /** |
|
64 | + * Get a secure mimetype that won't expose potential XSS. |
|
65 | + * |
|
66 | + * @param string $mimeType |
|
67 | + * @return string |
|
68 | + * @since 8.2.0 |
|
69 | + */ |
|
70 | + public function getSecureMimeType($mimeType); |
|
71 | 71 | |
72 | - /** |
|
73 | - * detect mimetype based on the content of a string |
|
74 | - * |
|
75 | - * @param string $data |
|
76 | - * @return string |
|
77 | - * @since 8.2.0 |
|
78 | - */ |
|
79 | - public function detectString($data); |
|
72 | + /** |
|
73 | + * detect mimetype based on the content of a string |
|
74 | + * |
|
75 | + * @param string $data |
|
76 | + * @return string |
|
77 | + * @since 8.2.0 |
|
78 | + */ |
|
79 | + public function detectString($data); |
|
80 | 80 | |
81 | - /** |
|
82 | - * Get path to the icon of a file type |
|
83 | - * @param string $mimeType the MIME type |
|
84 | - * @return string the url |
|
85 | - * @since 8.2.0 |
|
86 | - */ |
|
87 | - public function mimeTypeIcon($mimeType); |
|
81 | + /** |
|
82 | + * Get path to the icon of a file type |
|
83 | + * @param string $mimeType the MIME type |
|
84 | + * @return string the url |
|
85 | + * @since 8.2.0 |
|
86 | + */ |
|
87 | + public function mimeTypeIcon($mimeType); |
|
88 | 88 | } |
@@ -31,40 +31,40 @@ |
||
31 | 31 | use OCP\WorkflowEngine\IEntity; |
32 | 32 | |
33 | 33 | trait TFileCheck { |
34 | - /** @var IStorage */ |
|
35 | - protected $storage; |
|
34 | + /** @var IStorage */ |
|
35 | + protected $storage; |
|
36 | 36 | |
37 | - /** @var string */ |
|
38 | - protected $path; |
|
37 | + /** @var string */ |
|
38 | + protected $path; |
|
39 | 39 | |
40 | - /** @var bool */ |
|
41 | - protected $isDir; |
|
40 | + /** @var bool */ |
|
41 | + protected $isDir; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param IStorage $storage |
|
45 | - * @param string $path |
|
46 | - * @param bool $isDir |
|
47 | - * @since 18.0.0 |
|
48 | - */ |
|
49 | - public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void { |
|
50 | - $this->storage = $storage; |
|
51 | - $this->path = $path; |
|
52 | - $this->isDir = $isDir; |
|
53 | - } |
|
43 | + /** |
|
44 | + * @param IStorage $storage |
|
45 | + * @param string $path |
|
46 | + * @param bool $isDir |
|
47 | + * @since 18.0.0 |
|
48 | + */ |
|
49 | + public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void { |
|
50 | + $this->storage = $storage; |
|
51 | + $this->path = $path; |
|
52 | + $this->isDir = $isDir; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @throws \OCP\Files\NotFoundException |
|
57 | - */ |
|
58 | - public function setEntitySubject(IEntity $entity, $subject): void { |
|
59 | - if ($entity instanceof File) { |
|
60 | - if (!$subject instanceof Node) { |
|
61 | - throw new \UnexpectedValueException( |
|
62 | - 'Expected Node subject for File entity, got {class}', |
|
63 | - ['app' => Application::APP_ID, 'class' => get_class($subject)] |
|
64 | - ); |
|
65 | - } |
|
66 | - $this->storage = $subject->getStorage(); |
|
67 | - $this->path = $subject->getPath(); |
|
68 | - } |
|
69 | - } |
|
55 | + /** |
|
56 | + * @throws \OCP\Files\NotFoundException |
|
57 | + */ |
|
58 | + public function setEntitySubject(IEntity $entity, $subject): void { |
|
59 | + if ($entity instanceof File) { |
|
60 | + if (!$subject instanceof Node) { |
|
61 | + throw new \UnexpectedValueException( |
|
62 | + 'Expected Node subject for File entity, got {class}', |
|
63 | + ['app' => Application::APP_ID, 'class' => get_class($subject)] |
|
64 | + ); |
|
65 | + } |
|
66 | + $this->storage = $subject->getStorage(); |
|
67 | + $this->path = $subject->getPath(); |
|
68 | + } |
|
69 | + } |
|
70 | 70 | } |
@@ -33,38 +33,38 @@ |
||
33 | 33 | */ |
34 | 34 | class NodeRemovedFromCache extends Event { |
35 | 35 | |
36 | - /** @var IStorage */ |
|
37 | - private $storage; |
|
36 | + /** @var IStorage */ |
|
37 | + private $storage; |
|
38 | 38 | |
39 | - /** @var string */ |
|
40 | - private $path; |
|
39 | + /** @var string */ |
|
40 | + private $path; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param IStorage $storage |
|
44 | - * @param string $path |
|
45 | - * @since 18.0.0 |
|
46 | - */ |
|
47 | - public function __construct(IStorage $storage, |
|
48 | - string $path) { |
|
49 | - parent::__construct(); |
|
50 | - $this->storage = $storage; |
|
51 | - $this->path = $path; |
|
52 | - } |
|
42 | + /** |
|
43 | + * @param IStorage $storage |
|
44 | + * @param string $path |
|
45 | + * @since 18.0.0 |
|
46 | + */ |
|
47 | + public function __construct(IStorage $storage, |
|
48 | + string $path) { |
|
49 | + parent::__construct(); |
|
50 | + $this->storage = $storage; |
|
51 | + $this->path = $path; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @return IStorage |
|
56 | - * @since 18.0.0 |
|
57 | - */ |
|
58 | - public function getStorage(): IStorage { |
|
59 | - return $this->storage; |
|
60 | - } |
|
54 | + /** |
|
55 | + * @return IStorage |
|
56 | + * @since 18.0.0 |
|
57 | + */ |
|
58 | + public function getStorage(): IStorage { |
|
59 | + return $this->storage; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return string |
|
64 | - * @since 18.0.0 |
|
65 | - */ |
|
66 | - public function getPath(): string { |
|
67 | - return $this->path; |
|
68 | - } |
|
62 | + /** |
|
63 | + * @return string |
|
64 | + * @since 18.0.0 |
|
65 | + */ |
|
66 | + public function getPath(): string { |
|
67 | + return $this->path; |
|
68 | + } |
|
69 | 69 | |
70 | 70 | } |
@@ -33,38 +33,38 @@ |
||
33 | 33 | */ |
34 | 34 | class FileCacheUpdated extends Event { |
35 | 35 | |
36 | - /** @var IStorage */ |
|
37 | - private $storage; |
|
36 | + /** @var IStorage */ |
|
37 | + private $storage; |
|
38 | 38 | |
39 | - /** @var string */ |
|
40 | - private $path; |
|
39 | + /** @var string */ |
|
40 | + private $path; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param IStorage $storage |
|
44 | - * @param string $path |
|
45 | - * @since 18.0.0 |
|
46 | - */ |
|
47 | - public function __construct(IStorage $storage, |
|
48 | - string $path) { |
|
49 | - parent::__construct(); |
|
50 | - $this->storage = $storage; |
|
51 | - $this->path = $path; |
|
52 | - } |
|
42 | + /** |
|
43 | + * @param IStorage $storage |
|
44 | + * @param string $path |
|
45 | + * @since 18.0.0 |
|
46 | + */ |
|
47 | + public function __construct(IStorage $storage, |
|
48 | + string $path) { |
|
49 | + parent::__construct(); |
|
50 | + $this->storage = $storage; |
|
51 | + $this->path = $path; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @return IStorage |
|
56 | - * @since 18.0.0 |
|
57 | - */ |
|
58 | - public function getStorage(): IStorage { |
|
59 | - return $this->storage; |
|
60 | - } |
|
54 | + /** |
|
55 | + * @return IStorage |
|
56 | + * @since 18.0.0 |
|
57 | + */ |
|
58 | + public function getStorage(): IStorage { |
|
59 | + return $this->storage; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return string |
|
64 | - * @since 18.0.0 |
|
65 | - */ |
|
66 | - public function getPath(): string { |
|
67 | - return $this->path; |
|
68 | - } |
|
62 | + /** |
|
63 | + * @return string |
|
64 | + * @since 18.0.0 |
|
65 | + */ |
|
66 | + public function getPath(): string { |
|
67 | + return $this->path; |
|
68 | + } |
|
69 | 69 | |
70 | 70 | } |
@@ -33,38 +33,38 @@ |
||
33 | 33 | */ |
34 | 34 | class NodeAddedToCache extends Event { |
35 | 35 | |
36 | - /** @var IStorage */ |
|
37 | - private $storage; |
|
36 | + /** @var IStorage */ |
|
37 | + private $storage; |
|
38 | 38 | |
39 | - /** @var string */ |
|
40 | - private $path; |
|
39 | + /** @var string */ |
|
40 | + private $path; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param IStorage $storage |
|
44 | - * @param string $path |
|
45 | - * @since 18.0.0 |
|
46 | - */ |
|
47 | - public function __construct(IStorage $storage, |
|
48 | - string $path) { |
|
49 | - parent::__construct(); |
|
50 | - $this->storage = $storage; |
|
51 | - $this->path = $path; |
|
52 | - } |
|
42 | + /** |
|
43 | + * @param IStorage $storage |
|
44 | + * @param string $path |
|
45 | + * @since 18.0.0 |
|
46 | + */ |
|
47 | + public function __construct(IStorage $storage, |
|
48 | + string $path) { |
|
49 | + parent::__construct(); |
|
50 | + $this->storage = $storage; |
|
51 | + $this->path = $path; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @return IStorage |
|
56 | - * @since 18.0.0 |
|
57 | - */ |
|
58 | - public function getStorage(): IStorage { |
|
59 | - return $this->storage; |
|
60 | - } |
|
54 | + /** |
|
55 | + * @return IStorage |
|
56 | + * @since 18.0.0 |
|
57 | + */ |
|
58 | + public function getStorage(): IStorage { |
|
59 | + return $this->storage; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return string |
|
64 | - * @since 18.0.0 |
|
65 | - */ |
|
66 | - public function getPath(): string { |
|
67 | - return $this->path; |
|
68 | - } |
|
62 | + /** |
|
63 | + * @return string |
|
64 | + * @since 18.0.0 |
|
65 | + */ |
|
66 | + public function getPath(): string { |
|
67 | + return $this->path; |
|
68 | + } |
|
69 | 69 | |
70 | 70 | } |
@@ -34,22 +34,22 @@ |
||
34 | 34 | */ |
35 | 35 | class ShareCreatedEvent extends Event { |
36 | 36 | |
37 | - /** @var IShare */ |
|
38 | - private $share; |
|
39 | - |
|
40 | - /** |
|
41 | - * @since 18.0.0 |
|
42 | - */ |
|
43 | - public function __construct(IShare $share) { |
|
44 | - parent::__construct(); |
|
45 | - |
|
46 | - $this->share = $share; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * @since 18.0.0 |
|
51 | - */ |
|
52 | - public function getShare(): IShare { |
|
53 | - return $this->share; |
|
54 | - } |
|
37 | + /** @var IShare */ |
|
38 | + private $share; |
|
39 | + |
|
40 | + /** |
|
41 | + * @since 18.0.0 |
|
42 | + */ |
|
43 | + public function __construct(IShare $share) { |
|
44 | + parent::__construct(); |
|
45 | + |
|
46 | + $this->share = $share; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * @since 18.0.0 |
|
51 | + */ |
|
52 | + public function getShare(): IShare { |
|
53 | + return $this->share; |
|
54 | + } |
|
55 | 55 | } |
@@ -37,47 +37,47 @@ |
||
37 | 37 | |
38 | 38 | class AcceptController extends Controller { |
39 | 39 | |
40 | - /** @var ShareManager */ |
|
41 | - private $shareManager; |
|
40 | + /** @var ShareManager */ |
|
41 | + private $shareManager; |
|
42 | 42 | |
43 | - /** @var IUserSession */ |
|
44 | - private $userSession; |
|
43 | + /** @var IUserSession */ |
|
44 | + private $userSession; |
|
45 | 45 | |
46 | - /** @var IURLGenerator */ |
|
47 | - private $urlGenerator; |
|
46 | + /** @var IURLGenerator */ |
|
47 | + private $urlGenerator; |
|
48 | 48 | |
49 | - public function __construct(IRequest $request, ShareManager $shareManager, IUserSession $userSession, IURLGenerator $urlGenerator) { |
|
50 | - parent::__construct(Application::APP_ID, $request); |
|
49 | + public function __construct(IRequest $request, ShareManager $shareManager, IUserSession $userSession, IURLGenerator $urlGenerator) { |
|
50 | + parent::__construct(Application::APP_ID, $request); |
|
51 | 51 | |
52 | - $this->shareManager = $shareManager; |
|
53 | - $this->userSession = $userSession; |
|
54 | - $this->urlGenerator = $urlGenerator; |
|
55 | - } |
|
52 | + $this->shareManager = $shareManager; |
|
53 | + $this->userSession = $userSession; |
|
54 | + $this->urlGenerator = $urlGenerator; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @NoAdminRequired |
|
59 | - * @NoCSRFRequired |
|
60 | - */ |
|
61 | - public function accept(string $shareId): Response { |
|
62 | - try { |
|
63 | - $share = $this->shareManager->getShareById($shareId); |
|
64 | - } catch (ShareNotFound $e) { |
|
65 | - return new NotFoundResponse(); |
|
66 | - } |
|
57 | + /** |
|
58 | + * @NoAdminRequired |
|
59 | + * @NoCSRFRequired |
|
60 | + */ |
|
61 | + public function accept(string $shareId): Response { |
|
62 | + try { |
|
63 | + $share = $this->shareManager->getShareById($shareId); |
|
64 | + } catch (ShareNotFound $e) { |
|
65 | + return new NotFoundResponse(); |
|
66 | + } |
|
67 | 67 | |
68 | - $user = $this->userSession->getUser(); |
|
69 | - if ($user === null) { |
|
70 | - return new NotFoundResponse(); |
|
71 | - } |
|
68 | + $user = $this->userSession->getUser(); |
|
69 | + if ($user === null) { |
|
70 | + return new NotFoundResponse(); |
|
71 | + } |
|
72 | 72 | |
73 | - try { |
|
74 | - $share = $this->shareManager->acceptShare($share, $user->getUID()); |
|
75 | - } catch (\Exception $e) { |
|
76 | - // Just ignore |
|
77 | - } |
|
73 | + try { |
|
74 | + $share = $this->shareManager->acceptShare($share, $user->getUID()); |
|
75 | + } catch (\Exception $e) { |
|
76 | + // Just ignore |
|
77 | + } |
|
78 | 78 | |
79 | - $url = $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]); |
|
79 | + $url = $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]); |
|
80 | 80 | |
81 | - return new RedirectResponse($url); |
|
82 | - } |
|
81 | + return new RedirectResponse($url); |
|
82 | + } |
|
83 | 83 | } |