diff --git a/VKAPI/Handlers/Wall.php b/VKAPI/Handlers/Wall.php index 4b711827..dad7f883 100644 --- a/VKAPI/Handlers/Wall.php +++ b/VKAPI/Handlers/Wall.php @@ -284,12 +284,16 @@ final class Wall extends VKAPIRequestHandler foreach($psts as $pst) { $id = explode("_", $pst); - $post = (new PostsRepo)->getPostById(intval($id[0]), intval($id[1])); + $post = (new PostsRepo)->getPostById(intval($id[0]), intval($id[1]), true); if($post && !$post->isDeleted()) { if(!$post->canBeViewedBy($this->getUser())) continue; + if($post->getSuggestionType() != 0 && !$post->canBeEditedBy($this->getUser())) { + continue; + } + $from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId(); $attachments = []; $repost = []; // чел высрал семь сигарет 😳 помянем 🕯 @@ -594,10 +598,6 @@ final class Wall extends VKAPIRequestHandler if($wall > 0 && $wall !== $this->user->identity->getId()) (new WallPostNotification($wallOwner, $post, $this->user->identity))->emit(); - if($should_be_suggested) { - return (object)["post_id" => "on_view"]; - } - return (object)["post_id" => $post->getVirtualId()]; } @@ -728,7 +728,7 @@ final class Wall extends VKAPIRequestHandler "date" => $comment->getPublicationTime()->timestamp(), "text" => $comment->getText(false), "post_id" => $post->getVirtualId(), - "owner_id" => $post->isPostedOnBehalfOfGroup() ? $post->getOwner()->getId() * -1 : $post->getOwner()->getId(), + "owner_id" => method_exists($post, 'isPostedOnBehalfOfGroup') && $post->isPostedOnBehalfOfGroup() ? $post->getOwner()->getId() * -1 : $post->getOwner()->getId(), "parents_stack" => [], "attachments" => $attachments, "thread" => [ @@ -815,7 +815,7 @@ final class Wall extends VKAPIRequestHandler "date" => $comment->getPublicationTime()->timestamp(), "text" => $comment->getText(false), "post_id" => $comment->getTarget()->getVirtualId(), - "owner_id" => $comment->getTarget()->isPostedOnBehalfOfGroup() ? $comment->getTarget()->getOwner()->getId() * -1 : $comment->getTarget()->getOwner()->getId(), + "owner_id" => method_exists($comment->getTarget(), 'isPostedOnBehalfOfGroup') && $comment->getTarget()->isPostedOnBehalfOfGroup() ? $comment->getTarget()->getOwner()->getId() * -1 : $comment->getTarget()->getOwner()->getId(), "parents_stack" => [], "attachments" => $attachments, "likes" => [ @@ -966,7 +966,7 @@ final class Wall extends VKAPIRequestHandler $this->fail(-66, "Post will be empty, don't saving."); } - $post = (new PostsRepo)->getPostById($owner_id, $post_id); + $post = (new PostsRepo)->getPostById($owner_id, $post_id, true); if(!$post || $post->isDeleted()) $this->fail(102, "Invalid post"); diff --git a/Web/Presenters/InternalAPIPresenter.php b/Web/Presenters/InternalAPIPresenter.php index efca2807..e8830497 100644 --- a/Web/Presenters/InternalAPIPresenter.php +++ b/Web/Presenters/InternalAPIPresenter.php @@ -151,6 +151,8 @@ final class InternalAPIPresenter extends OpenVKPresenter exit(''); } + header("Content-Type: text/plain"); + if($type == 'post') { $this->template->_template = 'components/post.xml'; $this->template->post = $post; diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index 79ef3704..f42dab17 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -168,10 +168,10 @@ {/if} {var $canReport = $thisUser->getId() != $club->getOwner()->getId()} {if $canReport} - {_report} + {_report}