@@ -7,19 +7,19 @@ discard block |
||
| 7 | 7 | ?> |
| 8 | 8 | <form id="ocDefaultEncryptionModule" class="sub-section"> |
| 9 | 9 | <h3><?php p($l->t("Default encryption module")); ?></h3> |
| 10 | - <?php if(!$_["initStatus"] && $_['masterKeyEnabled'] === false): ?> |
|
| 10 | + <?php if (!$_["initStatus"] && $_['masterKeyEnabled'] === false): ?> |
|
| 11 | 11 | <?php p($l->t("Encryption app is enabled but your keys are not initialized, please log-out and log-in again")); ?> |
| 12 | 12 | <?php else: ?> |
| 13 | 13 | <p id="encryptHomeStorageSetting"> |
| 14 | 14 | <input type="checkbox" class="checkbox" name="encrypt_home_storage" id="encryptHomeStorage" |
| 15 | 15 | value="1" <?php if ($_['encryptHomeStorage']) print_unescaped('checked="checked"'); ?> /> |
| 16 | - <label for="encryptHomeStorage"><?php p($l->t('Encrypt the home storage'));?></label></br> |
|
| 17 | - <em><?php p( $l->t( "Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted" ) ); ?></em> |
|
| 16 | + <label for="encryptHomeStorage"><?php p($l->t('Encrypt the home storage')); ?></label></br> |
|
| 17 | + <em><?php p($l->t("Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted")); ?></em> |
|
| 18 | 18 | </p> |
| 19 | 19 | <br /> |
| 20 | - <?php if($_['masterKeyEnabled'] === false): ?> |
|
| 20 | + <?php if ($_['masterKeyEnabled'] === false): ?> |
|
| 21 | 21 | <p id="encryptionSetRecoveryKey"> |
| 22 | - <?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?> |
|
| 22 | + <?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?> |
|
| 23 | 23 | <span class="msg"></span> |
| 24 | 24 | <br/> |
| 25 | 25 | <em> |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | name="enableRecoveryKey" |
| 39 | 39 | id="enableRecoveryKey" |
| 40 | 40 | status="<?php p($_["recoveryEnabled"]) ?>" |
| 41 | - value="<?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?>"/> |
|
| 41 | + value="<?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?>"/> |
|
| 42 | 42 | </p> |
| 43 | 43 | <br/><br/> |
| 44 | 44 | |
| 45 | - <p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>> |
|
| 45 | + <p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"'); ?>> |
|
| 46 | 46 | <?php p($l->t("Change recovery key password:")); ?> |
| 47 | 47 | <span class="msg"></span> |
| 48 | 48 | <br/> |
@@ -70,34 +70,34 @@ |
||
| 70 | 70 | |
| 71 | 71 | $status = 'error'; |
| 72 | 72 | $message = 'no valid init status'; |
| 73 | - switch( $this->session->getStatus()) { |
|
| 73 | + switch ($this->session->getStatus()) { |
|
| 74 | 74 | case Session::RUN_MIGRATION: |
| 75 | 75 | $status = 'interactionNeeded'; |
| 76 | - $message = (string)$this->l->t( |
|
| 76 | + $message = (string) $this->l->t( |
|
| 77 | 77 | 'You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please run \'occ encryption:migrate\' or contact your administrator' |
| 78 | 78 | ); |
| 79 | 79 | break; |
| 80 | 80 | case Session::INIT_EXECUTED: |
| 81 | 81 | $status = 'interactionNeeded'; |
| 82 | - $message = (string)$this->l->t( |
|
| 82 | + $message = (string) $this->l->t( |
|
| 83 | 83 | 'Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.' |
| 84 | 84 | ); |
| 85 | 85 | break; |
| 86 | 86 | case Session::NOT_INITIALIZED: |
| 87 | 87 | $status = 'interactionNeeded'; |
| 88 | 88 | if ($this->encryptionManager->isEnabled()) { |
| 89 | - $message = (string)$this->l->t( |
|
| 89 | + $message = (string) $this->l->t( |
|
| 90 | 90 | 'Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.' |
| 91 | 91 | ); |
| 92 | 92 | } else { |
| 93 | - $message = (string)$this->l->t( |
|
| 93 | + $message = (string) $this->l->t( |
|
| 94 | 94 | 'Please enable server side encryption in the admin settings in order to use the encryption module.' |
| 95 | 95 | ); |
| 96 | 96 | } |
| 97 | 97 | break; |
| 98 | 98 | case Session::INIT_SUCCESSFUL: |
| 99 | 99 | $status = 'success'; |
| 100 | - $message = (string)$this->l->t('Encryption app is enabled and ready'); |
|
| 100 | + $message = (string) $this->l->t('Encryption app is enabled and ready'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | return new DataResponse( |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | |
| 68 | 68 | $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); |
| 69 | 69 | |
| 70 | - if(!$isMasterKeyEnabled) { |
|
| 70 | + if (!$isMasterKeyEnabled) { |
|
| 71 | 71 | $output->writeln('Master key already disabled'); |
| 72 | 72 | } else { |
| 73 | 73 | $question = new ConfirmationQuestion( |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $this->recoveryKeyId = $this->config->getAppValue('encryption', |
| 127 | 127 | 'recoveryKeyId'); |
| 128 | 128 | if (empty($this->recoveryKeyId)) { |
| 129 | - $this->recoveryKeyId = 'recoveryKey_' . substr(md5(time()), 0, 8); |
|
| 129 | + $this->recoveryKeyId = 'recoveryKey_'.substr(md5(time()), 0, 8); |
|
| 130 | 130 | $this->config->setAppValue('encryption', |
| 131 | 131 | 'recoveryKeyId', |
| 132 | 132 | $this->recoveryKeyId); |
@@ -135,14 +135,14 @@ discard block |
||
| 135 | 135 | $this->publicShareKeyId = $this->config->getAppValue('encryption', |
| 136 | 136 | 'publicShareKeyId'); |
| 137 | 137 | if (empty($this->publicShareKeyId)) { |
| 138 | - $this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8); |
|
| 138 | + $this->publicShareKeyId = 'pubShare_'.substr(md5(time()), 0, 8); |
|
| 139 | 139 | $this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $this->masterKeyId = $this->config->getAppValue('encryption', |
| 143 | 143 | 'masterKeyId'); |
| 144 | 144 | if (empty($this->masterKeyId)) { |
| 145 | - $this->masterKeyId = 'master_' . substr(md5(time()), 0, 8); |
|
| 145 | + $this->masterKeyId = 'master_'.substr(md5(time()), 0, 8); |
|
| 146 | 146 | $this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | // Save public key |
| 162 | 162 | $this->keyStorage->setSystemUserKey( |
| 163 | - $this->publicShareKeyId . '.publicKey', $keyPair['publicKey'], |
|
| 163 | + $this->publicShareKeyId.'.publicKey', $keyPair['publicKey'], |
|
| 164 | 164 | Encryption::ID); |
| 165 | 165 | |
| 166 | 166 | // Encrypt private key empty passphrase |
| 167 | 167 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], ''); |
| 168 | 168 | $header = $this->crypt->generateHeader(); |
| 169 | - $this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey); |
|
| 169 | + $this->setSystemPrivateKey($this->publicShareKeyId, $header.$encryptedKey); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | // Save public key |
| 187 | 187 | $this->keyStorage->setSystemUserKey( |
| 188 | - $this->masterKeyId . '.publicKey', $keyPair['publicKey'], |
|
| 188 | + $this->masterKeyId.'.publicKey', $keyPair['publicKey'], |
|
| 189 | 189 | Encryption::ID); |
| 190 | 190 | |
| 191 | 191 | // Encrypt private key with system password |
| 192 | 192 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], $this->getMasterKeyPassword(), $this->masterKeyId); |
| 193 | 193 | $header = $this->crypt->generateHeader(); |
| 194 | - $this->setSystemPrivateKey($this->masterKeyId, $header . $encryptedKey); |
|
| 194 | + $this->setSystemPrivateKey($this->masterKeyId, $header.$encryptedKey); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (!$this->session->isPrivateKeySet()) { |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @return string |
| 219 | 219 | */ |
| 220 | 220 | public function getRecoveryKey() { |
| 221 | - return $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.publicKey', Encryption::ID); |
|
| 221 | + return $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.publicKey', Encryption::ID); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @return bool |
| 236 | 236 | */ |
| 237 | 237 | public function checkRecoveryPassword($password) { |
| 238 | - $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.privateKey', Encryption::ID); |
|
| 238 | + $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.privateKey', Encryption::ID); |
|
| 239 | 239 | $decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $password); |
| 240 | 240 | |
| 241 | 241 | if ($decryptedRecoveryKey) { |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | $header = $this->crypt->generateHeader(); |
| 260 | 260 | |
| 261 | 261 | if ($encryptedKey) { |
| 262 | - $this->setPrivateKey($uid, $header . $encryptedKey); |
|
| 262 | + $this->setPrivateKey($uid, $header.$encryptedKey); |
|
| 263 | 263 | return true; |
| 264 | 264 | } |
| 265 | 265 | return false; |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $header = $this->crypt->generateHeader(); |
| 282 | 282 | |
| 283 | 283 | if ($encryptedKey) { |
| 284 | - $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header . $encryptedKey); |
|
| 284 | + $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header.$encryptedKey); |
|
| 285 | 285 | return true; |
| 286 | 286 | } |
| 287 | 287 | return false; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | * @return boolean |
| 342 | 342 | */ |
| 343 | 343 | public function setShareKey($path, $uid, $key) { |
| 344 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
| 344 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
| 345 | 345 | return $this->keyStorage->setFileKey($path, $keyId, $key, Encryption::ID); |
| 346 | 346 | } |
| 347 | 347 | |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | $this->session->setStatus(Session::INIT_EXECUTED); |
| 358 | 358 | |
| 359 | 359 | try { |
| 360 | - if($this->util->isMasterKeyEnabled()) { |
|
| 360 | + if ($this->util->isMasterKeyEnabled()) { |
|
| 361 | 361 | $uid = $this->getMasterKeyId(); |
| 362 | 362 | $passPhrase = $this->getMasterKeyPassword(); |
| 363 | 363 | $privateKey = $this->getSystemPrivateKey($uid); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | return false; |
| 372 | 372 | } catch (\Exception $e) { |
| 373 | 373 | $this->log->warning( |
| 374 | - 'Could not decrypt the private key from user "' . $uid . '"" during login. ' . |
|
| 374 | + 'Could not decrypt the private key from user "'.$uid.'"" during login. '. |
|
| 375 | 375 | 'Assume password change on the user back-end. Error message: ' |
| 376 | 376 | . $e->getMessage() |
| 377 | 377 | ); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | // use public share key for public links |
| 433 | 433 | $uid = $this->getPublicShareKeyId(); |
| 434 | 434 | $shareKey = $this->getShareKey($path, $uid); |
| 435 | - $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.privateKey', Encryption::ID); |
|
| 435 | + $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.privateKey', Encryption::ID); |
|
| 436 | 436 | $privateKey = $this->crypt->decryptPrivateKey($privateKey); |
| 437 | 437 | } else { |
| 438 | 438 | $shareKey = $this->getShareKey($path, $uid); |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | public function getVersion($path, View $view) { |
| 459 | 459 | $fileInfo = $view->getFileInfo($path); |
| 460 | - if($fileInfo === false) { |
|
| 460 | + if ($fileInfo === false) { |
|
| 461 | 461 | return 0; |
| 462 | 462 | } |
| 463 | 463 | return $fileInfo->getEncryptedVersion(); |
@@ -471,9 +471,9 @@ discard block |
||
| 471 | 471 | * @param View $view |
| 472 | 472 | */ |
| 473 | 473 | public function setVersion($path, $version, View $view) { |
| 474 | - $fileInfo= $view->getFileInfo($path); |
|
| 474 | + $fileInfo = $view->getFileInfo($path); |
|
| 475 | 475 | |
| 476 | - if($fileInfo !== false) { |
|
| 476 | + if ($fileInfo !== false) { |
|
| 477 | 477 | $cache = $fileInfo->getStorage()->getCache(); |
| 478 | 478 | $cache->update($fileInfo->getId(), ['encrypted' => $version, 'encryptedVersion' => $version]); |
| 479 | 479 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | public function deleteShareKey($path, $keyId) { |
| 503 | 503 | return $this->keyStorage->deleteFileKey( |
| 504 | 504 | $path, |
| 505 | - $keyId . '.' . $this->shareKeyId, |
|
| 505 | + $keyId.'.'.$this->shareKeyId, |
|
| 506 | 506 | Encryption::ID); |
| 507 | 507 | } |
| 508 | 508 | |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | * @return mixed |
| 514 | 514 | */ |
| 515 | 515 | public function getShareKey($path, $uid) { |
| 516 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
| 516 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
| 517 | 517 | return $this->keyStorage->getFileKey($path, $keyId, Encryption::ID); |
| 518 | 518 | } |
| 519 | 519 | |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | * @return string |
| 576 | 576 | */ |
| 577 | 577 | public function getPublicShareKey() { |
| 578 | - return $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.publicKey', Encryption::ID); |
|
| 578 | + return $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.publicKey', Encryption::ID); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | /** |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | * @return string returns openssl key |
| 646 | 646 | */ |
| 647 | 647 | public function getSystemPrivateKey($keyId) { |
| 648 | - return $this->keyStorage->getSystemUserKey($keyId . '.' . $this->privateKeyId, Encryption::ID); |
|
| 648 | + return $this->keyStorage->getSystemUserKey($keyId.'.'.$this->privateKeyId, Encryption::ID); |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | */ |
| 656 | 656 | public function setSystemPrivateKey($keyId, $key) { |
| 657 | 657 | return $this->keyStorage->setSystemUserKey( |
| 658 | - $keyId . '.' . $this->privateKeyId, |
|
| 658 | + $keyId.'.'.$this->privateKeyId, |
|
| 659 | 659 | $key, |
| 660 | 660 | Encryption::ID); |
| 661 | 661 | } |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | */ |
| 696 | 696 | public function getMasterKeyPassword() { |
| 697 | 697 | $password = $this->config->getSystemValue('secret'); |
| 698 | - if (empty($password)){ |
|
| 698 | + if (empty($password)) { |
|
| 699 | 699 | throw new \Exception('Can not get secret from Nextcloud instance'); |
| 700 | 700 | } |
| 701 | 701 | |
@@ -717,6 +717,6 @@ discard block |
||
| 717 | 717 | * @return string |
| 718 | 718 | */ |
| 719 | 719 | public function getPublicMasterKey() { |
| 720 | - return $this->keyStorage->getSystemUserKey($this->masterKeyId . '.publicKey', Encryption::ID); |
|
| 720 | + return $this->keyStorage->getSystemUserKey($this->masterKeyId.'.publicKey', Encryption::ID); |
|
| 721 | 721 | } |
| 722 | 722 | } |
@@ -86,17 +86,17 @@ discard block |
||
| 86 | 86 | $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event') { |
|
| 89 | + if ($event->getSubject() === self::SUBJECT_OBJECT_ADD.'_event') { |
|
| 90 | 90 | $subject = $this->l->t('{actor} created event {event} in calendar {calendar}'); |
| 91 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event_self') { |
|
| 91 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD.'_event_self') { |
|
| 92 | 92 | $subject = $this->l->t('You created event {event} in calendar {calendar}'); |
| 93 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event') { |
|
| 93 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE.'_event') { |
|
| 94 | 94 | $subject = $this->l->t('{actor} deleted event {event} from calendar {calendar}'); |
| 95 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event_self') { |
|
| 95 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE.'_event_self') { |
|
| 96 | 96 | $subject = $this->l->t('You deleted event {event} from calendar {calendar}'); |
| 97 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event') { |
|
| 97 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_event') { |
|
| 98 | 98 | $subject = $this->l->t('{actor} updated event {event} in calendar {calendar}'); |
| 99 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event_self') { |
|
| 99 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_event_self') { |
|
| 100 | 100 | $subject = $this->l->t('You updated event {event} in calendar {calendar}'); |
| 101 | 101 | } else { |
| 102 | 102 | throw new \InvalidArgumentException(); |
@@ -119,17 +119,17 @@ discard block |
||
| 119 | 119 | $parameters = $event->getSubjectParameters(); |
| 120 | 120 | |
| 121 | 121 | switch ($subject) { |
| 122 | - case self::SUBJECT_OBJECT_ADD . '_event': |
|
| 123 | - case self::SUBJECT_OBJECT_DELETE . '_event': |
|
| 124 | - case self::SUBJECT_OBJECT_UPDATE . '_event': |
|
| 122 | + case self::SUBJECT_OBJECT_ADD.'_event': |
|
| 123 | + case self::SUBJECT_OBJECT_DELETE.'_event': |
|
| 124 | + case self::SUBJECT_OBJECT_UPDATE.'_event': |
|
| 125 | 125 | return [ |
| 126 | 126 | 'actor' => $this->generateUserParameter($parameters[0]), |
| 127 | 127 | 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
| 128 | 128 | 'event' => $this->generateObjectParameter($parameters[2]), |
| 129 | 129 | ]; |
| 130 | - case self::SUBJECT_OBJECT_ADD . '_event_self': |
|
| 131 | - case self::SUBJECT_OBJECT_DELETE . '_event_self': |
|
| 132 | - case self::SUBJECT_OBJECT_UPDATE . '_event_self': |
|
| 130 | + case self::SUBJECT_OBJECT_ADD.'_event_self': |
|
| 131 | + case self::SUBJECT_OBJECT_DELETE.'_event_self': |
|
| 132 | + case self::SUBJECT_OBJECT_UPDATE.'_event_self': |
|
| 133 | 133 | return [ |
| 134 | 134 | 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
| 135 | 135 | 'event' => $this->generateObjectParameter($parameters[2]), |
@@ -46,26 +46,26 @@ discard block |
||
| 46 | 46 | $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg'))); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') { |
|
| 49 | + if ($event->getSubject() === self::SUBJECT_OBJECT_ADD.'_todo') { |
|
| 50 | 50 | $subject = $this->l->t('{actor} created todo {todo} in list {calendar}'); |
| 51 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') { |
|
| 51 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD.'_todo_self') { |
|
| 52 | 52 | $subject = $this->l->t('You created todo {todo} in list {calendar}'); |
| 53 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') { |
|
| 53 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE.'_todo') { |
|
| 54 | 54 | $subject = $this->l->t('{actor} deleted todo {todo} from list {calendar}'); |
| 55 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') { |
|
| 55 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE.'_todo_self') { |
|
| 56 | 56 | $subject = $this->l->t('You deleted todo {todo} from list {calendar}'); |
| 57 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') { |
|
| 57 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo') { |
|
| 58 | 58 | $subject = $this->l->t('{actor} updated todo {todo} in list {calendar}'); |
| 59 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') { |
|
| 59 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_self') { |
|
| 60 | 60 | $subject = $this->l->t('You updated todo {todo} in list {calendar}'); |
| 61 | 61 | |
| 62 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') { |
|
| 62 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_completed') { |
|
| 63 | 63 | $subject = $this->l->t('{actor} solved todo {todo} in list {calendar}'); |
| 64 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') { |
|
| 64 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_completed_self') { |
|
| 65 | 65 | $subject = $this->l->t('You solved todo {todo} in list {calendar}'); |
| 66 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') { |
|
| 66 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action') { |
|
| 67 | 67 | $subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}'); |
| 68 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') { |
|
| 68 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action_self') { |
|
| 69 | 69 | $subject = $this->l->t('You reopened todo {todo} in list {calendar}'); |
| 70 | 70 | } else { |
| 71 | 71 | throw new \InvalidArgumentException(); |
@@ -88,21 +88,21 @@ discard block |
||
| 88 | 88 | $parameters = $event->getSubjectParameters(); |
| 89 | 89 | |
| 90 | 90 | switch ($subject) { |
| 91 | - case self::SUBJECT_OBJECT_ADD . '_todo': |
|
| 92 | - case self::SUBJECT_OBJECT_DELETE . '_todo': |
|
| 93 | - case self::SUBJECT_OBJECT_UPDATE . '_todo': |
|
| 94 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_completed': |
|
| 95 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action': |
|
| 91 | + case self::SUBJECT_OBJECT_ADD.'_todo': |
|
| 92 | + case self::SUBJECT_OBJECT_DELETE.'_todo': |
|
| 93 | + case self::SUBJECT_OBJECT_UPDATE.'_todo': |
|
| 94 | + case self::SUBJECT_OBJECT_UPDATE.'_todo_completed': |
|
| 95 | + case self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action': |
|
| 96 | 96 | return [ |
| 97 | 97 | 'actor' => $this->generateUserParameter($parameters[0]), |
| 98 | 98 | 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
| 99 | 99 | 'todo' => $this->generateObjectParameter($parameters[2]), |
| 100 | 100 | ]; |
| 101 | - case self::SUBJECT_OBJECT_ADD . '_todo_self': |
|
| 102 | - case self::SUBJECT_OBJECT_DELETE . '_todo_self': |
|
| 103 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_self': |
|
| 104 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self': |
|
| 105 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self': |
|
| 101 | + case self::SUBJECT_OBJECT_ADD.'_todo_self': |
|
| 102 | + case self::SUBJECT_OBJECT_DELETE.'_todo_self': |
|
| 103 | + case self::SUBJECT_OBJECT_UPDATE.'_todo_self': |
|
| 104 | + case self::SUBJECT_OBJECT_UPDATE.'_todo_completed_self': |
|
| 105 | + case self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action_self': |
|
| 106 | 106 | return [ |
| 107 | 107 | 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
| 108 | 108 | 'todo' => $this->generateObjectParameter($parameters[2]), |
@@ -59,6 +59,9 @@ discard block |
||
| 59 | 59 | return $query->execute()->fetchAll(); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | + /** |
|
| 63 | + * @param string $path |
|
| 64 | + */ |
|
| 62 | 65 | private function getId($storage, $path) { |
| 63 | 66 | $builder = $this->connection->getQueryBuilder(); |
| 64 | 67 | |
@@ -70,6 +73,9 @@ discard block |
||
| 70 | 73 | return $query->execute()->fetchColumn(); |
| 71 | 74 | } |
| 72 | 75 | |
| 76 | + /** |
|
| 77 | + * @param string $newPath |
|
| 78 | + */ |
|
| 73 | 79 | private function update($fileid, $newPath) { |
| 74 | 80 | $builder = $this->connection->getQueryBuilder(); |
| 75 | 81 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | private function repair() { |
| 102 | 102 | $entries = $this->getInvalidEntries(); |
| 103 | 103 | foreach ($entries as $entry) { |
| 104 | - $calculatedPath = $entry['parent_path'] . '/' . $entry['name']; |
|
| 104 | + $calculatedPath = $entry['parent_path'].'/'.$entry['name']; |
|
| 105 | 105 | if ($newId = $this->getId($entry['storage'], $calculatedPath)) { |
| 106 | 106 | // a new entry with the correct path has already been created, reuse that one and delete the incorrect entry |
| 107 | 107 | $this->reparent($entry['fileid'], $newId); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | if (version_compare($versionFromBeforeUpdate, '12.0.0.30', '<') || version_compare($versionFromBeforeUpdate, '13.0.0.0', '==')) { |
| 120 | 120 | $count = $this->repair(); |
| 121 | 121 | |
| 122 | - $output->info('Repaired ' . $count . ' paths'); |
|
| 122 | + $output->info('Repaired '.$count.' paths'); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -180,6 +180,10 @@ discard block |
||
| 180 | 180 | return 'en'; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | + /** |
|
| 184 | + * @param string $app |
|
| 185 | + * @param string $lang |
|
| 186 | + */ |
|
| 183 | 187 | public function findLocale($app = null, $lang = null) |
| 184 | 188 | { |
| 185 | 189 | if ($this->config->getSystemValue('installed', false)) { |
@@ -367,6 +371,11 @@ discard block |
||
| 367 | 371 | */ |
| 368 | 372 | // FIXME This method is only public, until OC_L10N does not need it anymore, |
| 369 | 373 | // FIXME This is also the reason, why it is not in the public interface |
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * @param string $app |
|
| 377 | + * @param string $lang |
|
| 378 | + */ |
|
| 370 | 379 | public function getL10nFilesForApp($app, $lang) { |
| 371 | 380 | $languageFiles = []; |
| 372 | 381 | |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @link https://github.com/owncloud/core/issues/21955 |
| 144 | 144 | */ |
| 145 | - if($this->config->getSystemValue('installed', false)) { |
|
| 146 | - $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
| 147 | - if(!is_null($userId)) { |
|
| 145 | + if ($this->config->getSystemValue('installed', false)) { |
|
| 146 | + $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
| 147 | + if (!is_null($userId)) { |
|
| 148 | 148 | $userLang = $this->config->getUserValue($userId, 'core', 'lang', null); |
| 149 | 149 | } else { |
| 150 | 150 | $userLang = null; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | public function findLocale($app = null, $lang = null) |
| 184 | 184 | { |
| 185 | 185 | if ($this->config->getSystemValue('installed', false)) { |
| 186 | - $userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null; |
|
| 186 | + $userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null; |
|
| 187 | 187 | $userLocale = null; |
| 188 | 188 | if (null !== $userId) { |
| 189 | 189 | $userLocale = $this->config->getUserValue($userId, 'core', 'locale', null); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | // merge with translations from theme |
| 246 | 246 | $theme = $this->config->getSystemValue('theme'); |
| 247 | 247 | if (!empty($theme)) { |
| 248 | - $themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot)); |
|
| 248 | + $themeDir = $this->serverRoot.'/themes/'.$theme.substr($dir, strlen($this->serverRoot)); |
|
| 249 | 249 | |
| 250 | 250 | if (is_dir($themeDir)) { |
| 251 | 251 | $files = scandir($themeDir); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | public function findAvailableLocales() |
| 267 | 267 | { |
| 268 | - $localeData = file_get_contents(__DIR__ . '/locales.json'); |
|
| 268 | + $localeData = file_get_contents(__DIR__.'/locales.json'); |
|
| 269 | 269 | return json_decode($localeData, true); |
| 270 | 270 | } |
| 271 | 271 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | private function isSubDirectory($sub, $parent) { |
| 348 | 348 | // Check whether $sub contains no ".." |
| 349 | - if(strpos($sub, '..') !== false) { |
|
| 349 | + if (strpos($sub, '..') !== false) { |
|
| 350 | 350 | return false; |
| 351 | 351 | } |
| 352 | 352 | |
@@ -371,12 +371,12 @@ discard block |
||
| 371 | 371 | $languageFiles = []; |
| 372 | 372 | |
| 373 | 373 | $i18nDir = $this->findL10nDir($app); |
| 374 | - $transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json'; |
|
| 374 | + $transFile = strip_tags($i18nDir).strip_tags($lang).'.json'; |
|
| 375 | 375 | |
| 376 | - if (($this->isSubDirectory($transFile, $this->serverRoot . '/core/l10n/') |
|
| 377 | - || $this->isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/') |
|
| 378 | - || $this->isSubDirectory($transFile, $this->serverRoot . '/settings/l10n/') |
|
| 379 | - || $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/') |
|
| 376 | + if (($this->isSubDirectory($transFile, $this->serverRoot.'/core/l10n/') |
|
| 377 | + || $this->isSubDirectory($transFile, $this->serverRoot.'/lib/l10n/') |
|
| 378 | + || $this->isSubDirectory($transFile, $this->serverRoot.'/settings/l10n/') |
|
| 379 | + || $this->isSubDirectory($transFile, \OC_App::getAppPath($app).'/l10n/') |
|
| 380 | 380 | ) |
| 381 | 381 | && file_exists($transFile)) { |
| 382 | 382 | // load the translations file |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | // merge with translations from theme |
| 387 | 387 | $theme = $this->config->getSystemValue('theme'); |
| 388 | 388 | if (!empty($theme)) { |
| 389 | - $transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot)); |
|
| 389 | + $transFile = $this->serverRoot.'/themes/'.$theme.substr($transFile, strlen($this->serverRoot)); |
|
| 390 | 390 | if (file_exists($transFile)) { |
| 391 | 391 | $languageFiles[] = $transFile; |
| 392 | 392 | } |
@@ -403,14 +403,14 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | protected function findL10nDir($app = null) { |
| 405 | 405 | if (in_array($app, ['core', 'lib', 'settings'])) { |
| 406 | - if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) { |
|
| 407 | - return $this->serverRoot . '/' . $app . '/l10n/'; |
|
| 406 | + if (file_exists($this->serverRoot.'/'.$app.'/l10n/')) { |
|
| 407 | + return $this->serverRoot.'/'.$app.'/l10n/'; |
|
| 408 | 408 | } |
| 409 | 409 | } else if ($app && \OC_App::getAppPath($app) !== false) { |
| 410 | 410 | // Check if the app is in the app folder |
| 411 | - return \OC_App::getAppPath($app) . '/l10n/'; |
|
| 411 | + return \OC_App::getAppPath($app).'/l10n/'; |
|
| 412 | 412 | } |
| 413 | - return $this->serverRoot . '/core/l10n/'; |
|
| 413 | + return $this->serverRoot.'/core/l10n/'; |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | |
@@ -427,15 +427,15 @@ discard block |
||
| 427 | 427 | return $this->pluralFunctions[$string]; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { |
|
| 430 | + if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { |
|
| 431 | 431 | // sanitize |
| 432 | - $nplurals = preg_replace( '/[^0-9]/', '', $matches[1] ); |
|
| 433 | - $plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] ); |
|
| 432 | + $nplurals = preg_replace('/[^0-9]/', '', $matches[1]); |
|
| 433 | + $plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]); |
|
| 434 | 434 | |
| 435 | 435 | $body = str_replace( |
| 436 | - array( 'plural', 'n', '$n$plurals', ), |
|
| 437 | - array( '$plural', '$n', '$nplurals', ), |
|
| 438 | - 'nplurals='. $nplurals . '; plural=' . $plural |
|
| 436 | + array('plural', 'n', '$n$plurals',), |
|
| 437 | + array('$plural', '$n', '$nplurals',), |
|
| 438 | + 'nplurals='.$nplurals.'; plural='.$plural |
|
| 439 | 439 | ); |
| 440 | 440 | |
| 441 | 441 | // add parents |
@@ -443,9 +443,9 @@ discard block |
||
| 443 | 443 | $body .= ';'; |
| 444 | 444 | $res = ''; |
| 445 | 445 | $p = 0; |
| 446 | - for($i = 0; $i < strlen($body); $i++) { |
|
| 446 | + for ($i = 0; $i < strlen($body); $i++) { |
|
| 447 | 447 | $ch = $body[$i]; |
| 448 | - switch ( $ch ) { |
|
| 448 | + switch ($ch) { |
|
| 449 | 449 | case '?': |
| 450 | 450 | $res .= ' ? ('; |
| 451 | 451 | $p++; |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $res .= ') : ('; |
| 455 | 455 | break; |
| 456 | 456 | case ';': |
| 457 | - $res .= str_repeat( ')', $p ) . ';'; |
|
| 457 | + $res .= str_repeat(')', $p).';'; |
|
| 458 | 458 | $p = 0; |
| 459 | 459 | break; |
| 460 | 460 | default: |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | - $body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
| 465 | + $body = $res.'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
| 466 | 466 | $function = create_function('$n', $body); |
| 467 | 467 | $this->pluralFunctions[$string] = $function; |
| 468 | 468 | return $function; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public function getForm() { |
| 95 | 95 | $federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing'); |
| 96 | 96 | $lookupServerUploadEnabled = false; |
| 97 | - if($federatedFileSharingEnabled) { |
|
| 97 | + if ($federatedFileSharingEnabled) { |
|
| 98 | 98 | $federatedFileSharing = new Application(); |
| 99 | 99 | $shareProvider = $federatedFileSharing->getFederatedShareProvider(); |
| 100 | 100 | $lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled(); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | private function getLanguages(IUser $user) { |
| 196 | 196 | $forceLanguage = $this->config->getSystemValue('force_language', false); |
| 197 | - if($forceLanguage !== false) { |
|
| 197 | + if ($forceLanguage !== false) { |
|
| 198 | 198 | return []; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -206,16 +206,16 @@ discard block |
||
| 206 | 206 | $commonLanguages = []; |
| 207 | 207 | $languages = []; |
| 208 | 208 | |
| 209 | - foreach($languageCodes as $lang) { |
|
| 209 | + foreach ($languageCodes as $lang) { |
|
| 210 | 210 | $l = \OC::$server->getL10N('settings', $lang); |
| 211 | 211 | // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version |
| 212 | 212 | $potentialName = (string) $l->t('__language_name__'); |
| 213 | - if($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file |
|
| 213 | + if ($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file |
|
| 214 | 214 | $ln = array('code' => $lang, 'name' => $potentialName); |
| 215 | 215 | } elseif ($lang === 'en') { |
| 216 | 216 | $ln = ['code' => $lang, 'name' => 'English (US)']; |
| 217 | - }else{//fallback to language code |
|
| 218 | - $ln=array('code'=>$lang, 'name'=>$lang); |
|
| 217 | + } else {//fallback to language code |
|
| 218 | + $ln = array('code'=>$lang, 'name'=>$lang); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | // put appropriate languages into appropriate arrays, to print them sorted |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | if ($lang === $userLang) { |
| 224 | 224 | $userLang = $ln; |
| 225 | 225 | } elseif (in_array($lang, self::COMMON_LANGUAGE_CODES)) { |
| 226 | - $commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)]=$ln; |
|
| 226 | + $commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)] = $ln; |
|
| 227 | 227 | } else { |
| 228 | - $languages[]=$ln; |
|
| 228 | + $languages[] = $ln; |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | ksort($commonLanguages); |
| 241 | 241 | |
| 242 | 242 | // sort now by displayed language not the iso-code |
| 243 | - usort( $languages, function ($a, $b) { |
|
| 243 | + usort($languages, function($a, $b) { |
|
| 244 | 244 | if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) { |
| 245 | 245 | // If a doesn't have a name, but b does, list b before a |
| 246 | 246 | return 1; |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | private function getLocales(IUser $user) { |
| 264 | 264 | $forceLanguage = $this->config->getSystemValue('force_locale', false); |
| 265 | - if($forceLanguage !== false) { |
|
| 265 | + if ($forceLanguage !== false) { |
|
| 266 | 266 | return []; |
| 267 | 267 | } |
| 268 | 268 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | default: |
| 314 | 314 | $message = $this->l->t('Verify'); |
| 315 | 315 | } |
| 316 | - $messageParameters[$property . 'Message'] = $message; |
|
| 316 | + $messageParameters[$property.'Message'] = $message; |
|
| 317 | 317 | } |
| 318 | 318 | return $messageParameters; |
| 319 | 319 | } |