mirror of
https://github.com/openvk/openvk
synced 2025-07-07 16:29:50 +03:00
Исправил стиль кода в renderShare
This commit is contained in:
parent
07a1b33722
commit
231cd23eef
1 changed files with 16 additions and 17 deletions
|
@ -363,52 +363,51 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
$this->assertNoCSRF();
|
$this->assertNoCSRF();
|
||||||
|
|
||||||
$post = $this->posts->getPostById($wall, $post_id);
|
$post = $this->posts->getPostById($wall, $post_id);
|
||||||
if(!$post || $post->isDeleted()) $this->notFound();
|
|
||||||
|
if(!$post || $post->isDeleted())
|
||||||
|
$this->notFound();
|
||||||
|
|
||||||
$where = $this->postParam("type") ?? "wall";
|
$where = $this->postParam("type") ?? "wall";
|
||||||
$groupId = NULL;
|
$groupId = NULL;
|
||||||
$flags = 0;
|
$flags = 0;
|
||||||
|
|
||||||
if($where == "group")
|
if($where == "group")
|
||||||
{
|
|
||||||
$groupId = $this->postParam("groupId");
|
$groupId = $this->postParam("groupId");
|
||||||
}
|
|
||||||
if(!is_null($this->user)) {
|
if(!is_null($this->user)) {
|
||||||
$nPost = new Post;
|
$nPost = new Post;
|
||||||
if($where == "wall")
|
|
||||||
{
|
if($where == "wall") {
|
||||||
$nPost->setOwner($this->user->id);
|
$nPost->setOwner($this->user->id);
|
||||||
$nPost->setWall($this->user->id);
|
$nPost->setWall($this->user->id);
|
||||||
}
|
} elseif($where == "group") {
|
||||||
elseif($where == "group")
|
|
||||||
{
|
|
||||||
$nPost->setOwner($this->user->id);
|
$nPost->setOwner($this->user->id);
|
||||||
|
|
||||||
if($this->postParam("asGroup") == 1)
|
if($this->postParam("asGroup") == 1)
|
||||||
{
|
|
||||||
$flags |= 0b10000000;
|
$flags |= 0b10000000;
|
||||||
}
|
|
||||||
if($this->postParam("signed") == 1)
|
if($this->postParam("signed") == 1)
|
||||||
{
|
|
||||||
$flags |= 0b01000000;
|
$flags |= 0b01000000;
|
||||||
}
|
|
||||||
$nPost->setWall($groupId*-1);
|
$nPost->setWall($groupId*-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nPost->setContent($this->postParam("text"));
|
$nPost->setContent($this->postParam("text"));
|
||||||
$nPost->setFlags($flags);
|
$nPost->setFlags($flags);
|
||||||
$nPost->save();
|
$nPost->save();
|
||||||
|
|
||||||
$nPost->attach($post);
|
$nPost->attach($post);
|
||||||
|
|
||||||
if($post->getOwner(false)->getId() !== $this->user->identity->getId() && !($post->getOwner() instanceof Club))
|
if($post->getOwner(false)->getId() !== $this->user->identity->getId() && !($post->getOwner() instanceof Club))
|
||||||
(new RepostNotification($post->getOwner(false), $post, $this->user->identity))->emit();
|
(new RepostNotification($post->getOwner(false), $post, $this->user->identity))->emit();
|
||||||
};
|
};
|
||||||
|
|
||||||
if($where == "wall")
|
if($where == "wall")
|
||||||
{
|
|
||||||
$this->returnJson(["wall_owner" => $this->user->identity->getId()]);
|
$this->returnJson(["wall_owner" => $this->user->identity->getId()]);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
$this->returnJson(["wall_owner" => $groupId*-1]);
|
$this->returnJson(["wall_owner" => $groupId*-1]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function renderDelete(int $wall, int $post_id): void
|
function renderDelete(int $wall, int $post_id): void
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue