Fix short addr collision

This commit is contained in:
Jill Stingray 2020-06-11 12:54:20 +03:00
parent fe13bbfdb8
commit 095b7960ca
2 changed files with 7 additions and 1 deletions

View file

@ -137,6 +137,12 @@ class Club extends RowModel
return false; return false;
if(in_array($code, OPENVK_ROOT_CONF["openvk"]["preferences"]["shortcodes"]["forbiddenNames"])) if(in_array($code, OPENVK_ROOT_CONF["openvk"]["preferences"]["shortcodes"]["forbiddenNames"]))
return false; return false;
if(\Chandler\MVC\Routing\Router::i()->getMatchingRoute("/$code")[0]->presenter !== "UnknownTextRouteStrategy")
return false;
$pUser = DB::i()->getContext()->table("profiles")->where("shortcode", $code)->fetch();
if(!is_null($pUser))
return false;
} }
$this->stateChanges("shortcode", $code); $this->stateChanges("shortcode", $code);

View file

@ -146,7 +146,7 @@ final class GroupPresenter extends OpenVKPresenter
$club->setName(empty($this->postParam("name")) ? $club->getName() : $this->postParam("name")); $club->setName(empty($this->postParam("name")) ? $club->getName() : $this->postParam("name"));
$club->setAbout(empty($this->postParam("about")) ? NULL : $this->postParam("about")); $club->setAbout(empty($this->postParam("about")) ? NULL : $this->postParam("about"));
$club->setShortcode(empty($this->postParam("shortcode")) ? NULL : $this->postParam("shortcode")); $club->setShortcode(empty($this->postParam("shortcode")) ? NULL : $this->postParam("shortcode"));
$club->setWall(empty($this->postParam("wall")) ? 0 : 1); $club->setWall(empty($this->postParam("wall")) ? 0 : 1);
if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) { if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) {
$photo = new Photo; $photo = new Photo;