@@ -83,7 +83,7 @@ |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - private function fetchAll($sql){ |
|
86 | + private function fetchAll($sql) { |
|
87 | 87 | return $this->db->executeQuery($sql)->fetchAll(); |
88 | 88 | } |
89 | 89 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $setting = (in_array($methodName, $publicMethods)) ? 'link_sharing_enabled' : 'user_sharing_enabled'; |
27 | 27 | $sharing_enabled = ($this->settings->isEnabled($setting)); |
28 | 28 | |
29 | - if(in_array($methodName, $user_pub_methods)){ |
|
29 | + if (in_array($methodName, $user_pub_methods)) { |
|
30 | 30 | $sharing_enabled = ($this->settings->isEnabled('link_sharing_enabled') || $this->settings->isEnabled('user_sharing_enabled')); |
31 | 31 | } |
32 | 32 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | parent::__construct($db, 'passman_sharing_acl'); |
37 | 37 | } |
38 | 38 | |
39 | - public function createACLEntry(SharingACL $acl){ |
|
39 | + public function createACLEntry(SharingACL $acl) { |
|
40 | 40 | return $this->insert($acl); |
41 | 41 | } |
42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return SharingACL[] |
48 | 48 | */ |
49 | 49 | public function getVaultEntries($user_id, $vault_guid) { |
50 | - $q = "SELECT * FROM ". self::TABLE_NAME ." WHERE user_id = ? AND vault_guid = ?"; |
|
50 | + $q = "SELECT * FROM " . self::TABLE_NAME . " WHERE user_id = ? AND vault_guid = ?"; |
|
51 | 51 | return $this->findEntities($q, [$user_id, $vault_guid]); |
52 | 52 | } |
53 | 53 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $q = "SELECT * FROM " . self::TABLE_NAME . " WHERE item_guid = ? AND "; |
62 | 62 | $filter = [$item_guid]; |
63 | 63 | $q .= ($user_id === null) ? 'user_id is null' : 'user_id = ? '; |
64 | - if ($user_id !== null){ |
|
64 | + if ($user_id !== null) { |
|
65 | 65 | $filter[] = $user_id; |
66 | 66 | } |
67 | 67 | |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | * @return SharingACL[] |
86 | 86 | */ |
87 | 87 | public function getCredentialAclList($item_guid) { |
88 | - $q = "SELECT * FROM ". self::TABLE_NAME ." WHERE item_guid = ?"; |
|
88 | + $q = "SELECT * FROM " . self::TABLE_NAME . " WHERE item_guid = ?"; |
|
89 | 89 | return $this->findEntities($q, [$item_guid]); |
90 | 90 | } |
91 | 91 | |
92 | - public function deleteShareACL(SharingACL $ACL){ |
|
92 | + public function deleteShareACL(SharingACL $ACL) { |
|
93 | 93 | return $this->delete($ACL); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | \ No newline at end of file |
@@ -59,7 +59,7 @@ |
||
59 | 59 | foreach ($vaults as $vault) { |
60 | 60 | $credential = $this->credentialService->getRandomCredentialByVaultId($vault->getId(), $this->userId); |
61 | 61 | $secret_field = $protected_credential_fields[array_rand($protected_credential_fields)]; |
62 | - if(isset($credential)) { |
|
62 | + if (isset($credential)) { |
|
63 | 63 | array_push($result, array( |
64 | 64 | 'vault_id' => $vault->getId(), |
65 | 65 | 'guid' => $vault->getGuid(), |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
63 | 63 | * @return Vault[] |
64 | 64 | */ |
65 | - public function findVaultsFromUser($userId){ |
|
65 | + public function findVaultsFromUser($userId) { |
|
66 | 66 | $sql = 'SELECT * FROM `*PREFIX*passman_vaults` ' . |
67 | 67 | 'WHERE `user_id` = ? '; |
68 | 68 | $params = [$userId]; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param $userId |
76 | 76 | * @return Vault |
77 | 77 | */ |
78 | - public function create($vault_name, $userId){ |
|
78 | + public function create($vault_name, $userId) { |
|
79 | 79 | $vault = new Vault(); |
80 | 80 | $vault->setName($vault_name); |
81 | 81 | $vault->setUserId($userId); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param $vault_id |
91 | 91 | * @param $user_id |
92 | 92 | */ |
93 | - public function setLastAccess($vault_id, $user_id){ |
|
93 | + public function setLastAccess($vault_id, $user_id) { |
|
94 | 94 | $vault = new Vault(); |
95 | 95 | $vault->setId($vault_id); |
96 | 96 | $vault->setUserId($user_id); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * Update vault |
103 | 103 | * @param Vault $vault |
104 | 104 | */ |
105 | - public function updateVault(Vault $vault){ |
|
105 | + public function updateVault(Vault $vault) { |
|
106 | 106 | $this->update($vault); |
107 | 107 | } |
108 | 108 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param $privateKey |
113 | 113 | * @param $publicKey |
114 | 114 | */ |
115 | - public function updateSharingKeys($vault_id, $privateKey, $publicKey){ |
|
115 | + public function updateSharingKeys($vault_id, $privateKey, $publicKey) { |
|
116 | 116 | $vault = new Vault(); |
117 | 117 | $vault->setId($vault_id); |
118 | 118 | $vault->setPrivateSharingKey($privateKey); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * Delete a vault |
126 | 126 | * @param Vault $vault |
127 | 127 | */ |
128 | - public function deleteVault(Vault $vault){ |
|
128 | + public function deleteVault(Vault $vault) { |
|
129 | 129 | $this->delete($vault); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | \ No newline at end of file |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param $vault_id |
93 | 93 | * @param $user_id |
94 | 94 | */ |
95 | - public function setLastAccess($vault_id, $user_id){ |
|
95 | + public function setLastAccess($vault_id, $user_id) { |
|
96 | 96 | return $this->vaultMapper->setLastAccess($vault_id, $user_id); |
97 | 97 | } |
98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param $privateKey |
103 | 103 | * @param $publicKey |
104 | 104 | */ |
105 | - public function updateSharingKeys($vault_id, $privateKey, $publicKey){ |
|
105 | + public function updateSharingKeys($vault_id, $privateKey, $publicKey) { |
|
106 | 106 | return $this->vaultMapper->updateSharingKeys($vault_id, $privateKey, $publicKey); |
107 | 107 | } |
108 | 108 | |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | * @param string $vault_guid |
112 | 112 | * @param string $user_id |
113 | 113 | */ |
114 | - public function deleteVault($vault_guid, $user_id){ |
|
114 | + public function deleteVault($vault_guid, $user_id) { |
|
115 | 115 | $vault = $this->getByGuid($vault_guid, $user_id); |
116 | - if($vault instanceof Vault) { |
|
116 | + if ($vault instanceof Vault) { |
|
117 | 117 | $this->vaultMapper->deleteVault($vault); |
118 | 118 | } |
119 | 119 | } |
@@ -16,8 +16,8 @@ |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | public function afterController($controller, $methodName, Response $response) { |
19 | - if($response instanceof JSONResponse){ |
|
20 | - if(isset($this->request->server['HTTP_ORIGIN'])) { |
|
19 | + if ($response instanceof JSONResponse) { |
|
20 | + if (isset($this->request->server['HTTP_ORIGIN'])) { |
|
21 | 21 | $response->addHeader('Access-Control-Allow-Origin', $this->request->server['HTTP_ORIGIN']); |
22 | 22 | } |
23 | 23 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function __construct($AppName, |
24 | 24 | IRequest $request, |
25 | 25 | $UserId, |
26 | - FileService $fileService){ |
|
26 | + FileService $fileService) { |
|
27 | 27 | parent::__construct( |
28 | 28 | $AppName, |
29 | 29 | $request, |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | return new JSONResponse($this->fileService->deleteFile($file_id, $this->userId)); |
66 | 66 | } |
67 | 67 | |
68 | - public function updateFile($file_id, $file_data, $filename){ |
|
69 | - try{ |
|
68 | + public function updateFile($file_id, $file_data, $filename) { |
|
69 | + try { |
|
70 | 70 | $file = $this->fileService->getFile($file_id, $this->userId); |
71 | - } catch (\Exception $doesNotExistException){ |
|
71 | + } catch (\Exception $doesNotExistException) { |
|
72 | 72 | |
73 | 73 | } |
74 | - if($file){ |
|
75 | - if($file_data) { |
|
74 | + if ($file) { |
|
75 | + if ($file_data) { |
|
76 | 76 | $file->setFileData($file_data); |
77 | 77 | } |
78 | - if($filename) { |
|
78 | + if ($filename) { |
|
79 | 79 | $file->setFilename($filename); |
80 | 80 | } |
81 | - if($filename || $file_data){ |
|
81 | + if ($filename || $file_data) { |
|
82 | 82 | new JSONResponse($this->fileService->updateFile($file)); |
83 | 83 | } |
84 | 84 | } |
@@ -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 | } |