@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | ['app' => 'encryption']); |
| 118 | 118 | |
| 119 | 119 | if (openssl_error_string()) { |
| 120 | - $log->error('Encryption library openssl_pkey_new() fails: ' . openssl_error_string(), |
|
| 120 | + $log->error('Encryption library openssl_pkey_new() fails: '.openssl_error_string(), |
|
| 121 | 121 | ['app' => 'encryption']); |
| 122 | 122 | } |
| 123 | 123 | } elseif (openssl_pkey_export($res, |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | 'privateKey' => $privateKey |
| 133 | 133 | ]; |
| 134 | 134 | } |
| 135 | - $log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.' . $this->user, |
|
| 135 | + $log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.'.$this->user, |
|
| 136 | 136 | ['app' => 'encryption']); |
| 137 | 137 | if (openssl_error_string()) { |
| 138 | - $log->error('Encryption Library:' . openssl_error_string(), |
|
| 138 | + $log->error('Encryption Library:'.openssl_error_string(), |
|
| 139 | 139 | ['app' => 'encryption']); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -210,15 +210,15 @@ discard block |
||
| 210 | 210 | public function generateHeader($keyFormat = 'hash') { |
| 211 | 211 | |
| 212 | 212 | if (in_array($keyFormat, $this->supportedKeyFormats, true) === false) { |
| 213 | - throw new \InvalidArgumentException('key format "' . $keyFormat . '" is not supported'); |
|
| 213 | + throw new \InvalidArgumentException('key format "'.$keyFormat.'" is not supported'); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $cipher = $this->getCipher(); |
| 217 | 217 | |
| 218 | 218 | $header = self::HEADER_START |
| 219 | - . ':cipher:' . $cipher |
|
| 220 | - . ':keyFormat:' . $keyFormat |
|
| 221 | - . ':' . self::HEADER_END; |
|
| 219 | + . ':cipher:'.$cipher |
|
| 220 | + . ':keyFormat:'.$keyFormat |
|
| 221 | + . ':'.self::HEADER_END; |
|
| 222 | 222 | |
| 223 | 223 | return $header; |
| 224 | 224 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | if (!$encryptedContent) { |
| 242 | 242 | $error = 'Encryption (symmetric) of content failed'; |
| 243 | - $this->logger->error($error . openssl_error_string(), |
|
| 243 | + $this->logger->error($error.openssl_error_string(), |
|
| 244 | 244 | ['app' => 'encryption']); |
| 245 | 245 | throw new EncryptionFailedException($error); |
| 246 | 246 | } |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // Workaround for OpenSSL 0.9.8. Fallback to an old cipher that should work. |
| 271 | - if(OPENSSL_VERSION_NUMBER < 0x1000101f) { |
|
| 272 | - if($cipher === 'AES-256-CTR' || $cipher === 'AES-128-CTR') { |
|
| 271 | + if (OPENSSL_VERSION_NUMBER < 0x1000101f) { |
|
| 272 | + if ($cipher === 'AES-256-CTR' || $cipher === 'AES-128-CTR') { |
|
| 273 | 273 | $cipher = self::LEGACY_CIPHER; |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * @throws \InvalidArgumentException |
| 286 | 286 | */ |
| 287 | 287 | protected function getKeySize($cipher) { |
| 288 | - if(isset($this->supportedCiphersAndKeySize[$cipher])) { |
|
| 288 | + if (isset($this->supportedCiphersAndKeySize[$cipher])) { |
|
| 289 | 289 | return $this->supportedCiphersAndKeySize[$cipher]; |
| 290 | 290 | } |
| 291 | 291 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * @return string |
| 313 | 313 | */ |
| 314 | 314 | private function concatIV($encryptedContent, $iv) { |
| 315 | - return $encryptedContent . '00iv00' . $iv; |
|
| 315 | + return $encryptedContent.'00iv00'.$iv; |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | * @return string |
| 322 | 322 | */ |
| 323 | 323 | private function concatSig($encryptedContent, $signature) { |
| 324 | - return $encryptedContent . '00sig00' . $signature; |
|
| 324 | + return $encryptedContent.'00sig00'.$signature; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | * @return string |
| 334 | 334 | */ |
| 335 | 335 | private function addPadding($data) { |
| 336 | - return $data . 'xxx'; |
|
| 336 | + return $data.'xxx'; |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | protected function generatePasswordHash($password, $cipher, $uid = '') { |
| 348 | 348 | $instanceId = $this->config->getSystemValue('instanceid'); |
| 349 | 349 | $instanceSecret = $this->config->getSystemValue('secret'); |
| 350 | - $salt = hash('sha256', $uid . $instanceId . $instanceSecret, true); |
|
| 350 | + $salt = hash('sha256', $uid.$instanceId.$instanceSecret, true); |
|
| 351 | 351 | $keySize = $this->getKeySize($cipher); |
| 352 | 352 | |
| 353 | 353 | $hash = hash_pbkdf2( |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @return string |
| 494 | 494 | */ |
| 495 | 495 | private function createSignature($data, $passPhrase) { |
| 496 | - $passPhrase = hash('sha512', $passPhrase . 'a', true); |
|
| 496 | + $passPhrase = hash('sha512', $passPhrase.'a', true); |
|
| 497 | 497 | $signature = hash_hmac('sha256', $data, $passPhrase); |
| 498 | 498 | return $signature; |
| 499 | 499 | } |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | if ($plainContent) { |
| 586 | 586 | return $plainContent; |
| 587 | 587 | } else { |
| 588 | - throw new DecryptionFailedException('Encryption library: Decryption (symmetric) of content failed: ' . openssl_error_string()); |
|
| 588 | + throw new DecryptionFailedException('Encryption library: Decryption (symmetric) of content failed: '.openssl_error_string()); |
|
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | 591 | |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | if (openssl_open($encKeyFile, $plainContent, $shareKey, $privateKey)) { |
| 652 | 652 | return $plainContent; |
| 653 | 653 | } else { |
| 654 | - throw new MultiKeyDecryptException('multikeydecrypt with share key failed:' . openssl_error_string()); |
|
| 654 | + throw new MultiKeyDecryptException('multikeydecrypt with share key failed:'.openssl_error_string()); |
|
| 655 | 655 | } |
| 656 | 656 | } |
| 657 | 657 | |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | 'data' => $sealed |
| 688 | 688 | ]; |
| 689 | 689 | } else { |
| 690 | - throw new MultiKeyEncryptException('multikeyencryption failed ' . openssl_error_string()); |
|
| 690 | + throw new MultiKeyEncryptException('multikeyencryption failed '.openssl_error_string()); |
|
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | 693 | } |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $question = new Question('Please enter the recovery key password: '); |
| 85 | 85 | |
| 86 | - if($this->util->isMasterKeyEnabled()) { |
|
| 86 | + if ($this->util->isMasterKeyEnabled()) { |
|
| 87 | 87 | $output->writeln('Use master key to decrypt all files'); |
| 88 | 88 | $user = $this->keyManager->getMasterKeyId(); |
| 89 | - $password =$this->keyManager->getMasterKeyPassword(); |
|
| 89 | + $password = $this->keyManager->getMasterKeyPassword(); |
|
| 90 | 90 | } else { |
| 91 | 91 | $recoveryKeyId = $this->keyManager->getRecoveryKeyId(); |
| 92 | 92 | if (!empty($user)) { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | if ($useLoginPassword) { |
| 102 | 102 | $question = new Question('Please enter the user\'s login password: '); |
| 103 | 103 | } else if ($this->util->isRecoveryEnabledForUser($user) === false) { |
| 104 | - $output->writeln('No recovery key available for user ' . $user); |
|
| 104 | + $output->writeln('No recovery key available for user '.$user); |
|
| 105 | 105 | return false; |
| 106 | 106 | } else { |
| 107 | 107 | $user = $recoveryKeyId; |
@@ -181,12 +181,12 @@ |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $message = preg_replace( |
| 184 | - '/(^|\s)(' . '@' . $mention['id'] . ')(\b)/', |
|
| 184 | + '/(^|\s)('.'@'.$mention['id'].')(\b)/', |
|
| 185 | 185 | //'${1}' . $this->regexSafeUser($mention['id'], $displayName) . '${3}', |
| 186 | - '${1}' . '{mention' . $mentionCount . '}' . '${3}', |
|
| 186 | + '${1}'.'{mention'.$mentionCount.'}'.'${3}', |
|
| 187 | 187 | $message |
| 188 | 188 | ); |
| 189 | - $mentions['mention' . $mentionCount] = $this->generateUserParameter($mention['id']); |
|
| 189 | + $mentions['mention'.$mentionCount] = $this->generateUserParameter($mention['id']); |
|
| 190 | 190 | $mentionCount++; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | $comment = $event->getComment(); |
| 56 | 56 | |
| 57 | 57 | $mentions = $this->extractMentions($comment->getMentions()); |
| 58 | - if(empty($mentions)) { |
|
| 58 | + if (empty($mentions)) { |
|
| 59 | 59 | // no one to notify |
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $notification = $this->instantiateNotification($comment); |
| 64 | 64 | |
| 65 | - foreach($mentions as $uid) { |
|
| 66 | - if( ($comment->getActorType() === 'users' && $uid === $comment->getActorId()) |
|
| 65 | + foreach ($mentions as $uid) { |
|
| 66 | + if (($comment->getActorType() === 'users' && $uid === $comment->getActorId()) |
|
| 67 | 67 | || !$this->userManager->userExists($uid) |
| 68 | 68 | ) { |
| 69 | 69 | // do not notify unknown users or yourself |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $notification->setUser($uid); |
| 74 | - if( $event->getEvent() === CommentsEvent::EVENT_DELETE |
|
| 74 | + if ($event->getEvent() === CommentsEvent::EVENT_DELETE |
|
| 75 | 75 | || $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE) |
| 76 | 76 | { |
| 77 | 77 | $this->notificationManager->markProcessed($notification); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $notification |
| 93 | 93 | ->setApp('comments') |
| 94 | 94 | ->setObject('comment', $comment->getId()) |
| 95 | - ->setSubject('mention', [ $comment->getObjectType(), $comment->getObjectId() ]) |
|
| 95 | + ->setSubject('mention', [$comment->getObjectType(), $comment->getObjectId()]) |
|
| 96 | 96 | ->setDateTime($comment->getCreationDateTime()); |
| 97 | 97 | |
| 98 | 98 | return $notification; |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | * @return string[] containing the mentions, e.g. ['alice', 'bob'] |
| 106 | 106 | */ |
| 107 | 107 | public function extractMentions(array $mentions) { |
| 108 | - if(empty($mentions)) { |
|
| 108 | + if (empty($mentions)) { |
|
| 109 | 109 | return []; |
| 110 | 110 | } |
| 111 | 111 | $uids = []; |
| 112 | - foreach($mentions as $mention) { |
|
| 113 | - if($mention['type'] === 'user') { |
|
| 112 | + foreach ($mentions as $mention) { |
|
| 113 | + if ($mention['type'] === 'user') { |
|
| 114 | 114 | $uids[] = $mention['id']; |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | class Application extends App { |
| 28 | 28 | |
| 29 | - public function __construct (array $urlParams = array()) { |
|
| 29 | + public function __construct(array $urlParams = array()) { |
|
| 30 | 30 | parent::__construct('comments', $urlParams); |
| 31 | 31 | $container = $this->getContainer(); |
| 32 | 32 | |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | * @param CommentsEvent $event |
| 52 | 52 | */ |
| 53 | 53 | public function handle(CommentsEvent $event) { |
| 54 | - if($event->getComment()->getObjectType() !== 'files') { |
|
| 54 | + if ($event->getComment()->getObjectType() !== 'files') { |
|
| 55 | 55 | // this is a 'files'-specific Handler |
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $eventType = $event->getEvent(); |
| 60 | - if( $eventType === CommentsEvent::EVENT_ADD |
|
| 60 | + if ($eventType === CommentsEvent::EVENT_ADD |
|
| 61 | 61 | ) { |
| 62 | 62 | $this->notificationHandler($event); |
| 63 | 63 | $this->activityHandler($event); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | CommentsEvent::EVENT_UPDATE, |
| 70 | 70 | CommentsEvent::EVENT_DELETE, |
| 71 | 71 | ]; |
| 72 | - if(in_array($eventType, $applicableEvents)) { |
|
| 72 | + if (in_array($eventType, $applicableEvents)) { |
|
| 73 | 73 | $this->notificationHandler($event); |
| 74 | 74 | return; |
| 75 | 75 | } |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $dir = '/'; |
| 33 | 33 | if (isset($_POST['dir'])) { |
| 34 | - $dir = rtrim((string)$_POST['dir'], '/'). '/'; |
|
| 34 | + $dir = rtrim((string) $_POST['dir'], '/').'/'; |
|
| 35 | 35 | } |
| 36 | 36 | $allFiles = false; |
| 37 | -if (isset($_POST['allfiles']) && (string)$_POST['allfiles'] === 'true') { |
|
| 37 | +if (isset($_POST['allfiles']) && (string) $_POST['allfiles'] === 'true') { |
|
| 38 | 38 | $allFiles = true; |
| 39 | 39 | $list = array(); |
| 40 | 40 | $dirListing = true; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | foreach (OCA\Files_Trashbin\Helper::getTrashFiles($dir, \OCP\User::getUser()) as $file) { |
| 45 | 45 | $fileName = $file['name']; |
| 46 | 46 | if (!$dirListing) { |
| 47 | - $fileName .= '.d' . $file['mtime']; |
|
| 47 | + $fileName .= '.d'.$file['mtime']; |
|
| 48 | 48 | } |
| 49 | 49 | $list[] = $fileName; |
| 50 | 50 | } |
@@ -57,21 +57,21 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $i = 0; |
| 59 | 59 | foreach ($list as $file) { |
| 60 | - $path = $dir . '/' . $file; |
|
| 60 | + $path = $dir.'/'.$file; |
|
| 61 | 61 | if ($dir === '/') { |
| 62 | 62 | $file = ltrim($file, '/'); |
| 63 | 63 | $delimiter = strrpos($file, '.d'); |
| 64 | 64 | $filename = substr($file, 0, $delimiter); |
| 65 | - $timestamp = substr($file, $delimiter+2); |
|
| 65 | + $timestamp = substr($file, $delimiter + 2); |
|
| 66 | 66 | } else { |
| 67 | 67 | $path_parts = pathinfo($file); |
| 68 | 68 | $filename = $path_parts['basename']; |
| 69 | 69 | $timestamp = null; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if ( !OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp) ) { |
|
| 72 | + if (!OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp)) { |
|
| 73 | 73 | $error[] = $filename; |
| 74 | - \OCP\Util::writeLog('trashbin', 'can\'t restore ' . $filename, \OCP\Util::ERROR); |
|
| 74 | + \OCP\Util::writeLog('trashbin', 'can\'t restore '.$filename, \OCP\Util::ERROR); |
|
| 75 | 75 | } else { |
| 76 | 76 | $success[$i]['filename'] = $file; |
| 77 | 77 | $success[$i]['timestamp'] = $timestamp; |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -if ( $error ) { |
|
| 83 | +if ($error) { |
|
| 84 | 84 | $filelist = ''; |
| 85 | - foreach ( $error as $e ) { |
|
| 85 | + foreach ($error as $e) { |
|
| 86 | 86 | $filelist .= $e.', '; |
| 87 | 87 | } |
| 88 | 88 | $l = OC::$server->getL10N('files_trashbin'); |
@@ -25,8 +25,8 @@ |
||
| 25 | 25 | \OC::$server->getSession()->close(); |
| 26 | 26 | |
| 27 | 27 | // Load the files |
| 28 | -$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; |
|
| 29 | -$sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name'; |
|
| 28 | +$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : ''; |
|
| 29 | +$sortAttribute = isset($_GET['sort']) ? (string) $_GET['sort'] : 'name'; |
|
| 30 | 30 | $sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false; |
| 31 | 31 | $data = array(); |
| 32 | 32 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $folder = isset($_POST['dir']) ? $_POST['dir'] : '/'; |
| 32 | 32 | |
| 33 | 33 | // "empty trash" command |
| 34 | -if (isset($_POST['allfiles']) && (string)$_POST['allfiles'] === 'true'){ |
|
| 34 | +if (isset($_POST['allfiles']) && (string) $_POST['allfiles'] === 'true') { |
|
| 35 | 35 | $deleteAll = true; |
| 36 | 36 | if ($folder === '/' || $folder === '') { |
| 37 | 37 | OCA\Files_Trashbin\Trashbin::deleteAll(); |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | else { |
| 45 | 45 | $deleteAll = false; |
| 46 | - $files = (string)$_POST['files']; |
|
| 46 | + $files = (string) $_POST['files']; |
|
| 47 | 47 | $list = json_decode($files); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -$folder = rtrim($folder, '/') . '/'; |
|
| 50 | +$folder = rtrim($folder, '/').'/'; |
|
| 51 | 51 | $error = array(); |
| 52 | 52 | $success = array(); |
| 53 | 53 | |
@@ -57,16 +57,16 @@ discard block |
||
| 57 | 57 | $file = ltrim($file, '/'); |
| 58 | 58 | $delimiter = strrpos($file, '.d'); |
| 59 | 59 | $filename = substr($file, 0, $delimiter); |
| 60 | - $timestamp = substr($file, $delimiter+2); |
|
| 60 | + $timestamp = substr($file, $delimiter + 2); |
|
| 61 | 61 | } else { |
| 62 | - $filename = $folder . '/' . $file; |
|
| 62 | + $filename = $folder.'/'.$file; |
|
| 63 | 63 | $timestamp = null; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | OCA\Files_Trashbin\Trashbin::delete($filename, \OCP\User::getUser(), $timestamp); |
| 67 | 67 | if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) { |
| 68 | 68 | $error[] = $filename; |
| 69 | - \OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', \OCP\Util::ERROR); |
|
| 69 | + \OCP\Util::writeLog('trashbin', 'can\'t delete '.$filename.' permanently.', \OCP\Util::ERROR); |
|
| 70 | 70 | } |
| 71 | 71 | // only list deleted files if not deleting everything |
| 72 | 72 | else if (!$deleteAll) { |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | -if ( $error ) { |
|
| 79 | +if ($error) { |
|
| 80 | 80 | $filelist = ''; |
| 81 | - foreach ( $error as $e ) { |
|
| 81 | + foreach ($error as $e) { |
|
| 82 | 82 | $filelist .= $e.', '; |
| 83 | 83 | } |
| 84 | 84 | $l = \OC::$server->getL10N('files_trashbin'); |