mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 18:11:52 -04:00
Use the artwork from the session when editing
This commit is contained in:
parent
4b2e02950f
commit
c80e99a71a
1 changed files with 6 additions and 2 deletions
|
@ -4,14 +4,18 @@ use function Safe\session_unset;
|
|||
session_start();
|
||||
|
||||
$exception = $_SESSION['exception'] ?? null;
|
||||
/** @var Artwork $artwork */
|
||||
$artwork = $_SESSION['artwork'] ?? null;
|
||||
|
||||
try{
|
||||
$artwork = Artwork::GetByUrl(HttpInput::Str(GET, 'artist-url-name') ?? '', HttpInput::Str(GET, 'artwork-url-name') ?? '');
|
||||
|
||||
if($GLOBALS['User'] === null){
|
||||
throw new Exceptions\LoginRequiredException();
|
||||
}
|
||||
|
||||
if($artwork === null){
|
||||
$artwork = Artwork::GetByUrl(HttpInput::Str(GET, 'artist-url-name') ?? '', HttpInput::Str(GET, 'artwork-url-name') ?? '');
|
||||
}
|
||||
|
||||
$isEditingAllowed = ($artwork->Status == ArtworkStatus::Unverified) && ($GLOBALS['User']->Benefits->CanReviewArtwork || ($artwork->SubmitterUserId == $GLOBALS['User']->UserId));
|
||||
if(!$isEditingAllowed){
|
||||
throw new Exceptions\InvalidPermissionsException();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue