diff options
Diffstat (limited to 'app/Http')
5 files changed, 10 insertions, 18 deletions
diff --git a/app/Http/RequestHandlers/CreateMediaObjectAction.php b/app/Http/RequestHandlers/CreateMediaObjectAction.php index b82b02996d..3a4e3715ac 100644 --- a/app/Http/RequestHandlers/CreateMediaObjectAction.php +++ b/app/Http/RequestHandlers/CreateMediaObjectAction.php @@ -29,7 +29,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; -use function in_array; use function response; /** @@ -66,7 +65,7 @@ class CreateMediaObjectAction implements RequestHandlerInterface $note = Validator::parsedBody($request)->string('media-note'); $title = Validator::parsedBody($request)->string('title'); $type = Validator::parsedBody($request)->string('type'); - $restriction = Validator::parsedBody($request)->string('restriction'); + $restriction = Validator::parsedBody($request)->isInArray(['', 'NONE', 'PRIVACY', 'CONFIDENTIAL', 'LOCKED'])->string('restriction'); $file = $this->media_file_service->uploadFile($request); @@ -76,7 +75,7 @@ class CreateMediaObjectAction implements RequestHandlerInterface $gedcom = "0 @@ OBJE\n" . $this->media_file_service->createMediaFileGedcom($file, $type, $title, $note); - if (in_array($restriction, ['none', 'privacy', 'confidential', 'locked'], true)) { + if ($restriction !== '') { $gedcom .= "\n1 RESN " . $restriction; } diff --git a/app/Http/RequestHandlers/CreateNoteAction.php b/app/Http/RequestHandlers/CreateNoteAction.php index 2c6f7fe986..9b114bfa2f 100644 --- a/app/Http/RequestHandlers/CreateNoteAction.php +++ b/app/Http/RequestHandlers/CreateNoteAction.php @@ -26,8 +26,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; -use function in_array; - /** * Process a form to create a new note object. */ @@ -42,14 +40,14 @@ class CreateNoteAction implements RequestHandlerInterface { $tree = Validator::attributes($request)->tree(); $note = Validator::parsedBody($request)->string('note'); - $restriction = Validator::parsedBody($request)->isInArray(['none', 'privacy', 'confidential', 'locked'])->string('restriction'); + $restriction = Validator::parsedBody($request)->isInArray(['', 'NONE', 'PRIVACY', 'CONFIDENTIAL', 'LOCKED'])->string('restriction'); // Convert HTML line endings to GEDCOM continuations $note = strtr($note, ["\r\n" => "\n1 CONT "]); $gedcom = '0 @@ NOTE ' . $note; - if (in_array($restriction, ['none', 'privacy', 'confidential', 'locked'], true)) { + if ($restriction !== '') { $gedcom .= "\n1 RESN " . $restriction; } diff --git a/app/Http/RequestHandlers/CreateRepositoryAction.php b/app/Http/RequestHandlers/CreateRepositoryAction.php index d4861eaf4e..3913c38a6a 100644 --- a/app/Http/RequestHandlers/CreateRepositoryAction.php +++ b/app/Http/RequestHandlers/CreateRepositoryAction.php @@ -26,7 +26,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; -use function in_array; use function preg_replace; use function response; use function trim; @@ -48,7 +47,7 @@ class CreateRepositoryAction implements RequestHandlerInterface $name = Validator::parsedBody($request)->string('name'); $address = Validator::parsedBody($request)->string('address'); $url = Validator::parsedBody($request)->string('url'); - $restriction = Validator::parsedBody($request)->string('restriction'); + $restriction = Validator::parsedBody($request)->isInArray(['', 'NONE', 'PRIVACY', 'CONFIDENTIAL', 'LOCKED'])->string('restriction'); // Fix non-printing characters $name = trim(preg_replace('/\s+/', ' ', $name)); @@ -63,7 +62,7 @@ class CreateRepositoryAction implements RequestHandlerInterface $gedcom .= "\n1 WWW " . $url; } - if (in_array($restriction, ['none', 'privacy', 'confidential', 'locked'], true)) { + if ($restriction !== '') { $gedcom .= "\n1 RESN " . $restriction; } diff --git a/app/Http/RequestHandlers/CreateSourceAction.php b/app/Http/RequestHandlers/CreateSourceAction.php index 34e88a65ad..54b2fe7488 100644 --- a/app/Http/RequestHandlers/CreateSourceAction.php +++ b/app/Http/RequestHandlers/CreateSourceAction.php @@ -26,8 +26,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; -use function in_array; - /** * Process a form to create a new source. */ @@ -48,7 +46,7 @@ class CreateSourceAction implements RequestHandlerInterface $repository = Validator::parsedBody($request)->string('source-repository'); $call_number = Validator::parsedBody($request)->string('source-call-number'); $text = Validator::parsedBody($request)->string('source-text'); - $restriction = Validator::parsedBody($request)->string('restriction'); + $restriction = Validator::parsedBody($request)->isInArray(['', 'NONE', 'PRIVACY', 'CONFIDENTIAL', 'LOCKED'])->string('restriction'); // Fix non-printing characters $title = trim(preg_replace('/\s+/', ' ', $title)); @@ -87,7 +85,7 @@ class CreateSourceAction implements RequestHandlerInterface } } - if (in_array($restriction, ['none', 'privacy', 'confidential', 'locked'], true)) { + if ($restriction !== '') { $gedcom .= "\n1 RESN " . $restriction; } diff --git a/app/Http/RequestHandlers/CreateSubmitterAction.php b/app/Http/RequestHandlers/CreateSubmitterAction.php index 835e85a8c0..99a6892db3 100644 --- a/app/Http/RequestHandlers/CreateSubmitterAction.php +++ b/app/Http/RequestHandlers/CreateSubmitterAction.php @@ -26,8 +26,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; -use function in_array; - /** * Process a form to create a new submitter. */ @@ -45,7 +43,7 @@ class CreateSubmitterAction implements RequestHandlerInterface $address = Validator::parsedBody($request)->string('submitter_address'); $email = Validator::parsedBody($request)->string('submitter_email'); $phone = Validator::parsedBody($request)->string('submitter_phone'); - $restriction = Validator::parsedBody($request)->string('restriction'); + $restriction = Validator::parsedBody($request)->isInArray(['', 'NONE', 'PRIVACY', 'CONFIDENTIAL', 'LOCKED'])->string('restriction'); // Fix non-printing characters $name = trim(preg_replace('/\s+/', ' ', $name)); @@ -64,7 +62,7 @@ class CreateSubmitterAction implements RequestHandlerInterface $gedcom .= "\n1 PHON " . $phone; } - if (in_array($restriction, ['none', 'privacy', 'confidential', 'locked'], true)) { + if ($restriction !== '') { $gedcom .= "\n1 RESN " . $restriction; } |
