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 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 function isVerified(): bool

View file

@ -95,7 +95,17 @@ final class AuthPresenter extends OpenVKPresenter
$user = new User; $user = new User;
$user->setFirst_Name($this->postParam("first_name")); $user->setFirst_Name($this->postParam("first_name"));
$user->setLast_Name($this->postParam("last_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->setEmail($this->postParam("email"));
$user->setSince(date("Y-m-d H:i:s")); $user->setSince(date("Y-m-d H:i:s"));
$user->setRegistering_Ip(CONNECTING_IP); $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) if ($this->postParam("politViews") <= 9 && $this->postParam("politViews") >= 0)
$user->setPolit_Views($this->postParam("politViews")); $user->setPolit_Views($this->postParam("politViews"));
if ($this->postParam("gender") <= 1 && $this->postParam("gender") >= 0) if ($this->postParam("pronouns") <= 2 && $this->postParam("pronouns") >= 0)
$user->setSex($this->postParam("gender")); 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")); $user->setAudio_broadcast_enabled($this->checkbox("broadcast_music"));
if(!empty($this->postParam("phone")) && $this->postParam("phone") !== $user->getPhone()) { if(!empty($this->postParam("phone")) && $this->postParam("phone") !== $user->getPhone()) {

View file

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

View file

@ -139,12 +139,13 @@
</tr> </tr>
<tr> <tr>
<td width="120" valign="top"> <td width="120" valign="top">
<span class="nobold">{_gender}: </span> <span class="nobold">{_pronouns}: </span>
</td> </td>
<td> <td>
<select name="gender"> <select name="pronouns">
<option value="1" {if $user->isFemale() == true}selected{/if}>{_female}</option> <option value="0" {if $user->getPronouns() == 0}selected{/if}>{_male}</option>
<option value="0" {if $user->isFemale() == false}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> </select>
</td> </td>
</tr> </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"; "change_status" = "change status";
"name" = "Name"; "name" = "Name";
"surname" = "Surname"; "surname" = "Surname";
"gender" = "Sex"; "pronouns" = "Pronouns";
"male" = "male"; "male" = "he/him";
"female" = "female"; "female" = "she/her";
"neutral" = "they/them";
"description" = "Description"; "description" = "Description";
"save" = "Save"; "save" = "Save";
"main_information" = "Main information"; "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" = "изменить статус"; "change_status" = "изменить статус";
"name" = "Имя"; "name" = "Имя";
"surname" = "Фамилия"; "surname" = "Фамилия";
"gender" = "Пол"; "pronouns" = "Местоимения";
"male" = "мужской"; "male" = "он/его";
"female" = "женский"; "female" = "она/её";
"neutral" = "они/их";
"description" = "Описание"; "description" = "Описание";
"save" = "Сохранить"; "save" = "Сохранить";
"main_information" = "Основная информация"; "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" = "змінити статус"; "change_status" = "змінити статус";
"name" = "Ім’я"; "name" = "Ім’я";
"surname" = "Прізвище"; "surname" = "Прізвище";
"gender" = "Стать"; "pronouns" = "Займенники";
"male" = "Чоловіча"; "male" = "він/його";
"female" = "Жіноча"; "female" = "вона/її";
"neutral" = "вони/їх";
"description" = "Опис"; "description" = "Опис";
"save" = "Зберегти"; "save" = "Зберегти";
"main_information" = "Основна інформація"; "main_information" = "Основна інформація";