@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | parent::__construct('passman'); |
| 52 | 52 | $container = $this->getContainer(); |
| 53 | 53 | // Allow automatic DI for the View, until we migrated to Nodes API |
| 54 | - $container->registerService(View::class, function () { |
|
| 54 | + $container->registerService(View::class, function() { |
|
| 55 | 55 | return new View(''); |
| 56 | 56 | }, false); |
| 57 | - $container->registerService('isCLI', function () { |
|
| 57 | + $container->registerService('isCLI', function() { |
|
| 58 | 58 | return \OC::$CLI; |
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Middleware |
| 63 | 63 | */ |
| 64 | - $container->registerService('ShareMiddleware', function ($c) { |
|
| 64 | + $container->registerService('ShareMiddleware', function($c) { |
|
| 65 | 65 | return new ShareMiddleware($c->query('SettingsService')); |
| 66 | 66 | }); |
| 67 | 67 | $container->registerMiddleware('ShareMiddleware'); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * Controllers |
| 71 | 71 | */ |
| 72 | - $container->registerService('ShareController', function ($c) { |
|
| 72 | + $container->registerService('ShareController', function($c) { |
|
| 73 | 73 | $container = $this->getContainer(); |
| 74 | 74 | $server = $container->getServer(); |
| 75 | 75 | return new ShareController( |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | /** Cron **/ |
| 93 | - $container->registerService('CronService', function ($c) { |
|
| 93 | + $container->registerService('CronService', function($c) { |
|
| 94 | 94 | return new CronService( |
| 95 | 95 | $c->query('CredentialService'), |
| 96 | 96 | $c->query('Logger'), |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | ); |
| 102 | 102 | }); |
| 103 | 103 | |
| 104 | - $container->registerService('Db', function () { |
|
| 104 | + $container->registerService('Db', function() { |
|
| 105 | 105 | return new Db(); |
| 106 | 106 | }); |
| 107 | 107 | |
| 108 | - $container->registerService('Logger', function ($c) { |
|
| 108 | + $container->registerService('Logger', function($c) { |
|
| 109 | 109 | return $c->query('ServerContainer')->getLogger(); |
| 110 | 110 | }); |
| 111 | 111 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $c = $this->getContainer(); |
| 134 | 134 | /** @var \OCP\IServerContainer $server */ |
| 135 | 135 | $server = $c->getServer(); |
| 136 | - $navigationEntry = function () use ($c, $server) { |
|
| 136 | + $navigationEntry = function() use ($c, $server) { |
|
| 137 | 137 | return [ |
| 138 | 138 | 'id' => $c->getAppName(), |
| 139 | 139 | 'order' => 10, |
@@ -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 |
@@ -50,16 +50,16 @@ |
||
| 50 | 50 | public function expireCredentials() { |
| 51 | 51 | $this->logger->info('Passman cron test', array('app' => 'passman')); |
| 52 | 52 | $expired_credentials = $this->credentialService->getExpiredCredentials($this->utils->getTime()); |
| 53 | - foreach($expired_credentials as $credential){ |
|
| 53 | + foreach ($expired_credentials as $credential) { |
|
| 54 | 54 | $link = ''; // @TODO create direct link to credential |
| 55 | 55 | |
| 56 | 56 | $sql = 'SELECT count(*) as rows from `*PREFIX*notifications` WHERE `subject`= \'credential_expired\' AND object_id=?'; |
| 57 | 57 | $id = $credential->getId(); |
| 58 | 58 | $result = $this->db->executeQuery($sql, array($id)); |
| 59 | - $this->logger->debug($credential->getLabel() .' is expired, checking notifications!', array('app' => 'passman')); |
|
| 59 | + $this->logger->debug($credential->getLabel() . ' is expired, checking notifications!', array('app' => 'passman')); |
|
| 60 | 60 | $notifications = intval($result->fetch()['rows']); |
| 61 | - if($notifications === 0) { |
|
| 62 | - $this->logger->debug($credential->getLabel() .' is expired, adding notification!', array('app' => 'passman')); |
|
| 61 | + if ($notifications === 0) { |
|
| 62 | + $this->logger->debug($credential->getLabel() . ' is expired, adding notification!', array('app' => 'passman')); |
|
| 63 | 63 | $this->activityService->add( |
| 64 | 64 | Activity::SUBJECT_ITEM_EXPIRED, array($credential->getLabel(), $credential->getUserId()), |
| 65 | 65 | '', array(), |
@@ -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 | } |