Updated user not found page.

This commit is contained in:
flash 2019-06-06 22:18:31 +02:00
parent a2ae5e3d15
commit 712979ba89
5 changed files with 179 additions and 169 deletions

View file

@ -7,9 +7,9 @@ $isEditing = !empty($_GET['edit']) && is_string($_GET['edit']) ? (bool)$_GET['ed
$userId = user_find_for_profile($userId); $userId = user_find_for_profile($userId);
if ($userId < 1) { if($userId < 1) {
http_response_code(404); http_response_code(404);
echo tpl_render('user.notfound'); echo tpl_render('profile.index');
return; return;
} }

View file

@ -28,25 +28,34 @@
</div> </div>
<div class="profile__header__details__content"> <div class="profile__header__details__content">
<div class="profile__header__username" style="{{ profile.user_colour|html_colour }}"> {% if profile is defined %}
{{ profile.username }} <div class="profile__header__username" style="{{ profile.user_colour|html_colour }}">
</div> {{ profile.username }}
</div>
{% if profile.user_title is not empty %} {% if profile.user_title is not empty %}
<div class="profile__header__title">
{{ profile.user_title }}
</div>
{% endif %}
<div class="profile__header__country">
<div class="flag flag--{{ profile.user_country|lower }}"></div>
<div class="profile__header__country__name">
{{ profile.user_country|country_name }}
</div>
</div>
{% else %}
<div class="profile__header__username">
User not found!
</div>
<div class="profile__header__title"> <div class="profile__header__title">
{{ profile.user_title }} Check the link and try again.
</div> </div>
{% endif %} {% endif %}
<div class="profile__header__country">
<div class="flag flag--{{ profile.user_country|lower }}"></div>
<div class="profile__header__country__name">
{{ profile.user_country|country_name }}
</div>
</div>
</div> </div>
{% if profile_relation_info|length > 0 and (profile_relation_info.subject_relation is not null or profile_relation_info.user_relation is not null) %} {% if profile is defined and profile_relation_info|length > 0 and (profile_relation_info.subject_relation is not null or profile_relation_info.user_relation is not null) %}
<div class="profile__header__details__relation" title="Since {{ profile_relation_info.relation_created|date('r') }}"> <div class="profile__header__details__relation" title="Since {{ profile_relation_info.relation_created|date('r') }}">
{% if profile_relation_info.subject_relation and profile_relation_info.user_relation %} {% if profile_relation_info.subject_relation and profile_relation_info.user_relation %}
Mutual Friends Mutual Friends
@ -60,27 +69,29 @@
</div> </div>
<div class="profile__header__options"> <div class="profile__header__options">
<div class="profile__header__actions"> {% if profile is defined %}
{% if profile_mode is empty %} <div class="profile__header__actions">
{% if profile_is_editing %} {% if profile_mode is empty %}
<button class="input__button input__button--save profile__header__action">Save</button> {% if profile_is_editing %}
<a href="{{ url('user-profile', {'user': profile.user_id}) }}" class="input__button input__button--destroy profile__header__action">Discard</a> <button class="input__button input__button--save profile__header__action">Save</button>
<a href="{{ url('settings-index') }}" class="input__button profile__header__action">Settings</a> <a href="{{ url('user-profile', {'user': profile.user_id}) }}" class="input__button input__button--destroy profile__header__action">Discard</a>
{% elseif profile_can_edit %} <a href="{{ url('settings-index') }}" class="input__button profile__header__action">Settings</a>
<a href="{{ url('user-profile-edit', {'user': profile.user_id}) }}" class="input__button profile__header__action">Edit Profile</a> {% elseif profile_can_edit %}
{% endif %} <a href="{{ url('user-profile-edit', {'user': profile.user_id}) }}" class="input__button profile__header__action">Edit Profile</a>
{% if current_user is defined and current_user.user_id != profile.user_id and not profile_is_editing %}
{% if profile_relation_info.user_relation == constant('MSZ_USER_RELATION_FOLLOW') %}
<a href="{{ url('user-relation-none', {'user': profile.user_id}) }}" class="input__button input__button--destroy profile__header__action js-user-relation-action" data-relation-user="{{ profile.user_id }}" data-relation-type="{{ constant('MSZ_USER_RELATION_NONE') }}">Unfollow</a>
{% else %}
<a href="{{ url('user-relation-follow', {'user': profile.user_id}) }}" class="input__button profile__header__action js-user-relation-action" data-relation-user="{{ profile.user_id }}" data-relation-type="{{ constant('MSZ_USER_RELATION_FOLLOW') }}">Follow</a>
{% endif %} {% endif %}
{% if current_user is defined and current_user.user_id != profile.user_id and not profile_is_editing %}
{% if profile_relation_info.user_relation == constant('MSZ_USER_RELATION_FOLLOW') %}
<a href="{{ url('user-relation-none', {'user': profile.user_id}) }}" class="input__button input__button--destroy profile__header__action js-user-relation-action" data-relation-user="{{ profile.user_id }}" data-relation-type="{{ constant('MSZ_USER_RELATION_NONE') }}">Unfollow</a>
{% else %}
<a href="{{ url('user-relation-follow', {'user': profile.user_id}) }}" class="input__button profile__header__action js-user-relation-action" data-relation-user="{{ profile.user_id }}" data-relation-type="{{ constant('MSZ_USER_RELATION_FOLLOW') }}">Follow</a>
{% endif %}
{% endif %}
{% else %}
<a href="{{ url('user-profile', {'user': profile.user_id}) }}" class="input__button profile__header__action">Return</a>
{% endif %} {% endif %}
{% else %} </div>
<a href="{{ url('user-profile', {'user': profile.user_id}) }}" class="input__button profile__header__action">Return</a> {% endif %}
{% endif %}
</div>
{% if stats is defined %} {% if stats is defined %}
<div class="profile__header__stats"> <div class="profile__header__stats">

View file

@ -3,8 +3,12 @@
{% from 'user/macros.twig' import user_profile_warning %} {% from 'user/macros.twig' import user_profile_warning %}
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text, input_checkbox, input_file, input_file_raw, input_select %} {% from '_layout/input.twig' import input_hidden, input_csrf, input_text, input_checkbox, input_file, input_file_raw, input_select %}
{% set canonical_url = url('user-profile', {'user': profile.user_id}) %} {% if profile is defined %}
{% set title = profile.username %} {% set canonical_url = url('user-profile', {'user': profile.user_id}) %}
{% set title = profile.username %}
{% else %}
{% set title = 'User not found!' %}
{% endif %}
{% block content %} {% block content %}
{% if profile_is_editing %} {% if profile_is_editing %}
@ -169,90 +173,92 @@
</div> </div>
{% endif %} {% endif %}
<div class="profile__content__main"> {% if profile is defined %}
{% if (profile_is_editing and perms.edit_about) or profile.user_about_content|length > 0 %} <div class="profile__content__main">
<div class="container profile__container profile__about" id="about"> {% if (profile_is_editing and perms.edit_about) or profile.user_about_content|length > 0 %}
{{ container_title('About ' ~ profile.username) }} <div class="container profile__container profile__about" id="about">
{{ container_title('About ' ~ profile.username) }}
{% if profile_is_editing %} {% if profile_is_editing %}
<div class="profile__signature__editor"> <div class="profile__signature__editor">
{{ input_select('about[parser]', constant('MSZ_PARSERS_NAMES'), profile.user_about_parser, '', '', false, 'profile__about__select') }} {{ input_select('about[parser]', constant('MSZ_PARSERS_NAMES'), profile.user_about_parser, '', '', false, 'profile__about__select') }}
<textarea name="about[text]" class="input__textarea profile__about__text" id="about-textarea">{{ profile.user_about_content|escape }}</textarea> <textarea name="about[text]" class="input__textarea profile__about__text" id="about-textarea">{{ profile.user_about_content|escape }}</textarea>
</div> </div>
{% else %} {% else %}
<div class="profile__about__content{% if profile_is_editing %} profile__about__content--edit{% elseif profile.user_about_parser == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}"> <div class="profile__about__content{% if profile_is_editing %} profile__about__content--edit{% elseif profile.user_about_parser == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}">
{{ profile.user_about_content|escape|parse_text(profile.user_about_parser)|raw }} {{ profile.user_about_content|escape|parse_text(profile.user_about_parser)|raw }}
</div>
{% endif %}
</div>
{% endif %}
{% if (profile_is_editing and perms.edit_signature) or profile.user_signature_content|length > 0 %}
<div class="container profile__container profile__signature" id="signature">
{{ container_title('Signature') }}
{% if profile_is_editing %}
<div class="profile__signature__editor">
{{ input_select('signature[parser]', constant('MSZ_PARSERS_NAMES'), profile.user_signature_parser, '', '', false, 'profile__signature__select') }}
<textarea name="signature[text]" class="input__textarea profile__signature__text" id="signature-textarea">{{ profile.user_signature_content|escape }}</textarea>
</div>
{% else %}
<div class="profile__signature__content{% if profile_is_editing %} profile__signature__content--edit{% elseif profile.user_signature_parser == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}">
{{ profile.user_signature_content|escape|parse_text(profile.user_signature_parser)|raw }}
</div>
{% endif %}
</div>
{% endif %}
{% if profile_warnings|length > 0 %}
<div class="container profile__container profile__warning__container" id="account-standing">
{{ container_title('Account Standing', false, profile_warnings_can_manage ? '/manage/users.php?v=warnings&u=' ~ profile.user_id : '') }}
<div class="profile__warning">
<div class="profile__warning__background"></div>
{% if profile_warnings_can_manage %}
<div class="profile__warning__tools">
<div class="profile__warning__user">
<div class="profile__warning__user__ip">
User IP
</div>
</div>
<div class="profile__warning__user">
<div class="profile__warning__user__username">
Issuer
</div>
<div class="profile__warning__user__ip">
Issuer IP
</div>
</div>
</div> </div>
{% endif %} {% endif %}
</div>
{% endif %}
<div class="profile__warning__content"> {% if (profile_is_editing and perms.edit_signature) or profile.user_signature_content|length > 0 %}
<div class="profile__warning__type"> <div class="container profile__container profile__signature" id="signature">
Type {{ container_title('Signature') }}
{% if profile_is_editing %}
<div class="profile__signature__editor">
{{ input_select('signature[parser]', constant('MSZ_PARSERS_NAMES'), profile.user_signature_parser, '', '', false, 'profile__signature__select') }}
<textarea name="signature[text]" class="input__textarea profile__signature__text" id="signature-textarea">{{ profile.user_signature_content|escape }}</textarea>
</div> </div>
{% else %}
<div class="profile__warning__created"> <div class="profile__signature__content{% if profile_is_editing %} profile__signature__content--edit{% elseif profile.user_signature_parser == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}">
Created {{ profile.user_signature_content|escape|parse_text(profile.user_signature_parser)|raw }}
</div> </div>
{% endif %}
</div>
{% endif %}
<div class="profile__warning__duration"> {% if profile_warnings|length > 0 %}
Expires <div class="container profile__container profile__warning__container" id="account-standing">
</div> {{ container_title('Account Standing', false, profile_warnings_can_manage ? '/manage/users.php?v=warnings&u=' ~ profile.user_id : '') }}
<div class="profile__warning__note"> <div class="profile__warning">
Note <div class="profile__warning__background"></div>
{% if profile_warnings_can_manage %}
<div class="profile__warning__tools">
<div class="profile__warning__user">
<div class="profile__warning__user__ip">
User IP
</div>
</div>
<div class="profile__warning__user">
<div class="profile__warning__user__username">
Issuer
</div>
<div class="profile__warning__user__ip">
Issuer IP
</div>
</div>
</div>
{% endif %}
<div class="profile__warning__content">
<div class="profile__warning__type">
Type
</div>
<div class="profile__warning__created">
Created
</div>
<div class="profile__warning__duration">
Expires
</div>
<div class="profile__warning__note">
Note
</div>
</div> </div>
</div> </div>
</div>
{% for warning in profile_warnings %} {% for warning in profile_warnings %}
{{ user_profile_warning(warning, profile_warnings_view_private, profile_warnings_can_manage, profile_warnings_can_manage ? csrf_token('warning-delete[%d]'|format(warning.warning_id)) : '') }} {{ user_profile_warning(warning, profile_warnings_view_private, profile_warnings_can_manage, profile_warnings_can_manage ? csrf_token('warning-delete[%d]'|format(warning.warning_id)) : '') }}
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
{% endif %} {% endif %}
</div> </div>
</div> </div>

View file

@ -1,48 +1,55 @@
{% extends 'master.twig' %} {% extends 'master.twig' %}
{% set image = url('user-avatar', {'user': profile.user_id, 'res': 240}) %} {% if profile is defined %}
{% set manage_link = '/manage/users.php?v=view&u=' ~ profile.user_id %} {% set image = url('user-avatar', {'user': profile.user_id, 'res': 240}) %}
{% set stats = [ {% set manage_link = '/manage/users.php?v=view&u=' ~ profile.user_id %}
{ {% set stats = [
'title': 'Joined', {
'is_date': true, 'title': 'Joined',
'value': profile.user_created, 'is_date': true,
}, 'value': profile.user_created,
{ },
'title': 'Last seen', {
'is_date': true, 'title': 'Last seen',
'value': profile.user_active, 'is_date': true,
}, 'value': profile.user_active,
{ },
'title': 'Following', {
'value': profile.following_count, 'title': 'Following',
'url': url('user-profile-following', {'user': profile.user_id}), 'value': profile.following_count,
'active': profile_mode == 'following', 'url': url('user-profile-following', {'user': profile.user_id}),
}, 'active': profile_mode == 'following',
{ },
'title': 'Followers', {
'value': profile.followers_count, 'title': 'Followers',
'url': url('user-profile-followers', {'user': profile.user_id}), 'value': profile.followers_count,
'active': profile_mode == 'followers', 'url': url('user-profile-followers', {'user': profile.user_id}),
}, 'active': profile_mode == 'followers',
{ },
'title': 'Topics', {
'value': profile.forum_topic_count, 'title': 'Topics',
'url': url('user-profile-forum-topics', {'user': profile.user_id}), 'value': profile.forum_topic_count,
'active': profile_mode == 'forum-topics', 'url': url('user-profile-forum-topics', {'user': profile.user_id}),
}, 'active': profile_mode == 'forum-topics',
{ },
'title': 'Posts', {
'value': profile.forum_post_count, 'title': 'Posts',
'url': url('user-profile-forum-posts', {'user': profile.user_id}), 'value': profile.forum_post_count,
'active': profile_mode == 'forum-posts', 'url': url('user-profile-forum-posts', {'user': profile.user_id}),
}, 'active': profile_mode == 'forum-posts',
{ },
'title': 'Comments', {
'value': profile.comments_count, 'title': 'Comments',
}, 'value': profile.comments_count,
{ },
'title': 'Changes', {
'value': profile.changelog_count, 'title': 'Changes',
}, 'value': profile.changelog_count,
] %} },
] %}
{% else %}
{% set image = url('user-avatar', {'user': 0, 'res': 240}) %}
{% set manage_link = '/manage/users.php?v=listing' %}
{% set profile_is_editing = false %}
{% set profile_notices = [] %}
{% endif %}

View file

@ -1,14 +0,0 @@
{% extends 'user/master.twig' %}
{% from 'macros.twig' import container_title %}
{% set title = 'User not found!' %}
{% block content %}
<div class="container">
{{ container_title('User not found!') }}
<div class="container__content">
<p>Check the url and try again.</p>
</div>
</div>
{% endblock %}