@@ -30,13 +30,13 @@ |
||
30 | 30 | |
31 | 31 | class GlobalWorkflowsController extends AWorkflowController { |
32 | 32 | |
33 | - /** @var ScopeContext */ |
|
34 | - private $scopeContext; |
|
33 | + /** @var ScopeContext */ |
|
34 | + private $scopeContext; |
|
35 | 35 | |
36 | - protected function getScopeContext(): ScopeContext { |
|
37 | - if ($this->scopeContext === null) { |
|
38 | - $this->scopeContext = new ScopeContext(IManager::SCOPE_ADMIN); |
|
39 | - } |
|
40 | - return $this->scopeContext; |
|
41 | - } |
|
36 | + protected function getScopeContext(): ScopeContext { |
|
37 | + if ($this->scopeContext === null) { |
|
38 | + $this->scopeContext = new ScopeContext(IManager::SCOPE_ADMIN); |
|
39 | + } |
|
40 | + return $this->scopeContext; |
|
41 | + } |
|
42 | 42 | } |
@@ -30,19 +30,19 @@ |
||
30 | 30 | use OCP\IL10N; |
31 | 31 | |
32 | 32 | class SFTP_Key extends Backend { |
33 | - public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) { |
|
34 | - $this |
|
35 | - ->setIdentifier('\OC\Files\Storage\SFTP_Key') |
|
36 | - ->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP') |
|
37 | - ->setText($l->t('SFTP with secret key login')) |
|
38 | - ->addParameters([ |
|
39 | - new DefinitionParameter('host', $l->t('Host')), |
|
40 | - (new DefinitionParameter('root', $l->t('Remote subfolder'))) |
|
41 | - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
42 | - ]) |
|
43 | - ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY) |
|
44 | - ->setLegacyAuthMechanism($legacyAuth) |
|
45 | - ->deprecateTo($sftpBackend) |
|
46 | - ; |
|
47 | - } |
|
33 | + public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) { |
|
34 | + $this |
|
35 | + ->setIdentifier('\OC\Files\Storage\SFTP_Key') |
|
36 | + ->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP') |
|
37 | + ->setText($l->t('SFTP with secret key login')) |
|
38 | + ->addParameters([ |
|
39 | + new DefinitionParameter('host', $l->t('Host')), |
|
40 | + (new DefinitionParameter('root', $l->t('Remote subfolder'))) |
|
41 | + ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
42 | + ]) |
|
43 | + ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY) |
|
44 | + ->setLegacyAuthMechanism($legacyAuth) |
|
45 | + ->deprecateTo($sftpBackend) |
|
46 | + ; |
|
47 | + } |
|
48 | 48 | } |
@@ -25,19 +25,19 @@ |
||
25 | 25 | namespace OCA\Files_External\Config; |
26 | 26 | |
27 | 27 | class UserPlaceholderHandler extends UserContext implements IConfigHandler { |
28 | - use SimpleSubstitutionTrait; |
|
28 | + use SimpleSubstitutionTrait; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @param mixed $optionValue |
|
32 | - * @return mixed the same type as $optionValue |
|
33 | - * @since 16.0.0 |
|
34 | - */ |
|
35 | - public function handle($optionValue) { |
|
36 | - $this->placeholder = 'user'; |
|
37 | - $uid = $this->getUserId(); |
|
38 | - if ($uid === null) { |
|
39 | - return $optionValue; |
|
40 | - } |
|
41 | - return $this->processInput($optionValue, $uid); |
|
42 | - } |
|
30 | + /** |
|
31 | + * @param mixed $optionValue |
|
32 | + * @return mixed the same type as $optionValue |
|
33 | + * @since 16.0.0 |
|
34 | + */ |
|
35 | + public function handle($optionValue) { |
|
36 | + $this->placeholder = 'user'; |
|
37 | + $uid = $this->getUserId(); |
|
38 | + if ($uid === null) { |
|
39 | + return $optionValue; |
|
40 | + } |
|
41 | + return $this->processInput($optionValue, $uid); |
|
42 | + } |
|
43 | 43 | } |
@@ -31,57 +31,57 @@ |
||
31 | 31 | * @since 16.0.0 |
32 | 32 | */ |
33 | 33 | trait SimpleSubstitutionTrait { |
34 | - /** |
|
35 | - * @var string the placeholder without $ prefix |
|
36 | - * @since 16.0.0 |
|
37 | - */ |
|
38 | - protected $placeholder; |
|
34 | + /** |
|
35 | + * @var string the placeholder without $ prefix |
|
36 | + * @since 16.0.0 |
|
37 | + */ |
|
38 | + protected $placeholder; |
|
39 | 39 | |
40 | - /** @var string */ |
|
41 | - protected $sanitizedPlaceholder; |
|
40 | + /** @var string */ |
|
41 | + protected $sanitizedPlaceholder; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param mixed $optionValue |
|
45 | - * @param string $replacement |
|
46 | - * @return mixed |
|
47 | - * @since 16.0.0 |
|
48 | - */ |
|
49 | - private function processInput($optionValue, string $replacement) { |
|
50 | - $this->checkPlaceholder(); |
|
51 | - if (is_array($optionValue)) { |
|
52 | - foreach ($optionValue as &$value) { |
|
53 | - $value = $this->substituteIfString($value, $replacement); |
|
54 | - } |
|
55 | - } else { |
|
56 | - $optionValue = $this->substituteIfString($optionValue, $replacement); |
|
57 | - } |
|
58 | - return $optionValue; |
|
59 | - } |
|
43 | + /** |
|
44 | + * @param mixed $optionValue |
|
45 | + * @param string $replacement |
|
46 | + * @return mixed |
|
47 | + * @since 16.0.0 |
|
48 | + */ |
|
49 | + private function processInput($optionValue, string $replacement) { |
|
50 | + $this->checkPlaceholder(); |
|
51 | + if (is_array($optionValue)) { |
|
52 | + foreach ($optionValue as &$value) { |
|
53 | + $value = $this->substituteIfString($value, $replacement); |
|
54 | + } |
|
55 | + } else { |
|
56 | + $optionValue = $this->substituteIfString($optionValue, $replacement); |
|
57 | + } |
|
58 | + return $optionValue; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @throws \RuntimeException |
|
63 | - */ |
|
64 | - protected function checkPlaceholder(): void { |
|
65 | - $this->sanitizedPlaceholder = trim(strtolower($this->placeholder)); |
|
66 | - if (!(bool)\preg_match('/^[a-z0-9]*$/', $this->sanitizedPlaceholder)) { |
|
67 | - throw new \RuntimeException(sprintf( |
|
68 | - 'Invalid placeholder %s, only [a-z0-9] are allowed', $this->sanitizedPlaceholder |
|
69 | - )); |
|
70 | - } |
|
71 | - if ($this->sanitizedPlaceholder === '') { |
|
72 | - throw new \RuntimeException('Invalid empty placeholder'); |
|
73 | - } |
|
74 | - } |
|
61 | + /** |
|
62 | + * @throws \RuntimeException |
|
63 | + */ |
|
64 | + protected function checkPlaceholder(): void { |
|
65 | + $this->sanitizedPlaceholder = trim(strtolower($this->placeholder)); |
|
66 | + if (!(bool)\preg_match('/^[a-z0-9]*$/', $this->sanitizedPlaceholder)) { |
|
67 | + throw new \RuntimeException(sprintf( |
|
68 | + 'Invalid placeholder %s, only [a-z0-9] are allowed', $this->sanitizedPlaceholder |
|
69 | + )); |
|
70 | + } |
|
71 | + if ($this->sanitizedPlaceholder === '') { |
|
72 | + throw new \RuntimeException('Invalid empty placeholder'); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @param mixed $value |
|
78 | - * @param string $replacement |
|
79 | - * @return mixed |
|
80 | - */ |
|
81 | - protected function substituteIfString($value, string $replacement) { |
|
82 | - if (is_string($value)) { |
|
83 | - return str_ireplace('$' . $this->sanitizedPlaceholder, $replacement, $value); |
|
84 | - } |
|
85 | - return $value; |
|
86 | - } |
|
76 | + /** |
|
77 | + * @param mixed $value |
|
78 | + * @param string $replacement |
|
79 | + * @return mixed |
|
80 | + */ |
|
81 | + protected function substituteIfString($value, string $replacement) { |
|
82 | + if (is_string($value)) { |
|
83 | + return str_ireplace('$' . $this->sanitizedPlaceholder, $replacement, $value); |
|
84 | + } |
|
85 | + return $value; |
|
86 | + } |
|
87 | 87 | } |
@@ -26,24 +26,24 @@ |
||
26 | 26 | namespace OC\DB; |
27 | 27 | |
28 | 28 | class AdapterOCI8 extends Adapter { |
29 | - public function lastInsertId($table) { |
|
30 | - if (is_null($table)) { |
|
31 | - throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()'); |
|
32 | - } |
|
33 | - if ($table !== null) { |
|
34 | - $suffix = '_SEQ'; |
|
35 | - $table = '"' . $table . $suffix . '"'; |
|
36 | - } |
|
37 | - return $this->conn->realLastInsertId($table); |
|
38 | - } |
|
29 | + public function lastInsertId($table) { |
|
30 | + if (is_null($table)) { |
|
31 | + throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()'); |
|
32 | + } |
|
33 | + if ($table !== null) { |
|
34 | + $suffix = '_SEQ'; |
|
35 | + $table = '"' . $table . $suffix . '"'; |
|
36 | + } |
|
37 | + return $this->conn->realLastInsertId($table); |
|
38 | + } |
|
39 | 39 | |
40 | - public const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400"; |
|
40 | + public const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400"; |
|
41 | 41 | |
42 | - public function fixupStatement($statement) { |
|
43 | - $statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement); |
|
44 | - $statement = str_replace('`', '"', $statement); |
|
45 | - $statement = str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement); |
|
46 | - $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement); |
|
47 | - return $statement; |
|
48 | - } |
|
42 | + public function fixupStatement($statement) { |
|
43 | + $statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement); |
|
44 | + $statement = str_replace('`', '"', $statement); |
|
45 | + $statement = str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement); |
|
46 | + $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement); |
|
47 | + return $statement; |
|
48 | + } |
|
49 | 49 | } |
@@ -29,26 +29,26 @@ |
||
29 | 29 | use Sabre\DAV\Server; |
30 | 30 | |
31 | 31 | class PasswordLoginForbidden extends NotAuthenticated { |
32 | - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
32 | + public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
33 | 33 | |
34 | - public function getHTTPCode() { |
|
35 | - return 401; |
|
36 | - } |
|
34 | + public function getHTTPCode() { |
|
35 | + return 401; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * This method allows the exception to include additional information |
|
40 | - * into the WebDAV error response |
|
41 | - * |
|
42 | - * @param Server $server |
|
43 | - * @param DOMElement $errorNode |
|
44 | - * @return void |
|
45 | - */ |
|
46 | - public function serialize(Server $server, DOMElement $errorNode) { |
|
38 | + /** |
|
39 | + * This method allows the exception to include additional information |
|
40 | + * into the WebDAV error response |
|
41 | + * |
|
42 | + * @param Server $server |
|
43 | + * @param DOMElement $errorNode |
|
44 | + * @return void |
|
45 | + */ |
|
46 | + public function serialize(Server $server, DOMElement $errorNode) { |
|
47 | 47 | |
48 | - // set ownCloud namespace |
|
49 | - $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
|
48 | + // set ownCloud namespace |
|
49 | + $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
|
50 | 50 | |
51 | - $error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'password login forbidden'); |
|
52 | - $errorNode->appendChild($error); |
|
53 | - } |
|
51 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'password login forbidden'); |
|
52 | + $errorNode->appendChild($error); |
|
53 | + } |
|
54 | 54 | } |
@@ -30,13 +30,13 @@ |
||
30 | 30 | */ |
31 | 31 | class Collection extends \Sabre\CalDAV\Principal\Collection { |
32 | 32 | |
33 | - /** |
|
34 | - * Returns a child object based on principal information |
|
35 | - * |
|
36 | - * @param array $principalInfo |
|
37 | - * @return User |
|
38 | - */ |
|
39 | - public function getChildForPrincipal(array $principalInfo) { |
|
40 | - return new User($this->principalBackend, $principalInfo); |
|
41 | - } |
|
33 | + /** |
|
34 | + * Returns a child object based on principal information |
|
35 | + * |
|
36 | + * @param array $principalInfo |
|
37 | + * @return User |
|
38 | + */ |
|
39 | + public function getChildForPrincipal(array $principalInfo) { |
|
40 | + return new User($this->principalBackend, $principalInfo); |
|
41 | + } |
|
42 | 42 | } |
@@ -30,25 +30,25 @@ |
||
30 | 30 | */ |
31 | 31 | class User extends \Sabre\CalDAV\Principal\User { |
32 | 32 | |
33 | - /** |
|
34 | - * Returns a list of ACE's for this node. |
|
35 | - * |
|
36 | - * Each ACE has the following properties: |
|
37 | - * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
38 | - * currently the only supported privileges |
|
39 | - * * 'principal', a url to the principal who owns the node |
|
40 | - * * 'protected' (optional), indicating that this ACE is not allowed to |
|
41 | - * be updated. |
|
42 | - * |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - public function getACL() { |
|
46 | - $acl = parent::getACL(); |
|
47 | - $acl[] = [ |
|
48 | - 'privilege' => '{DAV:}read', |
|
49 | - 'principal' => '{DAV:}authenticated', |
|
50 | - 'protected' => true, |
|
51 | - ]; |
|
52 | - return $acl; |
|
53 | - } |
|
33 | + /** |
|
34 | + * Returns a list of ACE's for this node. |
|
35 | + * |
|
36 | + * Each ACE has the following properties: |
|
37 | + * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
38 | + * currently the only supported privileges |
|
39 | + * * 'principal', a url to the principal who owns the node |
|
40 | + * * 'protected' (optional), indicating that this ACE is not allowed to |
|
41 | + * be updated. |
|
42 | + * |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + public function getACL() { |
|
46 | + $acl = parent::getACL(); |
|
47 | + $acl[] = [ |
|
48 | + 'privilege' => '{DAV:}read', |
|
49 | + 'principal' => '{DAV:}authenticated', |
|
50 | + 'protected' => true, |
|
51 | + ]; |
|
52 | + return $acl; |
|
53 | + } |
|
54 | 54 | } |
@@ -32,17 +32,17 @@ |
||
32 | 32 | |
33 | 33 | class OffsetFilter implements XmlDeserializable { |
34 | 34 | |
35 | - /** |
|
36 | - * @param Reader $reader |
|
37 | - * @throws BadRequest |
|
38 | - * @return int |
|
39 | - */ |
|
40 | - public static function xmlDeserialize(Reader $reader) { |
|
41 | - $value = $reader->parseInnerTree(); |
|
42 | - if (!is_int($value) && !is_string($value)) { |
|
43 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value'); |
|
44 | - } |
|
35 | + /** |
|
36 | + * @param Reader $reader |
|
37 | + * @throws BadRequest |
|
38 | + * @return int |
|
39 | + */ |
|
40 | + public static function xmlDeserialize(Reader $reader) { |
|
41 | + $value = $reader->parseInnerTree(); |
|
42 | + if (!is_int($value) && !is_string($value)) { |
|
43 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value'); |
|
44 | + } |
|
45 | 45 | |
46 | - return (int)$value; |
|
47 | - } |
|
46 | + return (int)$value; |
|
47 | + } |
|
48 | 48 | } |