@@ -59,10 +59,10 @@ |
||
| 59 | 59 | if (is_array($value)) { |
| 60 | 60 | $output->writeln(" <comment>>></comment> $key:"); |
| 61 | 61 | foreach ($value as $subKey => $subValue) { |
| 62 | - $output->writeln(" <comment>>></comment> $subKey: " . str_repeat(' ', 46 - strlen($subKey)) . $subValue); |
|
| 62 | + $output->writeln(" <comment>>></comment> $subKey: ".str_repeat(' ', 46 - strlen($subKey)).$subValue); |
|
| 63 | 63 | } |
| 64 | 64 | } else { |
| 65 | - $output->writeln(" <comment>>></comment> $key: " . str_repeat(' ', 50 - strlen($key)) . $value); |
|
| 65 | + $output->writeln(" <comment>>></comment> $key: ".str_repeat(' ', 50 - strlen($key)).$value); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - return $this->checkQuota($parent->getPath() . '/' . basename($uri)); |
|
| 95 | + return $this->checkQuota($parent->getPath().'/'.basename($uri)); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | if ($length) { |
| 154 | 154 | list($parentPath, $newName) = \Sabre\Uri\split($path); |
| 155 | - if(is_null($parentPath)) { |
|
| 155 | + if (is_null($parentPath)) { |
|
| 156 | 156 | $parentPath = ''; |
| 157 | 157 | } |
| 158 | 158 | $req = $this->server->httpRequest; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | // there is still enough space for the remaining chunks |
| 164 | 164 | $length -= $chunkHandler->getCurrentSize(); |
| 165 | 165 | // use target file name for free space check in case of shared files |
| 166 | - $path = rtrim($parentPath, '/') . '/' . $info['name']; |
|
| 166 | + $path = rtrim($parentPath, '/').'/'.$info['name']; |
|
| 167 | 167 | } |
| 168 | 168 | $freeSpace = $this->getFreeSpace($path); |
| 169 | 169 | if ($freeSpace >= 0 && $length > $freeSpace) { |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | $suffix = '…'; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - return $prefix . substr($message, $start, $end - $start) . $suffix; |
|
| 109 | + return $prefix.substr($message, $start, $end - $start).$suffix; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | ) { |
| 59 | 59 | $backend = $this->backendService->getBackend($storageOptions['backend']); |
| 60 | 60 | if (!$backend) { |
| 61 | - throw new \UnexpectedValueException('Invalid backend ' . $storageOptions['backend']); |
|
| 61 | + throw new \UnexpectedValueException('Invalid backend '.$storageOptions['backend']); |
|
| 62 | 62 | } |
| 63 | 63 | $storageConfig->setBackend($backend); |
| 64 | 64 | if (isset($storageOptions['authMechanism']) && $storageOptions['authMechanism'] !== 'builtin::builtin') { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $storageOptions['authMechanism'] = 'null'; // to make error handling easier |
| 69 | 69 | } |
| 70 | 70 | if (!$authMechanism) { |
| 71 | - throw new \UnexpectedValueException('Invalid authentication mechanism ' . $storageOptions['authMechanism']); |
|
| 71 | + throw new \UnexpectedValueException('Invalid authentication mechanism '.$storageOptions['authMechanism']); |
|
| 72 | 72 | } |
| 73 | 73 | $storageConfig->setAuthMechanism($authMechanism); |
| 74 | 74 | $storageConfig->setBackendOptions($storageOptions['options']); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $parts = explode('/', ltrim($rootMountPath, '/'), 3); |
| 141 | 141 | if (count($parts) < 3) { |
| 142 | 142 | // something went wrong, skip |
| 143 | - \OC::$server->getLogger()->error('Could not parse mount point "' . $rootMountPath . '"', ['app' => 'files_external']); |
|
| 143 | + \OC::$server->getLogger()->error('Could not parse mount point "'.$rootMountPath.'"', ['app' => 'files_external']); |
|
| 144 | 144 | continue; |
| 145 | 145 | } |
| 146 | 146 | $relativeMountPath = rtrim($parts[2], '/'); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $storageOptions['authMechanism'] = null; // ensure config hash works |
| 155 | 155 | } |
| 156 | 156 | if (isset($storageOptions['id'])) { |
| 157 | - $configId = (int)$storageOptions['id']; |
|
| 157 | + $configId = (int) $storageOptions['id']; |
|
| 158 | 158 | if (isset($storages[$configId])) { |
| 159 | 159 | $currentStorage = $storages[$configId]; |
| 160 | 160 | } |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 37 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 38 | 38 | |
| 39 | 39 | try { |
| 40 | 40 | |
| 41 | - require_once __DIR__ . '/lib/base.php'; |
|
| 41 | + require_once __DIR__.'/lib/base.php'; |
|
| 42 | 42 | |
| 43 | 43 | if (\OCP\Util::needUpgrade()) { |
| 44 | 44 | \OC::$server->getLogger()->debug('Update required, skipping cron', ['app' => 'cron']); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $appMode = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax'); |
| 75 | 75 | if ($appMode === 'none') { |
| 76 | 76 | if (OC::$CLI) { |
| 77 | - echo 'Background Jobs are disabled!' . PHP_EOL; |
|
| 77 | + echo 'Background Jobs are disabled!'.PHP_EOL; |
|
| 78 | 78 | } else { |
| 79 | 79 | OC_JSON::error(array('data' => array('message' => 'Background jobs disabled!'))); |
| 80 | 80 | } |
@@ -89,15 +89,15 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // the cron job must be executed with the right user |
| 91 | 91 | if (!function_exists('posix_getuid')) { |
| 92 | - echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL; |
|
| 92 | + echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php".PHP_EOL; |
|
| 93 | 93 | exit(1); |
| 94 | 94 | } |
| 95 | 95 | $user = posix_getpwuid(posix_getuid()); |
| 96 | - $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php')); |
|
| 96 | + $configUser = posix_getpwuid(fileowner(OC::$configDir.'config.php')); |
|
| 97 | 97 | if ($user['name'] !== $configUser['name']) { |
| 98 | - echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL; |
|
| 99 | - echo "Current user: " . $user['name'] . PHP_EOL; |
|
| 100 | - echo "Web server user: " . $configUser['name'] . PHP_EOL; |
|
| 98 | + echo "Console has to be executed with the same user as the web server is operated".PHP_EOL; |
|
| 99 | + echo "Current user: ".$user['name'].PHP_EOL; |
|
| 100 | + echo "Web server user: ".$configUser['name'].PHP_EOL; |
|
| 101 | 101 | exit(1); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @package OCA\Federation\Controller |
| 49 | 49 | */ |
| 50 | -class OCSAuthAPIController extends OCSController{ |
|
| 50 | +class OCSAuthAPIController extends OCSController { |
|
| 51 | 51 | |
| 52 | 52 | /** @var ISecureRandom */ |
| 53 | 53 | private $secureRandom; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function requestSharedSecret($url, $token) { |
| 145 | 145 | if ($this->trustedServers->isTrustedServer($url) === false) { |
| 146 | - $this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']); |
|
| 146 | + $this->logger->error('remote server not trusted ('.$url.') while requesting shared secret', ['app' => 'federation']); |
|
| 147 | 147 | throw new OCSForbiddenException(); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $localToken = $this->dbHandler->getToken($url); |
| 153 | 153 | if (strcmp($localToken, $token) > 0) { |
| 154 | 154 | $this->logger->info( |
| 155 | - 'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.', |
|
| 155 | + 'remote server ('.$url.') presented lower token. We will initiate the exchange of the shared secret.', |
|
| 156 | 156 | ['app' => 'federation'] |
| 157 | 157 | ); |
| 158 | 158 | throw new OCSForbiddenException(); |
@@ -184,14 +184,14 @@ discard block |
||
| 184 | 184 | public function getSharedSecret($url, $token) { |
| 185 | 185 | |
| 186 | 186 | if ($this->trustedServers->isTrustedServer($url) === false) { |
| 187 | - $this->logger->error('remote server not trusted (' . $url . ') while getting shared secret', ['app' => 'federation']); |
|
| 187 | + $this->logger->error('remote server not trusted ('.$url.') while getting shared secret', ['app' => 'federation']); |
|
| 188 | 188 | throw new OCSForbiddenException(); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if ($this->isValidToken($url, $token) === false) { |
| 192 | 192 | $expectedToken = $this->dbHandler->getToken($url); |
| 193 | 193 | $this->logger->error( |
| 194 | - 'remote server (' . $url . ') didn\'t send a valid token (got "' . $token . '" but expected "'. $expectedToken . '") while getting shared secret', |
|
| 194 | + 'remote server ('.$url.') didn\'t send a valid token (got "'.$token.'" but expected "'.$expectedToken.'") while getting shared secret', |
|
| 195 | 195 | ['app' => 'federation'] |
| 196 | 196 | ); |
| 197 | 197 | throw new OCSForbiddenException(); |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string[] $remove |
| 69 | 69 | */ |
| 70 | 70 | public function updateShares(IShareable $shareable, array $add, array $remove) { |
| 71 | - foreach($add as $element) { |
|
| 71 | + foreach ($add as $element) { |
|
| 72 | 72 | $principal = $this->principalBackend->findByUri($element['href'], ''); |
| 73 | 73 | if ($principal !== '') { |
| 74 | 74 | $this->shareWith($shareable, $element); |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | - foreach($remove as $element) { |
|
| 77 | + foreach ($remove as $element) { |
|
| 78 | 78 | $principal = $this->principalBackend->findByUri($element, ''); |
| 79 | 79 | if ($principal !== '') { |
| 80 | 80 | $this->unshare($shareable, $element); |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | ->execute(); |
| 194 | 194 | |
| 195 | 195 | $shares = []; |
| 196 | - while($row = $result->fetch()) { |
|
| 196 | + while ($row = $result->fetch()) { |
|
| 197 | 197 | $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); |
| 198 | - $shares[]= [ |
|
| 198 | + $shares[] = [ |
|
| 199 | 199 | 'href' => "principal:${row['principaluri']}", |
| 200 | 200 | 'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '', |
| 201 | 201 | 'status' => 1, |
@@ -221,13 +221,13 @@ discard block |
||
| 221 | 221 | foreach ($shares as $share) { |
| 222 | 222 | $acl[] = [ |
| 223 | 223 | 'privilege' => '{DAV:}read', |
| 224 | - 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], |
|
| 224 | + 'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'], |
|
| 225 | 225 | 'protected' => true, |
| 226 | 226 | ]; |
| 227 | 227 | if (!$share['readOnly']) { |
| 228 | 228 | $acl[] = [ |
| 229 | 229 | 'privilege' => '{DAV:}write', |
| 230 | - 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], |
|
| 230 | + 'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'], |
|
| 231 | 231 | 'protected' => true, |
| 232 | 232 | ]; |
| 233 | 233 | } else if ($this->resourceType === 'calendar') { |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | // so users can change the visibility. |
| 236 | 236 | $acl[] = [ |
| 237 | 237 | 'privilege' => '{DAV:}write-properties', |
| 238 | - 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], |
|
| 238 | + 'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'], |
|
| 239 | 239 | 'protected' => true, |
| 240 | 240 | ]; |
| 241 | 241 | } |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | try { |
| 197 | 197 | stream_wrapper_register($protocol, $class); |
| 198 | 198 | if (self::isDirectoryHandle($source)) { |
| 199 | - $wrapped = opendir($protocol . '://', $context); |
|
| 199 | + $wrapped = opendir($protocol.'://', $context); |
|
| 200 | 200 | } else { |
| 201 | - $wrapped = fopen($protocol . '://', $mode, false, $context); |
|
| 201 | + $wrapped = fopen($protocol.'://', $mode, false, $context); |
|
| 202 | 202 | } |
| 203 | 203 | } catch (\BadMethodCallException $e) { |
| 204 | 204 | stream_wrapper_unregister($protocol); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if (array_key_exists($property, $context)) { |
| 223 | 223 | $this->{$property} = $context[$property]; |
| 224 | 224 | } else { |
| 225 | - throw new \BadMethodCallException('Invalid context, "' . $property . '" options not set'); |
|
| 225 | + throw new \BadMethodCallException('Invalid context, "'.$property.'" options not set'); |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | return $context; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | // for seekable streams the pointer is moved back to the beginning of the encrypted block |
| 326 | 326 | // flush will start writing there when the position moves to another block |
| 327 | - $positionInFile = (int)floor($this->position / $this->unencryptedBlockSize) * |
|
| 327 | + $positionInFile = (int) floor($this->position / $this->unencryptedBlockSize) * |
|
| 328 | 328 | $this->util->getBlockSize() + $this->headerSize; |
| 329 | 329 | $resultFseek = $this->parentStreamSeek($positionInFile); |
| 330 | 330 | |
@@ -341,14 +341,14 @@ discard block |
||
| 341 | 341 | // update position and liberate $data |
| 342 | 342 | if ($remainingLength < ($this->unencryptedBlockSize - $blockPosition)) { |
| 343 | 343 | $this->cache = substr($this->cache, 0, $blockPosition) |
| 344 | - . $data . substr($this->cache, $blockPosition + $remainingLength); |
|
| 344 | + . $data.substr($this->cache, $blockPosition + $remainingLength); |
|
| 345 | 345 | $this->position += $remainingLength; |
| 346 | 346 | $length += $remainingLength; |
| 347 | 347 | $data = ''; |
| 348 | 348 | // if $data doesn't fit the current block, the fill the current block and reiterate |
| 349 | 349 | // after the block is filled, it is flushed and $data is updatedxxx |
| 350 | 350 | } else { |
| 351 | - $this->cache = substr($this->cache, 0, $blockPosition) . |
|
| 351 | + $this->cache = substr($this->cache, 0, $blockPosition). |
|
| 352 | 352 | substr($data, 0, $this->unencryptedBlockSize - $blockPosition); |
| 353 | 353 | $this->flush(); |
| 354 | 354 | $this->position += ($this->unencryptedBlockSize - $blockPosition); |
@@ -406,10 +406,10 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | public function stream_close() { |
| 408 | 408 | $this->flush('end'); |
| 409 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
| 410 | - $remainingData = $this->encryptionModule->end($this->fullPath, $position . 'end'); |
|
| 409 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
| 410 | + $remainingData = $this->encryptionModule->end($this->fullPath, $position.'end'); |
|
| 411 | 411 | if ($this->readOnly === false) { |
| 412 | - if(!empty($remainingData)) { |
|
| 412 | + if (!empty($remainingData)) { |
|
| 413 | 413 | parent::stream_write($remainingData); |
| 414 | 414 | } |
| 415 | 415 | $this->encryptionStorage->updateUnencryptedSize($this->fullPath, $this->unencryptedSize); |
@@ -428,16 +428,16 @@ discard block |
||
| 428 | 428 | // automatically attempted when the file is written to disk - |
| 429 | 429 | // we are handling that separately here and we don't want to |
| 430 | 430 | // get into an infinite loop |
| 431 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
| 432 | - $encrypted = $this->encryptionModule->encrypt($this->cache, $position . $positionPrefix); |
|
| 431 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
| 432 | + $encrypted = $this->encryptionModule->encrypt($this->cache, $position.$positionPrefix); |
|
| 433 | 433 | $bytesWritten = parent::stream_write($encrypted); |
| 434 | 434 | $this->writeFlag = false; |
| 435 | 435 | // Check whether the write concerns the last block |
| 436 | 436 | // If so then update the encrypted filesize |
| 437 | 437 | // Note that the unencrypted pointer and filesize are NOT yet updated when flush() is called |
| 438 | 438 | // We recalculate the encrypted filesize as we do not know the context of calling flush() |
| 439 | - $completeBlocksInFile=(int)floor($this->unencryptedSize/$this->unencryptedBlockSize); |
|
| 440 | - if ($completeBlocksInFile === (int)floor($this->position/$this->unencryptedBlockSize)) { |
|
| 439 | + $completeBlocksInFile = (int) floor($this->unencryptedSize / $this->unencryptedBlockSize); |
|
| 440 | + if ($completeBlocksInFile === (int) floor($this->position / $this->unencryptedBlockSize)) { |
|
| 441 | 441 | $this->size = $this->util->getBlockSize() * $completeBlocksInFile; |
| 442 | 442 | $this->size += $bytesWritten; |
| 443 | 443 | $this->size += $this->headerSize; |
@@ -456,9 +456,9 @@ discard block |
||
| 456 | 456 | if ($this->cache === '' && !($this->position === $this->unencryptedSize && ($this->position % $this->unencryptedBlockSize) === 0)) { |
| 457 | 457 | // Get the data from the file handle |
| 458 | 458 | $data = parent::stream_read($this->util->getBlockSize()); |
| 459 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
| 460 | - $numberOfChunks = (int)($this->unencryptedSize / $this->unencryptedBlockSize); |
|
| 461 | - if($numberOfChunks === $position) { |
|
| 459 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
| 460 | + $numberOfChunks = (int) ($this->unencryptedSize / $this->unencryptedBlockSize); |
|
| 461 | + if ($numberOfChunks === $position) { |
|
| 462 | 462 | $position .= 'end'; |
| 463 | 463 | } |
| 464 | 464 | $this->cache = $this->encryptionModule->decrypt($data, $position); |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | * @param string $mode |
| 89 | 89 | * @return DataResponse|FileDisplayResponse |
| 90 | 90 | */ |
| 91 | - public function getPreview ( |
|
| 91 | + public function getPreview( |
|
| 92 | 92 | string $file = '', |
| 93 | 93 | int $x = 32, |
| 94 | 94 | int $y = 32, |