This commit is contained in:
veselcraft 2023-11-13 00:50:25 +03:00
parent 784b19aaf7
commit 6794d6421e
No known key found for this signature in database
GPG key ID: 9CF0B42766CCF7BA
24 changed files with 68 additions and 22 deletions

View file

@ -783,7 +783,29 @@ class User extends RowModel
function isFemale(): bool
{
return (bool) $this->getRecord()->sex;
return (bool) $this->getRecord()->sex == 1;
}
function isNeutral(): bool
{
return (bool) $this->getRecord()->sex == 2;
}
function getLocalizedPronouns(): string
{
switch ($this->getRecord()->sex) {
case 0:
return tr('male');
case 1:
return tr('female');
case 2:
return tr('neutral');
}
}
function getPronouns(): int
{
return $this->getRecord()->sex;
}
function isVerified(): bool

View file

@ -95,7 +95,17 @@ final class AuthPresenter extends OpenVKPresenter
$user = new User;
$user->setFirst_Name($this->postParam("first_name"));
$user->setLast_Name($this->postParam("last_name"));
$user->setSex((int)($this->postParam("sex") === "female"));
switch ($this->postParam("pronouns")) {
case 'male':
$user->setSex(0);
break;
case 'female':
$user->setSex(1);
break;
case 'neutral':
$user->setSex(2);
break;
}
$user->setEmail($this->postParam("email"));
$user->setSince(date("Y-m-d H:i:s"));
$user->setRegistering_Ip(CONNECTING_IP);

View file

@ -170,8 +170,18 @@ final class UserPresenter extends OpenVKPresenter
if ($this->postParam("politViews") <= 9 && $this->postParam("politViews") >= 0)
$user->setPolit_Views($this->postParam("politViews"));
if ($this->postParam("gender") <= 1 && $this->postParam("gender") >= 0)
$user->setSex($this->postParam("gender"));
if ($this->postParam("pronouns") <= 2 && $this->postParam("pronouns") >= 0)
switch ($this->postParam("pronouns")) {
case 'male':
$user->setSex(0);
break;
case 'female':
$user->setSex(1);
break;
case 'neutral':
$user->setSex(2);
break;
}
$user->setAudio_broadcast_enabled($this->checkbox("broadcast_music"));
if(!empty($this->postParam("phone")) && $this->postParam("phone") !== $user->getPhone()) {

View file

@ -91,13 +91,13 @@
</tr>
<tr>
<td class="regform-left">
<span class="nobold">{_gender}: </span>
<span class="nobold">{_pronouns}: </span>
</td>
<td class="regform-right">
{var $femalePreferred = OPENVK_ROOT_CONF["openvk"]["preferences"]["femaleGenderPriority"]}
<select name="sex" required>
<option n:attr="selected => !$femalePreferred" value="male">{_male}</option>
<option n:attr="selected => $femalePreferred" value="female">{_female}</option>
<select name="pronouns" required>
<option value="male">{_male}</option>
<option value="female">{_female}</option>
<option value="neutral">{_neutral}</option>
</select>
</td>
</tr>

View file

@ -139,12 +139,13 @@
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_gender}: </span>
<span class="nobold">{_pronouns}: </span>
</td>
<td>
<select name="gender">
<option value="1" {if $user->isFemale() == true}selected{/if}>{_female}</option>
<option value="0" {if $user->isFemale() == false}selected{/if}>{_male}</option>
<select name="pronouns">
<option value="0" {if $user->getPronouns() == 0}selected{/if}>{_male}</option>
<option value="1" {if $user->getPronouns() == 1}selected{/if}>{_female}</option>
<option value="2" {if $user->getPronouns() == 2}selected{/if}>{_neutral}</option>
</select>
</td>
</tr>

0
locales/README.md Normal file → Executable file
View file

0
locales/by.strings Normal file → Executable file
View file

0
locales/by_lat.strings Normal file → Executable file
View file

0
locales/de.strings Normal file → Executable file
View file

View file

@ -72,9 +72,10 @@
"change_status" = "change status";
"name" = "Name";
"surname" = "Surname";
"gender" = "Sex";
"male" = "male";
"female" = "female";
"pronouns" = "Pronouns";
"male" = "he/him";
"female" = "she/her";
"neutral" = "they/them";
"description" = "Description";
"save" = "Save";
"main_information" = "Main information";

0
locales/eo.strings Normal file → Executable file
View file

0
locales/hy.strings Normal file → Executable file
View file

0
locales/id.strings Normal file → Executable file
View file

0
locales/kk.strings Normal file → Executable file
View file

0
locales/pl.strings Normal file → Executable file
View file

0
locales/qqx.strings Normal file → Executable file
View file

View file

@ -62,9 +62,10 @@
"change_status" = "изменить статус";
"name" = "Имя";
"surname" = "Фамилия";
"gender" = "Пол";
"male" = "мужской";
"female" = "женский";
"pronouns" = "Местоимения";
"male" = "он/его";
"female" = "она/её";
"neutral" = "они/их";
"description" = "Описание";
"save" = "Сохранить";
"main_information" = "Основная информация";

0
locales/ru_old.strings Normal file → Executable file
View file

0
locales/ru_sov.strings Normal file → Executable file
View file

0
locales/sr_cyr.strings Normal file → Executable file
View file

0
locales/sr_lat.strings Normal file → Executable file
View file

0
locales/tr.strings Normal file → Executable file
View file

0
locales/udm.strings Normal file → Executable file
View file

View file

@ -64,9 +64,10 @@
"change_status" = "змінити статус";
"name" = "Ім’я";
"surname" = "Прізвище";
"gender" = "Стать";
"male" = "Чоловіча";
"female" = "Жіноча";
"pronouns" = "Займенники";
"male" = "він/його";
"female" = "вона/її";
"neutral" = "вони/їх";
"description" = "Опис";
"save" = "Зберегти";
"main_information" = "Основна інформація";