mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-29 13:10:06 +02:00
Use str_contains and similar instead of strpos
This commit is contained in:
parent
508de10191
commit
1dbf36b86b
16 changed files with 18 additions and 19 deletions
|
@ -417,7 +417,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
{
|
||||
//Only set if the URL is not empty
|
||||
if (!empty($url)) {
|
||||
if (false !== strpos($url, '%BASE%') || false !== strpos($url, '%MEDIA%')) {
|
||||
if (str_contains($url, '%BASE%') || str_contains($url, '%MEDIA%')) {
|
||||
throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!');
|
||||
}
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
*/
|
||||
public function isCLIEntry(): bool
|
||||
{
|
||||
return strpos($this->username, '!!!CLI ') === 0;
|
||||
return str_starts_with($this->username, '!!!CLI ');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -128,7 +128,7 @@ final class PermissionData implements \JsonSerializable
|
|||
public function isPermissionSet(string $permission, string $operation): bool
|
||||
{
|
||||
//We cannot access metadata via normal permission data
|
||||
if (strpos($permission, '$') !== false) {
|
||||
if (str_contains($permission, '$')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue