Now Notes and Albums cannot be created with empty title

This commit is contained in:
veselcraft 2021-01-16 17:45:49 -05:00
parent ad2e5ec8cc
commit b08c33e092
2 changed files with 7 additions and 0 deletions

View file

@ -54,6 +54,10 @@ final class NotesPresenter extends OpenVKPresenter
$this->notFound(); $this->notFound();
if($_SERVER["REQUEST_METHOD"] === "POST") { if($_SERVER["REQUEST_METHOD"] === "POST") {
if(empty($this->postParam("name"))) {
$this->flashFail("err", tr("error"), tr("error_segmentation"));
}
$note = new Note; $note = new Note;
$note->setOwner($this->user->id); $note->setOwner($this->user->id);
$note->setCreated(time()); $note->setCreated(time());

View file

@ -68,6 +68,9 @@ final class PhotosPresenter extends OpenVKPresenter
} }
if($_SERVER["REQUEST_METHOD"] === "POST") { if($_SERVER["REQUEST_METHOD"] === "POST") {
if(empty($this->postParam("name"))) {
$this->flashFail("err", tr("error"), tr("error_segmentation"));
}
$album = new Album; $album = new Album;
$album->setOwner(isset($club) ? $club->getId() * -1 : $this->user->id); $album->setOwner(isset($club) ? $club->getId() * -1 : $this->user->id);
$album->setName($this->postParam("name")); $album->setName($this->postParam("name"));