mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
User, Group: Don't force a redirect to short URL
This behavior wasn't seen in VKontakte.
This commit is contained in:
parent
5b5d095121
commit
65de19def1
2 changed files with 4 additions and 11 deletions
|
@ -22,15 +22,12 @@ final class GroupPresenter extends OpenVKPresenter
|
|||
if(!$club) {
|
||||
$this->notFound();
|
||||
} else {
|
||||
if($club->getShortCode())
|
||||
if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) !== "/" . $club->getShortCode())
|
||||
$this->redirect("/" . $club->getShortCode(), static::REDIRECT_TEMPORARY_PRESISTENT);
|
||||
|
||||
$this->template->club = $club;
|
||||
$this->template->albums = (new Albums)->getClubAlbums($club, 1, 3);
|
||||
$this->template->albumsCount = (new Albums)->getClubAlbumsCount($club);
|
||||
$this->template->topics = (new Topics)->getLastTopics($club, 3);
|
||||
$this->template->topicsCount = (new Topics)->getClubTopicsCount($club);
|
||||
|
||||
$this->template->club = $club;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,13 +33,9 @@ final class UserPresenter extends OpenVKPresenter
|
|||
function renderView(int $id): void
|
||||
{
|
||||
$user = $this->users->get($id);
|
||||
if(!$user || $user->isDeleted())
|
||||
if(!$user || $user->isDeleted()) {
|
||||
$this->template->_template = "User/deleted.xml";
|
||||
else {
|
||||
if($user->getShortCode())
|
||||
if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) !== "/" . $user->getShortCode())
|
||||
$this->redirect("/" . $user->getShortCode(), static::REDIRECT_TEMPORARY_PRESISTENT);
|
||||
|
||||
} else {
|
||||
$this->template->albums = (new Albums)->getUserAlbums($user);
|
||||
$this->template->albumsCount = (new Albums)->getUserAlbumsCount($user);
|
||||
$this->template->videos = (new Videos)->getByUser($user, 1, 2);
|
||||
|
|
Loading…
Reference in a new issue