Fix syntax errors in WallPresenter

This commit is contained in:
celestora 2021-11-04 19:01:09 +02:00 committed by GitHub
parent c049d5c0f3
commit c306899ead
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,20 +45,21 @@ final class WallPresenter extends OpenVKPresenter
exit("Ошибка доступа: " . (string) random_int(0, 255)); exit("Ошибка доступа: " . (string) random_int(0, 255));
$owner = ($user < 0 ? (new Clubs) : (new Users))->get(abs($user)); $owner = ($user < 0 ? (new Clubs) : (new Users))->get(abs($user));
if(is_null($this->user)) if(is_null($this->user)) {
$canPost = false; $canPost = false;
else if($user > 0) } else if($user > 0) {
if(!$owner->isBanned()) if(!$owner->isBanned())
$canPost = $owner->getPrivacyPermission("wall.write", $this->user->identity); $canPost = $owner->getPrivacyPermission("wall.write", $this->user->identity);
else else
$this->flashFail("err", tr("error"), "Ошибка доступа"); $this->flashFail("err", tr("error"), "Ошибка доступа");
else if($user < 0) } else if($user < 0) {
if($owner->canBeModifiedBy($this->user->identity)) if($owner->canBeModifiedBy($this->user->identity))
$canPost = true; $canPost = true;
else else
$canPost = $owner->canPost(); $canPost = $owner->canPost();
else } else {
$canPost = false; $canPost = false;
}
if ($embedded == true) $this->template->_template = "components/wall.xml"; if ($embedded == true) $this->template->_template = "components/wall.xml";
$this->template->oObj = $owner; $this->template->oObj = $owner;
@ -167,18 +168,19 @@ final class WallPresenter extends OpenVKPresenter
$wallOwner = ($wall > 0 ? (new Users)->get($wall) : (new Clubs)->get($wall * -1)) $wallOwner = ($wall > 0 ? (new Users)->get($wall) : (new Clubs)->get($wall * -1))
?? $this->flashFail("err", "Не удалось опубликовать пост", "Такого пользователя не существует."); ?? $this->flashFail("err", "Не удалось опубликовать пост", "Такого пользователя не существует.");
if($wall > 0) if($wall > 0) {
if(!$wallOwner->isBanned()) if(!$wallOwner->isBanned())
$canPost = $wallOwner->getPrivacyPermission("wall.write", $this->user->identity); $canPost = $wallOwner->getPrivacyPermission("wall.write", $this->user->identity);
else else
$this->flashFail("err", "Ошибка доступа", "Вам нельзя писать на эту стену."); $this->flashFail("err", "Ошибка доступа", "Вам нельзя писать на эту стену.");
else if($wall < 0) } else if($wall < 0) {
if($wallOwner->canBeModifiedBy($this->user->identity)) if($wallOwner->canBeModifiedBy($this->user->identity))
$canPost = true; $canPost = true;
else else
$canPost = $wallOwner->canPost(); $canPost = $wallOwner->canPost();
else } else {
$canPost = false; $canPost = false;
}
if(!$canPost) if(!$canPost)
$this->flashFail("err", "Ошибка доступа", "Вам нельзя писать на эту стену."); $this->flashFail("err", "Ошибка доступа", "Вам нельзя писать на эту стену.");