From 231cd23eef0d59cebabc008c1d2c7a379a9075e1 Mon Sep 17 00:00:00 2001 From: lalka2016 <99399973+lalka2016@users.noreply.github.com> Date: Mon, 8 May 2023 14:50:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=81=D1=82=D0=B8=D0=BB=D1=8C=20=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=20=D0=B2=20renderShare?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Web/Presenters/WallPresenter.php | 33 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index 73101d1b..d9ba06b0 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -363,51 +363,50 @@ final class WallPresenter extends OpenVKPresenter $this->assertNoCSRF(); $post = $this->posts->getPostById($wall, $post_id); - if(!$post || $post->isDeleted()) $this->notFound(); + + if(!$post || $post->isDeleted()) + $this->notFound(); + $where = $this->postParam("type") ?? "wall"; $groupId = NULL; $flags = 0; + if($where == "group") - { $groupId = $this->postParam("groupId"); - } + if(!is_null($this->user)) { $nPost = new Post; - if($where == "wall") - { + + if($where == "wall") { $nPost->setOwner($this->user->id); $nPost->setWall($this->user->id); - } - elseif($where == "group") - { + } elseif($where == "group") { $nPost->setOwner($this->user->id); - if($this->postParam("asGroup") == 1) - { + if($this->postParam("asGroup") == 1) $flags |= 0b10000000; - } + if($this->postParam("signed") == 1) - { $flags |= 0b01000000; - } + $nPost->setWall($groupId*-1); } + $nPost->setContent($this->postParam("text")); $nPost->setFlags($flags); $nPost->save(); + $nPost->attach($post); if($post->getOwner(false)->getId() !== $this->user->identity->getId() && !($post->getOwner() instanceof Club)) (new RepostNotification($post->getOwner(false), $post, $this->user->identity))->emit(); }; + if($where == "wall") - { $this->returnJson(["wall_owner" => $this->user->identity->getId()]); - } + else - { $this->returnJson(["wall_owner" => $groupId*-1]); - } } function renderDelete(int $wall, int $post_id): void