mirror of
https://github.com/openvk/openvk
synced 2024-11-13 10:39:24 +03:00
parent
c10b8274a6
commit
413e2ac6f0
2 changed files with 10 additions and 6 deletions
|
@ -70,9 +70,9 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
}
|
||||
|
||||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
if(empty($this->postParam("name"))) {
|
||||
if(empty($this->postParam("name")))
|
||||
$this->flashFail("err", tr("error"), tr("error_segmentation"));
|
||||
}
|
||||
|
||||
$album = new Album;
|
||||
$album->setOwner(isset($club) ? $club->getId() * -1 : $this->user->id);
|
||||
$album->setName($this->postParam("name"));
|
||||
|
@ -80,7 +80,10 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
$album->setCreated(time());
|
||||
$album->save();
|
||||
|
||||
$this->redirect("/album" . $album->getOwner()->getId() . "_" . $album->getId(), static::REDIRECT_TEMPORARY);
|
||||
if(isset($club))
|
||||
$this->redirect("/album-" . $album->getOwner()->getId() . "_" . $album->getId(), static::REDIRECT_TEMPORARY);
|
||||
else
|
||||
$this->redirect("/album" . $album->getOwner()->getId() . "_" . $album->getId(), static::REDIRECT_TEMPORARY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,10 +121,11 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
if(is_null($this->user) || !$album->canBeModifiedBy($this->user->identity))
|
||||
$this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
|
||||
|
||||
$name = $album->getName();
|
||||
$name = $album->getName();
|
||||
$owner = $album->getOwner();
|
||||
$album->delete();
|
||||
$this->flash("succ", "Альбом удалён", "Альбом $name был успешно удалён.");
|
||||
$this->redirect("/albums" . $this->user->id);
|
||||
$this->redirect("/albums" . ($owner instanceof Club ? "-" : "") . $owner->getId());
|
||||
}
|
||||
|
||||
function renderAlbum(int $owner, int $id): void
|
||||
|
|
|
@ -39,6 +39,6 @@
|
|||
</form>
|
||||
<hr/>
|
||||
<center>
|
||||
{_"you_can_also"} <a href="/album{$album->getOwner()->getId()}_{$album->getId()}/delete?hash={rawurlencode($csrfToken)}">{_"delete_album"}</a>.
|
||||
{_"you_can_also"} <a href="/album{$album->getOwner() instanceof openvk\Web\Models\Entities\Club ? '-' : ''}{$album->getOwner()->getId()}_{$album->getId()}/delete.pl?hash={rawurlencode($csrfToken)}">{_"delete_album"}</a>.
|
||||
</center>
|
||||
{/block}
|
||||
|
|
Loading…
Reference in a new issue