Fix spacing in WallPresenter.php

This commit is contained in:
Jill Stingray 2020-06-11 23:18:05 +03:00
parent eba579046e
commit 3eb5b6b4fc

View file

@ -50,11 +50,11 @@ final class WallPresenter extends OpenVKPresenter
else if($user > 0) else if($user > 0)
$canPost = $owner->getPrivacyPermission("wall.write", $this->user->identity); $canPost = $owner->getPrivacyPermission("wall.write", $this->user->identity);
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;
$this->template->oObj = $owner; $this->template->oObj = $owner;
@ -158,9 +158,9 @@ final class WallPresenter extends OpenVKPresenter
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;
@ -178,14 +178,6 @@ final class WallPresenter extends OpenVKPresenter
if($_FILES["_pic_attachment"]["error"] === UPLOAD_ERR_OK) { if($_FILES["_pic_attachment"]["error"] === UPLOAD_ERR_OK) {
try { try {
$post = new Post;
$post->setOwner($this->user->id);
$post->setWall($wall);
$post->setCreated(time());
$post->setContent($this->postParam("text"));
$post->setFlags($flags);
$post->save();
$photo = new Photo; $photo = new Photo;
$photo->setOwner($this->user->id); $photo->setOwner($this->user->id);
$photo->setDescription(iconv_substr($this->postParam("text"), 0, 36) . "..."); $photo->setDescription(iconv_substr($this->postParam("text"), 0, 36) . "...");
@ -200,6 +192,13 @@ final class WallPresenter extends OpenVKPresenter
$this->flashFail("err", "Не удалось опубликовать пост", "Файл повреждён."); $this->flashFail("err", "Не удалось опубликовать пост", "Файл повреждён.");
} }
$post = new Post;
$post->setOwner($this->user->id);
$post->setWall($wall);
$post->setCreated(time());
$post->setContent($this->postParam("text"));
$post->setFlags($flags);
$post->save();
$post->attach($photo); $post->attach($photo);
} elseif($this->postParam("text")) { } elseif($this->postParam("text")) {
try { try {