@@ -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 | } |
@@ -33,35 +33,35 @@ |
||
| 33 | 33 | * @since 14.0.0 |
| 34 | 34 | */ |
| 35 | 35 | class CloudFederationNotification implements ICloudFederationNotification { |
| 36 | - private $message = []; |
|
| 36 | + private $message = []; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * add a message to the notification |
|
| 40 | - * |
|
| 41 | - * @param string $notificationType (e.g. SHARE_ACCEPTED) |
|
| 42 | - * @param string $resourceType (e.g. file, calendar, contact,...) |
|
| 43 | - * @param string $providerId id of the share |
|
| 44 | - * @param array $notification payload of the notification |
|
| 45 | - * |
|
| 46 | - * @since 14.0.0 |
|
| 47 | - */ |
|
| 48 | - public function setMessage($notificationType, $resourceType, $providerId, array $notification) { |
|
| 49 | - $this->message = [ |
|
| 50 | - 'notificationType' => $notificationType, |
|
| 51 | - 'resourceType' => $resourceType, |
|
| 52 | - 'providerId' => $providerId, |
|
| 53 | - 'notification' => $notification, |
|
| 54 | - ]; |
|
| 55 | - } |
|
| 38 | + /** |
|
| 39 | + * add a message to the notification |
|
| 40 | + * |
|
| 41 | + * @param string $notificationType (e.g. SHARE_ACCEPTED) |
|
| 42 | + * @param string $resourceType (e.g. file, calendar, contact,...) |
|
| 43 | + * @param string $providerId id of the share |
|
| 44 | + * @param array $notification payload of the notification |
|
| 45 | + * |
|
| 46 | + * @since 14.0.0 |
|
| 47 | + */ |
|
| 48 | + public function setMessage($notificationType, $resourceType, $providerId, array $notification) { |
|
| 49 | + $this->message = [ |
|
| 50 | + 'notificationType' => $notificationType, |
|
| 51 | + 'resourceType' => $resourceType, |
|
| 52 | + 'providerId' => $providerId, |
|
| 53 | + 'notification' => $notification, |
|
| 54 | + ]; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * get message, ready to send out |
|
| 59 | - * |
|
| 60 | - * @return array |
|
| 61 | - * |
|
| 62 | - * @since 14.0.0 |
|
| 63 | - */ |
|
| 64 | - public function getMessage() { |
|
| 65 | - return $this->message; |
|
| 66 | - } |
|
| 57 | + /** |
|
| 58 | + * get message, ready to send out |
|
| 59 | + * |
|
| 60 | + * @return array |
|
| 61 | + * |
|
| 62 | + * @since 14.0.0 |
|
| 63 | + */ |
|
| 64 | + public function getMessage() { |
|
| 65 | + return $this->message; |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -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 | } |
@@ -27,48 +27,48 @@ |
||
| 27 | 27 | use OCP\Command\ICommand; |
| 28 | 28 | |
| 29 | 29 | class QueueBus implements IBus { |
| 30 | - /** |
|
| 31 | - * @var ICommand[]|callable[] |
|
| 32 | - */ |
|
| 33 | - private $queue = []; |
|
| 30 | + /** |
|
| 31 | + * @var ICommand[]|callable[] |
|
| 32 | + */ |
|
| 33 | + private $queue = []; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Schedule a command to be fired |
|
| 37 | - * |
|
| 38 | - * @param \OCP\Command\ICommand | callable $command |
|
| 39 | - */ |
|
| 40 | - public function push($command) { |
|
| 41 | - $this->queue[] = $command; |
|
| 42 | - } |
|
| 35 | + /** |
|
| 36 | + * Schedule a command to be fired |
|
| 37 | + * |
|
| 38 | + * @param \OCP\Command\ICommand | callable $command |
|
| 39 | + */ |
|
| 40 | + public function push($command) { |
|
| 41 | + $this->queue[] = $command; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Require all commands using a trait to be run synchronous |
|
| 46 | - * |
|
| 47 | - * @param string $trait |
|
| 48 | - */ |
|
| 49 | - public function requireSync($trait) { |
|
| 50 | - } |
|
| 44 | + /** |
|
| 45 | + * Require all commands using a trait to be run synchronous |
|
| 46 | + * |
|
| 47 | + * @param string $trait |
|
| 48 | + */ |
|
| 49 | + public function requireSync($trait) { |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @param \OCP\Command\ICommand | callable $command |
|
| 54 | - */ |
|
| 55 | - private function runCommand($command) { |
|
| 56 | - if ($command instanceof ICommand) { |
|
| 57 | - // ensure the command can be serialized |
|
| 58 | - $serialized = serialize($command); |
|
| 59 | - if (strlen($serialized) > 4000) { |
|
| 60 | - throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)'); |
|
| 61 | - } |
|
| 62 | - $unserialized = unserialize($serialized); |
|
| 63 | - $unserialized->handle(); |
|
| 64 | - } else { |
|
| 65 | - $command(); |
|
| 66 | - } |
|
| 67 | - } |
|
| 52 | + /** |
|
| 53 | + * @param \OCP\Command\ICommand | callable $command |
|
| 54 | + */ |
|
| 55 | + private function runCommand($command) { |
|
| 56 | + if ($command instanceof ICommand) { |
|
| 57 | + // ensure the command can be serialized |
|
| 58 | + $serialized = serialize($command); |
|
| 59 | + if (strlen($serialized) > 4000) { |
|
| 60 | + throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)'); |
|
| 61 | + } |
|
| 62 | + $unserialized = unserialize($serialized); |
|
| 63 | + $unserialized->handle(); |
|
| 64 | + } else { |
|
| 65 | + $command(); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - public function run() { |
|
| 70 | - while ($command = array_shift($this->queue)) { |
|
| 71 | - $this->runCommand($command); |
|
| 72 | - } |
|
| 73 | - } |
|
| 69 | + public function run() { |
|
| 70 | + while ($command = array_shift($this->queue)) { |
|
| 71 | + $this->runCommand($command); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -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 | } |