@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | protected $URLGenerator; |
57 | 57 | |
58 | - public function __construct( IURLGenerator $URLGenerator) { |
|
58 | + public function __construct(IURLGenerator $URLGenerator) { |
|
59 | 59 | $this->URLGenerator = $URLGenerator; |
60 | 60 | } |
61 | 61 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $l = \OC::$server->getL10N(self::APP_NAME); |
262 | 262 | return array( |
263 | 263 | 'top' => array(), |
264 | - 'apps' => array( self::FILTER_PASSMAN => |
|
264 | + 'apps' => array(self::FILTER_PASSMAN => |
|
265 | 265 | array( |
266 | 266 | 'id' => 'passman', |
267 | 267 | 'name' => (string) $l->t('Passwords'), |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @return boolean |
279 | 279 | */ |
280 | 280 | public function isFilterValid($filterValue) { |
281 | - return $filterValue === self::FILTER_PASSMAN; |
|
281 | + return $filterValue === self::FILTER_PASSMAN; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $data = @simplexml_load_string($xml); |
28 | 28 | libxml_disable_entity_loader($loadEntities); |
29 | 29 | if ($data !== false) { |
30 | - $version = (string)$data->version; |
|
30 | + $version = (string) $data->version; |
|
31 | 31 | } else { |
32 | 32 | libxml_clear_errors(); |
33 | 33 | } |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | $activity . '_self', array($label, $this->userId, $revision_created), |
175 | 175 | '', array(), |
176 | 176 | $link, $this->userId, Activity::TYPE_ITEM_ACTION); |
177 | - } else if (($storedCredential->getDeleteTime() === 0) && (int)$delete_time > 0) { |
|
177 | + } else if (($storedCredential->getDeleteTime() === 0) && (int) $delete_time > 0) { |
|
178 | 178 | $activity = 'item_deleted'; |
179 | 179 | $this->activityService->add( |
180 | 180 | $activity . '_self', array($label, $this->userId), |
181 | 181 | '', array(), |
182 | 182 | $link, $this->userId, Activity::TYPE_ITEM_ACTION); |
183 | - } else if (($storedCredential->getDeleteTime() > 0) && (int)$delete_time === 0) { |
|
183 | + } else if (($storedCredential->getDeleteTime() > 0) && (int) $delete_time === 0) { |
|
184 | 184 | $activity = 'item_recovered'; |
185 | 185 | $this->activityService->add( |
186 | 186 | $activity . '_self', array($label, $this->userId), |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $this->sharingService->unshareCredential($credential->getGuid()); |
294 | 294 | foreach ($this->credentialRevisionService->getRevisions($credential->getId()) as $revision) { |
295 | 295 | $id = $revision['revision_id']; |
296 | - if(isset($id)){ |
|
296 | + if (isset($id)) { |
|
297 | 297 | $this->credentialRevisionService->deleteRevision($id, $this->userId); |
298 | 298 | } |
299 | 299 | } |
@@ -107,10 +107,10 @@ |
||
107 | 107 | * @param string $userId |
108 | 108 | * @return File[] |
109 | 109 | */ |
110 | - public function getFilesFromUser($userId){ |
|
110 | + public function getFilesFromUser($userId) { |
|
111 | 111 | $files = $this->fileMapper->getFilesFromUser($userId); |
112 | 112 | $results = array(); |
113 | - foreach ($files as $file){ |
|
113 | + foreach ($files as $file) { |
|
114 | 114 | array_push($results, $this->encryptService->decryptFile($file)); |
115 | 115 | } |
116 | 116 | return $results; |
@@ -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 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | * @param $uid |
56 | 56 | * @return string |
57 | 57 | */ |
58 | - public static function getNameByUid($uid){ |
|
58 | + public static function getNameByUid($uid) { |
|
59 | 59 | $um = \OC::$server->getUserManager(); |
60 | 60 | $u = $um->get($uid); |
61 | 61 | return $u->getDisplayName(); |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | return new JSONResponse(array('success' => true)); |
110 | 110 | } |
111 | 111 | |
112 | - public function listRequests(){ |
|
112 | + public function listRequests() { |
|
113 | 113 | $requests = $this->deleteVaultRequestService->getDeleteRequests(); |
114 | 114 | $results = array(); |
115 | - foreach($requests as $request){ |
|
115 | + foreach ($requests as $request) { |
|
116 | 116 | $r = $request->jsonSerialize(); |
117 | 117 | $r['displayName'] = Utils::getNameByUid($request->getRequestedBy()); |
118 | 118 | array_push($results, $r); |
@@ -120,28 +120,28 @@ discard block |
||
120 | 120 | return new JSONResponse($results); |
121 | 121 | } |
122 | 122 | |
123 | - public function acceptRequestDeletion($vault_guid, $requested_by){ |
|
123 | + public function acceptRequestDeletion($vault_guid, $requested_by) { |
|
124 | 124 | $req = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
125 | - try{ |
|
125 | + try { |
|
126 | 126 | $vault = $this->vaultService->getByGuid($vault_guid, $requested_by); |
127 | - } catch (\Exception $e){ |
|
127 | + } catch (\Exception $e) { |
|
128 | 128 | //Ignore |
129 | 129 | } |
130 | 130 | |
131 | - if(isset($vault)){ |
|
131 | + if (isset($vault)) { |
|
132 | 132 | $credentials = $this->credentialService->getCredentialsByVaultId($vault->getId(), $requested_by); |
133 | - foreach($credentials as $credential){ |
|
133 | + foreach ($credentials as $credential) { |
|
134 | 134 | $revisions = $this->revisionService->getRevisions($credential->getId()); |
135 | - foreach($revisions as $revision){ |
|
135 | + foreach ($revisions as $revision) { |
|
136 | 136 | $this->revisionService->deleteRevision($revision['revision_id'], $requested_by); |
137 | 137 | } |
138 | - if($credential instanceof Credential){ |
|
138 | + if ($credential instanceof Credential) { |
|
139 | 139 | $this->credentialService->deleteCredential($credential); |
140 | 140 | } |
141 | 141 | } |
142 | 142 | $this->vaultService->deleteVault($vault_guid, $requested_by); |
143 | 143 | } |
144 | - if($req instanceof DeleteVaultRequest) { |
|
144 | + if ($req instanceof DeleteVaultRequest) { |
|
145 | 145 | $this->deleteVaultRequestService->removeDeleteRequestForVault($req); |
146 | 146 | } |
147 | 147 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function requestDeletion($vault_guid, $reason) { |
155 | 155 | $req = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
156 | - if($req){ |
|
156 | + if ($req) { |
|
157 | 157 | return new JSONResponse('Already exists'); |
158 | 158 | } |
159 | 159 | $vault = $this->vaultService->getByGuid($vault_guid, $this->userId); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $result = false; |
179 | 179 | try { |
180 | 180 | $delete_request = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
181 | - } catch (\Exception $exception){ |
|
181 | + } catch (\Exception $exception) { |
|
182 | 182 | // Ignore it |
183 | 183 | } |
184 | 184 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param DeleteVaultRequest $request |
43 | 43 | * @return \OCP\AppFramework\Db\Entity |
44 | 44 | */ |
45 | - public function createRequest(DeleteVaultRequest $request){ |
|
45 | + public function createRequest(DeleteVaultRequest $request) { |
|
46 | 46 | return $this->insert($request); |
47 | 47 | } |
48 | 48 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * Get all delete requests |
51 | 51 | * @return \OCP\AppFramework\Db\Entity |
52 | 52 | */ |
53 | - public function getDeleteRequests(){ |
|
53 | + public function getDeleteRequests() { |
|
54 | 54 | $q = "SELECT * FROM *PREFIX*" . self::TABLE_NAME; |
55 | 55 | return $this->findEntities($q); |
56 | 56 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @param $vault_id integer The vault id |
61 | 61 | * @return \OCP\AppFramework\Db\Entity |
62 | 62 | */ |
63 | - public function getDeleteRequestsForVault($vault_guid){ |
|
64 | - $q = "SELECT * FROM *PREFIX*" . self::TABLE_NAME .' WHERE `vault_guid` = ?'; |
|
63 | + public function getDeleteRequestsForVault($vault_guid) { |
|
64 | + $q = "SELECT * FROM *PREFIX*" . self::TABLE_NAME . ' WHERE `vault_guid` = ?'; |
|
65 | 65 | return $this->findEntity($q, [$vault_guid]); |
66 | 66 | } |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param DeleteVaultRequest $request Request to delete |
71 | 71 | * @return DeleteVaultRequest The deleted request |
72 | 72 | */ |
73 | - public function removeDeleteVaultRequest(DeleteVaultRequest $request){ |
|
73 | + public function removeDeleteVaultRequest(DeleteVaultRequest $request) { |
|
74 | 74 | return $this->delete($request); |
75 | 75 | } |
76 | 76 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function remind($credential_id) { |
47 | 47 | $credential = $this->credentialService->getCredentialById($credential_id, $this->userId); |
48 | - if($credential) { |
|
48 | + if ($credential) { |
|
49 | 49 | $credential->setExpireTime(time() + (24 * 60 * 60)); |
50 | 50 | $this->credentialService->upd($credential); |
51 | 51 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function read($credential_id) { |
65 | 65 | |
66 | 66 | $credential = $this->credentialService->getCredentialById($credential_id, $this->userId); |
67 | - if($credential) { |
|
67 | + if ($credential) { |
|
68 | 68 | $credential->setExpireTime(0); |
69 | 69 | $this->credentialService->upd($credential); |
70 | 70 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @NoAdminRequired |
91 | 91 | */ |
92 | 92 | public function generatePerson() { |
93 | - $context = [ 'http' => [ 'method' => 'GET' ], 'ssl' => [ 'verify_peer' => false, 'allow_self_signed'=> true ] ]; |
|
93 | + $context = ['http' => ['method' => 'GET'], 'ssl' => ['verify_peer' => false, 'allow_self_signed'=> true]]; |
|
94 | 94 | $context = stream_context_create($context); |
95 | 95 | $random_person = json_decode(file_get_contents('http://api.namefake.com/', false, $context)); |
96 | 96 | return new JSONResponse($random_person); |