mirror of
https://github.com/openvk/openvk
synced 2025-03-14 13:35:33 +03:00
openvk.uk
Возможно, приведение кода к кодстайлу (удаление скобочек то есть)
This commit is contained in:
parent
5f51881a5d
commit
6bd475a6ac
7 changed files with 29 additions and 43 deletions
|
@ -141,17 +141,15 @@ class Wall implements Handler
|
|||
$flags = 0;
|
||||
$flags |= 0b10000000;
|
||||
|
||||
if($sign) {
|
||||
if($sign)
|
||||
$flags |= 0b01000000;
|
||||
}
|
||||
|
||||
$post->setSuggested(0);
|
||||
$post->setCreated(time());
|
||||
$post->setFlags($flags);
|
||||
|
||||
if(mb_strlen($content) > 0) {
|
||||
if(mb_strlen($content) > 0)
|
||||
$post->setContent($content);
|
||||
}
|
||||
|
||||
$post->save();
|
||||
|
||||
|
|
|
@ -151,9 +151,9 @@ final class Wall extends VKAPIRequestHandler
|
|||
|
||||
$postType = "post";
|
||||
$signerId = NULL;
|
||||
if($post->getSuggestionType() != 0) {
|
||||
if($post->getSuggestionType() != 0)
|
||||
$postType = "suggest";
|
||||
}
|
||||
|
||||
|
||||
if($post->isSigned()) {
|
||||
$actualAuthor = $post->getOwner(false);
|
||||
|
@ -342,9 +342,9 @@ final class Wall extends VKAPIRequestHandler
|
|||
# TODO: $post->getVkApiType()
|
||||
$postType = "post";
|
||||
$signerId = NULL;
|
||||
if($post->getSuggestionType() != 0) {
|
||||
if($post->getSuggestionType() != 0)
|
||||
$postType = "suggest";
|
||||
}
|
||||
|
||||
|
||||
if($post->isSigned()) {
|
||||
$actualAuthor = $post->getOwner(false);
|
||||
|
@ -470,9 +470,8 @@ final class Wall extends VKAPIRequestHandler
|
|||
if($canPost == false) $this->fail(15, "Access denied");
|
||||
|
||||
if($post_id > 0) {
|
||||
if($owner_id > 0) {
|
||||
if($owner_id > 0)
|
||||
$this->fail(62, "Suggested posts available only at groups");
|
||||
}
|
||||
|
||||
$post = (new PostsRepo)->getPostById($owner_id, $post_id, true);
|
||||
|
||||
|
@ -539,9 +538,8 @@ final class Wall extends VKAPIRequestHandler
|
|||
$post->setFlags($flags);
|
||||
$post->setApi_Source_Name($this->getPlatform());
|
||||
|
||||
if($owner_id < 0 && !$wallOwner->canBeModifiedBy($this->getUser()) && $wallOwner->getWallType() == 2) {
|
||||
if($owner_id < 0 && !$wallOwner->canBeModifiedBy($this->getUser()) && $wallOwner->getWallType() == 2)
|
||||
$post->setSuggested(1);
|
||||
}
|
||||
|
||||
$post->save();
|
||||
} catch(\LogicException $ex) {
|
||||
|
|
|
@ -313,15 +313,13 @@ class Club extends RowModel
|
|||
{
|
||||
$count = 0;
|
||||
|
||||
if(is_null($user)) {
|
||||
if(is_null($user))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if($this->canBeModifiedBy($user)) {
|
||||
if($this->canBeModifiedBy($user))
|
||||
$count = (new Posts)->getSuggestedPostsCount($this->getId());
|
||||
} else {
|
||||
else
|
||||
$count = (new Posts)->getSuggestedPostsCountByUser($this->getId(), $user->getId());
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
|
|
@ -300,10 +300,9 @@ class Poll extends Attachable
|
|||
["attachable_type" => static::class,
|
||||
"attachable_id" => $this->getId()])->fetch();
|
||||
|
||||
if(!is_null($post->target_id)) {
|
||||
if(!is_null($post->target_id))
|
||||
return (new Posts)->get($post->target_id);
|
||||
} else {
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,11 +33,10 @@ final class GroupPresenter extends OpenVKPresenter
|
|||
$this->template->topicsCount = (new Topics)->getClubTopicsCount($club);
|
||||
}
|
||||
|
||||
if(!is_null($this->user->identity) && !$club->canBeModifiedBy($this->user->identity) && $club->getWallType() == 2) {
|
||||
if(!is_null($this->user->identity) && $club->getWallType() == 2) {
|
||||
if(!$club->canBeModifiedBy($this->user->identity))
|
||||
$this->template->suggestedPostsCountByUser = (new Posts)->getSuggestedPostsCountByUser($club->getId(), $this->user->id);
|
||||
}
|
||||
|
||||
if(!is_null($this->user->identity) && $club->canBeModifiedBy($this->user->identity) && $club->getWallType() == 2) {
|
||||
else
|
||||
$this->template->suggestedPostsCountByEveryone = (new Posts)->getSuggestedPostsCount($club->getId());
|
||||
}
|
||||
|
||||
|
|
|
@ -310,9 +310,8 @@ final class WallPresenter extends OpenVKPresenter
|
|||
$post->setFlags($flags);
|
||||
$post->setNsfw($this->postParam("nsfw") === "on");
|
||||
|
||||
if($wall < 0 && !$wallOwner->canBeModifiedBy($this->user->identity) && $wallOwner->getWallType() == 2) {
|
||||
if($wall < 0 && !$wallOwner->canBeModifiedBy($this->user->identity) && $wallOwner->getWallType() == 2)
|
||||
$post->setSuggested(1);
|
||||
}
|
||||
|
||||
$post->save();
|
||||
} catch (\LengthException $ex) {
|
||||
|
@ -351,17 +350,14 @@ final class WallPresenter extends OpenVKPresenter
|
|||
if($wall < 0 && !$wallOwner->canBeModifiedBy($this->user->identity) && $wallOwner->getWallType() == 2) {
|
||||
$suggsCount = $this->posts->getSuggestedPostsCount($wallOwner->getId());
|
||||
|
||||
# Возможно, это заебёт админов групп, но так они хотя бы про паблик вспомнят
|
||||
# Мб рандома добавить?
|
||||
if($suggsCount % 10 == 0) {
|
||||
$managers = $wallOwner->getManagers();
|
||||
$owner = $wallOwner->getOwner();
|
||||
(new NewSuggestedPostsNotification($owner, $wallOwner))->emit();
|
||||
|
||||
foreach($managers as $manager) {
|
||||
foreach($managers as $manager)
|
||||
(new NewSuggestedPostsNotification($manager->getUser(), $wallOwner))->emit();
|
||||
}
|
||||
}
|
||||
|
||||
$this->redirect("/club".$wallOwner->getId()."/suggested");
|
||||
} else {
|
||||
|
|
|
@ -14,15 +14,13 @@
|
|||
<h4 id="cound">{if $type == "my"}{tr("suggested_posts_in_group_by_you", $count)}{else}{tr("suggested_posts_in_group", $count)}{/if}</h4>
|
||||
<div id="postz" class="infContainer">
|
||||
{var $microblog = $thisUser->hasMicroblogEnabled()}
|
||||
{foreach $posts as $post}
|
||||
<div class="infObj">
|
||||
<div class="infObj" n:foreach="$posts as $post">
|
||||
{if $microblog}
|
||||
{include "../components/post/microblogpost.xml", post => $post, commentSection => false, suggestion => true, forceNoCommentsLink => true, forceNoPinLink => true, forceNoLike => true, forceNoShareLink => true, forceNoDeleteLink => false}
|
||||
{else}
|
||||
{include "../components/post/oldpost.xml", post => $post, commentSection => false, suggestion => true, forceNoCommentsLink => true, forceNoPinLink => true, forceNoLike => true, forceNoShareLink => true, forceNoDeleteLink => false}
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
{include "../components/paginator.xml", conf => (object) [
|
||||
"page" => $page,
|
||||
|
|
Loading…
Reference in a new issue