@@ -59,7 +59,7 @@ |
||
| 59 | 59 | * @since 13.0.0 |
| 60 | 60 | */ |
| 61 | 61 | protected function getValidatedType($type) { |
| 62 | - $type = trim((string)$type); |
|
| 62 | + $type = trim((string) $type); |
|
| 63 | 63 | |
| 64 | 64 | if ($type === '') { |
| 65 | 65 | throw new \InvalidArgumentException('Type must not be empty'); |
@@ -12,44 +12,44 @@ |
||
| 12 | 12 | * @since 13.0.0 |
| 13 | 13 | */ |
| 14 | 14 | class SearchResultType { |
| 15 | - /** @var string */ |
|
| 16 | - protected $label; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * SearchResultType constructor. |
|
| 20 | - * |
|
| 21 | - * @param string $label |
|
| 22 | - * @since 13.0.0 |
|
| 23 | - */ |
|
| 24 | - public function __construct($label) { |
|
| 25 | - $this->label = $this->getValidatedType($label); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @return string |
|
| 30 | - * @since 13.0.0 |
|
| 31 | - */ |
|
| 32 | - public function getLabel() { |
|
| 33 | - return $this->label; |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @param $type |
|
| 38 | - * @return string |
|
| 39 | - * @throws \InvalidArgumentException |
|
| 40 | - * @since 13.0.0 |
|
| 41 | - */ |
|
| 42 | - protected function getValidatedType($type) { |
|
| 43 | - $type = trim((string)$type); |
|
| 44 | - |
|
| 45 | - if ($type === '') { |
|
| 46 | - throw new \InvalidArgumentException('Type must not be empty'); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - if ($type === 'exact') { |
|
| 50 | - throw new \InvalidArgumentException('Provided type is a reserved word'); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - return $type; |
|
| 54 | - } |
|
| 15 | + /** @var string */ |
|
| 16 | + protected $label; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * SearchResultType constructor. |
|
| 20 | + * |
|
| 21 | + * @param string $label |
|
| 22 | + * @since 13.0.0 |
|
| 23 | + */ |
|
| 24 | + public function __construct($label) { |
|
| 25 | + $this->label = $this->getValidatedType($label); |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @return string |
|
| 30 | + * @since 13.0.0 |
|
| 31 | + */ |
|
| 32 | + public function getLabel() { |
|
| 33 | + return $this->label; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @param $type |
|
| 38 | + * @return string |
|
| 39 | + * @throws \InvalidArgumentException |
|
| 40 | + * @since 13.0.0 |
|
| 41 | + */ |
|
| 42 | + protected function getValidatedType($type) { |
|
| 43 | + $type = trim((string)$type); |
|
| 44 | + |
|
| 45 | + if ($type === '') { |
|
| 46 | + throw new \InvalidArgumentException('Type must not be empty'); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + if ($type === 'exact') { |
|
| 50 | + throw new \InvalidArgumentException('Provided type is a reserved word'); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + return $type; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -34,57 +34,57 @@ |
||
| 34 | 34 | * @package OC\IntegrityCheck\Helpers |
| 35 | 35 | */ |
| 36 | 36 | class FileAccessHelper { |
| 37 | - /** |
|
| 38 | - * Wrapper around file_get_contents($filename, $data) |
|
| 39 | - * |
|
| 40 | - * @param string $filename |
|
| 41 | - * @return string|false |
|
| 42 | - */ |
|
| 43 | - public function file_get_contents(string $filename) { |
|
| 44 | - return file_get_contents($filename); |
|
| 45 | - } |
|
| 37 | + /** |
|
| 38 | + * Wrapper around file_get_contents($filename, $data) |
|
| 39 | + * |
|
| 40 | + * @param string $filename |
|
| 41 | + * @return string|false |
|
| 42 | + */ |
|
| 43 | + public function file_get_contents(string $filename) { |
|
| 44 | + return file_get_contents($filename); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Wrapper around file_exists($filename) |
|
| 49 | - * |
|
| 50 | - * @param string $filename |
|
| 51 | - * @return bool |
|
| 52 | - */ |
|
| 53 | - public function file_exists(string $filename): bool { |
|
| 54 | - return file_exists($filename); |
|
| 55 | - } |
|
| 47 | + /** |
|
| 48 | + * Wrapper around file_exists($filename) |
|
| 49 | + * |
|
| 50 | + * @param string $filename |
|
| 51 | + * @return bool |
|
| 52 | + */ |
|
| 53 | + public function file_exists(string $filename): bool { |
|
| 54 | + return file_exists($filename); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Wrapper around file_put_contents($filename, $data) |
|
| 59 | - * |
|
| 60 | - * @param string $filename |
|
| 61 | - * @param string $data |
|
| 62 | - * @return int |
|
| 63 | - * @throws \Exception |
|
| 64 | - */ |
|
| 65 | - public function file_put_contents(string $filename, string $data): int { |
|
| 66 | - $bytesWritten = @file_put_contents($filename, $data); |
|
| 67 | - if ($bytesWritten === false || $bytesWritten !== \strlen($data)) { |
|
| 68 | - throw new \Exception('Failed to write into ' . $filename); |
|
| 69 | - } |
|
| 70 | - return $bytesWritten; |
|
| 71 | - } |
|
| 57 | + /** |
|
| 58 | + * Wrapper around file_put_contents($filename, $data) |
|
| 59 | + * |
|
| 60 | + * @param string $filename |
|
| 61 | + * @param string $data |
|
| 62 | + * @return int |
|
| 63 | + * @throws \Exception |
|
| 64 | + */ |
|
| 65 | + public function file_put_contents(string $filename, string $data): int { |
|
| 66 | + $bytesWritten = @file_put_contents($filename, $data); |
|
| 67 | + if ($bytesWritten === false || $bytesWritten !== \strlen($data)) { |
|
| 68 | + throw new \Exception('Failed to write into ' . $filename); |
|
| 69 | + } |
|
| 70 | + return $bytesWritten; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @param string $path |
|
| 75 | - * @return bool |
|
| 76 | - */ |
|
| 77 | - public function is_writable(string $path): bool { |
|
| 78 | - return is_writable($path); |
|
| 79 | - } |
|
| 73 | + /** |
|
| 74 | + * @param string $path |
|
| 75 | + * @return bool |
|
| 76 | + */ |
|
| 77 | + public function is_writable(string $path): bool { |
|
| 78 | + return is_writable($path); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * @param string $path |
|
| 83 | - * @throws \Exception |
|
| 84 | - */ |
|
| 85 | - public function assertDirectoryExists(string $path) { |
|
| 86 | - if (!is_dir($path)) { |
|
| 87 | - throw new \Exception('Directory ' . $path . ' does not exist.'); |
|
| 88 | - } |
|
| 89 | - } |
|
| 81 | + /** |
|
| 82 | + * @param string $path |
|
| 83 | + * @throws \Exception |
|
| 84 | + */ |
|
| 85 | + public function assertDirectoryExists(string $path) { |
|
| 86 | + if (!is_dir($path)) { |
|
| 87 | + throw new \Exception('Directory ' . $path . ' does not exist.'); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | 90 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | public function file_put_contents(string $filename, string $data): int { |
| 66 | 66 | $bytesWritten = @file_put_contents($filename, $data); |
| 67 | 67 | if ($bytesWritten === false || $bytesWritten !== \strlen($data)) { |
| 68 | - throw new \Exception('Failed to write into ' . $filename); |
|
| 68 | + throw new \Exception('Failed to write into '.$filename); |
|
| 69 | 69 | } |
| 70 | 70 | return $bytesWritten; |
| 71 | 71 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function assertDirectoryExists(string $path) { |
| 86 | 86 | if (!is_dir($path)) { |
| 87 | - throw new \Exception('Directory ' . $path . ' does not exist.'); |
|
| 87 | + throw new \Exception('Directory '.$path.' does not exist.'); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -27,51 +27,51 @@ |
||
| 27 | 27 | namespace OC\Security\FeaturePolicy; |
| 28 | 28 | |
| 29 | 29 | class FeaturePolicy extends \OCP\AppFramework\Http\FeaturePolicy { |
| 30 | - public function getAutoplayDomains(): array { |
|
| 31 | - return $this->autoplayDomains; |
|
| 32 | - } |
|
| 30 | + public function getAutoplayDomains(): array { |
|
| 31 | + return $this->autoplayDomains; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - public function setAutoplayDomains(array $autoplayDomains): void { |
|
| 35 | - $this->autoplayDomains = $autoplayDomains; |
|
| 36 | - } |
|
| 34 | + public function setAutoplayDomains(array $autoplayDomains): void { |
|
| 35 | + $this->autoplayDomains = $autoplayDomains; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function getCameraDomains(): array { |
|
| 39 | - return $this->cameraDomains; |
|
| 40 | - } |
|
| 38 | + public function getCameraDomains(): array { |
|
| 39 | + return $this->cameraDomains; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function setCameraDomains(array $cameraDomains): void { |
|
| 43 | - $this->cameraDomains = $cameraDomains; |
|
| 44 | - } |
|
| 42 | + public function setCameraDomains(array $cameraDomains): void { |
|
| 43 | + $this->cameraDomains = $cameraDomains; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - public function getFullscreenDomains(): array { |
|
| 47 | - return $this->fullscreenDomains; |
|
| 48 | - } |
|
| 46 | + public function getFullscreenDomains(): array { |
|
| 47 | + return $this->fullscreenDomains; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function setFullscreenDomains(array $fullscreenDomains): void { |
|
| 51 | - $this->fullscreenDomains = $fullscreenDomains; |
|
| 52 | - } |
|
| 50 | + public function setFullscreenDomains(array $fullscreenDomains): void { |
|
| 51 | + $this->fullscreenDomains = $fullscreenDomains; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function getGeolocationDomains(): array { |
|
| 55 | - return $this->geolocationDomains; |
|
| 56 | - } |
|
| 54 | + public function getGeolocationDomains(): array { |
|
| 55 | + return $this->geolocationDomains; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function setGeolocationDomains(array $geolocationDomains): void { |
|
| 59 | - $this->geolocationDomains = $geolocationDomains; |
|
| 60 | - } |
|
| 58 | + public function setGeolocationDomains(array $geolocationDomains): void { |
|
| 59 | + $this->geolocationDomains = $geolocationDomains; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function getMicrophoneDomains(): array { |
|
| 63 | - return $this->microphoneDomains; |
|
| 64 | - } |
|
| 62 | + public function getMicrophoneDomains(): array { |
|
| 63 | + return $this->microphoneDomains; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function setMicrophoneDomains(array $microphoneDomains): void { |
|
| 67 | - $this->microphoneDomains = $microphoneDomains; |
|
| 68 | - } |
|
| 66 | + public function setMicrophoneDomains(array $microphoneDomains): void { |
|
| 67 | + $this->microphoneDomains = $microphoneDomains; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - public function getPaymentDomains(): array { |
|
| 71 | - return $this->paymentDomains; |
|
| 72 | - } |
|
| 70 | + public function getPaymentDomains(): array { |
|
| 71 | + return $this->paymentDomains; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - public function setPaymentDomains(array $paymentDomains): void { |
|
| 75 | - $this->paymentDomains = $paymentDomains; |
|
| 76 | - } |
|
| 74 | + public function setPaymentDomains(array $paymentDomains): void { |
|
| 75 | + $this->paymentDomains = $paymentDomains; |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | public function getEncryptedValue(): string { |
| 58 | 58 | if ($this->encryptedValue === '') { |
| 59 | 59 | $sharedSecret = random_bytes(\strlen($this->value)); |
| 60 | - $this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret); |
|
| 60 | + $this->encryptedValue = base64_encode($this->value ^ $sharedSecret).':'.base64_encode($sharedSecret); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | return $this->encryptedValue; |
@@ -17,40 +17,40 @@ |
||
| 17 | 17 | * @package OC\Security\CSRF |
| 18 | 18 | */ |
| 19 | 19 | class CsrfToken { |
| 20 | - private string $encryptedValue = ''; |
|
| 20 | + private string $encryptedValue = ''; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @param string $value Value of the token. Can be encrypted or not encrypted. |
|
| 24 | - */ |
|
| 25 | - public function __construct( |
|
| 26 | - private string $value, |
|
| 27 | - ) { |
|
| 28 | - } |
|
| 22 | + /** |
|
| 23 | + * @param string $value Value of the token. Can be encrypted or not encrypted. |
|
| 24 | + */ |
|
| 25 | + public function __construct( |
|
| 26 | + private string $value, |
|
| 27 | + ) { |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Encrypted value of the token. This is used to mitigate BREACH alike |
|
| 32 | - * vulnerabilities. For display measures do use this functionality. |
|
| 33 | - */ |
|
| 34 | - public function getEncryptedValue(): string { |
|
| 35 | - if ($this->encryptedValue === '') { |
|
| 36 | - $sharedSecret = random_bytes(\strlen($this->value)); |
|
| 37 | - $this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret); |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Encrypted value of the token. This is used to mitigate BREACH alike |
|
| 32 | + * vulnerabilities. For display measures do use this functionality. |
|
| 33 | + */ |
|
| 34 | + public function getEncryptedValue(): string { |
|
| 35 | + if ($this->encryptedValue === '') { |
|
| 36 | + $sharedSecret = random_bytes(\strlen($this->value)); |
|
| 37 | + $this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return $this->encryptedValue; |
|
| 41 | - } |
|
| 40 | + return $this->encryptedValue; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * The unencrypted value of the token. Used for decrypting an already |
|
| 45 | - * encrypted token. |
|
| 46 | - */ |
|
| 47 | - public function getDecryptedValue(): string { |
|
| 48 | - $token = explode(':', $this->value); |
|
| 49 | - if (\count($token) !== 2) { |
|
| 50 | - return ''; |
|
| 51 | - } |
|
| 52 | - $obfuscatedToken = $token[0]; |
|
| 53 | - $secret = $token[1]; |
|
| 54 | - return base64_decode($obfuscatedToken) ^ base64_decode($secret); |
|
| 55 | - } |
|
| 43 | + /** |
|
| 44 | + * The unencrypted value of the token. Used for decrypting an already |
|
| 45 | + * encrypted token. |
|
| 46 | + */ |
|
| 47 | + public function getDecryptedValue(): string { |
|
| 48 | + $token = explode(':', $this->value); |
|
| 49 | + if (\count($token) !== 2) { |
|
| 50 | + return ''; |
|
| 51 | + } |
|
| 52 | + $obfuscatedToken = $token[0]; |
|
| 53 | + $secret = $token[1]; |
|
| 54 | + return base64_decode($obfuscatedToken) ^ base64_decode($secret); |
|
| 55 | + } |
|
| 56 | 56 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | \OC_JSON::checkAppEnabled('user_ldap'); |
| 31 | 31 | \OC_JSON::callCheck(); |
| 32 | 32 | |
| 33 | -$prefix = (string)$_POST['ldap_serverconfig_chooser']; |
|
| 33 | +$prefix = (string) $_POST['ldap_serverconfig_chooser']; |
|
| 34 | 34 | |
| 35 | 35 | // Checkboxes are not submitted, when they are unchecked. Set them manually. |
| 36 | 36 | // only legacy checkboxes (Advanced and Expert tab) need to be handled here, |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | // only legacy checkboxes (Advanced and Expert tab) need to be handled here, |
| 19 | 19 | // the Wizard-like tabs handle it on their own |
| 20 | 20 | $chkboxes = ['ldap_configuration_active', 'ldap_override_main_server', |
| 21 | - 'ldap_turn_off_cert_check']; |
|
| 21 | + 'ldap_turn_off_cert_check']; |
|
| 22 | 22 | foreach ($chkboxes as $boxid) { |
| 23 | - if (!isset($_POST[$boxid])) { |
|
| 24 | - $_POST[$boxid] = 0; |
|
| 25 | - } |
|
| 23 | + if (!isset($_POST[$boxid])) { |
|
| 24 | + $_POST[$boxid] = 0; |
|
| 25 | + } |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $ldapWrapper = new LDAP(); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $readOnly = false; |
| 80 | - $readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 80 | + $readOnlyIndex = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 81 | 81 | if (isset($calendar[$readOnlyIndex])) { |
| 82 | 82 | $readOnly = $calendar[$readOnlyIndex]; |
| 83 | 83 | } |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | $calendarTableData[] = [ |
| 86 | 86 | $calendar['uri'], |
| 87 | 87 | $calendar['{DAV:}displayname'], |
| 88 | - $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'], |
|
| 89 | - $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'], |
|
| 88 | + $calendar['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'], |
|
| 89 | + $calendar['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'], |
|
| 90 | 90 | $readOnly ? ' x ' : ' ✓ ', |
| 91 | 91 | ]; |
| 92 | 92 | } |
@@ -15,61 +15,61 @@ |
||
| 15 | 15 | use Symfony\Component\Console\Output\OutputInterface; |
| 16 | 16 | |
| 17 | 17 | class ListCalendars extends Command { |
| 18 | - public function __construct( |
|
| 19 | - protected IUserManager $userManager, |
|
| 20 | - private CalDavBackend $caldav, |
|
| 21 | - ) { |
|
| 22 | - parent::__construct(); |
|
| 23 | - } |
|
| 18 | + public function __construct( |
|
| 19 | + protected IUserManager $userManager, |
|
| 20 | + private CalDavBackend $caldav, |
|
| 21 | + ) { |
|
| 22 | + parent::__construct(); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - protected function configure(): void { |
|
| 26 | - $this |
|
| 27 | - ->setName('dav:list-calendars') |
|
| 28 | - ->setDescription('List all calendars of a user') |
|
| 29 | - ->addArgument('uid', |
|
| 30 | - InputArgument::REQUIRED, |
|
| 31 | - 'User for whom all calendars will be listed'); |
|
| 32 | - } |
|
| 25 | + protected function configure(): void { |
|
| 26 | + $this |
|
| 27 | + ->setName('dav:list-calendars') |
|
| 28 | + ->setDescription('List all calendars of a user') |
|
| 29 | + ->addArgument('uid', |
|
| 30 | + InputArgument::REQUIRED, |
|
| 31 | + 'User for whom all calendars will be listed'); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 35 | - $user = $input->getArgument('uid'); |
|
| 36 | - if (!$this->userManager->userExists($user)) { |
|
| 37 | - throw new \InvalidArgumentException("User <$user> is unknown."); |
|
| 38 | - } |
|
| 34 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 35 | + $user = $input->getArgument('uid'); |
|
| 36 | + if (!$this->userManager->userExists($user)) { |
|
| 37 | + throw new \InvalidArgumentException("User <$user> is unknown."); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - $calendars = $this->caldav->getCalendarsForUser("principals/users/$user"); |
|
| 40 | + $calendars = $this->caldav->getCalendarsForUser("principals/users/$user"); |
|
| 41 | 41 | |
| 42 | - $calendarTableData = []; |
|
| 43 | - foreach ($calendars as $calendar) { |
|
| 44 | - // skip birthday calendar |
|
| 45 | - if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) { |
|
| 46 | - continue; |
|
| 47 | - } |
|
| 42 | + $calendarTableData = []; |
|
| 43 | + foreach ($calendars as $calendar) { |
|
| 44 | + // skip birthday calendar |
|
| 45 | + if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) { |
|
| 46 | + continue; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - $readOnly = false; |
|
| 50 | - $readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 51 | - if (isset($calendar[$readOnlyIndex])) { |
|
| 52 | - $readOnly = $calendar[$readOnlyIndex]; |
|
| 53 | - } |
|
| 49 | + $readOnly = false; |
|
| 50 | + $readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 51 | + if (isset($calendar[$readOnlyIndex])) { |
|
| 52 | + $readOnly = $calendar[$readOnlyIndex]; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - $calendarTableData[] = [ |
|
| 56 | - $calendar['uri'], |
|
| 57 | - $calendar['{DAV:}displayname'], |
|
| 58 | - $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'], |
|
| 59 | - $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'], |
|
| 60 | - $readOnly ? ' x ' : ' ✓ ', |
|
| 61 | - ]; |
|
| 62 | - } |
|
| 55 | + $calendarTableData[] = [ |
|
| 56 | + $calendar['uri'], |
|
| 57 | + $calendar['{DAV:}displayname'], |
|
| 58 | + $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'], |
|
| 59 | + $calendar['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'], |
|
| 60 | + $readOnly ? ' x ' : ' ✓ ', |
|
| 61 | + ]; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - if (count($calendarTableData) > 0) { |
|
| 65 | - $table = new Table($output); |
|
| 66 | - $table->setHeaders(['URI', 'Displayname', 'Owner principal', 'Owner displayname', 'Writable']) |
|
| 67 | - ->setRows($calendarTableData); |
|
| 64 | + if (count($calendarTableData) > 0) { |
|
| 65 | + $table = new Table($output); |
|
| 66 | + $table->setHeaders(['URI', 'Displayname', 'Owner principal', 'Owner displayname', 'Writable']) |
|
| 67 | + ->setRows($calendarTableData); |
|
| 68 | 68 | |
| 69 | - $table->render(); |
|
| 70 | - } else { |
|
| 71 | - $output->writeln("<info>User <$user> has no calendars</info>"); |
|
| 72 | - } |
|
| 73 | - return self::SUCCESS; |
|
| 74 | - } |
|
| 69 | + $table->render(); |
|
| 70 | + } else { |
|
| 71 | + $output->writeln("<info>User <$user> has no calendars</info>"); |
|
| 72 | + } |
|
| 73 | + return self::SUCCESS; |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -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 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | protected function checkPlaceholder(): void { |
| 65 | 65 | $this->sanitizedPlaceholder = trim(strtolower($this->placeholder)); |
| 66 | - if (!(bool)\preg_match('/^[a-z0-9]*$/', $this->sanitizedPlaceholder)) { |
|
| 66 | + if (!(bool) \preg_match('/^[a-z0-9]*$/', $this->sanitizedPlaceholder)) { |
|
| 67 | 67 | throw new \RuntimeException(sprintf( |
| 68 | 68 | 'Invalid placeholder %s, only [a-z0-9] are allowed', $this->sanitizedPlaceholder |
| 69 | 69 | )); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | protected function substituteIfString($value, string $replacement) { |
| 82 | 82 | if (is_string($value)) { |
| 83 | - return str_ireplace('$' . $this->sanitizedPlaceholder, $replacement, $value); |
|
| 83 | + return str_ireplace('$'.$this->sanitizedPlaceholder, $replacement, $value); |
|
| 84 | 84 | } |
| 85 | 85 | return $value; |
| 86 | 86 | } |