diff options
Diffstat (limited to 'lib/private/Share20')
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 32 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 26 | ||||
-rw-r--r-- | lib/private/Share20/ProviderFactory.php | 16 |
3 files changed, 37 insertions, 37 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 1c0ec194528..ad002a1fc96 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -152,7 +152,7 @@ class DefaultShareProvider implements IShareProvider { if ($share->getExpirationDate() !== null) { $qb->setValue('expiration', $qb->createNamedParameter($share->getExpirationDate(), 'datetime')); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { //Set the GID of the group we share with $qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith())); @@ -160,7 +160,7 @@ class DefaultShareProvider implements IShareProvider { if ($share->getExpirationDate() !== null) { $qb->setValue('expiration', $qb->createNamedParameter($share->getExpirationDate(), 'datetime')); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { //set label for public link $qb->setValue('label', $qb->createNamedParameter($share->getLabel())); //Set the token of the share @@ -269,7 +269,7 @@ class DefaultShareProvider implements IShareProvider { ->set('note', $qb->createNamedParameter($share->getNote())) ->set('accepted', $qb->createNamedParameter($share->getStatus())) ->execute(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $qb = $this->dbConn->getQueryBuilder(); $qb->update('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) @@ -307,7 +307,7 @@ class DefaultShareProvider implements IShareProvider { ->set('permissions', $qb->createNamedParameter($share->getPermissions())) ->execute(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $qb = $this->dbConn->getQueryBuilder(); $qb->update('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) @@ -381,7 +381,7 @@ class DefaultShareProvider implements IShareProvider { $id = $data['id']; } - } else if ($share->getShareType() === IShare::TYPE_USER) { + } elseif ($share->getShareType() === IShare::TYPE_USER) { if ($share->getSharedWith() !== $recipient) { throw new ProviderException('Recipient does not match'); } @@ -519,7 +519,7 @@ class DefaultShareProvider implements IShareProvider { ->execute(); } - } else if ($share->getShareType() === IShare::TYPE_USER) { + } elseif ($share->getShareType() === IShare::TYPE_USER) { if ($share->getSharedWith() !== $recipient) { throw new ProviderException('Recipient does not match'); @@ -601,7 +601,7 @@ class DefaultShareProvider implements IShareProvider { ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) ->execute(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { // Check if there is a usergroup share $qb = $this->dbConn->getQueryBuilder(); @@ -894,7 +894,7 @@ class DefaultShareProvider implements IShareProvider { } $cursor->closeCursor(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { $user = $this->userManager->get($userId); $allGroups = $this->groupManager->getUserGroups($user); @@ -1035,9 +1035,9 @@ class DefaultShareProvider implements IShareProvider { if ($user !== null) { $share->setSharedWithDisplayName($user->getDisplayName()); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $share->setSharedWith($data['share_with']); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $share->setPassword($data['password']); $share->setSendPasswordByTalk((bool)$data['password_by_talk']); $share->setToken($data['token']); @@ -1152,7 +1152,7 @@ class DefaultShareProvider implements IShareProvider { $qb->expr()->eq('share_with', $qb->createNamedParameter($uid)) ) ); - } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { /* * Delete all group shares that are owned by this user * Or special user group shares that are received by this user @@ -1173,7 +1173,7 @@ class DefaultShareProvider implements IShareProvider { $qb->expr()->eq('share_with', $qb->createNamedParameter($uid)) ) ); - } else if ($shareType === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_LINK) { /* * Delete all link shares owned by this user. * And all link shares initiated by this user (until #22327 is in) @@ -1316,7 +1316,7 @@ class DefaultShareProvider implements IShareProvider { $uid = $row['share_with']; $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; $users[$uid][$row['id']] = $row; - } else if ($type === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($type === \OCP\Share::SHARE_TYPE_GROUP) { $gid = $row['share_with']; $group = $this->groupManager->get($gid); @@ -1330,9 +1330,9 @@ class DefaultShareProvider implements IShareProvider { $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; $users[$uid][$row['id']] = $row; } - } else if ($type === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($type === \OCP\Share::SHARE_TYPE_LINK) { $link = true; - } else if ($type === self::SHARE_TYPE_USERGROUP && $currentAccess === true) { + } elseif ($type === self::SHARE_TYPE_USERGROUP && $currentAccess === true) { $uid = $row['share_with']; $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; $users[$uid][$row['id']] = $row; @@ -1396,7 +1396,7 @@ class DefaultShareProvider implements IShareProvider { if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { $user = $this->userManager->get($share->getSharedWith()); $this->sendNote([$user], $share); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); $groupMembers = $group->getUsers(); $this->sendNote($groupMembers, $share); diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index c56db22c883..7ec678b07fb 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -221,33 +221,33 @@ class Manager implements IManager { if (!$this->userManager->userExists($share->getSharedWith())) { throw new \InvalidArgumentException('SharedWith is not a valid user'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { // We expect a valid group as sharedWith for group shares if (!$this->groupManager->groupExists($share->getSharedWith())) { throw new \InvalidArgumentException('SharedWith is not a valid group'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { if ($share->getSharedWith() !== null) { throw new \InvalidArgumentException('SharedWith should be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) { if ($share->getSharedWith() === null) { throw new \InvalidArgumentException('SharedWith should not be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { if ($share->getSharedWith() === null) { throw new \InvalidArgumentException('SharedWith should not be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { if ($share->getSharedWith() === null) { throw new \InvalidArgumentException('SharedWith should not be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) { $circle = \OCA\Circles\Api\v1\Circles::detailsCircle($share->getSharedWith()); if ($circle === null) { throw new \InvalidArgumentException('SharedWith is not a valid circle'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { } else { // We can't handle other types yet throw new \InvalidArgumentException('unknown share type'); @@ -721,13 +721,13 @@ class Manager implements IManager { //Verify the expiration date $share = $this->validateExpirationDateInternal($share); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $this->groupCreateChecks($share); //Verify the expiration date $share = $this->validateExpirationDateInternal($share); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $this->linkCreateChecks($share); $this->setLinkParent($share); @@ -751,7 +751,7 @@ class Manager implements IManager { if ($share->getPassword() !== null) { $share->setPassword($this->hasher->hash($share->getPassword())); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { $share->setToken( $this->secureRandom->generate( \OC\Share\Constants::TOKEN_LENGTH, @@ -952,7 +952,7 @@ class Manager implements IManager { $this->validateExpirationDate($share); $expirationDateUpdated = true; } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $this->groupCreateChecks($share); if ($share->getExpirationDate() != $originalShare->getExpirationDate()) { @@ -960,7 +960,7 @@ class Manager implements IManager { $this->validateExpirationDate($share); $expirationDateUpdated = true; } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $this->linkCreateChecks($share); $this->updateSharePasswordIfNeeded($share, $originalShare); @@ -970,7 +970,7 @@ class Manager implements IManager { $this->validateExpirationDate($share); $expirationDateUpdated = true; } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { // The new password is not set again if it is the same as the old // one, unless when switching from sending by Talk to sending by // mail. diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index cdfd40c8703..cf23779a8b9 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -257,13 +257,13 @@ class ProviderFactory implements IProviderFactory { $provider = null; if ($id === 'ocinternal') { $provider = $this->defaultShareProvider(); - } else if ($id === 'ocFederatedSharing') { + } elseif ($id === 'ocFederatedSharing') { $provider = $this->federatedShareProvider(); - } else if ($id === 'ocMailShare') { + } elseif ($id === 'ocMailShare') { $provider = $this->getShareByMailProvider(); - } else if ($id === 'ocCircleShare') { + } elseif ($id === 'ocCircleShare') { $provider = $this->getShareByCircleProvider(); - } else if ($id === 'ocRoomShare') { + } elseif ($id === 'ocRoomShare') { $provider = $this->getRoomShareProvider(); } @@ -285,13 +285,13 @@ class ProviderFactory implements IProviderFactory { $shareType === \OCP\Share::SHARE_TYPE_LINK ) { $provider = $this->defaultShareProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_REMOTE || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { $provider = $this->federatedShareProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { $provider = $this->getShareByMailProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { $provider = $this->getShareByCircleProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_ROOM) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_ROOM) { $provider = $this->getRoomShareProvider(); } |