diff options
author | Faraz Samapoor <f.samapoor@gmail.com> | 2023-06-02 20:08:40 +0330 |
---|---|---|
committer | Faraz Samapoor <f.samapoor@gmail.com> | 2023-06-02 20:08:40 +0330 |
commit | 12e359429996aa2162a827792e6448dedd73c09e (patch) | |
tree | c6ce23c939e34d0b592be33eebb597803078da99 /apps/files_sharing/lib/Controller | |
parent | 21885058378c1fb15ad0cb847043c0eea0e7de22 (diff) | |
download | nextcloud-server-12e359429996aa2162a827792e6448dedd73c09e.tar.gz nextcloud-server-12e359429996aa2162a827792e6448dedd73c09e.zip |
Refactors "strpos" calls in /apps/files_sharing to improve code readability.
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
Diffstat (limited to 'apps/files_sharing/lib/Controller')
-rw-r--r-- | apps/files_sharing/lib/Controller/ExternalSharesController.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/Controller/ExternalSharesController.php b/apps/files_sharing/lib/Controller/ExternalSharesController.php index 9fab8d4e1a0..4cd09423eaa 100644 --- a/apps/files_sharing/lib/Controller/ExternalSharesController.php +++ b/apps/files_sharing/lib/Controller/ExternalSharesController.php @@ -129,7 +129,7 @@ class ExternalSharesController extends Controller { * @return DataResponse */ public function testRemote($remote) { - if (strpos($remote, '#') !== false || strpos($remote, '?') !== false || strpos($remote, ';') !== false) { + if (str_contains($remote, '#') || str_contains($remote, '?') || str_contains($remote, ';')) { return new DataResponse(false); } diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 3287d9447d8..e9f0c465f36 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -1841,7 +1841,7 @@ class ShareAPIController extends OCSController { if ($share->getShareType() === IShare::TYPE_CIRCLE && \OC::$server->getAppManager()->isEnabledForUser('circles') && class_exists('\OCA\Circles\Api\v1\Circles')) { - $hasCircleId = (substr($share->getSharedWith(), -1) === ']'); + $hasCircleId = (str_ends_with($share->getSharedWith(), ']')); $shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0); $shareWithLength = ($hasCircleId ? -1 : strpos($share->getSharedWith(), ' ')); if ($shareWithLength === false) { |