From 6794d6421e85e7ca287dd239f8348f3e6fcc36ea Mon Sep 17 00:00:00 2001 From: veselcraft Date: Mon, 13 Nov 2023 00:50:25 +0300 Subject: [PATCH] jff --- Web/Models/Entities/User.php | 24 +++++++++++++++++++++- Web/Presenters/AuthPresenter.php | 12 ++++++++++- Web/Presenters/UserPresenter.php | 14 +++++++++++-- Web/Presenters/templates/Auth/Register.xml | 10 ++++----- Web/Presenters/templates/User/Edit.xml | 9 ++++---- locales/README.md | 0 locales/by.strings | 0 locales/by_lat.strings | 0 locales/de.strings | 0 locales/en.strings | 7 ++++--- locales/eo.strings | 0 locales/hy.strings | 0 locales/id.strings | 0 locales/kk.strings | 0 locales/pl.strings | 0 locales/qqx.strings | 0 locales/ru.strings | 7 ++++--- locales/ru_old.strings | 0 locales/ru_sov.strings | 0 locales/sr_cyr.strings | 0 locales/sr_lat.strings | 0 locales/tr.strings | 0 locales/udm.strings | 0 locales/uk.strings | 7 ++++--- 24 files changed, 68 insertions(+), 22 deletions(-) mode change 100644 => 100755 locales/README.md mode change 100644 => 100755 locales/by.strings mode change 100644 => 100755 locales/by_lat.strings mode change 100644 => 100755 locales/de.strings mode change 100644 => 100755 locales/eo.strings mode change 100644 => 100755 locales/hy.strings mode change 100644 => 100755 locales/id.strings mode change 100644 => 100755 locales/kk.strings mode change 100644 => 100755 locales/pl.strings mode change 100644 => 100755 locales/qqx.strings mode change 100644 => 100755 locales/ru_old.strings mode change 100644 => 100755 locales/ru_sov.strings mode change 100644 => 100755 locales/sr_cyr.strings mode change 100644 => 100755 locales/sr_lat.strings mode change 100644 => 100755 locales/tr.strings mode change 100644 => 100755 locales/udm.strings diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index 40ef7aeff..d2ef6e2c5 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -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 diff --git a/Web/Presenters/AuthPresenter.php b/Web/Presenters/AuthPresenter.php index c6a7f143f..7edcda7c2 100644 --- a/Web/Presenters/AuthPresenter.php +++ b/Web/Presenters/AuthPresenter.php @@ -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); diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 56d5685b8..d0534a0e9 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -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()) { diff --git a/Web/Presenters/templates/Auth/Register.xml b/Web/Presenters/templates/Auth/Register.xml index 238576339..120c0b912 100644 --- a/Web/Presenters/templates/Auth/Register.xml +++ b/Web/Presenters/templates/Auth/Register.xml @@ -91,13 +91,13 @@ - {_gender}: + {_pronouns}: - {var $femalePreferred = OPENVK_ROOT_CONF["openvk"]["preferences"]["femaleGenderPriority"]} - + + + diff --git a/Web/Presenters/templates/User/Edit.xml b/Web/Presenters/templates/User/Edit.xml index 0a28b879c..b6cadf37b 100644 --- a/Web/Presenters/templates/User/Edit.xml +++ b/Web/Presenters/templates/User/Edit.xml @@ -139,12 +139,13 @@ - {_gender}: + {_pronouns}: - + + + diff --git a/locales/README.md b/locales/README.md old mode 100644 new mode 100755 diff --git a/locales/by.strings b/locales/by.strings old mode 100644 new mode 100755 diff --git a/locales/by_lat.strings b/locales/by_lat.strings old mode 100644 new mode 100755 diff --git a/locales/de.strings b/locales/de.strings old mode 100644 new mode 100755 diff --git a/locales/en.strings b/locales/en.strings index 53385ff9b..e24b048d1 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -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"; diff --git a/locales/eo.strings b/locales/eo.strings old mode 100644 new mode 100755 diff --git a/locales/hy.strings b/locales/hy.strings old mode 100644 new mode 100755 diff --git a/locales/id.strings b/locales/id.strings old mode 100644 new mode 100755 diff --git a/locales/kk.strings b/locales/kk.strings old mode 100644 new mode 100755 diff --git a/locales/pl.strings b/locales/pl.strings old mode 100644 new mode 100755 diff --git a/locales/qqx.strings b/locales/qqx.strings old mode 100644 new mode 100755 diff --git a/locales/ru.strings b/locales/ru.strings index 63f404624..0157a1371 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -62,9 +62,10 @@ "change_status" = "изменить статус"; "name" = "Имя"; "surname" = "Фамилия"; -"gender" = "Пол"; -"male" = "мужской"; -"female" = "женский"; +"pronouns" = "Местоимения"; +"male" = "он/его"; +"female" = "она/её"; +"neutral" = "они/их"; "description" = "Описание"; "save" = "Сохранить"; "main_information" = "Основная информация"; diff --git a/locales/ru_old.strings b/locales/ru_old.strings old mode 100644 new mode 100755 diff --git a/locales/ru_sov.strings b/locales/ru_sov.strings old mode 100644 new mode 100755 diff --git a/locales/sr_cyr.strings b/locales/sr_cyr.strings old mode 100644 new mode 100755 diff --git a/locales/sr_lat.strings b/locales/sr_lat.strings old mode 100644 new mode 100755 diff --git a/locales/tr.strings b/locales/tr.strings old mode 100644 new mode 100755 diff --git a/locales/udm.strings b/locales/udm.strings old mode 100644 new mode 100755 diff --git a/locales/uk.strings b/locales/uk.strings index 41e7331db..bfac83220 100644 --- a/locales/uk.strings +++ b/locales/uk.strings @@ -64,9 +64,10 @@ "change_status" = "змінити статус"; "name" = "Ім’я"; "surname" = "Прізвище"; -"gender" = "Стать"; -"male" = "Чоловіча"; -"female" = "Жіноча"; +"pronouns" = "Займенники"; +"male" = "він/його"; +"female" = "вона/її"; +"neutral" = "вони/їх"; "description" = "Опис"; "save" = "Зберегти"; "main_information" = "Основна інформація";