@@ -31,92 +31,92 @@ |
||
31 | 31 | |
32 | 32 | class NavigationController extends OCSController { |
33 | 33 | |
34 | - /** @var INavigationManager */ |
|
35 | - private $navigationManager; |
|
34 | + /** @var INavigationManager */ |
|
35 | + private $navigationManager; |
|
36 | 36 | |
37 | - /** @var IURLGenerator */ |
|
38 | - private $urlGenerator; |
|
37 | + /** @var IURLGenerator */ |
|
38 | + private $urlGenerator; |
|
39 | 39 | |
40 | - public function __construct(string $appName, IRequest $request, INavigationManager $navigationManager, IURLGenerator $urlGenerator) { |
|
41 | - parent::__construct($appName, $request); |
|
42 | - $this->navigationManager = $navigationManager; |
|
43 | - $this->urlGenerator = $urlGenerator; |
|
44 | - } |
|
40 | + public function __construct(string $appName, IRequest $request, INavigationManager $navigationManager, IURLGenerator $urlGenerator) { |
|
41 | + parent::__construct($appName, $request); |
|
42 | + $this->navigationManager = $navigationManager; |
|
43 | + $this->urlGenerator = $urlGenerator; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @NoAdminRequired |
|
48 | - * @NoCSRFRequired |
|
49 | - * |
|
50 | - * @param bool $absolute |
|
51 | - * @return DataResponse |
|
52 | - */ |
|
53 | - public function getAppsNavigation(bool $absolute = false): DataResponse { |
|
54 | - $navigation = $this->navigationManager->getAll(); |
|
55 | - if ($absolute) { |
|
56 | - $navigation = $this->rewriteToAbsoluteUrls($navigation); |
|
57 | - } |
|
58 | - $navigation = array_values($navigation); |
|
59 | - $etag = $this->generateETag($navigation); |
|
60 | - if ($this->request->getHeader('If-None-Match') === $etag) { |
|
61 | - return new DataResponse([], Http::STATUS_NOT_MODIFIED); |
|
62 | - } |
|
63 | - $response = new DataResponse($navigation); |
|
64 | - $response->setETag($etag); |
|
65 | - return $response; |
|
66 | - } |
|
46 | + /** |
|
47 | + * @NoAdminRequired |
|
48 | + * @NoCSRFRequired |
|
49 | + * |
|
50 | + * @param bool $absolute |
|
51 | + * @return DataResponse |
|
52 | + */ |
|
53 | + public function getAppsNavigation(bool $absolute = false): DataResponse { |
|
54 | + $navigation = $this->navigationManager->getAll(); |
|
55 | + if ($absolute) { |
|
56 | + $navigation = $this->rewriteToAbsoluteUrls($navigation); |
|
57 | + } |
|
58 | + $navigation = array_values($navigation); |
|
59 | + $etag = $this->generateETag($navigation); |
|
60 | + if ($this->request->getHeader('If-None-Match') === $etag) { |
|
61 | + return new DataResponse([], Http::STATUS_NOT_MODIFIED); |
|
62 | + } |
|
63 | + $response = new DataResponse($navigation); |
|
64 | + $response->setETag($etag); |
|
65 | + return $response; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @NoAdminRequired |
|
70 | - * @NoCSRFRequired |
|
71 | - * |
|
72 | - * @param bool $absolute |
|
73 | - * @return DataResponse |
|
74 | - */ |
|
75 | - public function getSettingsNavigation(bool $absolute = false): DataResponse { |
|
76 | - $navigation = $this->navigationManager->getAll('settings'); |
|
77 | - if ($absolute) { |
|
78 | - $navigation = $this->rewriteToAbsoluteUrls($navigation); |
|
79 | - } |
|
80 | - $navigation = array_values($navigation); |
|
81 | - $etag = $this->generateETag($navigation); |
|
82 | - if ($this->request->getHeader('If-None-Match') === $etag) { |
|
83 | - return new DataResponse([], Http::STATUS_NOT_MODIFIED); |
|
84 | - } |
|
85 | - $response = new DataResponse($navigation); |
|
86 | - $response->setETag($etag); |
|
87 | - return $response; |
|
88 | - } |
|
68 | + /** |
|
69 | + * @NoAdminRequired |
|
70 | + * @NoCSRFRequired |
|
71 | + * |
|
72 | + * @param bool $absolute |
|
73 | + * @return DataResponse |
|
74 | + */ |
|
75 | + public function getSettingsNavigation(bool $absolute = false): DataResponse { |
|
76 | + $navigation = $this->navigationManager->getAll('settings'); |
|
77 | + if ($absolute) { |
|
78 | + $navigation = $this->rewriteToAbsoluteUrls($navigation); |
|
79 | + } |
|
80 | + $navigation = array_values($navigation); |
|
81 | + $etag = $this->generateETag($navigation); |
|
82 | + if ($this->request->getHeader('If-None-Match') === $etag) { |
|
83 | + return new DataResponse([], Http::STATUS_NOT_MODIFIED); |
|
84 | + } |
|
85 | + $response = new DataResponse($navigation); |
|
86 | + $response->setETag($etag); |
|
87 | + return $response; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Generate an ETag for a list of navigation entries |
|
92 | - * |
|
93 | - * @param array $navigation |
|
94 | - * @return string |
|
95 | - */ |
|
96 | - private function generateETag(array $navigation): string { |
|
97 | - foreach ($navigation as &$nav) { |
|
98 | - if ($nav['id'] === 'logout') { |
|
99 | - $nav['href'] = 'logout'; |
|
100 | - } |
|
101 | - } |
|
102 | - return md5(json_encode($navigation)); |
|
103 | - } |
|
90 | + /** |
|
91 | + * Generate an ETag for a list of navigation entries |
|
92 | + * |
|
93 | + * @param array $navigation |
|
94 | + * @return string |
|
95 | + */ |
|
96 | + private function generateETag(array $navigation): string { |
|
97 | + foreach ($navigation as &$nav) { |
|
98 | + if ($nav['id'] === 'logout') { |
|
99 | + $nav['href'] = 'logout'; |
|
100 | + } |
|
101 | + } |
|
102 | + return md5(json_encode($navigation)); |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * Rewrite href attribute of navigation entries to an absolute URL |
|
107 | - * |
|
108 | - * @param array $navigation |
|
109 | - * @return array |
|
110 | - */ |
|
111 | - private function rewriteToAbsoluteUrls(array $navigation): array { |
|
112 | - foreach ($navigation as &$entry) { |
|
113 | - if (0 !== strpos($entry['href'], $this->urlGenerator->getBaseUrl())) { |
|
114 | - $entry['href'] = $this->urlGenerator->getAbsoluteURL($entry['href']); |
|
115 | - } |
|
116 | - if (0 !== strpos($entry['icon'], $this->urlGenerator->getBaseUrl())) { |
|
117 | - $entry['icon'] = $this->urlGenerator->getAbsoluteURL($entry['icon']); |
|
118 | - } |
|
119 | - } |
|
120 | - return $navigation; |
|
121 | - } |
|
105 | + /** |
|
106 | + * Rewrite href attribute of navigation entries to an absolute URL |
|
107 | + * |
|
108 | + * @param array $navigation |
|
109 | + * @return array |
|
110 | + */ |
|
111 | + private function rewriteToAbsoluteUrls(array $navigation): array { |
|
112 | + foreach ($navigation as &$entry) { |
|
113 | + if (0 !== strpos($entry['href'], $this->urlGenerator->getBaseUrl())) { |
|
114 | + $entry['href'] = $this->urlGenerator->getAbsoluteURL($entry['href']); |
|
115 | + } |
|
116 | + if (0 !== strpos($entry['icon'], $this->urlGenerator->getBaseUrl())) { |
|
117 | + $entry['icon'] = $this->urlGenerator->getAbsoluteURL($entry['icon']); |
|
118 | + } |
|
119 | + } |
|
120 | + return $navigation; |
|
121 | + } |
|
122 | 122 | } |
@@ -29,78 +29,78 @@ |
||
29 | 29 | |
30 | 30 | class Provider extends \OCP\Search\Provider { |
31 | 31 | |
32 | - /** |
|
33 | - * Search for $query |
|
34 | - * |
|
35 | - * @param string $query |
|
36 | - * @return array An array of OCP\Search\Result's |
|
37 | - * @since 7.0.0 |
|
38 | - */ |
|
39 | - public function search($query): array { |
|
40 | - $cm = \OC::$server->getCommentsManager(); |
|
41 | - $us = \OC::$server->getUserSession(); |
|
42 | - |
|
43 | - $user = $us->getUser(); |
|
44 | - if (!$user instanceof IUser) { |
|
45 | - return []; |
|
46 | - } |
|
47 | - $uf = \OC::$server->getUserFolder($user->getUID()); |
|
48 | - |
|
49 | - if ($uf === null) { |
|
50 | - return []; |
|
51 | - } |
|
52 | - |
|
53 | - $result = []; |
|
54 | - $numComments = 50; |
|
55 | - $offset = 0; |
|
56 | - |
|
57 | - while (\count($result) < $numComments) { |
|
58 | - /** @var IComment[] $comments */ |
|
59 | - $comments = $cm->search($query, 'files', '', 'comment', $offset, $numComments); |
|
60 | - |
|
61 | - foreach ($comments as $comment) { |
|
62 | - if ($comment->getActorType() !== 'users') { |
|
63 | - continue; |
|
64 | - } |
|
65 | - |
|
66 | - $displayName = $cm->resolveDisplayName('user', $comment->getActorId()); |
|
67 | - |
|
68 | - try { |
|
69 | - $file = $this->getFileForComment($uf, $comment); |
|
70 | - $result[] = new Result($query, |
|
71 | - $comment, |
|
72 | - $displayName, |
|
73 | - $file->getPath() |
|
74 | - ); |
|
75 | - } catch (NotFoundException $e) { |
|
76 | - continue; |
|
77 | - } |
|
78 | - } |
|
79 | - |
|
80 | - if (\count($comments) < $numComments) { |
|
81 | - // Didn't find more comments when we tried to get, so there are no more comments. |
|
82 | - return $result; |
|
83 | - } |
|
84 | - |
|
85 | - $offset += $numComments; |
|
86 | - $numComments = 50 - \count($result); |
|
87 | - } |
|
88 | - |
|
89 | - return $result; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @param Folder $userFolder |
|
94 | - * @param IComment $comment |
|
95 | - * @return Node |
|
96 | - * @throws NotFoundException |
|
97 | - */ |
|
98 | - protected function getFileForComment(Folder $userFolder, IComment $comment): Node { |
|
99 | - $nodes = $userFolder->getById((int) $comment->getObjectId()); |
|
100 | - if (empty($nodes)) { |
|
101 | - throw new NotFoundException('File not found'); |
|
102 | - } |
|
103 | - |
|
104 | - return array_shift($nodes); |
|
105 | - } |
|
32 | + /** |
|
33 | + * Search for $query |
|
34 | + * |
|
35 | + * @param string $query |
|
36 | + * @return array An array of OCP\Search\Result's |
|
37 | + * @since 7.0.0 |
|
38 | + */ |
|
39 | + public function search($query): array { |
|
40 | + $cm = \OC::$server->getCommentsManager(); |
|
41 | + $us = \OC::$server->getUserSession(); |
|
42 | + |
|
43 | + $user = $us->getUser(); |
|
44 | + if (!$user instanceof IUser) { |
|
45 | + return []; |
|
46 | + } |
|
47 | + $uf = \OC::$server->getUserFolder($user->getUID()); |
|
48 | + |
|
49 | + if ($uf === null) { |
|
50 | + return []; |
|
51 | + } |
|
52 | + |
|
53 | + $result = []; |
|
54 | + $numComments = 50; |
|
55 | + $offset = 0; |
|
56 | + |
|
57 | + while (\count($result) < $numComments) { |
|
58 | + /** @var IComment[] $comments */ |
|
59 | + $comments = $cm->search($query, 'files', '', 'comment', $offset, $numComments); |
|
60 | + |
|
61 | + foreach ($comments as $comment) { |
|
62 | + if ($comment->getActorType() !== 'users') { |
|
63 | + continue; |
|
64 | + } |
|
65 | + |
|
66 | + $displayName = $cm->resolveDisplayName('user', $comment->getActorId()); |
|
67 | + |
|
68 | + try { |
|
69 | + $file = $this->getFileForComment($uf, $comment); |
|
70 | + $result[] = new Result($query, |
|
71 | + $comment, |
|
72 | + $displayName, |
|
73 | + $file->getPath() |
|
74 | + ); |
|
75 | + } catch (NotFoundException $e) { |
|
76 | + continue; |
|
77 | + } |
|
78 | + } |
|
79 | + |
|
80 | + if (\count($comments) < $numComments) { |
|
81 | + // Didn't find more comments when we tried to get, so there are no more comments. |
|
82 | + return $result; |
|
83 | + } |
|
84 | + |
|
85 | + $offset += $numComments; |
|
86 | + $numComments = 50 - \count($result); |
|
87 | + } |
|
88 | + |
|
89 | + return $result; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @param Folder $userFolder |
|
94 | + * @param IComment $comment |
|
95 | + * @return Node |
|
96 | + * @throws NotFoundException |
|
97 | + */ |
|
98 | + protected function getFileForComment(Folder $userFolder, IComment $comment): Node { |
|
99 | + $nodes = $userFolder->getById((int) $comment->getObjectId()); |
|
100 | + if (empty($nodes)) { |
|
101 | + throw new NotFoundException('File not found'); |
|
102 | + } |
|
103 | + |
|
104 | + return array_shift($nodes); |
|
105 | + } |
|
106 | 106 | } |
@@ -37,67 +37,67 @@ |
||
37 | 37 | */ |
38 | 38 | interface IAvatar { |
39 | 39 | |
40 | - /** |
|
41 | - * get the users avatar |
|
42 | - * @param int $size size in px of the avatar, avatars are square, defaults to 64, -1 can be used to not scale the image |
|
43 | - * @return boolean|\OCP\IImage containing the avatar or false if there's no image |
|
44 | - * @since 6.0.0 - size of -1 was added in 9.0.0 |
|
45 | - */ |
|
46 | - public function get($size = 64); |
|
40 | + /** |
|
41 | + * get the users avatar |
|
42 | + * @param int $size size in px of the avatar, avatars are square, defaults to 64, -1 can be used to not scale the image |
|
43 | + * @return boolean|\OCP\IImage containing the avatar or false if there's no image |
|
44 | + * @since 6.0.0 - size of -1 was added in 9.0.0 |
|
45 | + */ |
|
46 | + public function get($size = 64); |
|
47 | 47 | |
48 | - /** |
|
49 | - * Check if an avatar exists for the user |
|
50 | - * |
|
51 | - * @return bool |
|
52 | - * @since 8.1.0 |
|
53 | - */ |
|
54 | - public function exists(); |
|
48 | + /** |
|
49 | + * Check if an avatar exists for the user |
|
50 | + * |
|
51 | + * @return bool |
|
52 | + * @since 8.1.0 |
|
53 | + */ |
|
54 | + public function exists(); |
|
55 | 55 | |
56 | - /** |
|
57 | - * Check if the avatar of a user is a custom uploaded one |
|
58 | - * |
|
59 | - * @return bool |
|
60 | - * @since 14.0.0 |
|
61 | - */ |
|
62 | - public function isCustomAvatar(): bool; |
|
56 | + /** |
|
57 | + * Check if the avatar of a user is a custom uploaded one |
|
58 | + * |
|
59 | + * @return bool |
|
60 | + * @since 14.0.0 |
|
61 | + */ |
|
62 | + public function isCustomAvatar(): bool; |
|
63 | 63 | |
64 | - /** |
|
65 | - * sets the users avatar |
|
66 | - * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar |
|
67 | - * @throws \Exception if the provided file is not a jpg or png image |
|
68 | - * @throws \Exception if the provided image is not valid |
|
69 | - * @throws \OC\NotSquareException if the image is not square |
|
70 | - * @return void |
|
71 | - * @since 6.0.0 |
|
72 | - */ |
|
73 | - public function set($data); |
|
64 | + /** |
|
65 | + * sets the users avatar |
|
66 | + * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar |
|
67 | + * @throws \Exception if the provided file is not a jpg or png image |
|
68 | + * @throws \Exception if the provided image is not valid |
|
69 | + * @throws \OC\NotSquareException if the image is not square |
|
70 | + * @return void |
|
71 | + * @since 6.0.0 |
|
72 | + */ |
|
73 | + public function set($data); |
|
74 | 74 | |
75 | - /** |
|
76 | - * remove the users avatar |
|
77 | - * @return void |
|
78 | - * @since 6.0.0 |
|
79 | - */ |
|
80 | - public function remove(); |
|
75 | + /** |
|
76 | + * remove the users avatar |
|
77 | + * @return void |
|
78 | + * @since 6.0.0 |
|
79 | + */ |
|
80 | + public function remove(); |
|
81 | 81 | |
82 | - /** |
|
83 | - * Get the file of the avatar |
|
84 | - * @param int $size -1 can be used to not scale the image |
|
85 | - * @return File |
|
86 | - * @throws NotFoundException |
|
87 | - * @since 9.0.0 |
|
88 | - */ |
|
89 | - public function getFile($size); |
|
82 | + /** |
|
83 | + * Get the file of the avatar |
|
84 | + * @param int $size -1 can be used to not scale the image |
|
85 | + * @return File |
|
86 | + * @throws NotFoundException |
|
87 | + * @since 9.0.0 |
|
88 | + */ |
|
89 | + public function getFile($size); |
|
90 | 90 | |
91 | - /** |
|
92 | - * @param string $text |
|
93 | - * @return Color Object containting r g b int in the range [0, 255] |
|
94 | - * @since 14.0.0 |
|
95 | - */ |
|
96 | - public function avatarBackgroundColor(string $text); |
|
91 | + /** |
|
92 | + * @param string $text |
|
93 | + * @return Color Object containting r g b int in the range [0, 255] |
|
94 | + * @since 14.0.0 |
|
95 | + */ |
|
96 | + public function avatarBackgroundColor(string $text); |
|
97 | 97 | |
98 | - /** |
|
99 | - * Handle a changed user |
|
100 | - * @since 13.0.0 |
|
101 | - */ |
|
102 | - public function userChanged($feature, $oldValue, $newValue); |
|
98 | + /** |
|
99 | + * Handle a changed user |
|
100 | + * @since 13.0.0 |
|
101 | + */ |
|
102 | + public function userChanged($feature, $oldValue, $newValue); |
|
103 | 103 | } |
@@ -38,90 +38,90 @@ |
||
38 | 38 | |
39 | 39 | class Admin implements ISettings { |
40 | 40 | |
41 | - /** @var IL10N */ |
|
42 | - private $l; |
|
43 | - |
|
44 | - /** @var ILogger */ |
|
45 | - private $logger; |
|
46 | - |
|
47 | - /** @var IUserSession */ |
|
48 | - private $userSession; |
|
49 | - |
|
50 | - /** @var IConfig */ |
|
51 | - private $config; |
|
52 | - |
|
53 | - /** @var IUserManager */ |
|
54 | - private $userManager; |
|
55 | - |
|
56 | - /** @var ISession */ |
|
57 | - private $session; |
|
58 | - |
|
59 | - public function __construct( |
|
60 | - IL10N $l, |
|
61 | - ILogger $logger, |
|
62 | - IUserSession $userSession, |
|
63 | - IConfig $config, |
|
64 | - IUserManager $userManager, |
|
65 | - ISession $session |
|
66 | - ) { |
|
67 | - $this->l = $l; |
|
68 | - $this->logger = $logger; |
|
69 | - $this->userSession = $userSession; |
|
70 | - $this->config = $config; |
|
71 | - $this->userManager = $userManager; |
|
72 | - $this->session = $session; |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * @return TemplateResponse |
|
77 | - */ |
|
78 | - public function getForm() { |
|
79 | - $crypt = new Crypt( |
|
80 | - $this->logger, |
|
81 | - $this->userSession, |
|
82 | - $this->config, |
|
83 | - $this->l); |
|
84 | - |
|
85 | - $util = new Util( |
|
86 | - new View(), |
|
87 | - $crypt, |
|
88 | - $this->logger, |
|
89 | - $this->userSession, |
|
90 | - $this->config, |
|
91 | - $this->userManager); |
|
92 | - |
|
93 | - // Check if an adminRecovery account is enabled for recovering files after lost pwd |
|
94 | - $recoveryAdminEnabled = $this->config->getAppValue('encryption', 'recoveryAdminEnabled', '0'); |
|
95 | - $session = new Session($this->session); |
|
96 | - |
|
97 | - $encryptHomeStorage = $util->shouldEncryptHomeStorage(); |
|
98 | - |
|
99 | - $parameters = [ |
|
100 | - 'recoveryEnabled' => $recoveryAdminEnabled, |
|
101 | - 'initStatus' => $session->getStatus(), |
|
102 | - 'encryptHomeStorage' => $encryptHomeStorage, |
|
103 | - 'masterKeyEnabled' => $util->isMasterKeyEnabled(), |
|
104 | - ]; |
|
105 | - |
|
106 | - return new TemplateResponse('encryption', 'settings-admin', $parameters, ''); |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * @return string the section ID, e.g. 'sharing' |
|
111 | - */ |
|
112 | - public function getSection() { |
|
113 | - return 'security'; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @return int whether the form should be rather on the top or bottom of |
|
118 | - * the admin section. The forms are arranged in ascending order of the |
|
119 | - * priority values. It is required to return a value between 0 and 100. |
|
120 | - * |
|
121 | - * E.g.: 70 |
|
122 | - */ |
|
123 | - public function getPriority() { |
|
124 | - return 11; |
|
125 | - } |
|
41 | + /** @var IL10N */ |
|
42 | + private $l; |
|
43 | + |
|
44 | + /** @var ILogger */ |
|
45 | + private $logger; |
|
46 | + |
|
47 | + /** @var IUserSession */ |
|
48 | + private $userSession; |
|
49 | + |
|
50 | + /** @var IConfig */ |
|
51 | + private $config; |
|
52 | + |
|
53 | + /** @var IUserManager */ |
|
54 | + private $userManager; |
|
55 | + |
|
56 | + /** @var ISession */ |
|
57 | + private $session; |
|
58 | + |
|
59 | + public function __construct( |
|
60 | + IL10N $l, |
|
61 | + ILogger $logger, |
|
62 | + IUserSession $userSession, |
|
63 | + IConfig $config, |
|
64 | + IUserManager $userManager, |
|
65 | + ISession $session |
|
66 | + ) { |
|
67 | + $this->l = $l; |
|
68 | + $this->logger = $logger; |
|
69 | + $this->userSession = $userSession; |
|
70 | + $this->config = $config; |
|
71 | + $this->userManager = $userManager; |
|
72 | + $this->session = $session; |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * @return TemplateResponse |
|
77 | + */ |
|
78 | + public function getForm() { |
|
79 | + $crypt = new Crypt( |
|
80 | + $this->logger, |
|
81 | + $this->userSession, |
|
82 | + $this->config, |
|
83 | + $this->l); |
|
84 | + |
|
85 | + $util = new Util( |
|
86 | + new View(), |
|
87 | + $crypt, |
|
88 | + $this->logger, |
|
89 | + $this->userSession, |
|
90 | + $this->config, |
|
91 | + $this->userManager); |
|
92 | + |
|
93 | + // Check if an adminRecovery account is enabled for recovering files after lost pwd |
|
94 | + $recoveryAdminEnabled = $this->config->getAppValue('encryption', 'recoveryAdminEnabled', '0'); |
|
95 | + $session = new Session($this->session); |
|
96 | + |
|
97 | + $encryptHomeStorage = $util->shouldEncryptHomeStorage(); |
|
98 | + |
|
99 | + $parameters = [ |
|
100 | + 'recoveryEnabled' => $recoveryAdminEnabled, |
|
101 | + 'initStatus' => $session->getStatus(), |
|
102 | + 'encryptHomeStorage' => $encryptHomeStorage, |
|
103 | + 'masterKeyEnabled' => $util->isMasterKeyEnabled(), |
|
104 | + ]; |
|
105 | + |
|
106 | + return new TemplateResponse('encryption', 'settings-admin', $parameters, ''); |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * @return string the section ID, e.g. 'sharing' |
|
111 | + */ |
|
112 | + public function getSection() { |
|
113 | + return 'security'; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @return int whether the form should be rather on the top or bottom of |
|
118 | + * the admin section. The forms are arranged in ascending order of the |
|
119 | + * priority values. It is required to return a value between 0 and 100. |
|
120 | + * |
|
121 | + * E.g.: 70 |
|
122 | + */ |
|
123 | + public function getPriority() { |
|
124 | + return 11; |
|
125 | + } |
|
126 | 126 | |
127 | 127 | } |
@@ -163,7 +163,7 @@ |
||
163 | 163 | |
164 | 164 | $shares = array_merge($groupShares, $roomShares); |
165 | 165 | |
166 | - $shares = array_map(function (IShare $share) { |
|
166 | + $shares = array_map(function(IShare $share) { |
|
167 | 167 | return $this->formatShare($share); |
168 | 168 | }, $shares); |
169 | 169 |
@@ -48,168 +48,168 @@ |
||
48 | 48 | |
49 | 49 | class DeletedShareAPIController extends OCSController { |
50 | 50 | |
51 | - /** @var ShareManager */ |
|
52 | - private $shareManager; |
|
53 | - |
|
54 | - /** @var string */ |
|
55 | - private $userId; |
|
56 | - |
|
57 | - /** @var IUserManager */ |
|
58 | - private $userManager; |
|
59 | - |
|
60 | - /** @var IGroupManager */ |
|
61 | - private $groupManager; |
|
62 | - |
|
63 | - /** @var IRootFolder */ |
|
64 | - private $rootFolder; |
|
65 | - |
|
66 | - /** @var IAppManager */ |
|
67 | - private $appManager; |
|
68 | - |
|
69 | - /** @var IServerContainer */ |
|
70 | - private $serverContainer; |
|
71 | - |
|
72 | - public function __construct(string $appName, |
|
73 | - IRequest $request, |
|
74 | - ShareManager $shareManager, |
|
75 | - string $UserId, |
|
76 | - IUserManager $userManager, |
|
77 | - IGroupManager $groupManager, |
|
78 | - IRootFolder $rootFolder, |
|
79 | - IAppManager $appManager, |
|
80 | - IServerContainer $serverContainer) { |
|
81 | - parent::__construct($appName, $request); |
|
82 | - |
|
83 | - $this->shareManager = $shareManager; |
|
84 | - $this->userId = $UserId; |
|
85 | - $this->userManager = $userManager; |
|
86 | - $this->groupManager = $groupManager; |
|
87 | - $this->rootFolder = $rootFolder; |
|
88 | - $this->appManager = $appManager; |
|
89 | - $this->serverContainer = $serverContainer; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @suppress PhanUndeclaredClassMethod |
|
94 | - */ |
|
95 | - private function formatShare(IShare $share): array { |
|
96 | - $result = [ |
|
97 | - 'id' => $share->getFullId(), |
|
98 | - 'share_type' => $share->getShareType(), |
|
99 | - 'uid_owner' => $share->getSharedBy(), |
|
100 | - 'displayname_owner' => $this->userManager->get($share->getSharedBy())->getDisplayName(), |
|
101 | - 'permissions' => 0, |
|
102 | - 'stime' => $share->getShareTime()->getTimestamp(), |
|
103 | - 'parent' => null, |
|
104 | - 'expiration' => null, |
|
105 | - 'token' => null, |
|
106 | - 'uid_file_owner' => $share->getShareOwner(), |
|
107 | - 'displayname_file_owner' => $this->userManager->get($share->getShareOwner())->getDisplayName(), |
|
108 | - 'path' => $share->getTarget(), |
|
109 | - ]; |
|
110 | - $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); |
|
111 | - $nodes = $userFolder->getById($share->getNodeId()); |
|
112 | - if (empty($nodes)) { |
|
113 | - // fallback to guessing the path |
|
114 | - $node = $userFolder->get($share->getTarget()); |
|
115 | - if ($node === null || $share->getTarget() === '') { |
|
116 | - throw new NotFoundException(); |
|
117 | - } |
|
118 | - } else { |
|
119 | - $node = $nodes[0]; |
|
120 | - } |
|
121 | - |
|
122 | - $result['path'] = $userFolder->getRelativePath($node->getPath()); |
|
123 | - if ($node instanceof \OCP\Files\Folder) { |
|
124 | - $result['item_type'] = 'folder'; |
|
125 | - } else { |
|
126 | - $result['item_type'] = 'file'; |
|
127 | - } |
|
128 | - $result['mimetype'] = $node->getMimetype(); |
|
129 | - $result['storage_id'] = $node->getStorage()->getId(); |
|
130 | - $result['storage'] = $node->getStorage()->getCache()->getNumericStorageId(); |
|
131 | - $result['item_source'] = $node->getId(); |
|
132 | - $result['file_source'] = $node->getId(); |
|
133 | - $result['file_parent'] = $node->getParent()->getId(); |
|
134 | - $result['file_target'] = $share->getTarget(); |
|
135 | - |
|
136 | - $expiration = $share->getExpirationDate(); |
|
137 | - if ($expiration !== null) { |
|
138 | - $result['expiration'] = $expiration->format('Y-m-d 00:00:00'); |
|
139 | - } |
|
140 | - |
|
141 | - if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { |
|
142 | - $group = $this->groupManager->get($share->getSharedWith()); |
|
143 | - $result['share_with'] = $share->getSharedWith(); |
|
144 | - $result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith(); |
|
145 | - } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { |
|
146 | - $result['share_with'] = $share->getSharedWith(); |
|
147 | - $result['share_with_displayname'] = ''; |
|
148 | - |
|
149 | - try { |
|
150 | - $result = array_merge($result, $this->getRoomShareHelper()->formatShare($share)); |
|
151 | - } catch (QueryException $e) { |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - return $result; |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * @NoAdminRequired |
|
160 | - */ |
|
161 | - public function index(): DataResponse { |
|
162 | - $groupShares = $this->shareManager->getDeletedSharedWith($this->userId, \OCP\Share::SHARE_TYPE_GROUP, null, -1, 0); |
|
163 | - $roomShares = $this->shareManager->getDeletedSharedWith($this->userId, \OCP\Share::SHARE_TYPE_ROOM, null, -1, 0); |
|
164 | - |
|
165 | - $shares = array_merge($groupShares, $roomShares); |
|
166 | - |
|
167 | - $shares = array_map(function (IShare $share) { |
|
168 | - return $this->formatShare($share); |
|
169 | - }, $shares); |
|
170 | - |
|
171 | - return new DataResponse($shares); |
|
172 | - } |
|
173 | - |
|
174 | - /** |
|
175 | - * @NoAdminRequired |
|
176 | - * |
|
177 | - * @throws OCSException |
|
178 | - */ |
|
179 | - public function undelete(string $id): DataResponse { |
|
180 | - try { |
|
181 | - $share = $this->shareManager->getShareById($id, $this->userId); |
|
182 | - } catch (ShareNotFound $e) { |
|
183 | - throw new OCSNotFoundException('Share not found'); |
|
184 | - } |
|
185 | - |
|
186 | - if ($share->getPermissions() !== 0) { |
|
187 | - throw new OCSNotFoundException('No deleted share found'); |
|
188 | - } |
|
189 | - |
|
190 | - try { |
|
191 | - $this->shareManager->restoreShare($share, $this->userId); |
|
192 | - } catch (GenericShareException $e) { |
|
193 | - throw new OCSException('Something went wrong'); |
|
194 | - } |
|
195 | - |
|
196 | - return new DataResponse([]); |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * Returns the helper of DeletedShareAPIController for room shares. |
|
201 | - * |
|
202 | - * If the Talk application is not enabled or the helper is not available |
|
203 | - * a QueryException is thrown instead. |
|
204 | - * |
|
205 | - * @return \OCA\Talk\Share\Helper\DeletedShareAPIController |
|
206 | - * @throws QueryException |
|
207 | - */ |
|
208 | - private function getRoomShareHelper() { |
|
209 | - if (!$this->appManager->isEnabledForUser('spreed')) { |
|
210 | - throw new QueryException(); |
|
211 | - } |
|
212 | - |
|
213 | - return $this->serverContainer->query('\OCA\Talk\Share\Helper\DeletedShareAPIController'); |
|
214 | - } |
|
51 | + /** @var ShareManager */ |
|
52 | + private $shareManager; |
|
53 | + |
|
54 | + /** @var string */ |
|
55 | + private $userId; |
|
56 | + |
|
57 | + /** @var IUserManager */ |
|
58 | + private $userManager; |
|
59 | + |
|
60 | + /** @var IGroupManager */ |
|
61 | + private $groupManager; |
|
62 | + |
|
63 | + /** @var IRootFolder */ |
|
64 | + private $rootFolder; |
|
65 | + |
|
66 | + /** @var IAppManager */ |
|
67 | + private $appManager; |
|
68 | + |
|
69 | + /** @var IServerContainer */ |
|
70 | + private $serverContainer; |
|
71 | + |
|
72 | + public function __construct(string $appName, |
|
73 | + IRequest $request, |
|
74 | + ShareManager $shareManager, |
|
75 | + string $UserId, |
|
76 | + IUserManager $userManager, |
|
77 | + IGroupManager $groupManager, |
|
78 | + IRootFolder $rootFolder, |
|
79 | + IAppManager $appManager, |
|
80 | + IServerContainer $serverContainer) { |
|
81 | + parent::__construct($appName, $request); |
|
82 | + |
|
83 | + $this->shareManager = $shareManager; |
|
84 | + $this->userId = $UserId; |
|
85 | + $this->userManager = $userManager; |
|
86 | + $this->groupManager = $groupManager; |
|
87 | + $this->rootFolder = $rootFolder; |
|
88 | + $this->appManager = $appManager; |
|
89 | + $this->serverContainer = $serverContainer; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @suppress PhanUndeclaredClassMethod |
|
94 | + */ |
|
95 | + private function formatShare(IShare $share): array { |
|
96 | + $result = [ |
|
97 | + 'id' => $share->getFullId(), |
|
98 | + 'share_type' => $share->getShareType(), |
|
99 | + 'uid_owner' => $share->getSharedBy(), |
|
100 | + 'displayname_owner' => $this->userManager->get($share->getSharedBy())->getDisplayName(), |
|
101 | + 'permissions' => 0, |
|
102 | + 'stime' => $share->getShareTime()->getTimestamp(), |
|
103 | + 'parent' => null, |
|
104 | + 'expiration' => null, |
|
105 | + 'token' => null, |
|
106 | + 'uid_file_owner' => $share->getShareOwner(), |
|
107 | + 'displayname_file_owner' => $this->userManager->get($share->getShareOwner())->getDisplayName(), |
|
108 | + 'path' => $share->getTarget(), |
|
109 | + ]; |
|
110 | + $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); |
|
111 | + $nodes = $userFolder->getById($share->getNodeId()); |
|
112 | + if (empty($nodes)) { |
|
113 | + // fallback to guessing the path |
|
114 | + $node = $userFolder->get($share->getTarget()); |
|
115 | + if ($node === null || $share->getTarget() === '') { |
|
116 | + throw new NotFoundException(); |
|
117 | + } |
|
118 | + } else { |
|
119 | + $node = $nodes[0]; |
|
120 | + } |
|
121 | + |
|
122 | + $result['path'] = $userFolder->getRelativePath($node->getPath()); |
|
123 | + if ($node instanceof \OCP\Files\Folder) { |
|
124 | + $result['item_type'] = 'folder'; |
|
125 | + } else { |
|
126 | + $result['item_type'] = 'file'; |
|
127 | + } |
|
128 | + $result['mimetype'] = $node->getMimetype(); |
|
129 | + $result['storage_id'] = $node->getStorage()->getId(); |
|
130 | + $result['storage'] = $node->getStorage()->getCache()->getNumericStorageId(); |
|
131 | + $result['item_source'] = $node->getId(); |
|
132 | + $result['file_source'] = $node->getId(); |
|
133 | + $result['file_parent'] = $node->getParent()->getId(); |
|
134 | + $result['file_target'] = $share->getTarget(); |
|
135 | + |
|
136 | + $expiration = $share->getExpirationDate(); |
|
137 | + if ($expiration !== null) { |
|
138 | + $result['expiration'] = $expiration->format('Y-m-d 00:00:00'); |
|
139 | + } |
|
140 | + |
|
141 | + if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { |
|
142 | + $group = $this->groupManager->get($share->getSharedWith()); |
|
143 | + $result['share_with'] = $share->getSharedWith(); |
|
144 | + $result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith(); |
|
145 | + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { |
|
146 | + $result['share_with'] = $share->getSharedWith(); |
|
147 | + $result['share_with_displayname'] = ''; |
|
148 | + |
|
149 | + try { |
|
150 | + $result = array_merge($result, $this->getRoomShareHelper()->formatShare($share)); |
|
151 | + } catch (QueryException $e) { |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + return $result; |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * @NoAdminRequired |
|
160 | + */ |
|
161 | + public function index(): DataResponse { |
|
162 | + $groupShares = $this->shareManager->getDeletedSharedWith($this->userId, \OCP\Share::SHARE_TYPE_GROUP, null, -1, 0); |
|
163 | + $roomShares = $this->shareManager->getDeletedSharedWith($this->userId, \OCP\Share::SHARE_TYPE_ROOM, null, -1, 0); |
|
164 | + |
|
165 | + $shares = array_merge($groupShares, $roomShares); |
|
166 | + |
|
167 | + $shares = array_map(function (IShare $share) { |
|
168 | + return $this->formatShare($share); |
|
169 | + }, $shares); |
|
170 | + |
|
171 | + return new DataResponse($shares); |
|
172 | + } |
|
173 | + |
|
174 | + /** |
|
175 | + * @NoAdminRequired |
|
176 | + * |
|
177 | + * @throws OCSException |
|
178 | + */ |
|
179 | + public function undelete(string $id): DataResponse { |
|
180 | + try { |
|
181 | + $share = $this->shareManager->getShareById($id, $this->userId); |
|
182 | + } catch (ShareNotFound $e) { |
|
183 | + throw new OCSNotFoundException('Share not found'); |
|
184 | + } |
|
185 | + |
|
186 | + if ($share->getPermissions() !== 0) { |
|
187 | + throw new OCSNotFoundException('No deleted share found'); |
|
188 | + } |
|
189 | + |
|
190 | + try { |
|
191 | + $this->shareManager->restoreShare($share, $this->userId); |
|
192 | + } catch (GenericShareException $e) { |
|
193 | + throw new OCSException('Something went wrong'); |
|
194 | + } |
|
195 | + |
|
196 | + return new DataResponse([]); |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * Returns the helper of DeletedShareAPIController for room shares. |
|
201 | + * |
|
202 | + * If the Talk application is not enabled or the helper is not available |
|
203 | + * a QueryException is thrown instead. |
|
204 | + * |
|
205 | + * @return \OCA\Talk\Share\Helper\DeletedShareAPIController |
|
206 | + * @throws QueryException |
|
207 | + */ |
|
208 | + private function getRoomShareHelper() { |
|
209 | + if (!$this->appManager->isEnabledForUser('spreed')) { |
|
210 | + throw new QueryException(); |
|
211 | + } |
|
212 | + |
|
213 | + return $this->serverContainer->query('\OCA\Talk\Share\Helper\DeletedShareAPIController'); |
|
214 | + } |
|
215 | 215 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $result = $query->execute(); |
60 | 60 | $providers = []; |
61 | 61 | foreach ($result->fetchAll() as $row) { |
62 | - $providers[$row['provider_id']] = 1 === (int)$row['enabled']; |
|
62 | + $providers[$row['provider_id']] = 1 === (int) $row['enabled']; |
|
63 | 63 | } |
64 | 64 | $result->closeCursor(); |
65 | 65 |
@@ -35,77 +35,77 @@ |
||
35 | 35 | * 2FA providers |
36 | 36 | */ |
37 | 37 | class ProviderUserAssignmentDao { |
38 | - public const TABLE_NAME = 'twofactor_providers'; |
|
39 | - |
|
40 | - /** @var IDBConnection */ |
|
41 | - private $conn; |
|
42 | - |
|
43 | - public function __construct(IDBConnection $dbConn) { |
|
44 | - $this->conn = $dbConn; |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Get all assigned provider IDs for the given user ID |
|
49 | - * |
|
50 | - * @return string[] where the array key is the provider ID (string) and the |
|
51 | - * value is the enabled state (bool) |
|
52 | - */ |
|
53 | - public function getState(string $uid): array { |
|
54 | - $qb = $this->conn->getQueryBuilder(); |
|
55 | - |
|
56 | - $query = $qb->select('provider_id', 'enabled') |
|
57 | - ->from(self::TABLE_NAME) |
|
58 | - ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))); |
|
59 | - $result = $query->execute(); |
|
60 | - $providers = []; |
|
61 | - foreach ($result->fetchAll() as $row) { |
|
62 | - $providers[$row['provider_id']] = 1 === (int)$row['enabled']; |
|
63 | - } |
|
64 | - $result->closeCursor(); |
|
65 | - |
|
66 | - return $providers; |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Persist a new/updated (provider_id, uid, enabled) tuple |
|
71 | - */ |
|
72 | - public function persist(string $providerId, string $uid, int $enabled) { |
|
73 | - $qb = $this->conn->getQueryBuilder(); |
|
74 | - |
|
75 | - try { |
|
76 | - // Insert a new entry |
|
77 | - $insertQuery = $qb->insert(self::TABLE_NAME)->values([ |
|
78 | - 'provider_id' => $qb->createNamedParameter($providerId), |
|
79 | - 'uid' => $qb->createNamedParameter($uid), |
|
80 | - 'enabled' => $qb->createNamedParameter($enabled, IQueryBuilder::PARAM_INT), |
|
81 | - ]); |
|
82 | - |
|
83 | - $insertQuery->execute(); |
|
84 | - } catch (UniqueConstraintViolationException $ex) { |
|
85 | - // There is already an entry -> update it |
|
86 | - $updateQuery = $qb->update(self::TABLE_NAME) |
|
87 | - ->set('enabled', $qb->createNamedParameter($enabled)) |
|
88 | - ->where($qb->expr()->eq('provider_id', $qb->createNamedParameter($providerId))) |
|
89 | - ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid))); |
|
90 | - $updateQuery->execute(); |
|
91 | - } |
|
92 | - } |
|
93 | - |
|
94 | - public function deleteByUser(string $uid) { |
|
95 | - $qb = $this->conn->getQueryBuilder(); |
|
96 | - |
|
97 | - $deleteQuery = $qb->delete(self::TABLE_NAME) |
|
98 | - ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))); |
|
99 | - |
|
100 | - $deleteQuery->execute(); |
|
101 | - } |
|
102 | - |
|
103 | - public function deleteAll(string $providerId) { |
|
104 | - $qb = $this->conn->getQueryBuilder(); |
|
105 | - |
|
106 | - $deleteQuery = $qb->delete(self::TABLE_NAME) |
|
107 | - ->where($qb->expr()->eq('provider_id', $qb->createNamedParameter($providerId))); |
|
108 | - |
|
109 | - $deleteQuery->execute(); |
|
110 | - } |
|
38 | + public const TABLE_NAME = 'twofactor_providers'; |
|
39 | + |
|
40 | + /** @var IDBConnection */ |
|
41 | + private $conn; |
|
42 | + |
|
43 | + public function __construct(IDBConnection $dbConn) { |
|
44 | + $this->conn = $dbConn; |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Get all assigned provider IDs for the given user ID |
|
49 | + * |
|
50 | + * @return string[] where the array key is the provider ID (string) and the |
|
51 | + * value is the enabled state (bool) |
|
52 | + */ |
|
53 | + public function getState(string $uid): array { |
|
54 | + $qb = $this->conn->getQueryBuilder(); |
|
55 | + |
|
56 | + $query = $qb->select('provider_id', 'enabled') |
|
57 | + ->from(self::TABLE_NAME) |
|
58 | + ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))); |
|
59 | + $result = $query->execute(); |
|
60 | + $providers = []; |
|
61 | + foreach ($result->fetchAll() as $row) { |
|
62 | + $providers[$row['provider_id']] = 1 === (int)$row['enabled']; |
|
63 | + } |
|
64 | + $result->closeCursor(); |
|
65 | + |
|
66 | + return $providers; |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Persist a new/updated (provider_id, uid, enabled) tuple |
|
71 | + */ |
|
72 | + public function persist(string $providerId, string $uid, int $enabled) { |
|
73 | + $qb = $this->conn->getQueryBuilder(); |
|
74 | + |
|
75 | + try { |
|
76 | + // Insert a new entry |
|
77 | + $insertQuery = $qb->insert(self::TABLE_NAME)->values([ |
|
78 | + 'provider_id' => $qb->createNamedParameter($providerId), |
|
79 | + 'uid' => $qb->createNamedParameter($uid), |
|
80 | + 'enabled' => $qb->createNamedParameter($enabled, IQueryBuilder::PARAM_INT), |
|
81 | + ]); |
|
82 | + |
|
83 | + $insertQuery->execute(); |
|
84 | + } catch (UniqueConstraintViolationException $ex) { |
|
85 | + // There is already an entry -> update it |
|
86 | + $updateQuery = $qb->update(self::TABLE_NAME) |
|
87 | + ->set('enabled', $qb->createNamedParameter($enabled)) |
|
88 | + ->where($qb->expr()->eq('provider_id', $qb->createNamedParameter($providerId))) |
|
89 | + ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid))); |
|
90 | + $updateQuery->execute(); |
|
91 | + } |
|
92 | + } |
|
93 | + |
|
94 | + public function deleteByUser(string $uid) { |
|
95 | + $qb = $this->conn->getQueryBuilder(); |
|
96 | + |
|
97 | + $deleteQuery = $qb->delete(self::TABLE_NAME) |
|
98 | + ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))); |
|
99 | + |
|
100 | + $deleteQuery->execute(); |
|
101 | + } |
|
102 | + |
|
103 | + public function deleteAll(string $providerId) { |
|
104 | + $qb = $this->conn->getQueryBuilder(); |
|
105 | + |
|
106 | + $deleteQuery = $qb->delete(self::TABLE_NAME) |
|
107 | + ->where($qb->expr()->eq('provider_id', $qb->createNamedParameter($providerId))); |
|
108 | + |
|
109 | + $deleteQuery->execute(); |
|
110 | + } |
|
111 | 111 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |