@@ -23,10 +23,10 @@ |
||
23 | 23 | namespace OC\Preview; |
24 | 24 | |
25 | 25 | class XBitmap extends Image { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getMimeType(): string { |
|
30 | - return '/image\/x-xbitmap/'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getMimeType(): string { |
|
30 | + return '/image\/x-xbitmap/'; |
|
31 | + } |
|
32 | 32 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | namespace OC\Preview; |
24 | 24 | |
25 | 25 | class PNG extends Image { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getMimeType(): string { |
|
30 | - return '/image\/png/'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getMimeType(): string { |
|
30 | + return '/image\/png/'; |
|
31 | + } |
|
32 | 32 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | |
24 | 24 | //.docm, .dotm, .xls(m), .xlt(m), .xla(m), .ppt(m), .pot(m), .pps(m), .ppa(m) |
25 | 25 | class MSOffice2003 extends Office { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getMimeType(): string { |
|
30 | - return '/application\/vnd.ms-.*/'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getMimeType(): string { |
|
30 | + return '/application\/vnd.ms-.*/'; |
|
31 | + } |
|
32 | 32 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | namespace OC\Preview; |
24 | 24 | |
25 | 25 | class JPEG extends Image { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getMimeType(): string { |
|
30 | - return '/image\/jpeg/'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getMimeType(): string { |
|
30 | + return '/image\/jpeg/'; |
|
31 | + } |
|
32 | 32 | } |
@@ -31,16 +31,16 @@ |
||
31 | 31 | |
32 | 32 | abstract class ARemoteWipeEvent extends Event { |
33 | 33 | |
34 | - /** @var IToken */ |
|
35 | - private $token; |
|
34 | + /** @var IToken */ |
|
35 | + private $token; |
|
36 | 36 | |
37 | - public function __construct(IToken $token) { |
|
38 | - parent::__construct(); |
|
39 | - $this->token = $token; |
|
40 | - } |
|
37 | + public function __construct(IToken $token) { |
|
38 | + parent::__construct(); |
|
39 | + $this->token = $token; |
|
40 | + } |
|
41 | 41 | |
42 | - public function getToken(): IToken { |
|
43 | - return $this->token; |
|
44 | - } |
|
42 | + public function getToken(): IToken { |
|
43 | + return $this->token; |
|
44 | + } |
|
45 | 45 | |
46 | 46 | } |
@@ -31,23 +31,23 @@ |
||
31 | 31 | * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy |
32 | 32 | */ |
33 | 33 | interface IContentSecurityPolicyManager { |
34 | - /** |
|
35 | - * Allows to inject something into the default content policy. This is for |
|
36 | - * example useful when you're injecting Javascript code into a view belonging |
|
37 | - * to another controller and cannot modify its Content-Security-Policy itself. |
|
38 | - * Note that the adjustment is only applied to applications that use AppFramework |
|
39 | - * controllers. |
|
40 | - * |
|
41 | - * To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`, |
|
42 | - * $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`. |
|
43 | - * |
|
44 | - * WARNING: Using this API incorrectly may make the instance more insecure. |
|
45 | - * Do think twice before adding whitelisting resources. Please do also note |
|
46 | - * that it is not possible to use the `disallowXYZ` functions. |
|
47 | - * |
|
48 | - * @param EmptyContentSecurityPolicy $policy |
|
49 | - * @since 9.0.0 |
|
50 | - * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy |
|
51 | - */ |
|
52 | - public function addDefaultPolicy(EmptyContentSecurityPolicy $policy); |
|
34 | + /** |
|
35 | + * Allows to inject something into the default content policy. This is for |
|
36 | + * example useful when you're injecting Javascript code into a view belonging |
|
37 | + * to another controller and cannot modify its Content-Security-Policy itself. |
|
38 | + * Note that the adjustment is only applied to applications that use AppFramework |
|
39 | + * controllers. |
|
40 | + * |
|
41 | + * To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`, |
|
42 | + * $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`. |
|
43 | + * |
|
44 | + * WARNING: Using this API incorrectly may make the instance more insecure. |
|
45 | + * Do think twice before adding whitelisting resources. Please do also note |
|
46 | + * that it is not possible to use the `disallowXYZ` functions. |
|
47 | + * |
|
48 | + * @param EmptyContentSecurityPolicy $policy |
|
49 | + * @since 9.0.0 |
|
50 | + * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy |
|
51 | + */ |
|
52 | + public function addDefaultPolicy(EmptyContentSecurityPolicy $policy); |
|
53 | 53 | } |
@@ -31,9 +31,9 @@ |
||
31 | 31 | * @since 17.0.0 |
32 | 32 | */ |
33 | 33 | interface IVersionedPreviewFile { |
34 | - /** |
|
35 | - * @return string |
|
36 | - * @since 17.0.0 |
|
37 | - */ |
|
38 | - public function getPreviewVersion(): string; |
|
34 | + /** |
|
35 | + * @return string |
|
36 | + * @since 17.0.0 |
|
37 | + */ |
|
38 | + public function getPreviewVersion(): string; |
|
39 | 39 | } |
@@ -26,9 +26,9 @@ |
||
26 | 26 | |
27 | 27 | interface IWipeableToken extends IToken { |
28 | 28 | |
29 | - /** |
|
30 | - * Mark the token for remote wipe |
|
31 | - */ |
|
32 | - public function wipe(): void; |
|
29 | + /** |
|
30 | + * Mark the token for remote wipe |
|
31 | + */ |
|
32 | + public function wipe(): void; |
|
33 | 33 | |
34 | 34 | } |
@@ -34,132 +34,132 @@ |
||
34 | 34 | |
35 | 35 | class AppConfigController extends OCSController { |
36 | 36 | |
37 | - /** @var IConfig */ |
|
38 | - protected $config; |
|
39 | - |
|
40 | - /** @var IAppConfig */ |
|
41 | - protected $appConfig; |
|
42 | - |
|
43 | - /** |
|
44 | - * @param string $appName |
|
45 | - * @param IRequest $request |
|
46 | - * @param IConfig $config |
|
47 | - * @param IAppConfig $appConfig |
|
48 | - */ |
|
49 | - public function __construct(string $appName, |
|
50 | - IRequest $request, |
|
51 | - IConfig $config, |
|
52 | - IAppConfig $appConfig) { |
|
53 | - parent::__construct($appName, $request); |
|
54 | - $this->config = $config; |
|
55 | - $this->appConfig = $appConfig; |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * @return DataResponse |
|
60 | - */ |
|
61 | - public function getApps(): DataResponse { |
|
62 | - return new DataResponse([ |
|
63 | - 'data' => $this->appConfig->getApps(), |
|
64 | - ]); |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * @param string $app |
|
69 | - * @return DataResponse |
|
70 | - */ |
|
71 | - public function getKeys(string $app): DataResponse { |
|
72 | - try { |
|
73 | - $this->verifyAppId($app); |
|
74 | - } catch (\InvalidArgumentException $e) { |
|
75 | - return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN); |
|
76 | - } |
|
77 | - return new DataResponse([ |
|
78 | - 'data' => $this->config->getAppKeys($app), |
|
79 | - ]); |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * @param string $app |
|
84 | - * @param string $key |
|
85 | - * @param string $defaultValue |
|
86 | - * @return DataResponse |
|
87 | - */ |
|
88 | - public function getValue(string $app, string $key, string $defaultValue = ''): DataResponse { |
|
89 | - try { |
|
90 | - $this->verifyAppId($app); |
|
91 | - } catch (\InvalidArgumentException $e) { |
|
92 | - return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN); |
|
93 | - } |
|
94 | - return new DataResponse([ |
|
95 | - 'data' => $this->config->getAppValue($app, $key, $defaultValue), |
|
96 | - ]); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @PasswordConfirmationRequired |
|
101 | - * @param string $app |
|
102 | - * @param string $key |
|
103 | - * @param string $value |
|
104 | - * @return DataResponse |
|
105 | - */ |
|
106 | - public function setValue(string $app, string $key, string $value): DataResponse { |
|
107 | - try { |
|
108 | - $this->verifyAppId($app); |
|
109 | - $this->verifyConfigKey($app, $key, $value); |
|
110 | - } catch (\InvalidArgumentException $e) { |
|
111 | - return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN); |
|
112 | - } |
|
113 | - |
|
114 | - $this->config->setAppValue($app, $key, $value); |
|
115 | - return new DataResponse(); |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @PasswordConfirmationRequired |
|
120 | - * @param string $app |
|
121 | - * @param string $key |
|
122 | - * @return DataResponse |
|
123 | - */ |
|
124 | - public function deleteKey(string $app, string $key): DataResponse { |
|
125 | - try { |
|
126 | - $this->verifyAppId($app); |
|
127 | - $this->verifyConfigKey($app, $key, ''); |
|
128 | - } catch (\InvalidArgumentException $e) { |
|
129 | - return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN); |
|
130 | - } |
|
131 | - |
|
132 | - $this->config->deleteAppValue($app, $key); |
|
133 | - return new DataResponse(); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * @param string $app |
|
138 | - * @throws \InvalidArgumentException |
|
139 | - */ |
|
140 | - protected function verifyAppId(string $app) { |
|
141 | - if (\OC_App::cleanAppId($app) !== $app) { |
|
142 | - throw new \InvalidArgumentException('Invalid app id given'); |
|
143 | - } |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * @param string $app |
|
148 | - * @param string $key |
|
149 | - * @param string $value |
|
150 | - * @throws \InvalidArgumentException |
|
151 | - */ |
|
152 | - protected function verifyConfigKey(string $app, string $key, string $value) { |
|
153 | - if (in_array($key, ['installed_version', 'enabled', 'types'])) { |
|
154 | - throw new \InvalidArgumentException('The given key can not be set'); |
|
155 | - } |
|
156 | - |
|
157 | - if ($app === 'core' && $key === 'encryption_enabled' && $value !== 'yes') { |
|
158 | - throw new \InvalidArgumentException('The given key can not be set'); |
|
159 | - } |
|
160 | - |
|
161 | - if ($app === 'core' && (strpos($key, 'public_') === 0 || strpos($key, 'remote_') === 0)) { |
|
162 | - throw new \InvalidArgumentException('The given key can not be set'); |
|
163 | - } |
|
164 | - } |
|
37 | + /** @var IConfig */ |
|
38 | + protected $config; |
|
39 | + |
|
40 | + /** @var IAppConfig */ |
|
41 | + protected $appConfig; |
|
42 | + |
|
43 | + /** |
|
44 | + * @param string $appName |
|
45 | + * @param IRequest $request |
|
46 | + * @param IConfig $config |
|
47 | + * @param IAppConfig $appConfig |
|
48 | + */ |
|
49 | + public function __construct(string $appName, |
|
50 | + IRequest $request, |
|
51 | + IConfig $config, |
|
52 | + IAppConfig $appConfig) { |
|
53 | + parent::__construct($appName, $request); |
|
54 | + $this->config = $config; |
|
55 | + $this->appConfig = $appConfig; |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * @return DataResponse |
|
60 | + */ |
|
61 | + public function getApps(): DataResponse { |
|
62 | + return new DataResponse([ |
|
63 | + 'data' => $this->appConfig->getApps(), |
|
64 | + ]); |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * @param string $app |
|
69 | + * @return DataResponse |
|
70 | + */ |
|
71 | + public function getKeys(string $app): DataResponse { |
|
72 | + try { |
|
73 | + $this->verifyAppId($app); |
|
74 | + } catch (\InvalidArgumentException $e) { |
|
75 | + return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN); |
|
76 | + } |
|
77 | + return new DataResponse([ |
|
78 | + 'data' => $this->config->getAppKeys($app), |
|
79 | + ]); |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * @param string $app |
|
84 | + * @param string $key |
|
85 | + * @param string $defaultValue |
|
86 | + * @return DataResponse |
|
87 | + */ |
|
88 | + public function getValue(string $app, string $key, string $defaultValue = ''): DataResponse { |
|
89 | + try { |
|
90 | + $this->verifyAppId($app); |
|
91 | + } catch (\InvalidArgumentException $e) { |
|
92 | + return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN); |
|
93 | + } |
|
94 | + return new DataResponse([ |
|
95 | + 'data' => $this->config->getAppValue($app, $key, $defaultValue), |
|
96 | + ]); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @PasswordConfirmationRequired |
|
101 | + * @param string $app |
|
102 | + * @param string $key |
|
103 | + * @param string $value |
|
104 | + * @return DataResponse |
|
105 | + */ |
|
106 | + public function setValue(string $app, string $key, string $value): DataResponse { |
|
107 | + try { |
|
108 | + $this->verifyAppId($app); |
|
109 | + $this->verifyConfigKey($app, $key, $value); |
|
110 | + } catch (\InvalidArgumentException $e) { |
|
111 | + return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN); |
|
112 | + } |
|
113 | + |
|
114 | + $this->config->setAppValue($app, $key, $value); |
|
115 | + return new DataResponse(); |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @PasswordConfirmationRequired |
|
120 | + * @param string $app |
|
121 | + * @param string $key |
|
122 | + * @return DataResponse |
|
123 | + */ |
|
124 | + public function deleteKey(string $app, string $key): DataResponse { |
|
125 | + try { |
|
126 | + $this->verifyAppId($app); |
|
127 | + $this->verifyConfigKey($app, $key, ''); |
|
128 | + } catch (\InvalidArgumentException $e) { |
|
129 | + return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN); |
|
130 | + } |
|
131 | + |
|
132 | + $this->config->deleteAppValue($app, $key); |
|
133 | + return new DataResponse(); |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * @param string $app |
|
138 | + * @throws \InvalidArgumentException |
|
139 | + */ |
|
140 | + protected function verifyAppId(string $app) { |
|
141 | + if (\OC_App::cleanAppId($app) !== $app) { |
|
142 | + throw new \InvalidArgumentException('Invalid app id given'); |
|
143 | + } |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * @param string $app |
|
148 | + * @param string $key |
|
149 | + * @param string $value |
|
150 | + * @throws \InvalidArgumentException |
|
151 | + */ |
|
152 | + protected function verifyConfigKey(string $app, string $key, string $value) { |
|
153 | + if (in_array($key, ['installed_version', 'enabled', 'types'])) { |
|
154 | + throw new \InvalidArgumentException('The given key can not be set'); |
|
155 | + } |
|
156 | + |
|
157 | + if ($app === 'core' && $key === 'encryption_enabled' && $value !== 'yes') { |
|
158 | + throw new \InvalidArgumentException('The given key can not be set'); |
|
159 | + } |
|
160 | + |
|
161 | + if ($app === 'core' && (strpos($key, 'public_') === 0 || strpos($key, 'remote_') === 0)) { |
|
162 | + throw new \InvalidArgumentException('The given key can not be set'); |
|
163 | + } |
|
164 | + } |
|
165 | 165 | } |