mirror of
https://github.com/openvk/openvk
synced 2025-07-07 16:29:50 +03:00
Update GroupPresenter.php
This commit is contained in:
parent
1b82077f59
commit
e33a15b0ed
1 changed files with 4 additions and 4 deletions
|
@ -271,23 +271,23 @@ final class GroupPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderChangeOwner(int $id, int $newOwnerID): void
|
function renderChangeOwner(int $id, int $newOwnerId): void
|
||||||
{
|
{
|
||||||
$this->assertUserLoggedIn();
|
$this->assertUserLoggedIn();
|
||||||
$this->willExecuteWriteAction();
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] !== "POST")
|
if($_SERVER['REQUEST_METHOD'] !== "POST")
|
||||||
$this->redirect("/groups".$this->user->id);
|
$this->redirect("/groups" . $this->user->id);
|
||||||
|
|
||||||
if(!Authenticator::verifyHash($this->postParam("password"), $this->user->identity->getChandlerUser()->getRaw()->passwordHash))
|
if(!Authenticator::verifyHash($this->postParam("password"), $this->user->identity->getChandlerUser()->getRaw()->passwordHash))
|
||||||
$this->flashFail("err", tr("error"), tr("incorrect_password"));
|
$this->flashFail("err", tr("error"), tr("incorrect_password"));
|
||||||
|
|
||||||
$club = $this->clubs->get($id);
|
$club = $this->clubs->get($id);
|
||||||
$newOwner = (new Users)->get($newOwnerID);
|
$newOwner = (new Users)->get($newOwnerId);
|
||||||
if($this->user->id !== $club->getOwner()->getId())
|
if($this->user->id !== $club->getOwner()->getId())
|
||||||
$this->flashFail("err", tr("error"), tr("forbidden"));
|
$this->flashFail("err", tr("error"), tr("forbidden"));
|
||||||
|
|
||||||
$club->setOwner($newOwnerID);
|
$club->setOwner($newOwnerId);
|
||||||
$club->addManager($this->user->id);
|
$club->addManager($this->user->id);
|
||||||
$club->save();
|
$club->save();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue