Users: Replace Error 404 for deleted profiles

This commit replaces the 404 error with a new template for
deleted/non-existent users.
(this commit was backported from profile-removal)
This commit is contained in:
Ilya Prokopenko 2022-03-04 15:00:43 +03:00
parent a205dc82b8
commit dee3942aef
No known key found for this signature in database
GPG key ID: 7736BBBB05F14A56
4 changed files with 17 additions and 1 deletions

View file

@ -31,7 +31,7 @@ final class UserPresenter extends OpenVKPresenter
{ {
$user = $this->users->get($id); $user = $this->users->get($id);
if(!$user || $user->isDeleted()) if(!$user || $user->isDeleted())
$this->notFound(); $this->template->_template = "User/deleted.xml";
else { else {
if($user->getShortCode()) if($user->getShortCode())
if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) !== "/" . $user->getShortCode()) if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) !== "/" . $user->getShortCode())

View file

@ -0,0 +1,14 @@
{extends "../@layout.xml"}
{block title}{_information}{/block}
{block header}
{_information}
{/block}
{block content}
<center style="background: white;border: #DEDEDE solid 1px;">
<span style="color: #707070;margin: 60px 0;display: block;">
{_profile_not_found_text}
</span>
</center>
{/block}

View file

@ -800,6 +800,7 @@
"profile_changed" = "Profile changed"; "profile_changed" = "Profile changed";
"profile_changed_comment" = "Your active profile has been changed."; "profile_changed_comment" = "Your active profile has been changed.";
"profile_not_found" = "User is not found."; "profile_not_found" = "User is not found.";
"profile_not_found_text" = "This profile has either been deleted or not been created yet.";
"suspicious_registration_attempt" = "Suspicious registration attempt"; "suspicious_registration_attempt" = "Suspicious registration attempt";
"suspicious_registration_attempt_comment" = "You tried to register from a suspicious location."; "suspicious_registration_attempt_comment" = "You tried to register from a suspicious location.";

View file

@ -843,6 +843,7 @@
"profile_changed" = "Профиль изменён"; "profile_changed" = "Профиль изменён";
"profile_changed_comment" = "Ваш активный профиль был изменён."; "profile_changed_comment" = "Ваш активный профиль был изменён.";
"profile_not_found" = "Пользователь не найден."; "profile_not_found" = "Пользователь не найден.";
"profile_not_found_text" = "Страница удалена либо ещё не создана.";
"suspicious_registration_attempt" = "Подозрительная попытка регистрации"; "suspicious_registration_attempt" = "Подозрительная попытка регистрации";
"suspicious_registration_attempt_comment" = "Вы пытались зарегистрироваться из подозрительного места."; "suspicious_registration_attempt_comment" = "Вы пытались зарегистрироваться из подозрительного места.";