@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | private $userId; |
| 23 | 23 | |
| 24 | - public function __construct($AppName, IRequest $request, $UserId){ |
|
| 24 | + public function __construct($AppName, IRequest $request, $UserId) { |
|
| 25 | 25 | parent::__construct($AppName, $request); |
| 26 | 26 | $this->userId = $UserId; |
| 27 | 27 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function index() { |
| 40 | 40 | $params = ['user' => $this->userId]; |
| 41 | - return new TemplateResponse('passman', 'main', $params); // templates/main.php |
|
| 41 | + return new TemplateResponse('passman', 'main', $params); // templates/main.php |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @NoAdminRequired |
| 47 | 47 | * @NoCSRFRequired |
| 48 | 48 | */ |
| 49 | - public function bookmarklet($url='',$title='') { |
|
| 49 | + public function bookmarklet($url = '', $title = '') { |
|
| 50 | 50 | $params = array('url' => $url, 'title' => $title); |
| 51 | 51 | return new TemplateResponse('passman', 'bookmarklet', $params); |
| 52 | 52 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | |
| 40 | 40 | |
| 41 | -class DeleteVaultRequest extends Entity implements \JsonSerializable{ |
|
| 41 | +class DeleteVaultRequest extends Entity implements \JsonSerializable { |
|
| 42 | 42 | |
| 43 | 43 | use EntityJSONSerializer; |
| 44 | 44 | |
@@ -181,7 +181,7 @@ |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | |
| 184 | - private function parseLinkElement($htmlHead, $pageUrlInfo, $base_href){ |
|
| 184 | + private function parseLinkElement($htmlHead, $pageUrlInfo, $base_href) { |
|
| 185 | 185 | if (preg_match('#<\s*link[^>]*(rel=(["\'])[^>\2]*icon[^>\2]*\2)[^>]*>#i', $htmlHead, $matches)) { |
| 186 | 186 | $link_tag = $matches[0]; |
| 187 | 187 | $this->debugInfo['link_tag'] = $link_tag; |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | if ($data !== false) { |
| 83 | - $version = (string)$data->version; |
|
| 83 | + $version = (string) $data->version; |
|
| 84 | 84 | } else { |
| 85 | 85 | libxml_clear_errors(); |
| 86 | 86 | } |
@@ -267,7 +267,7 @@ |
||
| 267 | 267 | 'apps' => array(self::FILTER_PASSMAN => |
| 268 | 268 | array( |
| 269 | 269 | 'id' => 'passman', |
| 270 | - 'name' => (string)$l->t('Passwords'), |
|
| 270 | + 'name' => (string) $l->t('Passwords'), |
|
| 271 | 271 | 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', ['filter' => self::FILTER_PASSMAN]), |
| 272 | 272 | ), |
| 273 | 273 | ), |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // Deal with known subjects |
| 53 | 53 | case 'credential_expired': |
| 54 | 54 | $notification->setParsedSubject( |
| 55 | - (string)$l->t('Your credential "%s" expired, click here to update the credential.', $notification->getSubjectParameters()) |
|
| 55 | + (string) $l->t('Your credential "%s" expired, click here to update the credential.', $notification->getSubjectParameters()) |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | // Deal with the actions for a known subject |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | switch ($action->getLabel()) { |
| 61 | 61 | case 'remind': |
| 62 | 62 | $action->setParsedLabel( |
| 63 | - (string)$l->t('Remind me later') |
|
| 63 | + (string) $l->t('Remind me later') |
|
| 64 | 64 | ); |
| 65 | 65 | break; |
| 66 | 66 | |
| 67 | 67 | case 'ignore': |
| 68 | 68 | $action->setParsedLabel( |
| 69 | - (string)$l->t('Ignore') |
|
| 69 | + (string) $l->t('Ignore') |
|
| 70 | 70 | ); |
| 71 | 71 | break; |
| 72 | 72 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | case 'credential_shared': |
| 80 | 80 | $notification->setParsedSubject( |
| 81 | - (string)$l->t('%s shared "%s" with you. Click here to accept', $notification->getSubjectParameters()) |
|
| 81 | + (string) $l->t('%s shared "%s" with you. Click here to accept', $notification->getSubjectParameters()) |
|
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | 84 | // Deal with the actions for a known subject |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | switch ($action->getLabel()) { |
| 87 | 87 | case 'decline': |
| 88 | 88 | $action->setParsedLabel( |
| 89 | - (string)$l->t('Decline') |
|
| 89 | + (string) $l->t('Decline') |
|
| 90 | 90 | ); |
| 91 | 91 | break; |
| 92 | 92 | } |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | case 'credential_share_denied': |
| 99 | 99 | $notification->setParsedSubject( |
| 100 | - (string)$l->t('%s has declined your share request for "%s".', $notification->getSubjectParameters()) |
|
| 100 | + (string) $l->t('%s has declined your share request for "%s".', $notification->getSubjectParameters()) |
|
| 101 | 101 | ); |
| 102 | 102 | return $notification; |
| 103 | 103 | |
| 104 | 104 | case 'credential_share_accepted': |
| 105 | 105 | $notification->setParsedSubject( |
| 106 | - (string)$l->t('%s has accepted your share request for "%s".', $notification->getSubjectParameters()) |
|
| 106 | + (string) $l->t('%s has accepted your share request for "%s".', $notification->getSubjectParameters()) |
|
| 107 | 107 | ); |
| 108 | 108 | return $notification; |
| 109 | 109 | default: |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $context->registerSearchProvider(Provider::class); |
| 76 | 76 | |
| 77 | - $context->registerService(View::class, function () { |
|
| 77 | + $context->registerService(View::class, function() { |
|
| 78 | 78 | return new View(''); |
| 79 | 79 | }, false); |
| 80 | 80 | |
| 81 | - $context->registerService('isCLI', function () { |
|
| 81 | + $context->registerService('isCLI', function() { |
|
| 82 | 82 | return \OC::$CLI; |
| 83 | 83 | }); |
| 84 | 84 | |
| 85 | 85 | $context->registerMiddleware(ShareMiddleware::class); |
| 86 | 86 | $context->registerMiddleware(APIMiddleware::class); |
| 87 | 87 | |
| 88 | - $context->registerService('ShareController', function (ContainerInterface $c) { |
|
| 88 | + $context->registerService('ShareController', function(ContainerInterface $c) { |
|
| 89 | 89 | /** @var IUserManager $userManager */ |
| 90 | 90 | $userManager = $c->get(IUserManager::class); |
| 91 | 91 | /** @var IGroupManager $groupManager */ |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | }); |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - $context->registerService('CronService', function (ContainerInterface $c) { |
|
| 114 | + $context->registerService('CronService', function(ContainerInterface $c) { |
|
| 115 | 115 | return new CronService( |
| 116 | 116 | $c->get(CredentialService::class), |
| 117 | 117 | $c->get(LoggerInterface::class), |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | ); |
| 123 | 123 | }); |
| 124 | 124 | |
| 125 | - $context->registerService('Logger', function (ContainerInterface $c) { |
|
| 125 | + $context->registerService('Logger', function(ContainerInterface $c) { |
|
| 126 | 126 | return $c->get(ServerContainer::class)->getLogger(); |
| 127 | 127 | }); |
| 128 | 128 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | /** @var INavigationManager $navigationManager */ |
| 144 | 144 | $navigationManager = $c->get(INavigationManager::class); |
| 145 | 145 | |
| 146 | - $navigationEntry = function () use ($c) { |
|
| 146 | + $navigationEntry = function() use ($c) { |
|
| 147 | 147 | /** @var IURLGenerator $urlGenerator */ |
| 148 | 148 | $urlGenerator = $c->get(IURLGenerator::class); |
| 149 | 149 | return [ |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @param IUserManager $userManager |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public static function getNameByUid(string $uid, IUserManager $userManager){ |
|
| 61 | + public static function getNameByUid(string $uid, IUserManager $userManager) { |
|
| 62 | 62 | $u = $userManager->get($uid); |
| 63 | 63 | return $u->getDisplayName(); |
| 64 | 64 | } |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | * @param array $results |
| 69 | 69 | * @return array|mixed |
| 70 | 70 | */ |
| 71 | - public static function getDirContents(string $dir, &$results = array()){ |
|
| 71 | + public static function getDirContents(string $dir, &$results = array()) { |
|
| 72 | 72 | $files = scandir($dir); |
| 73 | 73 | |
| 74 | - foreach($files as $value){ |
|
| 75 | - $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
|
| 76 | - if(!is_dir($path)) { |
|
| 74 | + foreach ($files as $value) { |
|
| 75 | + $path = realpath($dir . DIRECTORY_SEPARATOR . $value); |
|
| 76 | + if (!is_dir($path)) { |
|
| 77 | 77 | $results[] = $path; |
| 78 | - } else if($value != "." && $value != "..") { |
|
| 78 | + } else if ($value != "." && $value != "..") { |
|
| 79 | 79 | Utils::getDirContents($path, $results); |
| 80 | 80 | $results[] = $path; |
| 81 | 81 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function moveCredentials($source_account, $destination_account) { |
| 82 | 82 | $succeed = false; |
| 83 | - if ($source_account != $destination_account){ |
|
| 83 | + if ($source_account != $destination_account) { |
|
| 84 | 84 | $vaults = $this->vaultService->getByUser($source_account); |
| 85 | 85 | foreach ($vaults as $vault) { |
| 86 | 86 | $credentials = $this->credentialService->getCredentialsByVaultId($vault->getId(), $source_account); |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | return new JSONResponse(array('success' => $succeed)); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function listRequests(){ |
|
| 121 | + public function listRequests() { |
|
| 122 | 122 | $requests = $this->deleteVaultRequestService->getDeleteRequests(); |
| 123 | 123 | $results = array(); |
| 124 | - foreach($requests as $request){ |
|
| 124 | + foreach ($requests as $request) { |
|
| 125 | 125 | $r = $request->jsonSerialize(); |
| 126 | 126 | $r['displayName'] = Utils::getNameByUid($request->getRequestedBy(), $this->userManager); |
| 127 | 127 | array_push($results, $r); |
@@ -129,28 +129,28 @@ discard block |
||
| 129 | 129 | return new JSONResponse($results); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function acceptRequestDeletion($vault_guid, $requested_by){ |
|
| 132 | + public function acceptRequestDeletion($vault_guid, $requested_by) { |
|
| 133 | 133 | $req = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
| 134 | - try{ |
|
| 134 | + try { |
|
| 135 | 135 | $vault = $this->vaultService->getByGuid($vault_guid, $requested_by); |
| 136 | - } catch (\Exception $e){ |
|
| 136 | + } catch (\Exception $e) { |
|
| 137 | 137 | //Ignore |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if(isset($vault)){ |
|
| 140 | + if (isset($vault)) { |
|
| 141 | 141 | $credentials = $this->credentialService->getCredentialsByVaultId($vault->getId(), $requested_by); |
| 142 | - foreach($credentials as $credential){ |
|
| 142 | + foreach ($credentials as $credential) { |
|
| 143 | 143 | $revisions = $this->revisionService->getRevisions($credential->getId()); |
| 144 | - foreach($revisions as $revision){ |
|
| 144 | + foreach ($revisions as $revision) { |
|
| 145 | 145 | $this->revisionService->deleteRevision($revision['revision_id'], $requested_by); |
| 146 | 146 | } |
| 147 | - if($credential instanceof Credential){ |
|
| 147 | + if ($credential instanceof Credential) { |
|
| 148 | 148 | $this->credentialService->deleteCredential($credential); |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | $this->vaultService->deleteVault($vault_guid, $requested_by); |
| 152 | 152 | } |
| 153 | - if($req instanceof DeleteVaultRequest) { |
|
| 153 | + if ($req instanceof DeleteVaultRequest) { |
|
| 154 | 154 | $this->deleteVaultRequestService->removeDeleteRequestForVault($req); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function requestDeletion($vault_guid, $reason) { |
| 164 | 164 | $req = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
| 165 | - if($req){ |
|
| 165 | + if ($req) { |
|
| 166 | 166 | return new JSONResponse('Already exists'); |
| 167 | 167 | } |
| 168 | 168 | $vault = $this->vaultService->getByGuid($vault_guid, $this->userId); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $result = false; |
| 188 | 188 | try { |
| 189 | 189 | $delete_request = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
| 190 | - } catch (\Exception $exception){ |
|
| 190 | + } catch (\Exception $exception) { |
|
| 191 | 191 | // Ignore it |
| 192 | 192 | } |
| 193 | 193 | |