diff options
Diffstat (limited to 'apps/files_sharing')
16 files changed, 77 insertions, 77 deletions
diff --git a/apps/files_sharing/lib/Activity/Providers/Base.php b/apps/files_sharing/lib/Activity/Providers/Base.php index b63eb346f7c..16e46aae991 100644 --- a/apps/files_sharing/lib/Activity/Providers/Base.php +++ b/apps/files_sharing/lib/Activity/Providers/Base.php @@ -147,7 +147,7 @@ abstract class Base implements IProvider { if (is_array($parameter)) { $path = reset($parameter); $id = (string) key($parameter); - } else if ($event !== null) { + } elseif ($event !== null) { // Legacy from before ownCloud 8.2 $path = $parameter; $id = $event->getObjectId(); diff --git a/apps/files_sharing/lib/Activity/Providers/Downloads.php b/apps/files_sharing/lib/Activity/Providers/Downloads.php index 706945060de..91ad8322e6f 100644 --- a/apps/files_sharing/lib/Activity/Providers/Downloads.php +++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php @@ -46,7 +46,7 @@ class Downloads extends Base { if ($event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED || $event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED) { $subject = $this->l->t('Downloaded via public link'); - } else if ($event->getSubject() === self::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED || + } elseif ($event->getSubject() === self::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED || $event->getSubject() === self::SUBJECT_SHARED_FOLDER_BY_EMAIL_DOWNLOADED) { $subject = $this->l->t('Downloaded by {email}'); } else { @@ -75,7 +75,7 @@ class Downloads extends Base { if ($event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED || $event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED) { $subject = $this->l->t('{file} downloaded via public link'); - } else if ($event->getSubject() === self::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED || + } elseif ($event->getSubject() === self::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED || $event->getSubject() === self::SUBJECT_SHARED_FOLDER_BY_EMAIL_DOWNLOADED) { $subject = $this->l->t('{email} downloaded {file}'); } else { diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php index 8a061f9373d..70e3c177e66 100644 --- a/apps/files_sharing/lib/Activity/Providers/Groups.php +++ b/apps/files_sharing/lib/Activity/Providers/Groups.php @@ -72,13 +72,13 @@ class Groups extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_GROUP_SELF) { $subject = $this->l->t('Shared with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_SELF) { $subject = $this->l->t('Removed share for group {group}'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_GROUP_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_GROUP_BY) { $subject = $this->l->t('{actor} shared with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) { $subject = $this->l->t('{actor} removed share for group {group}'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) { $subject = $this->l->t('Share for group {group} expired'); } else { throw new \InvalidArgumentException(); @@ -105,13 +105,13 @@ class Groups extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_GROUP_SELF) { $subject = $this->l->t('You shared {file} with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_SELF) { $subject = $this->l->t('You removed group {group} from {file}'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_GROUP_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_GROUP_BY) { $subject = $this->l->t('{actor} shared {file} with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) { $subject = $this->l->t('{actor} removed group {group} from {file}'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) { $subject = $this->l->t('Share for file {file} with group {group} expired'); } else { throw new \InvalidArgumentException(); diff --git a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php index 20b8414bee9..97fc66eaf69 100644 --- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php @@ -45,15 +45,15 @@ class PublicLinks extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_LINK_SELF) { $subject = $this->l->t('Shared as public link'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_SELF) { $subject = $this->l->t('Removed public link'); - } else if ($event->getSubject() === self::SUBJECT_LINK_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_LINK_EXPIRED) { $subject = $this->l->t('Public link expired'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_LINK_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_LINK_BY) { $subject = $this->l->t('{actor} shared as public link'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_BY) { $subject = $this->l->t('{actor} removed public link'); - } else if ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { $subject = $this->l->t('Public link of {actor} expired'); } else { @@ -81,15 +81,15 @@ class PublicLinks extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_LINK_SELF) { $subject = $this->l->t('You shared {file} as public link'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_SELF) { $subject = $this->l->t('You removed public link for {file}'); - } else if ($event->getSubject() === self::SUBJECT_LINK_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_LINK_EXPIRED) { $subject = $this->l->t('Public link expired for {file}'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_LINK_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_LINK_BY) { $subject = $this->l->t('{actor} shared {file} as public link'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_BY) { $subject = $this->l->t('{actor} removed public link for {file}'); - } else if ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { $subject = $this->l->t('Public link of {actor} for {file} expired'); } else { diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php index 36d4dbbb8fd..b56100b6be9 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -60,7 +60,7 @@ class RemoteShares extends Base { if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_ACCEPTED) { $subject = $this->l->t('{user} accepted the remote share'); - } else if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_DECLINED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_DECLINED) { $subject = $this->l->t('{user} declined the remote share'); } else { throw new \InvalidArgumentException(); @@ -87,11 +87,11 @@ class RemoteShares extends Base { if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_RECEIVED) { $subject = $this->l->t('You received a new remote share {file} from {user}'); - } else if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_ACCEPTED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_ACCEPTED) { $subject = $this->l->t('{user} accepted the remote share of {file}'); - } else if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_DECLINED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_DECLINED) { $subject = $this->l->t('{user} declined the remote share of {file}'); - } else if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_UNSHARED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_UNSHARED) { $subject = $this->l->t('{user} unshared {file} from you'); } else { throw new \InvalidArgumentException(); diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php index 82c1cca9f8c..4274e551899 100644 --- a/apps/files_sharing/lib/Activity/Providers/Users.php +++ b/apps/files_sharing/lib/Activity/Providers/Users.php @@ -54,23 +54,23 @@ class Users extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_USER_SELF) { $subject = $this->l->t('Shared with {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_USER_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_USER_SELF) { $subject = $this->l->t('Removed share for {user}'); - } else if ($event->getSubject() === self::SUBJECT_SELF_UNSHARED) { + } elseif ($event->getSubject() === self::SUBJECT_SELF_UNSHARED) { $subject = $this->l->t('You removed yourself'); - } else if ($event->getSubject() === self::SUBJECT_SELF_UNSHARED_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SELF_UNSHARED_BY) { $subject = $this->l->t('{actor} removed themselves'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_USER_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_USER_BY) { $subject = $this->l->t('{actor} shared with {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_USER_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_USER_BY) { $subject = $this->l->t('{actor} removed share for {user}'); - } else if ($event->getSubject() === self::SUBJECT_SHARED_WITH_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_WITH_BY) { $subject = $this->l->t('Shared by {actor}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_BY) { $subject = $this->l->t('{actor} removed share'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED_USER) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED_USER) { $subject = $this->l->t('Share for {user} expired'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED) { $subject = $this->l->t('Share expired'); } else { throw new \InvalidArgumentException(); @@ -97,23 +97,23 @@ class Users extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_USER_SELF) { $subject = $this->l->t('You shared {file} with {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_USER_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_USER_SELF) { $subject = $this->l->t('You removed {user} from {file}'); - } else if ($event->getSubject() === self::SUBJECT_SELF_UNSHARED) { + } elseif ($event->getSubject() === self::SUBJECT_SELF_UNSHARED) { $subject = $this->l->t('You removed yourself from {file}'); - } else if ($event->getSubject() === self::SUBJECT_SELF_UNSHARED_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SELF_UNSHARED_BY) { $subject = $this->l->t('{actor} removed themselves from {file}'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_USER_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_USER_BY) { $subject = $this->l->t('{actor} shared {file} with {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_USER_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_USER_BY) { $subject = $this->l->t('{actor} removed {user} from {file}'); - } else if ($event->getSubject() === self::SUBJECT_SHARED_WITH_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_WITH_BY) { $subject = $this->l->t('{actor} shared {file} with you'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_BY) { $subject = $this->l->t('{actor} removed you from the share named {file}'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED_USER) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED_USER) { $subject = $this->l->t('Share for file {file} with {user} expired'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED) { $subject = $this->l->t('Share for file {file} expired'); } else { diff --git a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php index b109a6282fa..fc58b5d1209 100644 --- a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php +++ b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php @@ -143,7 +143,7 @@ class DeletedShareAPIController extends OCSController { $group = $this->groupManager->get($share->getSharedWith()); $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = ''; diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 833bc788687..40a9a387dde 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -218,11 +218,11 @@ class ShareAPIController extends OCSController { $sharedWith = $this->userManager->get($share->getSharedWith()); $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith(); - } else if ($share->getShareType() === Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith(); - } else if ($share->getShareType() === IShare::TYPE_LINK) { + } elseif ($share->getShareType() === IShare::TYPE_LINK) { // "share_with" and "share_with_displayname" for passwords of link // shares was deprecated in Nextcloud 15, use "password" instead. @@ -235,17 +235,17 @@ class ShareAPIController extends OCSController { $result['token'] = $share->getToken(); $result['url'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $share->getToken()]); - } else if ($share->getShareType() === Share::SHARE_TYPE_REMOTE || $share->getShareType() === Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_REMOTE || $share->getShareType() === Share::SHARE_TYPE_REMOTE_GROUP) { $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $this->getDisplayNameFromAddressBook($share->getSharedWith(), 'CLOUD'); $result['token'] = $share->getToken(); - } else if ($share->getShareType() === Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_EMAIL) { $result['share_with'] = $share->getSharedWith(); $result['password'] = $share->getPassword(); $result['send_password_by_talk'] = $share->getSendPasswordByTalk(); $result['share_with_displayname'] = $this->getDisplayNameFromAddressBook($share->getSharedWith(), 'EMAIL'); $result['token'] = $share->getToken(); - } else if ($share->getShareType() === Share::SHARE_TYPE_CIRCLE) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_CIRCLE) { // getSharedWith() returns either "name (type, owner)" or // "name (type, owner) [id]", depending on the Circles app version. $hasCircleId = (substr($share->getSharedWith(), -1) === ']'); @@ -264,7 +264,7 @@ class ShareAPIController extends OCSController { $shareWithLength = -1; } $result['share_with'] = substr($share->getSharedWith(), $shareWithStart, $shareWithLength); - } else if ($share->getShareType() === Share::SHARE_TYPE_ROOM) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_ROOM) { $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = ''; @@ -461,7 +461,7 @@ class ShareAPIController extends OCSController { } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_GROUP) { + } elseif ($shareType === Share::SHARE_TYPE_GROUP) { if (!$this->shareManager->allowGroupSharing()) { throw new OCSNotFoundException($this->l->t('Group sharing is disabled by the administrator')); } @@ -472,7 +472,7 @@ class ShareAPIController extends OCSController { } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_LINK + } elseif ($shareType === Share::SHARE_TYPE_LINK || $shareType === Share::SHARE_TYPE_EMAIL) { // Can we even share links? @@ -533,21 +533,21 @@ class ShareAPIController extends OCSController { throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); } } - } else if ($shareType === Share::SHARE_TYPE_REMOTE) { + } elseif ($shareType === Share::SHARE_TYPE_REMOTE) { if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) { throw new OCSForbiddenException($this->l->t('Sharing %1$s failed because the back end does not allow shares from type %2$s', [$path->getPath(), $shareType])); } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { if (!$this->shareManager->outgoingServer2ServerGroupSharesAllowed()) { throw new OCSForbiddenException($this->l->t('Sharing %1$s failed because the back end does not allow shares from type %2$s', [$path->getPath(), $shareType])); } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_CIRCLE) { + } elseif ($shareType === Share::SHARE_TYPE_CIRCLE) { if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) { throw new OCSNotFoundException($this->l->t('You cannot share to a Circle if the app is not enabled')); } @@ -560,7 +560,7 @@ class ShareAPIController extends OCSController { } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_ROOM) { + } elseif ($shareType === Share::SHARE_TYPE_ROOM) { try { $this->getRoomShareHelper()->createShare($share, $shareWith, $permissions, $expireDate); } catch (QueryException $e) { @@ -975,14 +975,14 @@ class ShareAPIController extends OCSController { // Update hide download state if ($hideDownload === 'true') { $share->setHideDownload(true); - } else if ($hideDownload === 'false') { + } elseif ($hideDownload === 'false') { $share->setHideDownload(false); } $newPermissions = null; if ($publicUpload === 'true') { $newPermissions = Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE; - } else if ($publicUpload === 'false') { + } elseif ($publicUpload === 'false') { $newPermissions = Constants::PERMISSION_READ; } @@ -1028,7 +1028,7 @@ class ShareAPIController extends OCSController { if ($expireDate === '') { $share->setExpirationDate(null); - } else if ($expireDate !== null) { + } elseif ($expireDate !== null) { try { $expireDate = $this->parseDate($expireDate); } catch (\Exception $e) { @@ -1039,7 +1039,7 @@ class ShareAPIController extends OCSController { if ($password === '') { $share->setPassword(null); - } else if ($password !== null) { + } elseif ($password !== null) { $share->setPassword($password); } @@ -1054,7 +1054,7 @@ class ShareAPIController extends OCSController { } $share->setSendPasswordByTalk(true); - } else if ($sendPasswordByTalk !== null) { + } elseif ($sendPasswordByTalk !== null) { $share->setSendPasswordByTalk(false); } } @@ -1068,7 +1068,7 @@ class ShareAPIController extends OCSController { if ($expireDate === '') { $share->setExpirationDate(null); - } else if ($expireDate !== null) { + } elseif ($expireDate !== null) { try { $expireDate = $this->parseDate($expireDate); } catch (\Exception $e) { diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 898e57c1591..a8cd2196629 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -193,7 +193,7 @@ class ShareesAPIController extends OCSController { if ($shareType !== null && is_array($shareType)) { $shareTypes = array_intersect($shareTypes, $shareType); - } else if (is_numeric($shareType)) { + } elseif (is_numeric($shareType)) { $shareTypes = array_intersect($shareTypes, [(int) $shareType]); } sort($shareTypes); @@ -362,7 +362,7 @@ class ShareesAPIController extends OCSController { if (isset($_GET['shareType']) && is_array($_GET['shareType'])) { $shareTypes = array_intersect($shareTypes, $_GET['shareType']); sort($shareTypes); - } else if (is_numeric($shareType)) { + } elseif (is_numeric($shareType)) { $shareTypes = array_intersect($shareTypes, [(int) $shareType]); sort($shareTypes); } diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index 31cc7135c0e..ee547ce9114 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -250,7 +250,7 @@ class Manager { // check if the user is allowed to access it if ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_USER && $share['user'] === $this->uid) { return $share; - } else if ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { + } elseif ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { $user = $this->userManager->get($this->uid); if ($this->groupManager->get($share['user'])->inGroup($user)) { return $share; @@ -333,7 +333,7 @@ class Manager { $this->processNotification($id); $result = true; - } else if ($share && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { + } elseif ($share && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { $result = $this->writeShareToDb( $share['remote'], $share['share_token'], @@ -537,7 +537,7 @@ class Manager { WHERE `id` = ? '); $result = (bool)$query->execute([(int)$share['id']]); - } else if ($result && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { + } elseif ($result && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { $query = $this->connection->prepare(' UPDATE `*PREFIX*share_external` SET `accepted` = ? diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php index 95008574627..1390c0a4f56 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -361,7 +361,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage { // old federated sharing permissions if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { $permissions = $response['{http://open-collaboration-services.org/ns}share-permissions']; - } else if (isset($response['{http://open-cloud-mesh.org/ns}share-permissions'])) { + } elseif (isset($response['{http://open-cloud-mesh.org/ns}share-permissions'])) { // permissions provided by the OCM API $permissions = $this->ocmPermissions2ncPermissions($response['{http://open-collaboration-services.org/ns}share-permissions']); } else { diff --git a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php index 010fdd9f883..758138bb7f0 100644 --- a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php +++ b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php @@ -60,7 +60,7 @@ class UserShareAcceptanceListener implements IEventListener { if ($share->getShareType() === IShare::TYPE_USER) { $this->handleAutoAccept($share, $share->getSharedWith()); - } else if ($share->getShareType() === IShare::TYPE_GROUP) { + } elseif ($share->getShareType() === IShare::TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); if ($group === null) { diff --git a/apps/files_sharing/lib/Notification/Listener.php b/apps/files_sharing/lib/Notification/Listener.php index 8f5dccdd20f..1b2678b2bc3 100644 --- a/apps/files_sharing/lib/Notification/Listener.php +++ b/apps/files_sharing/lib/Notification/Listener.php @@ -66,7 +66,7 @@ class Listener { $notification->setSubject(Notifier::INCOMING_USER_SHARE) ->setUser($share->getSharedWith()); $this->notificationManager->notify($notification); - } else if ($share->getShareType() === IShare::TYPE_GROUP) { + } elseif ($share->getShareType() === IShare::TYPE_GROUP) { $notification->setSubject(Notifier::INCOMING_GROUP_SHARE); $group = $this->groupManager->get($share->getSharedWith()); diff --git a/apps/files_sharing/lib/Notification/Notifier.php b/apps/files_sharing/lib/Notification/Notifier.php index a47b04e5b14..07c41882917 100644 --- a/apps/files_sharing/lib/Notification/Notifier.php +++ b/apps/files_sharing/lib/Notification/Notifier.php @@ -154,7 +154,7 @@ class Notifier implements INotifier { if ($share->getStatus() !== IShare::STATUS_PENDING) { throw new AlreadyProcessedException(); } - } else if ($share->getShareType() === IShare::TYPE_GROUP) { + } elseif ($share->getShareType() === IShare::TYPE_GROUP) { if ($share->getStatus() !== IShare::STATUS_PENDING) { throw new AlreadyProcessedException(); } diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php index f811d7f6bd4..fdbd0da96a3 100644 --- a/apps/files_sharing/lib/ShareBackend/File.php +++ b/apps/files_sharing/lib/ShareBackend/File.php @@ -134,7 +134,7 @@ class File implements \OCP\Share_Backend_File_Dependent { 'permissions' => $item['permissions'], 'uid_owner' => $item['uid_owner'], ]; - } else if ($format === self::FORMAT_GET_FOLDER_CONTENTS) { + } elseif ($format === self::FORMAT_GET_FOLDER_CONTENTS) { $files = []; foreach ($items as $item) { $file = []; @@ -157,25 +157,25 @@ class File implements \OCP\Share_Backend_File_Dependent { $files[] = $file; } return $files; - } else if ($format === self::FORMAT_OPENDIR) { + } elseif ($format === self::FORMAT_OPENDIR) { $files = []; foreach ($items as $item) { $files[] = basename($item['file_target']); } return $files; - } else if ($format === self::FORMAT_GET_ALL) { + } elseif ($format === self::FORMAT_GET_ALL) { $ids = []; foreach ($items as $item) { $ids[] = $item['file_source']; } return $ids; - } else if ($format === self::FORMAT_PERMISSIONS) { + } elseif ($format === self::FORMAT_PERMISSIONS) { $filePermissions = []; foreach ($items as $item) { $filePermissions[$item['file_source']] = $item['permissions']; } return $filePermissions; - } else if ($format === self::FORMAT_TARGET_NAMES) { + } elseif ($format === self::FORMAT_TARGET_NAMES) { $targets = []; foreach ($items as $item) { $targets[] = $item['file_target']; diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index cda01aacba2..f3fe96d2c3d 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -334,7 +334,7 @@ class SharedMountTest extends TestCase { if ($type === 'file') { $path = $this->filename; - } else if ($type === 'folder') { + } elseif ($type === 'folder') { $path = $this->folder; } |