@@ -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]), |
@@ -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 | } |
@@ -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 | } |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | * @param string $opts, additional optional options |
46 | 46 | */ |
47 | 47 | function emit_css_tag($href, $opts = '') { |
48 | - $s='<link rel="stylesheet"'; |
|
48 | + $s = '<link rel="stylesheet"'; |
|
49 | 49 | if (!empty($href)) { |
50 | - $s.=' href="' . $href .'"'; |
|
50 | + $s .= ' href="'.$href.'"'; |
|
51 | 51 | } |
52 | 52 | if (!empty($opts)) { |
53 | - $s.=' '.$opts; |
|
53 | + $s .= ' '.$opts; |
|
54 | 54 | } |
55 | 55 | print_unescaped($s.">\n"); |
56 | 56 | } |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * @param hash $obj all the script information from template |
61 | 61 | */ |
62 | 62 | function emit_css_loading_tags($obj) { |
63 | - foreach($obj['cssfiles'] as $css) { |
|
63 | + foreach ($obj['cssfiles'] as $css) { |
|
64 | 64 | emit_css_tag($css); |
65 | 65 | } |
66 | - foreach($obj['printcssfiles'] as $css) { |
|
66 | + foreach ($obj['printcssfiles'] as $css) { |
|
67 | 67 | emit_css_tag($css, 'media="print"'); |
68 | 68 | } |
69 | 69 | } |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | * @param string $script_content the inline script content, ignored when empty |
75 | 75 | * @param bool $defer_flag deferred loading or not |
76 | 76 | */ |
77 | -function emit_script_tag($src, $script_content='') { |
|
78 | - $defer_str=' defer'; |
|
79 | - $s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"'; |
|
77 | +function emit_script_tag($src, $script_content = '') { |
|
78 | + $defer_str = ' defer'; |
|
79 | + $s = '<script nonce="'.\OC::$server->getContentSecurityPolicyNonceManager()->getNonce().'"'; |
|
80 | 80 | if (!empty($src)) { |
81 | 81 | // emit script tag for deferred loading from $src |
82 | - $s.=$defer_str.' src="' . $src .'">'; |
|
82 | + $s .= $defer_str.' src="'.$src.'">'; |
|
83 | 83 | } else if (!empty($script_content)) { |
84 | 84 | // emit script tag for inline script from $script_content without defer (see MDN) |
85 | - $s.=">\n".$script_content."\n"; |
|
85 | + $s .= ">\n".$script_content."\n"; |
|
86 | 86 | } else { |
87 | 87 | // no $src nor $src_content, really useless empty tag |
88 | - $s.='>'; |
|
88 | + $s .= '>'; |
|
89 | 89 | } |
90 | - $s.='</script>'; |
|
90 | + $s .= '</script>'; |
|
91 | 91 | print_unescaped($s."\n"); |
92 | 92 | } |
93 | 93 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param hash $obj all the script information from template |
97 | 97 | */ |
98 | 98 | function emit_script_loading_tags($obj) { |
99 | - foreach($obj['jsfiles'] as $jsfile) { |
|
99 | + foreach ($obj['jsfiles'] as $jsfile) { |
|
100 | 100 | emit_script_tag($jsfile, ''); |
101 | 101 | } |
102 | 102 | if (!empty($obj['inline_ocjs'])) { |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * if an array is given it will add all scripts |
121 | 121 | */ |
122 | 122 | function script($app, $file = null) { |
123 | - if(is_array($file)) { |
|
124 | - foreach($file as $f) { |
|
123 | + if (is_array($file)) { |
|
124 | + foreach ($file as $f) { |
|
125 | 125 | OC_Util::addScript($app, $f); |
126 | 126 | } |
127 | 127 | } else { |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | * if an array is given it will add all scripts |
137 | 137 | */ |
138 | 138 | function vendor_script($app, $file = null) { |
139 | - if(is_array($file)) { |
|
140 | - foreach($file as $f) { |
|
139 | + if (is_array($file)) { |
|
140 | + foreach ($file as $f) { |
|
141 | 141 | OC_Util::addVendorScript($app, $f); |
142 | 142 | } |
143 | 143 | } else { |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * if an array is given it will add all styles |
153 | 153 | */ |
154 | 154 | function style($app, $file = null) { |
155 | - if(is_array($file)) { |
|
156 | - foreach($file as $f) { |
|
155 | + if (is_array($file)) { |
|
156 | + foreach ($file as $f) { |
|
157 | 157 | OC_Util::addStyle($app, $f); |
158 | 158 | } |
159 | 159 | } else { |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * if an array is given it will add all styles |
169 | 169 | */ |
170 | 170 | function vendor_style($app, $file = null) { |
171 | - if(is_array($file)) { |
|
172 | - foreach($file as $f) { |
|
171 | + if (is_array($file)) { |
|
172 | + foreach ($file as $f) { |
|
173 | 173 | OC_Util::addVendorStyle($app, $f); |
174 | 174 | } |
175 | 175 | } else { |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | * if an array is given it will add all components |
194 | 194 | */ |
195 | 195 | function component($app, $file) { |
196 | - if(is_array($file)) { |
|
197 | - foreach($file as $f) { |
|
198 | - $url = link_to($app, 'component/' . $f . '.html'); |
|
196 | + if (is_array($file)) { |
|
197 | + foreach ($file as $f) { |
|
198 | + $url = link_to($app, 'component/'.$f.'.html'); |
|
199 | 199 | OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
200 | 200 | } |
201 | 201 | } else { |
202 | - $url = link_to($app, 'component/' . $file . '.html'); |
|
202 | + $url = link_to($app, 'component/'.$file.'.html'); |
|
203 | 203 | OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
204 | 204 | } |
205 | 205 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * |
214 | 214 | * For further information have a look at \OCP\IURLGenerator::linkTo |
215 | 215 | */ |
216 | -function link_to( $app, $file, $args = array() ) { |
|
216 | +function link_to($app, $file, $args = array()) { |
|
217 | 217 | return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
218 | 218 | } |
219 | 219 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * |
234 | 234 | * For further information have a look at \OCP\IURLGenerator::imagePath |
235 | 235 | */ |
236 | -function image_path( $app, $image ) { |
|
237 | - return \OC::$server->getURLGenerator()->imagePath( $app, $image ); |
|
236 | +function image_path($app, $image) { |
|
237 | + return \OC::$server->getURLGenerator()->imagePath($app, $image); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | * @param string $mimetype mimetype |
243 | 243 | * @return string link to the image |
244 | 244 | */ |
245 | -function mimetype_icon( $mimetype ) { |
|
246 | - return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); |
|
245 | +function mimetype_icon($mimetype) { |
|
246 | + return \OC::$server->getMimeTypeDetector()->mimeTypeIcon($mimetype); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | * @param string $path path of file |
253 | 253 | * @return link to the preview |
254 | 254 | */ |
255 | -function preview_icon( $path ) { |
|
255 | +function preview_icon($path) { |
|
256 | 256 | return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]); |
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
260 | 260 | * @param string $path |
261 | 261 | */ |
262 | -function publicPreview_icon ( $path, $token ) { |
|
262 | +function publicPreview_icon($path, $token) { |
|
263 | 263 | return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]); |
264 | 264 | } |
265 | 265 | |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | * |
271 | 271 | * For further information have a look at OC_Helper::humanFileSize |
272 | 272 | */ |
273 | -function human_file_size( $bytes ) { |
|
274 | - return OC_Helper::humanFileSize( $bytes ); |
|
273 | +function human_file_size($bytes) { |
|
274 | + return OC_Helper::humanFileSize($bytes); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @param int $timestamp UNIX timestamp to strip |
280 | 280 | * @return $timestamp without time value |
281 | 281 | */ |
282 | -function strip_time($timestamp){ |
|
282 | +function strip_time($timestamp) { |
|
283 | 283 | $date = new \DateTime("@{$timestamp}"); |
284 | 284 | $date->setTime(0, 0, 0); |
285 | 285 | return intval($date->format('U')); |
@@ -297,15 +297,15 @@ discard block |
||
297 | 297 | /** @var \OC\DateTimeFormatter $formatter */ |
298 | 298 | $formatter = \OC::$server->query('DateTimeFormatter'); |
299 | 299 | |
300 | - if ($dateOnly){ |
|
300 | + if ($dateOnly) { |
|
301 | 301 | return $formatter->formatDateSpan($timestamp, $fromTime); |
302 | 302 | } |
303 | 303 | return $formatter->formatTimeSpan($timestamp, $fromTime); |
304 | 304 | } |
305 | 305 | |
306 | -function html_select_options($options, $selected, $params=array()) { |
|
306 | +function html_select_options($options, $selected, $params = array()) { |
|
307 | 307 | if (!is_array($selected)) { |
308 | - $selected=array($selected); |
|
308 | + $selected = array($selected); |
|
309 | 309 | } |
310 | 310 | if (isset($params['combine']) && $params['combine']) { |
311 | 311 | $options = array_combine($options, $options); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $label_name = $params['label']; |
319 | 319 | } |
320 | 320 | $html = ''; |
321 | - foreach($options as $value => $label) { |
|
321 | + foreach ($options as $value => $label) { |
|
322 | 322 | if ($value_name && is_array($label)) { |
323 | 323 | $value = $label[$value_name]; |
324 | 324 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $label = $label[$label_name]; |
327 | 327 | } |
328 | 328 | $select = in_array($value, $selected) ? ' selected="selected"' : ''; |
329 | - $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n"; |
|
329 | + $html .= '<option value="'.\OCP\Util::sanitizeHTML($value).'"'.$select.'>'.\OCP\Util::sanitizeHTML($label).'</option>'."\n"; |
|
330 | 330 | } |
331 | 331 | return $html; |
332 | 332 | } |