@@ -32,10 +32,10 @@ |
||
32 | 32 | */ |
33 | 33 | class UnsupportedLimitOnInitialSyncException extends InsufficientStorage { |
34 | 34 | |
35 | - /** |
|
36 | - * @inheritDoc |
|
37 | - */ |
|
38 | - public function serialize(Server $server, \DOMElement $errorNode) { |
|
39 | - $errorNode->appendChild($errorNode->ownerDocument->createElementNS('DAV:', 'd:number-of-matches-within-limits')); |
|
40 | - } |
|
35 | + /** |
|
36 | + * @inheritDoc |
|
37 | + */ |
|
38 | + public function serialize(Server $server, \DOMElement $errorNode) { |
|
39 | + $errorNode->appendChild($errorNode->ownerDocument->createElementNS('DAV:', 'd:number-of-matches-within-limits')); |
|
40 | + } |
|
41 | 41 | } |
@@ -42,45 +42,45 @@ |
||
42 | 42 | * @deprecated 17.0.0 |
43 | 43 | */ |
44 | 44 | class StrictContentSecurityPolicy extends EmptyContentSecurityPolicy { |
45 | - /** @var bool Whether inline JS snippets are allowed */ |
|
46 | - protected $inlineScriptAllowed = false; |
|
47 | - /** @var bool Whether eval in JS scripts is allowed */ |
|
48 | - protected $evalScriptAllowed = false; |
|
49 | - /** @var array Domains from which scripts can get loaded */ |
|
50 | - protected $allowedScriptDomains = [ |
|
51 | - '\'self\'', |
|
52 | - ]; |
|
53 | - /** @var bool Whether inline CSS is allowed */ |
|
54 | - protected $inlineStyleAllowed = false; |
|
55 | - /** @var array Domains from which CSS can get loaded */ |
|
56 | - protected $allowedStyleDomains = [ |
|
57 | - '\'self\'', |
|
58 | - ]; |
|
59 | - /** @var array Domains from which images can get loaded */ |
|
60 | - protected $allowedImageDomains = [ |
|
61 | - '\'self\'', |
|
62 | - 'data:', |
|
63 | - 'blob:', |
|
64 | - ]; |
|
65 | - /** @var array Domains to which connections can be done */ |
|
66 | - protected $allowedConnectDomains = [ |
|
67 | - '\'self\'', |
|
68 | - ]; |
|
69 | - /** @var array Domains from which media elements can be loaded */ |
|
70 | - protected $allowedMediaDomains = [ |
|
71 | - '\'self\'', |
|
72 | - ]; |
|
73 | - /** @var array Domains from which object elements can be loaded */ |
|
74 | - protected $allowedObjectDomains = []; |
|
75 | - /** @var array Domains from which iframes can be loaded */ |
|
76 | - protected $allowedFrameDomains = []; |
|
77 | - /** @var array Domains from which fonts can be loaded */ |
|
78 | - protected $allowedFontDomains = [ |
|
79 | - '\'self\'', |
|
80 | - ]; |
|
81 | - /** @var array Domains from which web-workers and nested browsing content can load elements */ |
|
82 | - protected $allowedChildSrcDomains = []; |
|
45 | + /** @var bool Whether inline JS snippets are allowed */ |
|
46 | + protected $inlineScriptAllowed = false; |
|
47 | + /** @var bool Whether eval in JS scripts is allowed */ |
|
48 | + protected $evalScriptAllowed = false; |
|
49 | + /** @var array Domains from which scripts can get loaded */ |
|
50 | + protected $allowedScriptDomains = [ |
|
51 | + '\'self\'', |
|
52 | + ]; |
|
53 | + /** @var bool Whether inline CSS is allowed */ |
|
54 | + protected $inlineStyleAllowed = false; |
|
55 | + /** @var array Domains from which CSS can get loaded */ |
|
56 | + protected $allowedStyleDomains = [ |
|
57 | + '\'self\'', |
|
58 | + ]; |
|
59 | + /** @var array Domains from which images can get loaded */ |
|
60 | + protected $allowedImageDomains = [ |
|
61 | + '\'self\'', |
|
62 | + 'data:', |
|
63 | + 'blob:', |
|
64 | + ]; |
|
65 | + /** @var array Domains to which connections can be done */ |
|
66 | + protected $allowedConnectDomains = [ |
|
67 | + '\'self\'', |
|
68 | + ]; |
|
69 | + /** @var array Domains from which media elements can be loaded */ |
|
70 | + protected $allowedMediaDomains = [ |
|
71 | + '\'self\'', |
|
72 | + ]; |
|
73 | + /** @var array Domains from which object elements can be loaded */ |
|
74 | + protected $allowedObjectDomains = []; |
|
75 | + /** @var array Domains from which iframes can be loaded */ |
|
76 | + protected $allowedFrameDomains = []; |
|
77 | + /** @var array Domains from which fonts can be loaded */ |
|
78 | + protected $allowedFontDomains = [ |
|
79 | + '\'self\'', |
|
80 | + ]; |
|
81 | + /** @var array Domains from which web-workers and nested browsing content can load elements */ |
|
82 | + protected $allowedChildSrcDomains = []; |
|
83 | 83 | |
84 | - /** @var array Domains which can embed this Nextcloud instance */ |
|
85 | - protected $allowedFrameAncestors = []; |
|
84 | + /** @var array Domains which can embed this Nextcloud instance */ |
|
85 | + protected $allowedFrameAncestors = []; |
|
86 | 86 | } |
@@ -37,23 +37,23 @@ |
||
37 | 37 | * @since 17.0.0 |
38 | 38 | */ |
39 | 39 | class FeaturePolicy extends EmptyFeaturePolicy { |
40 | - protected $autoplayDomains = [ |
|
41 | - '\'self\'', |
|
42 | - ]; |
|
40 | + protected $autoplayDomains = [ |
|
41 | + '\'self\'', |
|
42 | + ]; |
|
43 | 43 | |
44 | - /** @var string[] of allowed domains that can access the camera */ |
|
45 | - protected $cameraDomains = []; |
|
44 | + /** @var string[] of allowed domains that can access the camera */ |
|
45 | + protected $cameraDomains = []; |
|
46 | 46 | |
47 | - protected $fullscreenDomains = [ |
|
48 | - '\'self\'', |
|
49 | - ]; |
|
47 | + protected $fullscreenDomains = [ |
|
48 | + '\'self\'', |
|
49 | + ]; |
|
50 | 50 | |
51 | - /** @var string[] of allowed domains that can use the geolocation of the device */ |
|
52 | - protected $geolocationDomains = []; |
|
51 | + /** @var string[] of allowed domains that can use the geolocation of the device */ |
|
52 | + protected $geolocationDomains = []; |
|
53 | 53 | |
54 | - /** @var string[] of allowed domains that can use the microphone */ |
|
55 | - protected $microphoneDomains = []; |
|
54 | + /** @var string[] of allowed domains that can use the microphone */ |
|
55 | + protected $microphoneDomains = []; |
|
56 | 56 | |
57 | - /** @var string[] of allowed domains that can use the payment API */ |
|
58 | - protected $paymentDomains = []; |
|
57 | + /** @var string[] of allowed domains that can use the payment API */ |
|
58 | + protected $paymentDomains = []; |
|
59 | 59 | } |
@@ -36,16 +36,16 @@ |
||
36 | 36 | */ |
37 | 37 | class Proxy extends Entity { |
38 | 38 | |
39 | - /** @var string */ |
|
40 | - protected $ownerId; |
|
41 | - /** @var string */ |
|
42 | - protected $proxyId; |
|
43 | - /** @var int */ |
|
44 | - protected $permissions; |
|
39 | + /** @var string */ |
|
40 | + protected $ownerId; |
|
41 | + /** @var string */ |
|
42 | + protected $proxyId; |
|
43 | + /** @var int */ |
|
44 | + protected $permissions; |
|
45 | 45 | |
46 | - public function __construct() { |
|
47 | - $this->addType('ownerId', 'string'); |
|
48 | - $this->addType('proxyId', 'string'); |
|
49 | - $this->addType('permissions', 'int'); |
|
50 | - } |
|
46 | + public function __construct() { |
|
47 | + $this->addType('ownerId', 'string'); |
|
48 | + $this->addType('proxyId', 'string'); |
|
49 | + $this->addType('permissions', 'int'); |
|
50 | + } |
|
51 | 51 | } |
@@ -31,51 +31,51 @@ |
||
31 | 31 | */ |
32 | 32 | class NotificationProviderManager { |
33 | 33 | |
34 | - /** @var INotificationProvider[] */ |
|
35 | - private $providers = []; |
|
34 | + /** @var INotificationProvider[] */ |
|
35 | + private $providers = []; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Checks whether a provider for a given ACTION exists |
|
39 | - * |
|
40 | - * @param string $type |
|
41 | - * @return bool |
|
42 | - */ |
|
43 | - public function hasProvider(string $type):bool { |
|
44 | - return (\in_array($type, ReminderService::REMINDER_TYPES, true) |
|
45 | - && isset($this->providers[$type])); |
|
46 | - } |
|
37 | + /** |
|
38 | + * Checks whether a provider for a given ACTION exists |
|
39 | + * |
|
40 | + * @param string $type |
|
41 | + * @return bool |
|
42 | + */ |
|
43 | + public function hasProvider(string $type):bool { |
|
44 | + return (\in_array($type, ReminderService::REMINDER_TYPES, true) |
|
45 | + && isset($this->providers[$type])); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Get provider for a given ACTION |
|
50 | - * |
|
51 | - * @param string $type |
|
52 | - * @return INotificationProvider |
|
53 | - * @throws NotificationProvider\ProviderNotAvailableException |
|
54 | - * @throws NotificationTypeDoesNotExistException |
|
55 | - */ |
|
56 | - public function getProvider(string $type):INotificationProvider { |
|
57 | - if (in_array($type, ReminderService::REMINDER_TYPES, true)) { |
|
58 | - if (isset($this->providers[$type])) { |
|
59 | - return $this->providers[$type]; |
|
60 | - } |
|
61 | - throw new NotificationProvider\ProviderNotAvailableException($type); |
|
62 | - } |
|
63 | - throw new NotificationTypeDoesNotExistException($type); |
|
64 | - } |
|
48 | + /** |
|
49 | + * Get provider for a given ACTION |
|
50 | + * |
|
51 | + * @param string $type |
|
52 | + * @return INotificationProvider |
|
53 | + * @throws NotificationProvider\ProviderNotAvailableException |
|
54 | + * @throws NotificationTypeDoesNotExistException |
|
55 | + */ |
|
56 | + public function getProvider(string $type):INotificationProvider { |
|
57 | + if (in_array($type, ReminderService::REMINDER_TYPES, true)) { |
|
58 | + if (isset($this->providers[$type])) { |
|
59 | + return $this->providers[$type]; |
|
60 | + } |
|
61 | + throw new NotificationProvider\ProviderNotAvailableException($type); |
|
62 | + } |
|
63 | + throw new NotificationTypeDoesNotExistException($type); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Registers a new provider |
|
68 | - * |
|
69 | - * @param string $providerClassName |
|
70 | - * @throws \OCP\AppFramework\QueryException |
|
71 | - */ |
|
72 | - public function registerProvider(string $providerClassName):void { |
|
73 | - $provider = \OC::$server->query($providerClassName); |
|
66 | + /** |
|
67 | + * Registers a new provider |
|
68 | + * |
|
69 | + * @param string $providerClassName |
|
70 | + * @throws \OCP\AppFramework\QueryException |
|
71 | + */ |
|
72 | + public function registerProvider(string $providerClassName):void { |
|
73 | + $provider = \OC::$server->query($providerClassName); |
|
74 | 74 | |
75 | - if (!$provider instanceof INotificationProvider) { |
|
76 | - throw new \InvalidArgumentException('Invalid notification provider registered'); |
|
77 | - } |
|
75 | + if (!$provider instanceof INotificationProvider) { |
|
76 | + throw new \InvalidArgumentException('Invalid notification provider registered'); |
|
77 | + } |
|
78 | 78 | |
79 | - $this->providers[$provider::NOTIFICATION_TYPE] = $provider; |
|
80 | - } |
|
79 | + $this->providers[$provider::NOTIFICATION_TYPE] = $provider; |
|
80 | + } |
|
81 | 81 | } |
@@ -26,15 +26,15 @@ |
||
26 | 26 | |
27 | 27 | class NotificationTypeDoesNotExistException extends \Exception { |
28 | 28 | |
29 | - /** |
|
30 | - * NotificationTypeDoesNotExistException constructor. |
|
31 | - * |
|
32 | - * @since 16.0.0 |
|
33 | - * |
|
34 | - * @param string $type ReminderType |
|
35 | - */ |
|
36 | - public function __construct(string $type) { |
|
37 | - parent::__construct("Type $type is not an accepted type of notification"); |
|
38 | - } |
|
29 | + /** |
|
30 | + * NotificationTypeDoesNotExistException constructor. |
|
31 | + * |
|
32 | + * @since 16.0.0 |
|
33 | + * |
|
34 | + * @param string $type ReminderType |
|
35 | + */ |
|
36 | + public function __construct(string $type) { |
|
37 | + parent::__construct("Type $type is not an accepted type of notification"); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | } |
@@ -25,15 +25,15 @@ |
||
25 | 25 | |
26 | 26 | class ProviderNotAvailableException extends \Exception { |
27 | 27 | |
28 | - /** |
|
29 | - * ProviderNotAvailableException constructor. |
|
30 | - * |
|
31 | - * @since 16.0.0 |
|
32 | - * |
|
33 | - * @param string $type ReminderType |
|
34 | - */ |
|
35 | - public function __construct(string $type) { |
|
36 | - parent::__construct("No notification provider for type $type available"); |
|
37 | - } |
|
28 | + /** |
|
29 | + * ProviderNotAvailableException constructor. |
|
30 | + * |
|
31 | + * @since 16.0.0 |
|
32 | + * |
|
33 | + * @param string $type ReminderType |
|
34 | + */ |
|
35 | + public function __construct(string $type) { |
|
36 | + parent::__construct("No notification provider for type $type available"); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | } |
@@ -32,6 +32,6 @@ |
||
32 | 32 | */ |
33 | 33 | class AudioProvider extends PushProvider { |
34 | 34 | |
35 | - /** @var string */ |
|
36 | - public const NOTIFICATION_TYPE = 'AUDIO'; |
|
35 | + /** @var string */ |
|
36 | + public const NOTIFICATION_TYPE = 'AUDIO'; |
|
37 | 37 | } |
@@ -31,91 +31,91 @@ |
||
31 | 31 | |
32 | 32 | class FileSize implements ICheck { |
33 | 33 | |
34 | - /** @var int */ |
|
35 | - protected $size; |
|
36 | - |
|
37 | - /** @var IL10N */ |
|
38 | - protected $l; |
|
39 | - |
|
40 | - /** @var IRequest */ |
|
41 | - protected $request; |
|
42 | - |
|
43 | - /** |
|
44 | - * @param IL10N $l |
|
45 | - * @param IRequest $request |
|
46 | - */ |
|
47 | - public function __construct(IL10N $l, IRequest $request) { |
|
48 | - $this->l = $l; |
|
49 | - $this->request = $request; |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @param string $operator |
|
54 | - * @param string $value |
|
55 | - * @return bool |
|
56 | - */ |
|
57 | - public function executeCheck($operator, $value) { |
|
58 | - $size = $this->getFileSizeFromHeader(); |
|
59 | - |
|
60 | - $value = Util::computerFileSize($value); |
|
61 | - if ($size !== false) { |
|
62 | - switch ($operator) { |
|
63 | - case 'less': |
|
64 | - return $size < $value; |
|
65 | - case '!less': |
|
66 | - return $size >= $value; |
|
67 | - case 'greater': |
|
68 | - return $size > $value; |
|
69 | - case '!greater': |
|
70 | - return $size <= $value; |
|
71 | - } |
|
72 | - } |
|
73 | - return false; |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * @param string $operator |
|
78 | - * @param string $value |
|
79 | - * @throws \UnexpectedValueException |
|
80 | - */ |
|
81 | - public function validateCheck($operator, $value) { |
|
82 | - if (!in_array($operator, ['less', '!less', 'greater', '!greater'])) { |
|
83 | - throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); |
|
84 | - } |
|
85 | - |
|
86 | - if (!preg_match('/^[0-9]+[ ]?[kmgt]?b$/i', $value)) { |
|
87 | - throw new \UnexpectedValueException($this->l->t('The given file size is invalid'), 2); |
|
88 | - } |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - protected function getFileSizeFromHeader() { |
|
95 | - if ($this->size !== null) { |
|
96 | - return $this->size; |
|
97 | - } |
|
98 | - |
|
99 | - $size = $this->request->getHeader('OC-Total-Length'); |
|
100 | - if ($size === '') { |
|
101 | - if (in_array($this->request->getMethod(), ['POST', 'PUT'])) { |
|
102 | - $size = $this->request->getHeader('Content-Length'); |
|
103 | - } |
|
104 | - } |
|
105 | - |
|
106 | - if ($size === '') { |
|
107 | - $size = false; |
|
108 | - } |
|
109 | - |
|
110 | - $this->size = $size; |
|
111 | - return $this->size; |
|
112 | - } |
|
113 | - |
|
114 | - public function supportedEntities(): array { |
|
115 | - return [ File::class ]; |
|
116 | - } |
|
117 | - |
|
118 | - public function isAvailableForScope(int $scope): bool { |
|
119 | - return true; |
|
120 | - } |
|
34 | + /** @var int */ |
|
35 | + protected $size; |
|
36 | + |
|
37 | + /** @var IL10N */ |
|
38 | + protected $l; |
|
39 | + |
|
40 | + /** @var IRequest */ |
|
41 | + protected $request; |
|
42 | + |
|
43 | + /** |
|
44 | + * @param IL10N $l |
|
45 | + * @param IRequest $request |
|
46 | + */ |
|
47 | + public function __construct(IL10N $l, IRequest $request) { |
|
48 | + $this->l = $l; |
|
49 | + $this->request = $request; |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @param string $operator |
|
54 | + * @param string $value |
|
55 | + * @return bool |
|
56 | + */ |
|
57 | + public function executeCheck($operator, $value) { |
|
58 | + $size = $this->getFileSizeFromHeader(); |
|
59 | + |
|
60 | + $value = Util::computerFileSize($value); |
|
61 | + if ($size !== false) { |
|
62 | + switch ($operator) { |
|
63 | + case 'less': |
|
64 | + return $size < $value; |
|
65 | + case '!less': |
|
66 | + return $size >= $value; |
|
67 | + case 'greater': |
|
68 | + return $size > $value; |
|
69 | + case '!greater': |
|
70 | + return $size <= $value; |
|
71 | + } |
|
72 | + } |
|
73 | + return false; |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * @param string $operator |
|
78 | + * @param string $value |
|
79 | + * @throws \UnexpectedValueException |
|
80 | + */ |
|
81 | + public function validateCheck($operator, $value) { |
|
82 | + if (!in_array($operator, ['less', '!less', 'greater', '!greater'])) { |
|
83 | + throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); |
|
84 | + } |
|
85 | + |
|
86 | + if (!preg_match('/^[0-9]+[ ]?[kmgt]?b$/i', $value)) { |
|
87 | + throw new \UnexpectedValueException($this->l->t('The given file size is invalid'), 2); |
|
88 | + } |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + protected function getFileSizeFromHeader() { |
|
95 | + if ($this->size !== null) { |
|
96 | + return $this->size; |
|
97 | + } |
|
98 | + |
|
99 | + $size = $this->request->getHeader('OC-Total-Length'); |
|
100 | + if ($size === '') { |
|
101 | + if (in_array($this->request->getMethod(), ['POST', 'PUT'])) { |
|
102 | + $size = $this->request->getHeader('Content-Length'); |
|
103 | + } |
|
104 | + } |
|
105 | + |
|
106 | + if ($size === '') { |
|
107 | + $size = false; |
|
108 | + } |
|
109 | + |
|
110 | + $this->size = $size; |
|
111 | + return $this->size; |
|
112 | + } |
|
113 | + |
|
114 | + public function supportedEntities(): array { |
|
115 | + return [ File::class ]; |
|
116 | + } |
|
117 | + |
|
118 | + public function isAvailableForScope(int $scope): bool { |
|
119 | + return true; |
|
120 | + } |
|
121 | 121 | } |