Skip to content

Commit

Permalink
jff
Browse files Browse the repository at this point in the history
  • Loading branch information
veselcraft committed Nov 12, 2023
1 parent 784b19a commit 6794d64
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 22 deletions.
24 changes: 23 additions & 1 deletion Web/Models/Entities/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,29 @@ function getNsfwTolerance(): int

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
Expand Down
12 changes: 11 additions & 1 deletion Web/Presenters/AuthPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,17 @@ function renderRegister(): void
$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);
Expand Down
14 changes: 12 additions & 2 deletions Web/Presenters/UserPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,18 @@ function renderEdit(): void
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()) {
Expand Down
10 changes: 5 additions & 5 deletions Web/Presenters/templates/Auth/Register.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
9 changes: 5 additions & 4 deletions Web/Presenters/templates/User/Edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Empty file modified locales/README.md
100644 → 100755
Empty file.
Empty file modified locales/by.strings
100644 → 100755
Empty file.
Empty file modified locales/by_lat.strings
100644 → 100755
Empty file.
Empty file modified locales/de.strings
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions locales/en.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Empty file modified locales/eo.strings
100644 → 100755
Empty file.
Empty file modified locales/hy.strings
100644 → 100755
Empty file.
Empty file modified locales/id.strings
100644 → 100755
Empty file.
Empty file modified locales/kk.strings
100644 → 100755
Empty file.
Empty file modified locales/pl.strings
100644 → 100755
Empty file.
Empty file modified locales/qqx.strings
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions locales/ru.strings
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@
"change_status" = "изменить статус";
"name" = "Имя";
"surname" = "Фамилия";
"gender" = "Пол";
"male" = "мужской";
"female" = "женский";
"pronouns" = "Местоимения";
"male" = "он/его";
"female" = "она/её";
"neutral" = "они/их";
"description" = "Описание";
"save" = "Сохранить";
"main_information" = "Основная информация";
Expand Down
Empty file modified locales/ru_old.strings
100644 → 100755
Empty file.
Empty file modified locales/ru_sov.strings
100644 → 100755
Empty file.
Empty file modified locales/sr_cyr.strings
100644 → 100755
Empty file.
Empty file modified locales/sr_lat.strings
100644 → 100755
Empty file.
Empty file modified locales/tr.strings
100644 → 100755
Empty file.
Empty file modified locales/udm.strings
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions locales/uk.strings
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@
"change_status" = "змінити статус";
"name" = "Ім’я";
"surname" = "Прізвище";
"gender" = "Стать";
"male" = "Чоловіча";
"female" = "Жіноча";
"pronouns" = "Займенники";
"male" = "він/його";
"female" = "вона/її";
"neutral" = "вони/їх";
"description" = "Опис";
"save" = "Зберегти";
"main_information" = "Основна інформація";
Expand Down

0 comments on commit 6794d64

Please sign in to comment.