mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
parent
80e9ec4ba7
commit
74b3bf5e3f
5 changed files with 19 additions and 6 deletions
|
@ -544,7 +544,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
];
|
||||
}
|
||||
|
||||
function deleteComment(int $comment_id) {
|
||||
function deleteComment(int $comment_id) {
|
||||
$this->requireUser();
|
||||
|
||||
$comment = (new CommentsRepo)->get($comment_id);
|
||||
|
|
|
@ -243,8 +243,11 @@ class Photo extends Media
|
|||
$photo->setFile($file);
|
||||
$photo->save();
|
||||
|
||||
if(!is_null($album))
|
||||
if(!is_null($album)) {
|
||||
$album->addPhoto($photo);
|
||||
$album->setEdited(time());
|
||||
$album->save();
|
||||
}
|
||||
|
||||
return $photo;
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
$name = $album->getName();
|
||||
$owner = $album->getOwner();
|
||||
$album->delete();
|
||||
|
||||
$this->flash("succ", "Альбом удалён", "Альбом $name был успешно удалён.");
|
||||
$this->redirect("/albums" . ($owner instanceof Club ? "-" : "") . $owner->getId());
|
||||
}
|
||||
|
@ -241,7 +242,10 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
}
|
||||
|
||||
$album->addPhoto($photo);
|
||||
$this->redirect("/photo" . $photo->getPrettyId(), static::REDIRECT_TEMPORARY);
|
||||
$album->setEdited(time());
|
||||
$album->save();
|
||||
|
||||
$this->redirect("/photo" . $photo->getPrettyId() . "?from=album" . $album->getId(), static::REDIRECT_TEMPORARY);
|
||||
} else {
|
||||
$this->template->album = $album;
|
||||
}
|
||||
|
@ -262,6 +266,8 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$this->assertNoCSRF();
|
||||
$album->removePhoto($photo);
|
||||
$album->setEdited(time());
|
||||
$album->save();
|
||||
|
||||
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
||||
$this->redirect("/album" . $album->getPrettyId(), static::REDIRECT_TEMPORARY);
|
||||
|
|
|
@ -293,7 +293,11 @@ final class UserPresenter extends OpenVKPresenter
|
|||
$this->flashFail("err", tr("error"), tr("error_upload_failed"));
|
||||
}
|
||||
|
||||
(new Albums)->getUserAvatarAlbum($this->user->identity)->addPhoto($photo);
|
||||
$album = (new Albums)->getUserAvatarAlbum($this->user->identity);
|
||||
$album->addPhoto($photo);
|
||||
$album->setEdited(time());
|
||||
$album->save();
|
||||
|
||||
$this->flashFail("succ", tr("photo_saved"), tr("photo_saved_comment"));
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,6 @@
|
|||
{block description}
|
||||
<span>{$x->getDescription() ?? $x->getName()}</span><br />
|
||||
<span style="color: grey;">{$x->getPhotosCount()} фотографий</span><br />
|
||||
<span style="color: grey;">Обновлен {$x->getEditTime() ?? $x->getCreationTime()}</span><br />
|
||||
<span style="color: grey;">Создан {$x->getCreationTime()}</span><br />
|
||||
<span style="color: grey;">{tr("updated_at", $x->getEditTime() ?? $x->getCreationTime())}</span><br />
|
||||
<span style="color: grey;">{_created} {$x->getCreationTime()}</span><br />
|
||||
{/block}
|
||||
|
|
Loading…
Reference in a new issue