@@ -20,118 +20,118 @@ |
||
20 | 20 | |
21 | 21 | class OC_Theme { |
22 | 22 | |
23 | - /** |
|
24 | - * Returns the base URL |
|
25 | - * @return string URL |
|
26 | - */ |
|
27 | - public function getBaseUrl() { |
|
28 | - return 'https://nextcloud.com'; |
|
29 | - } |
|
30 | - |
|
31 | - /** |
|
32 | - * Returns the documentation URL |
|
33 | - * @return string URL |
|
34 | - */ |
|
35 | - public function getDocBaseUrl() { |
|
36 | - return 'https://docs.nextcloud.com'; |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * Returns the title |
|
41 | - * @return string title |
|
42 | - */ |
|
43 | - public function getTitle() { |
|
44 | - return 'Custom Cloud'; |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Returns the short name of the software |
|
49 | - * @return string title |
|
50 | - */ |
|
51 | - public function getName() { |
|
52 | - return 'Custom Cloud'; |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Returns the short name of the software containing HTML strings |
|
57 | - * @return string title |
|
58 | - */ |
|
59 | - public function getHTMLName() { |
|
60 | - return 'Custom Cloud'; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * Returns entity (e.g. company name) - used for footer, copyright |
|
65 | - * @return string entity name |
|
66 | - */ |
|
67 | - public function getEntity() { |
|
68 | - return 'Custom Cloud Co.'; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Returns slogan |
|
73 | - * @return string slogan |
|
74 | - */ |
|
75 | - public function getSlogan() { |
|
76 | - return 'Your custom cloud, personalized for you!'; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Returns logo claim |
|
81 | - * @return string logo claim |
|
82 | - * @deprecated 13.0.0 not used anymore |
|
83 | - */ |
|
84 | - public function getLogoClaim() { |
|
85 | - return ''; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Returns short version of the footer |
|
90 | - * @return string short footer |
|
91 | - */ |
|
92 | - public function getShortFooter() { |
|
93 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
94 | - '<br/>' . $this->getSlogan(); |
|
95 | - |
|
96 | - return $footer; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Returns long version of the footer |
|
101 | - * @return string long footer |
|
102 | - */ |
|
103 | - public function getLongFooter() { |
|
104 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
105 | - '<br/>' . $this->getSlogan(); |
|
106 | - |
|
107 | - return $footer; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * Generate a documentation link for a given key |
|
112 | - * @return string documentation link |
|
113 | - */ |
|
114 | - public function buildDocLinkToKey($key) { |
|
115 | - return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * Returns mail header color |
|
121 | - * @return string |
|
122 | - */ |
|
123 | - public function getColorPrimary() { |
|
124 | - return '#745bca'; |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * Returns variables to overload defaults from core/css/variables.scss |
|
129 | - * @return array |
|
130 | - */ |
|
131 | - public function getScssVariables() { |
|
132 | - return [ |
|
133 | - 'color-primary' => '#745bca' |
|
134 | - ]; |
|
135 | - } |
|
23 | + /** |
|
24 | + * Returns the base URL |
|
25 | + * @return string URL |
|
26 | + */ |
|
27 | + public function getBaseUrl() { |
|
28 | + return 'https://nextcloud.com'; |
|
29 | + } |
|
30 | + |
|
31 | + /** |
|
32 | + * Returns the documentation URL |
|
33 | + * @return string URL |
|
34 | + */ |
|
35 | + public function getDocBaseUrl() { |
|
36 | + return 'https://docs.nextcloud.com'; |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * Returns the title |
|
41 | + * @return string title |
|
42 | + */ |
|
43 | + public function getTitle() { |
|
44 | + return 'Custom Cloud'; |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Returns the short name of the software |
|
49 | + * @return string title |
|
50 | + */ |
|
51 | + public function getName() { |
|
52 | + return 'Custom Cloud'; |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Returns the short name of the software containing HTML strings |
|
57 | + * @return string title |
|
58 | + */ |
|
59 | + public function getHTMLName() { |
|
60 | + return 'Custom Cloud'; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * Returns entity (e.g. company name) - used for footer, copyright |
|
65 | + * @return string entity name |
|
66 | + */ |
|
67 | + public function getEntity() { |
|
68 | + return 'Custom Cloud Co.'; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Returns slogan |
|
73 | + * @return string slogan |
|
74 | + */ |
|
75 | + public function getSlogan() { |
|
76 | + return 'Your custom cloud, personalized for you!'; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Returns logo claim |
|
81 | + * @return string logo claim |
|
82 | + * @deprecated 13.0.0 not used anymore |
|
83 | + */ |
|
84 | + public function getLogoClaim() { |
|
85 | + return ''; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Returns short version of the footer |
|
90 | + * @return string short footer |
|
91 | + */ |
|
92 | + public function getShortFooter() { |
|
93 | + $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
94 | + '<br/>' . $this->getSlogan(); |
|
95 | + |
|
96 | + return $footer; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Returns long version of the footer |
|
101 | + * @return string long footer |
|
102 | + */ |
|
103 | + public function getLongFooter() { |
|
104 | + $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
105 | + '<br/>' . $this->getSlogan(); |
|
106 | + |
|
107 | + return $footer; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * Generate a documentation link for a given key |
|
112 | + * @return string documentation link |
|
113 | + */ |
|
114 | + public function buildDocLinkToKey($key) { |
|
115 | + return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * Returns mail header color |
|
121 | + * @return string |
|
122 | + */ |
|
123 | + public function getColorPrimary() { |
|
124 | + return '#745bca'; |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * Returns variables to overload defaults from core/css/variables.scss |
|
129 | + * @return array |
|
130 | + */ |
|
131 | + public function getScssVariables() { |
|
132 | + return [ |
|
133 | + 'color-primary' => '#745bca' |
|
134 | + ]; |
|
135 | + } |
|
136 | 136 | |
137 | 137 | } |
@@ -35,34 +35,34 @@ |
||
35 | 35 | * a reload but if the session variable is set we properly redirect to the login page. |
36 | 36 | */ |
37 | 37 | class ReloadExecutionMiddleware extends Middleware { |
38 | - /** @var ISession */ |
|
39 | - private $session; |
|
40 | - /** @var IURLGenerator */ |
|
41 | - private $urlGenerator; |
|
38 | + /** @var ISession */ |
|
39 | + private $session; |
|
40 | + /** @var IURLGenerator */ |
|
41 | + private $urlGenerator; |
|
42 | 42 | |
43 | - public function __construct(ISession $session, IURLGenerator $urlGenerator) { |
|
44 | - $this->session = $session; |
|
45 | - $this->urlGenerator = $urlGenerator; |
|
46 | - } |
|
43 | + public function __construct(ISession $session, IURLGenerator $urlGenerator) { |
|
44 | + $this->session = $session; |
|
45 | + $this->urlGenerator = $urlGenerator; |
|
46 | + } |
|
47 | 47 | |
48 | - public function beforeController($controller, $methodName) { |
|
49 | - if ($this->session->exists('clearingExecutionContexts')) { |
|
50 | - throw new ReloadExecutionException(); |
|
51 | - } |
|
52 | - } |
|
48 | + public function beforeController($controller, $methodName) { |
|
49 | + if ($this->session->exists('clearingExecutionContexts')) { |
|
50 | + throw new ReloadExecutionException(); |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - public function afterException($controller, $methodName, \Exception $exception) { |
|
55 | - if ($exception instanceof ReloadExecutionException) { |
|
56 | - $this->session->remove('clearingExecutionContexts'); |
|
54 | + public function afterException($controller, $methodName, \Exception $exception) { |
|
55 | + if ($exception instanceof ReloadExecutionException) { |
|
56 | + $this->session->remove('clearingExecutionContexts'); |
|
57 | 57 | |
58 | - return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute( |
|
59 | - 'core.login.showLoginForm', |
|
60 | - ['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers |
|
61 | - )); |
|
62 | - } |
|
58 | + return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute( |
|
59 | + 'core.login.showLoginForm', |
|
60 | + ['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers |
|
61 | + )); |
|
62 | + } |
|
63 | 63 | |
64 | - return parent::afterException($controller, $methodName, $exception); |
|
65 | - } |
|
64 | + return parent::afterException($controller, $methodName, $exception); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | 68 | } |
@@ -32,119 +32,119 @@ |
||
32 | 32 | * @since 16.0.0 |
33 | 33 | */ |
34 | 34 | class InMemoryFile implements ISimpleFile { |
35 | - /** |
|
36 | - * Holds the file name. |
|
37 | - * |
|
38 | - * @var string |
|
39 | - */ |
|
40 | - private $name; |
|
41 | - |
|
42 | - /** |
|
43 | - * Holds the file contents. |
|
44 | - * |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - private $contents; |
|
48 | - |
|
49 | - /** |
|
50 | - * InMemoryFile constructor. |
|
51 | - * |
|
52 | - * @param string $name The file name |
|
53 | - * @param string $contents The file contents |
|
54 | - * @since 16.0.0 |
|
55 | - */ |
|
56 | - public function __construct(string $name, string $contents) { |
|
57 | - $this->name = $name; |
|
58 | - $this->contents = $contents; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * @inheritdoc |
|
63 | - * @since 16.0.0 |
|
64 | - */ |
|
65 | - public function getName() { |
|
66 | - return $this->name; |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * @inheritdoc |
|
71 | - * @since 16.0.0 |
|
72 | - */ |
|
73 | - public function getSize() { |
|
74 | - return strlen($this->contents); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * @inheritdoc |
|
79 | - * @since 16.0.0 |
|
80 | - */ |
|
81 | - public function getETag() { |
|
82 | - return ''; |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * @inheritdoc |
|
87 | - * @since 16.0.0 |
|
88 | - */ |
|
89 | - public function getMTime() { |
|
90 | - return time(); |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * @inheritdoc |
|
95 | - * @since 16.0.0 |
|
96 | - */ |
|
97 | - public function getContent() { |
|
98 | - return $this->contents; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @inheritdoc |
|
103 | - * @since 16.0.0 |
|
104 | - */ |
|
105 | - public function putContent($data) { |
|
106 | - $this->contents = $data; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * In memory files can't be deleted. |
|
111 | - * |
|
112 | - * @since 16.0.0 |
|
113 | - */ |
|
114 | - public function delete() { |
|
115 | - // unimplemented for in memory files |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @inheritdoc |
|
120 | - * @since 16.0.0 |
|
121 | - */ |
|
122 | - public function getMimeType() { |
|
123 | - $fileInfo = new \finfo(FILEINFO_MIME_TYPE); |
|
124 | - return $fileInfo->buffer($this->contents); |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * Stream reading is unsupported for in memory files. |
|
129 | - * |
|
130 | - * @throws NotPermittedException |
|
131 | - * @since 16.0.0 |
|
132 | - */ |
|
133 | - public function read() { |
|
134 | - throw new NotPermittedException( |
|
135 | - 'Stream reading is unsupported for in memory files' |
|
136 | - ); |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * Stream writing isn't available for in memory files. |
|
141 | - * |
|
142 | - * @throws NotPermittedException |
|
143 | - * @since 16.0.0 |
|
144 | - */ |
|
145 | - public function write() { |
|
146 | - throw new NotPermittedException( |
|
147 | - 'Stream writing is unsupported for in memory files' |
|
148 | - ); |
|
149 | - } |
|
35 | + /** |
|
36 | + * Holds the file name. |
|
37 | + * |
|
38 | + * @var string |
|
39 | + */ |
|
40 | + private $name; |
|
41 | + |
|
42 | + /** |
|
43 | + * Holds the file contents. |
|
44 | + * |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + private $contents; |
|
48 | + |
|
49 | + /** |
|
50 | + * InMemoryFile constructor. |
|
51 | + * |
|
52 | + * @param string $name The file name |
|
53 | + * @param string $contents The file contents |
|
54 | + * @since 16.0.0 |
|
55 | + */ |
|
56 | + public function __construct(string $name, string $contents) { |
|
57 | + $this->name = $name; |
|
58 | + $this->contents = $contents; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * @inheritdoc |
|
63 | + * @since 16.0.0 |
|
64 | + */ |
|
65 | + public function getName() { |
|
66 | + return $this->name; |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * @inheritdoc |
|
71 | + * @since 16.0.0 |
|
72 | + */ |
|
73 | + public function getSize() { |
|
74 | + return strlen($this->contents); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * @inheritdoc |
|
79 | + * @since 16.0.0 |
|
80 | + */ |
|
81 | + public function getETag() { |
|
82 | + return ''; |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * @inheritdoc |
|
87 | + * @since 16.0.0 |
|
88 | + */ |
|
89 | + public function getMTime() { |
|
90 | + return time(); |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * @inheritdoc |
|
95 | + * @since 16.0.0 |
|
96 | + */ |
|
97 | + public function getContent() { |
|
98 | + return $this->contents; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @inheritdoc |
|
103 | + * @since 16.0.0 |
|
104 | + */ |
|
105 | + public function putContent($data) { |
|
106 | + $this->contents = $data; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * In memory files can't be deleted. |
|
111 | + * |
|
112 | + * @since 16.0.0 |
|
113 | + */ |
|
114 | + public function delete() { |
|
115 | + // unimplemented for in memory files |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @inheritdoc |
|
120 | + * @since 16.0.0 |
|
121 | + */ |
|
122 | + public function getMimeType() { |
|
123 | + $fileInfo = new \finfo(FILEINFO_MIME_TYPE); |
|
124 | + return $fileInfo->buffer($this->contents); |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * Stream reading is unsupported for in memory files. |
|
129 | + * |
|
130 | + * @throws NotPermittedException |
|
131 | + * @since 16.0.0 |
|
132 | + */ |
|
133 | + public function read() { |
|
134 | + throw new NotPermittedException( |
|
135 | + 'Stream reading is unsupported for in memory files' |
|
136 | + ); |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * Stream writing isn't available for in memory files. |
|
141 | + * |
|
142 | + * @throws NotPermittedException |
|
143 | + * @since 16.0.0 |
|
144 | + */ |
|
145 | + public function write() { |
|
146 | + throw new NotPermittedException( |
|
147 | + 'Stream writing is unsupported for in memory files' |
|
148 | + ); |
|
149 | + } |
|
150 | 150 | } |
@@ -34,24 +34,24 @@ |
||
34 | 34 | |
35 | 35 | interface IAvatarManager { |
36 | 36 | |
37 | - /** |
|
38 | - * return a user specific instance of \OCP\IAvatar |
|
39 | - * @see IAvatar |
|
40 | - * @param string $user the ownCloud user id |
|
41 | - * @return IAvatar |
|
42 | - * @throws \Exception In case the username is potentially dangerous |
|
43 | - * @throws \OCP\Files\NotFoundException In case there is no user folder yet |
|
44 | - * @since 6.0.0 |
|
45 | - */ |
|
46 | - public function getAvatar(string $user) : IAvatar; |
|
37 | + /** |
|
38 | + * return a user specific instance of \OCP\IAvatar |
|
39 | + * @see IAvatar |
|
40 | + * @param string $user the ownCloud user id |
|
41 | + * @return IAvatar |
|
42 | + * @throws \Exception In case the username is potentially dangerous |
|
43 | + * @throws \OCP\Files\NotFoundException In case there is no user folder yet |
|
44 | + * @since 6.0.0 |
|
45 | + */ |
|
46 | + public function getAvatar(string $user) : IAvatar; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Returns a guest user avatar instance. |
|
50 | - * |
|
51 | - * @param string $name The guest name, e.g. "Albert". |
|
52 | - * @return IAvatar |
|
53 | - * @since 16.0.0 |
|
54 | - */ |
|
55 | - public function getGuestAvatar(string $name): IAvatar; |
|
48 | + /** |
|
49 | + * Returns a guest user avatar instance. |
|
50 | + * |
|
51 | + * @param string $name The guest name, e.g. "Albert". |
|
52 | + * @return IAvatar |
|
53 | + * @since 16.0.0 |
|
54 | + */ |
|
55 | + public function getGuestAvatar(string $name): IAvatar; |
|
56 | 56 | |
57 | 57 | } |
@@ -30,90 +30,90 @@ |
||
30 | 30 | * This class represents a guest user's avatar. |
31 | 31 | */ |
32 | 32 | class GuestAvatar extends Avatar { |
33 | - /** |
|
34 | - * Holds the guest user display name. |
|
35 | - * |
|
36 | - * @var string |
|
37 | - */ |
|
38 | - private $userDisplayName; |
|
33 | + /** |
|
34 | + * Holds the guest user display name. |
|
35 | + * |
|
36 | + * @var string |
|
37 | + */ |
|
38 | + private $userDisplayName; |
|
39 | 39 | |
40 | - /** |
|
41 | - * GuestAvatar constructor. |
|
42 | - * |
|
43 | - * @param string $userDisplayName The guest user display name |
|
44 | - * @param ILogger $logger The logger |
|
45 | - */ |
|
46 | - public function __construct(string $userDisplayName, ILogger $logger) { |
|
47 | - parent::__construct($logger); |
|
48 | - $this->userDisplayName = $userDisplayName; |
|
49 | - } |
|
40 | + /** |
|
41 | + * GuestAvatar constructor. |
|
42 | + * |
|
43 | + * @param string $userDisplayName The guest user display name |
|
44 | + * @param ILogger $logger The logger |
|
45 | + */ |
|
46 | + public function __construct(string $userDisplayName, ILogger $logger) { |
|
47 | + parent::__construct($logger); |
|
48 | + $this->userDisplayName = $userDisplayName; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Tests if the user has an avatar. |
|
53 | - * |
|
54 | - * @return true Guests always have an avatar. |
|
55 | - */ |
|
56 | - public function exists() { |
|
57 | - return true; |
|
58 | - } |
|
51 | + /** |
|
52 | + * Tests if the user has an avatar. |
|
53 | + * |
|
54 | + * @return true Guests always have an avatar. |
|
55 | + */ |
|
56 | + public function exists() { |
|
57 | + return true; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Returns the guest user display name. |
|
62 | - * |
|
63 | - * @return string |
|
64 | - */ |
|
65 | - public function getDisplayName(): string { |
|
66 | - return $this->userDisplayName; |
|
67 | - } |
|
60 | + /** |
|
61 | + * Returns the guest user display name. |
|
62 | + * |
|
63 | + * @return string |
|
64 | + */ |
|
65 | + public function getDisplayName(): string { |
|
66 | + return $this->userDisplayName; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Setting avatars isn't implemented for guests. |
|
71 | - * |
|
72 | - * @param \OCP\IImage|resource|string $data |
|
73 | - * @return void |
|
74 | - */ |
|
75 | - public function set($data) { |
|
76 | - // unimplemented for guest user avatars |
|
77 | - } |
|
69 | + /** |
|
70 | + * Setting avatars isn't implemented for guests. |
|
71 | + * |
|
72 | + * @param \OCP\IImage|resource|string $data |
|
73 | + * @return void |
|
74 | + */ |
|
75 | + public function set($data) { |
|
76 | + // unimplemented for guest user avatars |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Removing avatars isn't implemented for guests. |
|
81 | - */ |
|
82 | - public function remove() { |
|
83 | - // unimplemented for guest user avatars |
|
84 | - } |
|
79 | + /** |
|
80 | + * Removing avatars isn't implemented for guests. |
|
81 | + */ |
|
82 | + public function remove() { |
|
83 | + // unimplemented for guest user avatars |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Generates an avatar for the guest. |
|
88 | - * |
|
89 | - * @param int $size The desired image size. |
|
90 | - * @return InMemoryFile |
|
91 | - */ |
|
92 | - public function getFile($size) { |
|
93 | - $avatar = $this->generateAvatar($this->userDisplayName, $size); |
|
94 | - return new InMemoryFile('avatar.png', $avatar); |
|
95 | - } |
|
86 | + /** |
|
87 | + * Generates an avatar for the guest. |
|
88 | + * |
|
89 | + * @param int $size The desired image size. |
|
90 | + * @return InMemoryFile |
|
91 | + */ |
|
92 | + public function getFile($size) { |
|
93 | + $avatar = $this->generateAvatar($this->userDisplayName, $size); |
|
94 | + return new InMemoryFile('avatar.png', $avatar); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Updates the display name if changed. |
|
99 | - * |
|
100 | - * @param string $feature The changed feature |
|
101 | - * @param mixed $oldValue The previous value |
|
102 | - * @param mixed $newValue The new value |
|
103 | - * @return void |
|
104 | - */ |
|
105 | - public function userChanged($feature, $oldValue, $newValue) { |
|
106 | - if ($feature === 'displayName') { |
|
107 | - $this->userDisplayName = $newValue; |
|
108 | - } |
|
109 | - } |
|
97 | + /** |
|
98 | + * Updates the display name if changed. |
|
99 | + * |
|
100 | + * @param string $feature The changed feature |
|
101 | + * @param mixed $oldValue The previous value |
|
102 | + * @param mixed $newValue The new value |
|
103 | + * @return void |
|
104 | + */ |
|
105 | + public function userChanged($feature, $oldValue, $newValue) { |
|
106 | + if ($feature === 'displayName') { |
|
107 | + $this->userDisplayName = $newValue; |
|
108 | + } |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Guests don't have custom avatars. |
|
113 | - * |
|
114 | - * @return bool |
|
115 | - */ |
|
116 | - public function isCustomAvatar(): bool { |
|
117 | - return false; |
|
118 | - } |
|
111 | + /** |
|
112 | + * Guests don't have custom avatars. |
|
113 | + * |
|
114 | + * @return bool |
|
115 | + */ |
|
116 | + public function isCustomAvatar(): bool { |
|
117 | + return false; |
|
118 | + } |
|
119 | 119 | } |
@@ -33,75 +33,75 @@ |
||
33 | 33 | */ |
34 | 34 | class GuestAvatarController extends Controller { |
35 | 35 | |
36 | - /** |
|
37 | - * @var ILogger |
|
38 | - */ |
|
39 | - private $logger; |
|
36 | + /** |
|
37 | + * @var ILogger |
|
38 | + */ |
|
39 | + private $logger; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var IAvatarManager |
|
43 | - */ |
|
44 | - private $avatarManager; |
|
41 | + /** |
|
42 | + * @var IAvatarManager |
|
43 | + */ |
|
44 | + private $avatarManager; |
|
45 | 45 | |
46 | - /** |
|
47 | - * GuestAvatarController constructor. |
|
48 | - * |
|
49 | - * @param $appName |
|
50 | - * @param IRequest $request |
|
51 | - * @param IAvatarManager $avatarManager |
|
52 | - * @param ILogger $logger |
|
53 | - */ |
|
54 | - public function __construct( |
|
55 | - $appName, |
|
56 | - IRequest $request, |
|
57 | - IAvatarManager $avatarManager, |
|
58 | - ILogger $logger |
|
59 | - ) { |
|
60 | - parent::__construct($appName, $request); |
|
61 | - $this->avatarManager = $avatarManager; |
|
62 | - $this->logger = $logger; |
|
63 | - } |
|
46 | + /** |
|
47 | + * GuestAvatarController constructor. |
|
48 | + * |
|
49 | + * @param $appName |
|
50 | + * @param IRequest $request |
|
51 | + * @param IAvatarManager $avatarManager |
|
52 | + * @param ILogger $logger |
|
53 | + */ |
|
54 | + public function __construct( |
|
55 | + $appName, |
|
56 | + IRequest $request, |
|
57 | + IAvatarManager $avatarManager, |
|
58 | + ILogger $logger |
|
59 | + ) { |
|
60 | + parent::__construct($appName, $request); |
|
61 | + $this->avatarManager = $avatarManager; |
|
62 | + $this->logger = $logger; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Returns a guest avatar image response. |
|
67 | - * |
|
68 | - * @PublicPage |
|
69 | - * @NoCSRFRequired |
|
70 | - * |
|
71 | - * @param string $guestName The guest name, e.g. "Albert" |
|
72 | - * @param string $size The desired avatar size, e.g. 64 for 64x64px |
|
73 | - * @return FileDisplayResponse|Http\Response |
|
74 | - */ |
|
75 | - public function getAvatar($guestName, $size) { |
|
76 | - $size = (int) $size; |
|
65 | + /** |
|
66 | + * Returns a guest avatar image response. |
|
67 | + * |
|
68 | + * @PublicPage |
|
69 | + * @NoCSRFRequired |
|
70 | + * |
|
71 | + * @param string $guestName The guest name, e.g. "Albert" |
|
72 | + * @param string $size The desired avatar size, e.g. 64 for 64x64px |
|
73 | + * @return FileDisplayResponse|Http\Response |
|
74 | + */ |
|
75 | + public function getAvatar($guestName, $size) { |
|
76 | + $size = (int) $size; |
|
77 | 77 | |
78 | - // min/max size |
|
79 | - if ($size > 2048) { |
|
80 | - $size = 2048; |
|
81 | - } elseif ($size <= 0) { |
|
82 | - $size = 64; |
|
83 | - } |
|
78 | + // min/max size |
|
79 | + if ($size > 2048) { |
|
80 | + $size = 2048; |
|
81 | + } elseif ($size <= 0) { |
|
82 | + $size = 64; |
|
83 | + } |
|
84 | 84 | |
85 | - try { |
|
86 | - $avatar = $this->avatarManager->getGuestAvatar($guestName); |
|
87 | - $avatarFile = $avatar->getFile($size); |
|
85 | + try { |
|
86 | + $avatar = $this->avatarManager->getGuestAvatar($guestName); |
|
87 | + $avatarFile = $avatar->getFile($size); |
|
88 | 88 | |
89 | - $resp = new FileDisplayResponse( |
|
90 | - $avatarFile, |
|
91 | - $avatar->isCustomAvatar() ? Http::STATUS_OK : Http::STATUS_CREATED, |
|
92 | - ['Content-Type' => $avatarFile->getMimeType()] |
|
93 | - ); |
|
94 | - } catch (\Exception $e) { |
|
95 | - $this->logger->error('error while creating guest avatar', [ |
|
96 | - 'err' => $e, |
|
97 | - ]); |
|
98 | - $resp = new Http\Response(); |
|
99 | - $resp->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |
|
100 | - return $resp; |
|
101 | - } |
|
89 | + $resp = new FileDisplayResponse( |
|
90 | + $avatarFile, |
|
91 | + $avatar->isCustomAvatar() ? Http::STATUS_OK : Http::STATUS_CREATED, |
|
92 | + ['Content-Type' => $avatarFile->getMimeType()] |
|
93 | + ); |
|
94 | + } catch (\Exception $e) { |
|
95 | + $this->logger->error('error while creating guest avatar', [ |
|
96 | + 'err' => $e, |
|
97 | + ]); |
|
98 | + $resp = new Http\Response(); |
|
99 | + $resp->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |
|
100 | + return $resp; |
|
101 | + } |
|
102 | 102 | |
103 | - // Cache for 30 minutes |
|
104 | - $resp->cacheFor(1800); |
|
105 | - return $resp; |
|
106 | - } |
|
103 | + // Cache for 30 minutes |
|
104 | + $resp->cacheFor(1800); |
|
105 | + return $resp; |
|
106 | + } |
|
107 | 107 | } |
@@ -38,326 +38,326 @@ |
||
38 | 38 | * @since 8.2.0 |
39 | 39 | */ |
40 | 40 | interface IEvent { |
41 | - /** |
|
42 | - * Set the app of the activity |
|
43 | - * |
|
44 | - * @param string $app |
|
45 | - * @return IEvent |
|
46 | - * @throws \InvalidArgumentException if the app id is invalid |
|
47 | - * @since 8.2.0 |
|
48 | - */ |
|
49 | - public function setApp(string $app): self; |
|
50 | - |
|
51 | - /** |
|
52 | - * Set the type of the activity |
|
53 | - * |
|
54 | - * @param string $type |
|
55 | - * @return IEvent |
|
56 | - * @throws \InvalidArgumentException if the type is invalid |
|
57 | - * @since 8.2.0 |
|
58 | - */ |
|
59 | - public function setType(string $type): self; |
|
60 | - |
|
61 | - /** |
|
62 | - * Set the affected user of the activity |
|
63 | - * |
|
64 | - * @param string $user |
|
65 | - * @return IEvent |
|
66 | - * @throws \InvalidArgumentException if the affected user is invalid |
|
67 | - * @since 8.2.0 |
|
68 | - */ |
|
69 | - public function setAffectedUser(string $user): self; |
|
70 | - |
|
71 | - /** |
|
72 | - * Set the author of the activity |
|
73 | - * |
|
74 | - * @param string $author |
|
75 | - * @return IEvent |
|
76 | - * @throws \InvalidArgumentException if the author is invalid |
|
77 | - * @since 8.2.0 |
|
78 | - */ |
|
79 | - public function setAuthor(string $author): self; |
|
80 | - |
|
81 | - /** |
|
82 | - * Set the author of the activity |
|
83 | - * |
|
84 | - * @param int $timestamp |
|
85 | - * @return IEvent |
|
86 | - * @throws \InvalidArgumentException if the timestamp is invalid |
|
87 | - * @since 8.2.0 |
|
88 | - */ |
|
89 | - public function setTimestamp(int $timestamp): self; |
|
90 | - |
|
91 | - /** |
|
92 | - * Set the subject of the activity |
|
93 | - * |
|
94 | - * @param string $subject |
|
95 | - * @param array $parameters |
|
96 | - * @return IEvent |
|
97 | - * @throws \InvalidArgumentException if the subject or parameters are invalid |
|
98 | - * @since 8.2.0 |
|
99 | - */ |
|
100 | - public function setSubject(string $subject, array $parameters = []): self; |
|
101 | - |
|
102 | - /** |
|
103 | - * Set a parsed subject |
|
104 | - * |
|
105 | - * HTML is not allowed in the parsed subject and will be escaped |
|
106 | - * automatically by the clients. You can use the RichObjectString system |
|
107 | - * provided by the Nextcloud server to highlight important parameters via |
|
108 | - * the setRichSubject method, but make sure, that a plain text message is |
|
109 | - * always set via setParsedSubject, to support clients which can not handle |
|
110 | - * rich strings. |
|
111 | - * |
|
112 | - * See https://github.com/nextcloud/server/issues/1706 for more information. |
|
113 | - * |
|
114 | - * @param string $subject |
|
115 | - * @return $this |
|
116 | - * @throws \InvalidArgumentException if the subject is invalid |
|
117 | - * @since 11.0.0 |
|
118 | - */ |
|
119 | - public function setParsedSubject(string $subject): self; |
|
120 | - |
|
121 | - /** |
|
122 | - * @return string |
|
123 | - * @since 11.0.0 |
|
124 | - */ |
|
125 | - public function getParsedSubject(): string; |
|
126 | - |
|
127 | - /** |
|
128 | - * Set a RichObjectString subject |
|
129 | - * |
|
130 | - * HTML is not allowed in the rich subject and will be escaped automatically |
|
131 | - * by the clients, but you can use the RichObjectString system provided by |
|
132 | - * the Nextcloud server to highlight important parameters. |
|
133 | - * Also make sure, that a plain text subject is always set via |
|
134 | - * setParsedSubject, to support clients which can not handle rich strings. |
|
135 | - * |
|
136 | - * See https://github.com/nextcloud/server/issues/1706 for more information. |
|
137 | - * |
|
138 | - * @param string $subject |
|
139 | - * @param array $parameters |
|
140 | - * @return $this |
|
141 | - * @throws \InvalidArgumentException if the subject or parameters are invalid |
|
142 | - * @since 11.0.0 |
|
143 | - */ |
|
144 | - public function setRichSubject(string $subject, array $parameters = []): self; |
|
145 | - |
|
146 | - /** |
|
147 | - * @return string |
|
148 | - * @since 11.0.0 |
|
149 | - */ |
|
150 | - public function getRichSubject(): string; |
|
151 | - |
|
152 | - /** |
|
153 | - * @return array[] |
|
154 | - * @since 11.0.0 |
|
155 | - */ |
|
156 | - public function getRichSubjectParameters(): array; |
|
157 | - |
|
158 | - /** |
|
159 | - * Set the message of the activity |
|
160 | - * |
|
161 | - * @param string $message |
|
162 | - * @param array $parameters |
|
163 | - * @return IEvent |
|
164 | - * @throws \InvalidArgumentException if the message or parameters are invalid |
|
165 | - * @since 8.2.0 |
|
166 | - */ |
|
167 | - public function setMessage(string $message, array $parameters = []): self; |
|
168 | - |
|
169 | - /** |
|
170 | - * Set a parsed message |
|
171 | - * |
|
172 | - * HTML is not allowed in the parsed message and will be escaped |
|
173 | - * automatically by the clients. You can use the RichObjectString system |
|
174 | - * provided by the Nextcloud server to highlight important parameters via |
|
175 | - * the setRichMessage method, but make sure, that a plain text message is |
|
176 | - * always set via setParsedMessage, to support clients which can not handle |
|
177 | - * rich strings. |
|
178 | - * |
|
179 | - * See https://github.com/nextcloud/server/issues/1706 for more information. |
|
180 | - * |
|
181 | - * @param string $message |
|
182 | - * @return $this |
|
183 | - * @throws \InvalidArgumentException if the message is invalid |
|
184 | - * @since 11.0.0 |
|
185 | - */ |
|
186 | - public function setParsedMessage(string $message): self; |
|
187 | - |
|
188 | - /** |
|
189 | - * @return string |
|
190 | - * @since 11.0.0 |
|
191 | - */ |
|
192 | - public function getParsedMessage(): string; |
|
193 | - |
|
194 | - /** |
|
195 | - * Set a RichObjectString message |
|
196 | - * |
|
197 | - * HTML is not allowed in the rich message and will be escaped automatically |
|
198 | - * by the clients, but you can use the RichObjectString system provided by |
|
199 | - * the Nextcloud server to highlight important parameters. |
|
200 | - * Also make sure, that a plain text message is always set via |
|
201 | - * setParsedMessage, to support clients which can not handle rich strings. |
|
202 | - * |
|
203 | - * See https://github.com/nextcloud/server/issues/1706 for more information. |
|
204 | - * |
|
205 | - * @param string $message |
|
206 | - * @param array $parameters |
|
207 | - * @return $this |
|
208 | - * @throws \InvalidArgumentException if the message or parameters are invalid |
|
209 | - * @since 11.0.0 |
|
210 | - */ |
|
211 | - public function setRichMessage(string $message, array $parameters = []): self; |
|
212 | - |
|
213 | - /** |
|
214 | - * @return string |
|
215 | - * @since 11.0.0 |
|
216 | - */ |
|
217 | - public function getRichMessage(): string; |
|
218 | - |
|
219 | - /** |
|
220 | - * @return array[] |
|
221 | - * @since 11.0.0 |
|
222 | - */ |
|
223 | - public function getRichMessageParameters(): array; |
|
224 | - |
|
225 | - /** |
|
226 | - * Set the object of the activity |
|
227 | - * |
|
228 | - * @param string $objectType |
|
229 | - * @param int $objectId |
|
230 | - * @param string $objectName |
|
231 | - * @return IEvent |
|
232 | - * @throws \InvalidArgumentException if the object is invalid |
|
233 | - * @since 8.2.0 |
|
234 | - */ |
|
235 | - public function setObject(string $objectType, int $objectId, string $objectName = ''): self; |
|
236 | - |
|
237 | - /** |
|
238 | - * Set the link of the activity |
|
239 | - * |
|
240 | - * @param string $link |
|
241 | - * @return IEvent |
|
242 | - * @throws \InvalidArgumentException if the link is invalid |
|
243 | - * @since 8.2.0 |
|
244 | - */ |
|
245 | - public function setLink(string $link): self; |
|
246 | - |
|
247 | - /** |
|
248 | - * @return string |
|
249 | - * @since 8.2.0 |
|
250 | - */ |
|
251 | - public function getApp(): string; |
|
252 | - |
|
253 | - /** |
|
254 | - * @return string |
|
255 | - * @since 8.2.0 |
|
256 | - */ |
|
257 | - public function getType(): string; |
|
258 | - |
|
259 | - /** |
|
260 | - * @return string |
|
261 | - * @since 8.2.0 |
|
262 | - */ |
|
263 | - public function getAffectedUser(): string; |
|
264 | - |
|
265 | - /** |
|
266 | - * @return string |
|
267 | - * @since 8.2.0 |
|
268 | - */ |
|
269 | - public function getAuthor(): string; |
|
270 | - |
|
271 | - /** |
|
272 | - * @return int |
|
273 | - * @since 8.2.0 |
|
274 | - */ |
|
275 | - public function getTimestamp(): int; |
|
276 | - |
|
277 | - /** |
|
278 | - * @return string |
|
279 | - * @since 8.2.0 |
|
280 | - */ |
|
281 | - public function getSubject(): string; |
|
282 | - |
|
283 | - /** |
|
284 | - * @return array |
|
285 | - * @since 8.2.0 |
|
286 | - */ |
|
287 | - public function getSubjectParameters(): array; |
|
288 | - |
|
289 | - /** |
|
290 | - * @return string |
|
291 | - * @since 8.2.0 |
|
292 | - */ |
|
293 | - public function getMessage(): string; |
|
294 | - |
|
295 | - /** |
|
296 | - * @return array |
|
297 | - * @since 8.2.0 |
|
298 | - */ |
|
299 | - public function getMessageParameters(): array; |
|
300 | - |
|
301 | - /** |
|
302 | - * @return string |
|
303 | - * @since 8.2.0 |
|
304 | - */ |
|
305 | - public function getObjectType(): string; |
|
306 | - |
|
307 | - /** |
|
308 | - * @return int |
|
309 | - * @since 8.2.0 |
|
310 | - */ |
|
311 | - public function getObjectId(): int; |
|
312 | - |
|
313 | - /** |
|
314 | - * @return string |
|
315 | - * @since 8.2.0 |
|
316 | - */ |
|
317 | - public function getObjectName(): string; |
|
318 | - |
|
319 | - /** |
|
320 | - * @return string |
|
321 | - * @since 8.2.0 |
|
322 | - */ |
|
323 | - public function getLink(): string; |
|
324 | - |
|
325 | - /** |
|
326 | - * @param string $icon |
|
327 | - * @return $this |
|
328 | - * @throws \InvalidArgumentException if the icon is invalid |
|
329 | - * @since 11.0.0 |
|
330 | - */ |
|
331 | - public function setIcon(string $icon): self; |
|
332 | - |
|
333 | - /** |
|
334 | - * @return string |
|
335 | - * @since 11.0.0 |
|
336 | - */ |
|
337 | - public function getIcon(): string; |
|
338 | - |
|
339 | - /** |
|
340 | - * @param IEvent $child |
|
341 | - * @return $this |
|
342 | - * @since 11.0.0 - Since 15.0.0 returns $this |
|
343 | - */ |
|
344 | - public function setChildEvent(IEvent $child): self; |
|
345 | - |
|
346 | - /** |
|
347 | - * @return IEvent|null |
|
348 | - * @since 11.0.0 |
|
349 | - */ |
|
350 | - public function getChildEvent(); |
|
351 | - |
|
352 | - /** |
|
353 | - * @return bool |
|
354 | - * @since 11.0.0 |
|
355 | - */ |
|
356 | - public function isValid(): bool; |
|
357 | - |
|
358 | - /** |
|
359 | - * @return bool |
|
360 | - * @since 11.0.0 |
|
361 | - */ |
|
362 | - public function isValidParsed(): bool; |
|
41 | + /** |
|
42 | + * Set the app of the activity |
|
43 | + * |
|
44 | + * @param string $app |
|
45 | + * @return IEvent |
|
46 | + * @throws \InvalidArgumentException if the app id is invalid |
|
47 | + * @since 8.2.0 |
|
48 | + */ |
|
49 | + public function setApp(string $app): self; |
|
50 | + |
|
51 | + /** |
|
52 | + * Set the type of the activity |
|
53 | + * |
|
54 | + * @param string $type |
|
55 | + * @return IEvent |
|
56 | + * @throws \InvalidArgumentException if the type is invalid |
|
57 | + * @since 8.2.0 |
|
58 | + */ |
|
59 | + public function setType(string $type): self; |
|
60 | + |
|
61 | + /** |
|
62 | + * Set the affected user of the activity |
|
63 | + * |
|
64 | + * @param string $user |
|
65 | + * @return IEvent |
|
66 | + * @throws \InvalidArgumentException if the affected user is invalid |
|
67 | + * @since 8.2.0 |
|
68 | + */ |
|
69 | + public function setAffectedUser(string $user): self; |
|
70 | + |
|
71 | + /** |
|
72 | + * Set the author of the activity |
|
73 | + * |
|
74 | + * @param string $author |
|
75 | + * @return IEvent |
|
76 | + * @throws \InvalidArgumentException if the author is invalid |
|
77 | + * @since 8.2.0 |
|
78 | + */ |
|
79 | + public function setAuthor(string $author): self; |
|
80 | + |
|
81 | + /** |
|
82 | + * Set the author of the activity |
|
83 | + * |
|
84 | + * @param int $timestamp |
|
85 | + * @return IEvent |
|
86 | + * @throws \InvalidArgumentException if the timestamp is invalid |
|
87 | + * @since 8.2.0 |
|
88 | + */ |
|
89 | + public function setTimestamp(int $timestamp): self; |
|
90 | + |
|
91 | + /** |
|
92 | + * Set the subject of the activity |
|
93 | + * |
|
94 | + * @param string $subject |
|
95 | + * @param array $parameters |
|
96 | + * @return IEvent |
|
97 | + * @throws \InvalidArgumentException if the subject or parameters are invalid |
|
98 | + * @since 8.2.0 |
|
99 | + */ |
|
100 | + public function setSubject(string $subject, array $parameters = []): self; |
|
101 | + |
|
102 | + /** |
|
103 | + * Set a parsed subject |
|
104 | + * |
|
105 | + * HTML is not allowed in the parsed subject and will be escaped |
|
106 | + * automatically by the clients. You can use the RichObjectString system |
|
107 | + * provided by the Nextcloud server to highlight important parameters via |
|
108 | + * the setRichSubject method, but make sure, that a plain text message is |
|
109 | + * always set via setParsedSubject, to support clients which can not handle |
|
110 | + * rich strings. |
|
111 | + * |
|
112 | + * See https://github.com/nextcloud/server/issues/1706 for more information. |
|
113 | + * |
|
114 | + * @param string $subject |
|
115 | + * @return $this |
|
116 | + * @throws \InvalidArgumentException if the subject is invalid |
|
117 | + * @since 11.0.0 |
|
118 | + */ |
|
119 | + public function setParsedSubject(string $subject): self; |
|
120 | + |
|
121 | + /** |
|
122 | + * @return string |
|
123 | + * @since 11.0.0 |
|
124 | + */ |
|
125 | + public function getParsedSubject(): string; |
|
126 | + |
|
127 | + /** |
|
128 | + * Set a RichObjectString subject |
|
129 | + * |
|
130 | + * HTML is not allowed in the rich subject and will be escaped automatically |
|
131 | + * by the clients, but you can use the RichObjectString system provided by |
|
132 | + * the Nextcloud server to highlight important parameters. |
|
133 | + * Also make sure, that a plain text subject is always set via |
|
134 | + * setParsedSubject, to support clients which can not handle rich strings. |
|
135 | + * |
|
136 | + * See https://github.com/nextcloud/server/issues/1706 for more information. |
|
137 | + * |
|
138 | + * @param string $subject |
|
139 | + * @param array $parameters |
|
140 | + * @return $this |
|
141 | + * @throws \InvalidArgumentException if the subject or parameters are invalid |
|
142 | + * @since 11.0.0 |
|
143 | + */ |
|
144 | + public function setRichSubject(string $subject, array $parameters = []): self; |
|
145 | + |
|
146 | + /** |
|
147 | + * @return string |
|
148 | + * @since 11.0.0 |
|
149 | + */ |
|
150 | + public function getRichSubject(): string; |
|
151 | + |
|
152 | + /** |
|
153 | + * @return array[] |
|
154 | + * @since 11.0.0 |
|
155 | + */ |
|
156 | + public function getRichSubjectParameters(): array; |
|
157 | + |
|
158 | + /** |
|
159 | + * Set the message of the activity |
|
160 | + * |
|
161 | + * @param string $message |
|
162 | + * @param array $parameters |
|
163 | + * @return IEvent |
|
164 | + * @throws \InvalidArgumentException if the message or parameters are invalid |
|
165 | + * @since 8.2.0 |
|
166 | + */ |
|
167 | + public function setMessage(string $message, array $parameters = []): self; |
|
168 | + |
|
169 | + /** |
|
170 | + * Set a parsed message |
|
171 | + * |
|
172 | + * HTML is not allowed in the parsed message and will be escaped |
|
173 | + * automatically by the clients. You can use the RichObjectString system |
|
174 | + * provided by the Nextcloud server to highlight important parameters via |
|
175 | + * the setRichMessage method, but make sure, that a plain text message is |
|
176 | + * always set via setParsedMessage, to support clients which can not handle |
|
177 | + * rich strings. |
|
178 | + * |
|
179 | + * See https://github.com/nextcloud/server/issues/1706 for more information. |
|
180 | + * |
|
181 | + * @param string $message |
|
182 | + * @return $this |
|
183 | + * @throws \InvalidArgumentException if the message is invalid |
|
184 | + * @since 11.0.0 |
|
185 | + */ |
|
186 | + public function setParsedMessage(string $message): self; |
|
187 | + |
|
188 | + /** |
|
189 | + * @return string |
|
190 | + * @since 11.0.0 |
|
191 | + */ |
|
192 | + public function getParsedMessage(): string; |
|
193 | + |
|
194 | + /** |
|
195 | + * Set a RichObjectString message |
|
196 | + * |
|
197 | + * HTML is not allowed in the rich message and will be escaped automatically |
|
198 | + * by the clients, but you can use the RichObjectString system provided by |
|
199 | + * the Nextcloud server to highlight important parameters. |
|
200 | + * Also make sure, that a plain text message is always set via |
|
201 | + * setParsedMessage, to support clients which can not handle rich strings. |
|
202 | + * |
|
203 | + * See https://github.com/nextcloud/server/issues/1706 for more information. |
|
204 | + * |
|
205 | + * @param string $message |
|
206 | + * @param array $parameters |
|
207 | + * @return $this |
|
208 | + * @throws \InvalidArgumentException if the message or parameters are invalid |
|
209 | + * @since 11.0.0 |
|
210 | + */ |
|
211 | + public function setRichMessage(string $message, array $parameters = []): self; |
|
212 | + |
|
213 | + /** |
|
214 | + * @return string |
|
215 | + * @since 11.0.0 |
|
216 | + */ |
|
217 | + public function getRichMessage(): string; |
|
218 | + |
|
219 | + /** |
|
220 | + * @return array[] |
|
221 | + * @since 11.0.0 |
|
222 | + */ |
|
223 | + public function getRichMessageParameters(): array; |
|
224 | + |
|
225 | + /** |
|
226 | + * Set the object of the activity |
|
227 | + * |
|
228 | + * @param string $objectType |
|
229 | + * @param int $objectId |
|
230 | + * @param string $objectName |
|
231 | + * @return IEvent |
|
232 | + * @throws \InvalidArgumentException if the object is invalid |
|
233 | + * @since 8.2.0 |
|
234 | + */ |
|
235 | + public function setObject(string $objectType, int $objectId, string $objectName = ''): self; |
|
236 | + |
|
237 | + /** |
|
238 | + * Set the link of the activity |
|
239 | + * |
|
240 | + * @param string $link |
|
241 | + * @return IEvent |
|
242 | + * @throws \InvalidArgumentException if the link is invalid |
|
243 | + * @since 8.2.0 |
|
244 | + */ |
|
245 | + public function setLink(string $link): self; |
|
246 | + |
|
247 | + /** |
|
248 | + * @return string |
|
249 | + * @since 8.2.0 |
|
250 | + */ |
|
251 | + public function getApp(): string; |
|
252 | + |
|
253 | + /** |
|
254 | + * @return string |
|
255 | + * @since 8.2.0 |
|
256 | + */ |
|
257 | + public function getType(): string; |
|
258 | + |
|
259 | + /** |
|
260 | + * @return string |
|
261 | + * @since 8.2.0 |
|
262 | + */ |
|
263 | + public function getAffectedUser(): string; |
|
264 | + |
|
265 | + /** |
|
266 | + * @return string |
|
267 | + * @since 8.2.0 |
|
268 | + */ |
|
269 | + public function getAuthor(): string; |
|
270 | + |
|
271 | + /** |
|
272 | + * @return int |
|
273 | + * @since 8.2.0 |
|
274 | + */ |
|
275 | + public function getTimestamp(): int; |
|
276 | + |
|
277 | + /** |
|
278 | + * @return string |
|
279 | + * @since 8.2.0 |
|
280 | + */ |
|
281 | + public function getSubject(): string; |
|
282 | + |
|
283 | + /** |
|
284 | + * @return array |
|
285 | + * @since 8.2.0 |
|
286 | + */ |
|
287 | + public function getSubjectParameters(): array; |
|
288 | + |
|
289 | + /** |
|
290 | + * @return string |
|
291 | + * @since 8.2.0 |
|
292 | + */ |
|
293 | + public function getMessage(): string; |
|
294 | + |
|
295 | + /** |
|
296 | + * @return array |
|
297 | + * @since 8.2.0 |
|
298 | + */ |
|
299 | + public function getMessageParameters(): array; |
|
300 | + |
|
301 | + /** |
|
302 | + * @return string |
|
303 | + * @since 8.2.0 |
|
304 | + */ |
|
305 | + public function getObjectType(): string; |
|
306 | + |
|
307 | + /** |
|
308 | + * @return int |
|
309 | + * @since 8.2.0 |
|
310 | + */ |
|
311 | + public function getObjectId(): int; |
|
312 | + |
|
313 | + /** |
|
314 | + * @return string |
|
315 | + * @since 8.2.0 |
|
316 | + */ |
|
317 | + public function getObjectName(): string; |
|
318 | + |
|
319 | + /** |
|
320 | + * @return string |
|
321 | + * @since 8.2.0 |
|
322 | + */ |
|
323 | + public function getLink(): string; |
|
324 | + |
|
325 | + /** |
|
326 | + * @param string $icon |
|
327 | + * @return $this |
|
328 | + * @throws \InvalidArgumentException if the icon is invalid |
|
329 | + * @since 11.0.0 |
|
330 | + */ |
|
331 | + public function setIcon(string $icon): self; |
|
332 | + |
|
333 | + /** |
|
334 | + * @return string |
|
335 | + * @since 11.0.0 |
|
336 | + */ |
|
337 | + public function getIcon(): string; |
|
338 | + |
|
339 | + /** |
|
340 | + * @param IEvent $child |
|
341 | + * @return $this |
|
342 | + * @since 11.0.0 - Since 15.0.0 returns $this |
|
343 | + */ |
|
344 | + public function setChildEvent(IEvent $child): self; |
|
345 | + |
|
346 | + /** |
|
347 | + * @return IEvent|null |
|
348 | + * @since 11.0.0 |
|
349 | + */ |
|
350 | + public function getChildEvent(); |
|
351 | + |
|
352 | + /** |
|
353 | + * @return bool |
|
354 | + * @since 11.0.0 |
|
355 | + */ |
|
356 | + public function isValid(): bool; |
|
357 | + |
|
358 | + /** |
|
359 | + * @return bool |
|
360 | + * @since 11.0.0 |
|
361 | + */ |
|
362 | + public function isValidParsed(): bool; |
|
363 | 363 | } |
@@ -30,10 +30,10 @@ |
||
30 | 30 | * @since 16.0.0 |
31 | 31 | */ |
32 | 32 | interface IConfigHandler { |
33 | - /** |
|
34 | - * @param mixed $optionValue |
|
35 | - * @return mixed the same type as $optionValue |
|
36 | - * @since 16.0.0 |
|
37 | - */ |
|
38 | - public function handle($optionValue); |
|
33 | + /** |
|
34 | + * @param mixed $optionValue |
|
35 | + * @return mixed the same type as $optionValue |
|
36 | + * @since 16.0.0 |
|
37 | + */ |
|
38 | + public function handle($optionValue); |
|
39 | 39 | } |
@@ -28,47 +28,47 @@ |
||
28 | 28 | |
29 | 29 | class GenerateBirthdayCalendarBackgroundJob extends QueuedJob { |
30 | 30 | |
31 | - /** @var BirthdayService */ |
|
32 | - private $birthdayService; |
|
31 | + /** @var BirthdayService */ |
|
32 | + private $birthdayService; |
|
33 | 33 | |
34 | - /** @var IConfig */ |
|
35 | - private $config; |
|
34 | + /** @var IConfig */ |
|
35 | + private $config; |
|
36 | 36 | |
37 | - /** |
|
38 | - * GenerateAllBirthdayCalendarsBackgroundJob constructor. |
|
39 | - * |
|
40 | - * @param BirthdayService $birthdayService |
|
41 | - * @param IConfig $config |
|
42 | - */ |
|
43 | - public function __construct(BirthdayService $birthdayService, |
|
44 | - IConfig $config) { |
|
45 | - $this->birthdayService = $birthdayService; |
|
46 | - $this->config = $config; |
|
47 | - } |
|
37 | + /** |
|
38 | + * GenerateAllBirthdayCalendarsBackgroundJob constructor. |
|
39 | + * |
|
40 | + * @param BirthdayService $birthdayService |
|
41 | + * @param IConfig $config |
|
42 | + */ |
|
43 | + public function __construct(BirthdayService $birthdayService, |
|
44 | + IConfig $config) { |
|
45 | + $this->birthdayService = $birthdayService; |
|
46 | + $this->config = $config; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param array $arguments |
|
51 | - */ |
|
52 | - public function run($arguments) { |
|
53 | - $userId = $arguments['userId']; |
|
54 | - $purgeBeforeGenerating = $arguments['purgeBeforeGenerating'] ?? false; |
|
49 | + /** |
|
50 | + * @param array $arguments |
|
51 | + */ |
|
52 | + public function run($arguments) { |
|
53 | + $userId = $arguments['userId']; |
|
54 | + $purgeBeforeGenerating = $arguments['purgeBeforeGenerating'] ?? false; |
|
55 | 55 | |
56 | - // make sure admin didn't change his mind |
|
57 | - $isGloballyEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'); |
|
58 | - if ($isGloballyEnabled !== 'yes') { |
|
59 | - return; |
|
60 | - } |
|
56 | + // make sure admin didn't change his mind |
|
57 | + $isGloballyEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'); |
|
58 | + if ($isGloballyEnabled !== 'yes') { |
|
59 | + return; |
|
60 | + } |
|
61 | 61 | |
62 | - // did the user opt out? |
|
63 | - $isUserEnabled = $this->config->getUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes'); |
|
64 | - if ($isUserEnabled !== 'yes') { |
|
65 | - return; |
|
66 | - } |
|
62 | + // did the user opt out? |
|
63 | + $isUserEnabled = $this->config->getUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes'); |
|
64 | + if ($isUserEnabled !== 'yes') { |
|
65 | + return; |
|
66 | + } |
|
67 | 67 | |
68 | - if ($purgeBeforeGenerating) { |
|
69 | - $this->birthdayService->resetForUser($userId); |
|
70 | - } |
|
68 | + if ($purgeBeforeGenerating) { |
|
69 | + $this->birthdayService->resetForUser($userId); |
|
70 | + } |
|
71 | 71 | |
72 | - $this->birthdayService->syncUser($userId); |
|
73 | - } |
|
72 | + $this->birthdayService->syncUser($userId); |
|
73 | + } |
|
74 | 74 | } |