aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/appinfo/v1/webdav.php2
-rw-r--r--apps/dav/appinfo/v2/direct.php2
-rw-r--r--apps/dav/appinfo/v2/remote.php2
-rw-r--r--apps/dav/lib/CalDAV/Activity/Backend.php6
-rw-r--r--apps/dav/lib/CalDAV/Integration/ExternalCalendar.php4
-rw-r--r--apps/dav/lib/CalDAV/Publishing/PublishPlugin.php2
-rw-r--r--apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php8
-rw-r--r--apps/dav/lib/CalDAV/Schedule/Plugin.php6
-rw-r--r--apps/dav/lib/CardDAV/CardDavBackend.php10
-rw-r--r--apps/dav/lib/CardDAV/HasPhotoPlugin.php4
-rw-r--r--apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php4
-rw-r--r--apps/dav/lib/CardDAV/MultiGetExportPlugin.php2
-rw-r--r--apps/dav/lib/CardDAV/PhotoCache.php2
-rw-r--r--apps/dav/lib/CardDAV/SyncService.php2
-rw-r--r--apps/dav/lib/CardDAV/SystemAddressbook.php2
-rw-r--r--apps/dav/lib/Comments/CommentNode.php2
-rw-r--r--apps/dav/lib/Comments/CommentsPlugin.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/CachingTree.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/DavAclPlugin.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php2
-rw-r--r--apps/dav/lib/DAV/GroupPrincipalBackend.php2
-rw-r--r--apps/dav/lib/DAV/PublicAuth.php2
-rw-r--r--apps/dav/lib/DAV/Sharing/Plugin.php2
-rw-r--r--apps/dav/lib/Listener/CalendarContactInteractionListener.php5
-rw-r--r--apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php3
-rw-r--r--apps/dav/lib/Server.php2
28 files changed, 43 insertions, 45 deletions
diff --git a/apps/dav/appinfo/v1/webdav.php b/apps/dav/appinfo/v1/webdav.php
index 8dbe846f3ff..73fea85fa40 100644
--- a/apps/dav/appinfo/v1/webdav.php
+++ b/apps/dav/appinfo/v1/webdav.php
@@ -31,7 +31,7 @@
use Psr\Log\LoggerInterface;
// no php execution timeout for webdav
-if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
+if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) {
@set_time_limit(0);
}
ignore_user_abort(true);
diff --git a/apps/dav/appinfo/v2/direct.php b/apps/dav/appinfo/v2/direct.php
index cab6109e5e6..c4676e62c4f 100644
--- a/apps/dav/appinfo/v2/direct.php
+++ b/apps/dav/appinfo/v2/direct.php
@@ -27,7 +27,7 @@ declare(strict_types=1);
use \OCA\DAV\Direct\ServerFactory;
// no php execution timeout for webdav
-if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
+if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) {
@set_time_limit(0);
}
ignore_user_abort(true);
diff --git a/apps/dav/appinfo/v2/remote.php b/apps/dav/appinfo/v2/remote.php
index de2ba989f8d..5d4fb46c407 100644
--- a/apps/dav/appinfo/v2/remote.php
+++ b/apps/dav/appinfo/v2/remote.php
@@ -22,7 +22,7 @@
*
*/
// no php execution timeout for webdav
-if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
+if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) {
@set_time_limit(0);
}
ignore_user_abort(true);
diff --git a/apps/dav/lib/CalDAV/Activity/Backend.php b/apps/dav/lib/CalDAV/Activity/Backend.php
index 781a456b5b3..661a3dcc9ae 100644
--- a/apps/dav/lib/CalDAV/Activity/Backend.php
+++ b/apps/dav/lib/CalDAV/Activity/Backend.php
@@ -455,9 +455,9 @@ class Backend {
$action = $action . '_' . $object['type'];
- if ($object['type'] === 'todo' && strpos($action, Event::SUBJECT_OBJECT_UPDATE) === 0 && $object['status'] === 'COMPLETED') {
+ if ($object['type'] === 'todo' && str_starts_with($action, Event::SUBJECT_OBJECT_UPDATE) && $object['status'] === 'COMPLETED') {
$action .= '_completed';
- } elseif ($object['type'] === 'todo' && strpos($action, Event::SUBJECT_OBJECT_UPDATE) === 0 && $object['status'] === 'NEEDS-ACTION') {
+ } elseif ($object['type'] === 'todo' && str_starts_with($action, Event::SUBJECT_OBJECT_UPDATE) && $object['status'] === 'NEEDS-ACTION') {
$action .= '_needs_action';
}
@@ -491,7 +491,7 @@ class Backend {
],
];
- if ($object['type'] === 'event' && strpos($action, Event::SUBJECT_OBJECT_DELETE) === false && $this->appManager->isEnabledForUser('calendar')) {
+ if ($object['type'] === 'event' && !str_contains($action, Event::SUBJECT_OBJECT_DELETE) && $this->appManager->isEnabledForUser('calendar')) {
$params['object']['link']['object_uri'] = $objectData['uri'];
$params['object']['link']['calendar_uri'] = $calendarData['uri'];
$params['object']['link']['owner'] = $owner;
diff --git a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php
index 9c801a08a26..0afb11c2673 100644
--- a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php
+++ b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php
@@ -98,7 +98,7 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
* @return bool
*/
public static function isAppGeneratedCalendar(string $calendarUri):bool {
- return strpos($calendarUri, self::PREFIX) === 0 && substr_count($calendarUri, self::DELIMITER) >= 2;
+ return str_starts_with($calendarUri, self::PREFIX) && substr_count($calendarUri, self::DELIMITER) >= 2;
}
/**
@@ -126,6 +126,6 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
* @return bool
*/
public static function doesViolateReservedName(string $calendarUri):bool {
- return strpos($calendarUri, self::PREFIX) === 0;
+ return str_starts_with($calendarUri, self::PREFIX);
}
}
diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
index aabf78da1aa..35a3478046b 100644
--- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
+++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php
@@ -156,7 +156,7 @@ class PublishPlugin extends ServerPlugin {
// Only handling xml
$contentType = $request->getHeader('Content-Type');
- if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) {
+ if (!str_contains($contentType, 'application/xml') && !str_contains($contentType, 'text/xml')) {
return;
}
diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
index d2ad4cafb98..32642bee195 100644
--- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
+++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
@@ -160,7 +160,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
* @return array
*/
public function getPrincipalByPath($path) {
- if (strpos($path, $this->principalPrefix) !== 0) {
+ if (!str_starts_with($path, $this->principalPrefix)) {
return null;
}
[, $name] = \Sabre\Uri\split($path);
@@ -443,7 +443,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
}
$usersGroups = $this->groupManager->getUserGroupIds($user);
- if (strpos($uri, 'mailto:') === 0) {
+ if (str_starts_with($uri, 'mailto:')) {
$email = substr($uri, 7);
$query = $this->db->getQueryBuilder();
$query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname', 'group_restrictions'])
@@ -463,9 +463,9 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
return $this->rowToPrincipal($row)['uri'];
}
- if (strpos($uri, 'principal:') === 0) {
+ if (str_starts_with($uri, 'principal:')) {
$path = substr($uri, 10);
- if (strpos($path, $this->principalPrefix) !== 0) {
+ if (!str_starts_with($path, $this->principalPrefix)) {
return null;
}
diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php
index 0751638b697..2845ccdf6c2 100644
--- a/apps/dav/lib/CalDAV/Schedule/Plugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php
@@ -310,10 +310,10 @@ EOF;
return null;
}
- $isResourceOrRoom = strpos($principalUrl, 'principals/calendar-resources') === 0 ||
- strpos($principalUrl, 'principals/calendar-rooms') === 0;
+ $isResourceOrRoom = str_starts_with($principalUrl, 'principals/calendar-resources') ||
+ str_starts_with($principalUrl, 'principals/calendar-rooms');
- if (strpos($principalUrl, 'principals/users') === 0) {
+ if (str_starts_with($principalUrl, 'principals/users')) {
[, $userId] = split($principalUrl);
$uri = $this->config->getUserValue($userId, 'dav', 'defaultCalendar', CalDavBackend::PERSONAL_CALENDAR_URI);
$displayName = CalDavBackend::PERSONAL_CALENDAR_NAME;
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index 4e4d64f6f72..87e9cd22dac 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -1013,7 +1013,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
// Micro optimisation
// don't loop through
- if (strpos($cardData, 'PHOTO:data:') === 0) {
+ if (str_starts_with($cardData, 'PHOTO:data:')) {
return $cardData;
}
@@ -1022,8 +1022,8 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$cardDataFiltered = [];
$removingPhoto = false;
foreach ($cardDataArray as $line) {
- if (strpos($line, 'PHOTO:data:') === 0
- && strpos($line, 'PHOTO:data:image/') !== 0) {
+ if (str_starts_with($line, 'PHOTO:data:')
+ && !str_starts_with($line, 'PHOTO:data:image/')) {
// Filter out PHOTO data of non-images
$removingPhoto = true;
$modified = true;
@@ -1031,7 +1031,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
}
if ($removingPhoto) {
- if (strpos($line, ' ') === 0) {
+ if (str_starts_with($line, ' ')) {
continue;
}
// No leading space means this is a new property
@@ -1131,7 +1131,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$propertyOr = $query2->expr()->orX();
foreach ($searchProperties as $property) {
if ($escapePattern) {
- if ($property === 'EMAIL' && strpos($pattern, ' ') !== false) {
+ if ($property === 'EMAIL' && str_contains($pattern, ' ')) {
// There can be no spaces in emails
continue;
}
diff --git a/apps/dav/lib/CardDAV/HasPhotoPlugin.php b/apps/dav/lib/CardDAV/HasPhotoPlugin.php
index 528fcb36bf5..310649bdae9 100644
--- a/apps/dav/lib/CardDAV/HasPhotoPlugin.php
+++ b/apps/dav/lib/CardDAV/HasPhotoPlugin.php
@@ -66,8 +66,8 @@ class HasPhotoPlugin extends ServerPlugin {
return $vcard instanceof VCard
&& $vcard->PHOTO
// Either the PHOTO is a url (doesn't start with data:) or the mimetype has to start with image/
- && (strpos($vcard->PHOTO->getValue(), 'data:') !== 0
- || strpos($vcard->PHOTO->getValue(), 'data:image/') === 0)
+ && (!str_starts_with($vcard->PHOTO->getValue(), 'data:')
+ || str_starts_with($vcard->PHOTO->getValue(), 'data:image/'))
;
});
}
diff --git a/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php b/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php
index bd394cb7fb6..6f05bb6ce6a 100644
--- a/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php
+++ b/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php
@@ -91,7 +91,7 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties {
* @return bool
*/
public static function isAppGeneratedAddressBook(string $uri): bool {
- return strpos($uri, self::PREFIX) === 0 && substr_count($uri, self::DELIMITER) >= 2;
+ return str_starts_with($uri, self::PREFIX) && substr_count($uri, self::DELIMITER) >= 2;
}
/**
@@ -121,6 +121,6 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties {
* @return bool
*/
public static function doesViolateReservedName(string $uri): bool {
- return strpos($uri, self::PREFIX) === 0;
+ return str_starts_with($uri, self::PREFIX);
}
}
diff --git a/apps/dav/lib/CardDAV/MultiGetExportPlugin.php b/apps/dav/lib/CardDAV/MultiGetExportPlugin.php
index 62c4f7e8178..c3224bc5d9b 100644
--- a/apps/dav/lib/CardDAV/MultiGetExportPlugin.php
+++ b/apps/dav/lib/CardDAV/MultiGetExportPlugin.php
@@ -62,7 +62,7 @@ class MultiGetExportPlugin extends DAV\ServerPlugin {
// Only handling xml
$contentType = $response->getHeader('Content-Type');
- if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) {
+ if (!str_contains($contentType, 'application/xml') && !str_contains($contentType, 'text/xml')) {
return;
}
diff --git a/apps/dav/lib/CardDAV/PhotoCache.php b/apps/dav/lib/CardDAV/PhotoCache.php
index 101111f9310..e4d5b40fa1b 100644
--- a/apps/dav/lib/CardDAV/PhotoCache.php
+++ b/apps/dav/lib/CardDAV/PhotoCache.php
@@ -266,7 +266,7 @@ class PhotoCache {
$typeParam = isset($params['TYPE']) ? $params['TYPE'] : $params['MEDIATYPE'];
$type = $typeParam->getValue();
- if (strpos($type, 'image/') === 0) {
+ if (str_starts_with($type, 'image/')) {
return $type;
} else {
return 'image/' . strtolower($type);
diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php
index 067a279941d..09c31683069 100644
--- a/apps/dav/lib/CardDAV/SyncService.php
+++ b/apps/dav/lib/CardDAV/SyncService.php
@@ -157,7 +157,7 @@ class SyncService {
$certPath = $this->getCertPath();
$client->setThrowExceptions(true);
- if ($certPath !== '' && strpos($url, 'http://') !== 0) {
+ if ($certPath !== '' && !str_starts_with($url, 'http://')) {
$client->addCurlSetting(CURLOPT_CAINFO, $this->certPath);
}
diff --git a/apps/dav/lib/CardDAV/SystemAddressbook.php b/apps/dav/lib/CardDAV/SystemAddressbook.php
index 1cffde63474..5587324efcd 100644
--- a/apps/dav/lib/CardDAV/SystemAddressbook.php
+++ b/apps/dav/lib/CardDAV/SystemAddressbook.php
@@ -122,7 +122,7 @@ class SystemAddressbook extends AddressBook {
$children = parent::getChildren();
return array_filter($children, function (Card $child) {
// check only for URIs that begin with Guests:
- return strpos($child->getName(), 'Guests:') !== 0;
+ return !str_starts_with($child->getName(), 'Guests:');
});
}
diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php
index b41dbc276e8..332c0e2d4d8 100644
--- a/apps/dav/lib/Comments/CommentNode.php
+++ b/apps/dav/lib/Comments/CommentNode.php
@@ -79,7 +79,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
$methods = get_class_methods($this->comment);
$methods = array_filter($methods, function ($name) {
- return strpos($name, 'get') === 0;
+ return str_starts_with($name, 'get');
});
foreach ($methods as $getter) {
if ($getter === 'getMentions') {
diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php
index f31e479c212..bb07217a0ab 100644
--- a/apps/dav/lib/Comments/CommentsPlugin.php
+++ b/apps/dav/lib/Comments/CommentsPlugin.php
@@ -85,7 +85,7 @@ class CommentsPlugin extends ServerPlugin {
*/
public function initialize(Server $server) {
$this->server = $server;
- if (strpos($this->server->getRequestUri(), 'comments/') !== 0) {
+ if (!str_starts_with($this->server->getRequestUri(), 'comments/')) {
return;
}
diff --git a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php
index 6c3600fa5eb..d8be0c20dc8 100644
--- a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php
@@ -54,7 +54,7 @@ class AnonymousOptionsPlugin extends ServerPlugin {
* @return bool
*/
public function isRequestInRoot($path) {
- return $path === '' || (is_string($path) && strpos($path, '/') === false);
+ return $path === '' || (is_string($path) && !str_contains($path, '/'));
}
/**
diff --git a/apps/dav/lib/Connector/Sabre/CachingTree.php b/apps/dav/lib/Connector/Sabre/CachingTree.php
index 81ffd47a977..b1bccce3620 100644
--- a/apps/dav/lib/Connector/Sabre/CachingTree.php
+++ b/apps/dav/lib/Connector/Sabre/CachingTree.php
@@ -46,7 +46,7 @@ class CachingTree extends Tree {
$path = trim($path, '/');
foreach ($this->cache as $nodePath => $node) {
$nodePath = (string) $nodePath;
- if ('' === $path || $nodePath == $path || 0 === strpos($nodePath, $path.'/')) {
+ if ('' === $path || $nodePath == $path || str_starts_with($nodePath, $path . '/')) {
unset($this->cache[$nodePath]);
}
}
diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
index 6842975835d..6164b28b625 100644
--- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
@@ -94,7 +94,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin {
$path = $request->getPath();
// prevent the plugin from causing an unneeded overhead for file requests
- if (strpos($path, 'files/') !== 0) {
+ if (!str_starts_with($path, 'files/')) {
parent::beforeMethod($request, $response);
}
}
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php
index 0a882288314..ff82f1fac53 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -482,7 +482,7 @@ class Principal implements BackendInterface {
$restrictGroups = $this->groupManager->getUserGroupIds($user);
}
- if (strpos($uri, 'mailto:') === 0) {
+ if (str_starts_with($uri, 'mailto:')) {
if ($principalPrefix === 'principals/users') {
$users = $this->userManager->getByEmail(substr($uri, 7));
if (count($users) !== 1) {
diff --git a/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php b/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php
index d0251b2755f..0c274d807a0 100644
--- a/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php
@@ -61,7 +61,7 @@ class PropfindCompressionPlugin extends ServerPlugin {
return $response;
}
- if (strpos($header, 'gzip') !== false) {
+ if (str_contains($header, 'gzip')) {
$body = $response->getBody();
if (is_string($body)) {
$response->setHeader('Content-Encoding', 'gzip');
diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php
index f1f15fd61a6..9acc7c4b05b 100644
--- a/apps/dav/lib/DAV/GroupPrincipalBackend.php
+++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php
@@ -288,7 +288,7 @@ class GroupPrincipalBackend implements BackendInterface {
$restrictGroups = $this->groupManager->getUserGroupIds($user);
}
- if (strpos($uri, 'principal:principals/groups/') === 0) {
+ if (str_starts_with($uri, 'principal:principals/groups/')) {
$name = urlencode(substr($uri, 28));
if ($restrictGroups !== false && !\in_array($name, $restrictGroups, true)) {
return null;
diff --git a/apps/dav/lib/DAV/PublicAuth.php b/apps/dav/lib/DAV/PublicAuth.php
index 83874ab0d4d..3ba8bb2f3c5 100644
--- a/apps/dav/lib/DAV/PublicAuth.php
+++ b/apps/dav/lib/DAV/PublicAuth.php
@@ -86,7 +86,7 @@ class PublicAuth implements BackendInterface {
private function isRequestPublic(RequestInterface $request) {
$url = $request->getPath();
$matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) {
- return strpos($url, $publicUrl, 0) === 0;
+ return str_starts_with($url, $publicUrl);
});
return !empty($matchingUrls);
}
diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php
index a4b2cd3681c..c09723c3c36 100644
--- a/apps/dav/lib/DAV/Sharing/Plugin.php
+++ b/apps/dav/lib/DAV/Sharing/Plugin.php
@@ -126,7 +126,7 @@ class Plugin extends ServerPlugin {
// Only handling xml
$contentType = $request->getHeader('Content-Type');
- if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) {
+ if (!str_contains($contentType, 'application/xml') && !str_contains($contentType, 'text/xml')) {
return;
}
diff --git a/apps/dav/lib/Listener/CalendarContactInteractionListener.php b/apps/dav/lib/Listener/CalendarContactInteractionListener.php
index 04c759d5c3c..b27aa53aa11 100644
--- a/apps/dav/lib/Listener/CalendarContactInteractionListener.php
+++ b/apps/dav/lib/Listener/CalendarContactInteractionListener.php
@@ -43,7 +43,6 @@ use Sabre\VObject\Property;
use Sabre\VObject\Reader;
use Throwable;
use function strlen;
-use function strpos;
use function substr;
class CalendarContactInteractionListener implements IEventListener {
@@ -130,7 +129,7 @@ class CalendarContactInteractionListener implements IEventListener {
// Invalid principal
return;
}
- if (strpos($principal, self::URI_USERS) !== 0) {
+ if (!str_starts_with($principal, self::URI_USERS)) {
// Not a user principal
return;
}
@@ -159,7 +158,7 @@ class CalendarContactInteractionListener implements IEventListener {
}
$mailTo = $attendee->getValue();
- if (strpos($mailTo, 'mailto:') !== 0) {
+ if (!str_starts_with($mailTo, 'mailto:')) {
// Doesn't look like an email
continue;
}
diff --git a/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php b/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php
index 7bb535383c0..42dd0dfc0a7 100644
--- a/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php
+++ b/apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php
@@ -31,7 +31,6 @@ use OCP\EventDispatcher\IEventListener;
use OCP\IConfig;
use Psr\Log\LoggerInterface;
use Throwable;
-use function strpos;
/**
* @template-implements IEventListener<\OCA\DAV\Events\CalendarDeletedEvent>
@@ -61,7 +60,7 @@ class CalendarDeletionDefaultUpdaterListener implements IEventListener {
try {
$principalUri = $event->getCalendarData()['principaluri'];
- if (strpos($principalUri, 'principals/users') !== 0) {
+ if (!str_starts_with($principalUri, 'principals/users')) {
$this->logger->debug('Default calendar needs no update because the deleted calendar does not belong to a user principal');
return;
}
diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php
index 909bcaa71e8..580a97615a9 100644
--- a/apps/dav/lib/Server.php
+++ b/apps/dav/lib/Server.php
@@ -373,7 +373,7 @@ class Server {
private function requestIsForSubtree(array $subTrees): bool {
foreach ($subTrees as $subTree) {
$subTree = trim($subTree, ' /');
- if (strpos($this->server->getRequestUri(), $subTree.'/') === 0) {
+ if (str_starts_with($this->server->getRequestUri(), $subTree . '/')) {
return true;
}
}