mirror of
https://github.com/standardebooks/web.git
synced 2025-07-16 11:26:37 -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();
|
session_start();
|
||||||
|
|
||||||
$exception = $_SESSION['exception'] ?? null;
|
$exception = $_SESSION['exception'] ?? null;
|
||||||
|
/** @var Artwork $artwork */
|
||||||
|
$artwork = $_SESSION['artwork'] ?? null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$artwork = Artwork::GetByUrl(HttpInput::Str(GET, 'artist-url-name') ?? '', HttpInput::Str(GET, 'artwork-url-name') ?? '');
|
|
||||||
|
|
||||||
if($GLOBALS['User'] === null){
|
if($GLOBALS['User'] === null){
|
||||||
throw new Exceptions\LoginRequiredException();
|
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));
|
$isEditingAllowed = ($artwork->Status == ArtworkStatus::Unverified) && ($GLOBALS['User']->Benefits->CanReviewArtwork || ($artwork->SubmitterUserId == $GLOBALS['User']->UserId));
|
||||||
if(!$isEditingAllowed){
|
if(!$isEditingAllowed){
|
||||||
throw new Exceptions\InvalidPermissionsException();
|
throw new Exceptions\InvalidPermissionsException();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue