Update gender to constants

This commit is contained in:
Visman 2023-05-13 22:41:17 +07:00
parent 68747c98a8
commit 9f2923adf8
10 changed files with 17 additions and 17 deletions

View file

@ -1130,7 +1130,7 @@ class Install extends Admin
'u_pm_last_post' => ['INT(10) UNSIGNED', false, 0],
'warning_flag' => ['TINYINT(1)', false, 0],
'warning_all' => ['INT(10) UNSIGNED', false, 0],
'gender' => ['TINYINT UNSIGNED', false, 0],
'gender' => ['TINYINT UNSIGNED', false, FORK_GEN_NOT],
'u_mark_all_read' => ['INT(10) UNSIGNED', false, 0],
'last_report_id' => ['INT(10) UNSIGNED', false, 0],
'ip_check_type' => ['TINYINT UNSIGNED', false, 0],

View file

@ -66,7 +66,7 @@ class View extends Users
'email' => 'string:null|max:80',
'title' => 'string:null|max:50',
'realname' => 'string:null|max:40',
'gender' => 'integer|in:0,1,2',
'gender' => 'integer|in:' . FORK_GEN_NOT . ',' . FORK_GEN_MAN . ',' . FORK_GEN_FEM,
'url' => 'string:null|max:100',
'location' => 'string:null|max:30',
'signature' => 'string:null|max:512',
@ -208,9 +208,9 @@ class View extends Users
'value' => $data['realname'] ?? null,
];
$genders = [
0 => __('Do not display'),
1 => __('Male'),
2 => __('Female'),
FORK_GEN_NOT => __('Do not display'),
FORK_GEN_MAN => __('Male'),
FORK_GEN_FEM => __('Female'),
];
$fields['gender'] = [
# 'class' => ['block'],

View file

@ -92,7 +92,7 @@ class Edit extends Profile
'delete_avatar' => $ruleDelAvatar,
'admin_note' => $ruleAdminNote,
'realname' => 'exist|string:trim|max:40|noURL:1',
'gender' => 'required|integer|in:0,1,2',
'gender' => 'required|integer|in:' . FORK_GEN_NOT . ',' . FORK_GEN_MAN . ',' . FORK_GEN_FEM,
'location' => 'exist|string:trim|max:30|noURL:1',
'email_setting' => 'required|integer|in:0,1,2',
'url' => $ruleWebsite,
@ -374,9 +374,9 @@ class Edit extends Profile
'value' => $this->curUser->realname,
];
$genders = [
0 => __('Do not display'),
1 => __('Male'),
2 => __('Female'),
FORK_GEN_NOT => __('Do not display'),
FORK_GEN_MAN => __('Male'),
FORK_GEN_FEM => __('Female'),
];
$fields['gender'] = [
'class' => ['block'],

View file

@ -118,8 +118,8 @@ class View extends Profile
];
}
$genders = [
1 => __('Male'),
2 => __('Female'),
FORK_GEN_MAN => __('Male'),
FORK_GEN_FEM => __('Female'),
];
if (isset($genders[$this->curUser->gender])) {
$fields['gender'] = [

View file

@ -145,6 +145,6 @@ class GitHub extends Driver
*/
protected function getuserGender(): int
{
return 0;
return FORK_GEN_NOT;
}
}

View file

@ -22,7 +22,7 @@
<h2>{!! __($p->postsTitle) !!}</h2>
@foreach ($p->posts as $post)
@if ($post->id)
<article id="p{{ $post->id }}" class="f-post @if (1 == $post->user->gender) f-user-male @elseif (2 == $post->user->gender) f-user-female @endif">
<article id="p{{ $post->id }}" class="f-post @if (FORK_GEN_MAN == $post->user->gender) f-user-male @elseif (FORK_GEN_FEM == $post->user->gender) f-user-female @endif">
<header class="f-post-header">
<h3 class="f-phead-h3">@if ($post->postNumber > 1){!! __('Re') !!} @endif{{ $post->parent->name }}</h3>
<span class="f-post-posted"><time datetime="{{ \gmdate('c', $post->posted) }}">{{ dt($post->posted) }}</time></span>

View file

@ -44,7 +44,7 @@
@if (empty($post->id) && $iswev = [FORK_MESS_ERR => [['Message %s was not found in the database', $id]]])
@include ('layouts/iswev')
@else
<article id="p{{ $post->id }}" class="f-post @if (1 == $post->user->gender) f-user-male @elseif (2 == $post->user->gender) f-user-female @endif @if ($post->user->online) f-user-online @endif @if (1 === $post->postNumber) f-post-first @endif">
<article id="p{{ $post->id }}" class="f-post @if (FORK_GEN_MAN == $post->user->gender) f-user-male @elseif (FORK_GEN_FEM == $post->user->gender) f-user-female @endif @if ($post->user->online) f-user-online @endif @if (1 === $post->postNumber) f-post-first @endif">
@if ($p->enableMod && $post->postNumber > 1)
<input id="checkbox-{{ $post->id }}" class="f-post-checkbox" type="checkbox" name="ids[{{ $post->id }}]" value="{{ $post->id }}" form="id-form-mod">
@endif

View file

@ -32,7 +32,7 @@
<h2>{!! __($p->postsTitle) !!}</h2>
@foreach ($p->posts as $post)
@if ($post->id)
<article id="p{{ $post->id }}" class="f-post @if (1 == $post->user->gender) f-user-male @elseif (2 == $post->user->gender) f-user-female @endif">
<article id="p{{ $post->id }}" class="f-post @if (FORK_GEN_MAN == $post->user->gender) f-user-male @elseif (FORK_GEN_FEM == $post->user->gender) f-user-female @endif">
<header class="f-post-header">
<h3 class="f-phead-h3">@if ($post->postNumber > 1){!! __('Re') !!} @endif{{ $post->parent->name }}</h3>
<span class="f-post-posted"><time datetime="{{ \gmdate('c', $post->posted) }}">{{ dt($post->posted) }}</time></span>

View file

@ -51,7 +51,7 @@
@if (empty($post->id) && $iswev = [FORK_MESS_ERR => [['Message %s was not found in the database', $id]]])
@include ('layouts/iswev')
@else
<article id="p{{ $post->id }}" class="f-post @if (1 == $post->user->gender) f-user-male @elseif (2 == $post->user->gender) f-user-female @endif @if ($post->user->online) f-user-online @endif @if (1 === $post->postNumber) f-post-first @endif">
<article id="p{{ $post->id }}" class="f-post @if (FORK_GEN_MAN == $post->user->gender) f-user-male @elseif (FORK_GEN_FEM == $post->user->gender) f-user-female @endif @if ($post->user->online) f-user-online @endif @if (1 === $post->postNumber) f-post-first @endif">
@if ($p->enableMod && $post->postNumber > 1)
<input hidden id="checkbox-{{ $post->id }}" class="f-post-checkbox" type="checkbox" name="ids[{{ $post->id }}]" value="{{ $post->id }}" form="id-form-mod">
@endif

View file

@ -38,7 +38,7 @@
@if (empty($post->id) && $iswev = [FORK_MESS_ERR => [['Message %s was not found in the database', $id]]])
@include ('layouts/iswev')
@else
<article id="p{{ $post->id }}" class="f-post f-post-search @if (1 == $post->user->gender) f-user-male @elseif (2 == $post->user->gender) f-user-female @endif @if ($post->user->online) f-user-online @endif">
<article id="p{{ $post->id }}" class="f-post f-post-search @if (FORK_GEN_MAN == $post->user->gender) f-user-male @elseif (FORK_GEN_FEM == $post->user->gender) f-user-female @endif @if ($post->user->online) f-user-online @endif">
<header class="f-post-header">
<h3 class="f-phead-h3">
<span class="f-psh-forum"><a href="{{ $post->parent->parent->link }}" title="{{ __('Go to forum') }}">{{ $post->parent->parent->forum_name }}</a></span>