diff --git a/assets/js/signup.js b/assets/js/signup.js index f66eac9bf8..15b9cbe6f4 100644 --- a/assets/js/signup.js +++ b/assets/js/signup.js @@ -7,7 +7,7 @@ import 'leaflet/dist/leaflet.css'; import {initializeSingleAutoComplete} from './suggest/locations'; import 'leaflet.fullscreen'; import 'leaflet.fullscreen/Control.FullScreen.css'; -import { default as rangeslider } from 'rangeslider-pure'; +import { default as rangeSlider } from 'rangeslider-pure'; const htmlTag = document.getElementsByTagName('html')[0]; const lang = htmlTag.attributes['lang'].value; @@ -84,7 +84,7 @@ function updateValueOutput(value) { } const initializeSlider = () => { - return rangeslider.create(slider, { + return rangeSlider.create(slider, { onInit: function() { updateValueOutput(0); }, @@ -101,7 +101,7 @@ const hostingInterest = document.getElementById('hosting_interest'); const radioHandler = (event) => { if (event.target.type === 'radio') { console.log("Clicked: ", event.target.type, event.target.checked, event.target.value); - if (event.target.value === 'no') { + if (event.target.value === 'neverask') { hostingInterest.classList.remove('u-block'); hostingInterest.classList.add('u-hidden'); } else { diff --git a/assets/js/signup/setlocation.js b/assets/js/signup/setlocation.js index 7ccdb48a47..1ce8f1eb9f 100644 --- a/assets/js/signup/setlocation.js +++ b/assets/js/signup/setlocation.js @@ -1,3 +1,3 @@ import {initializeSingleAutoComplete} from '../suggest/locations'; -initializeSingleAutoComplete("/suggest/locations/places/exact", 'js-location-picker', '_autocomplete'); +initializeSingleAutoComplete("/suggest/locations/places/exact", 'js-location-picker'); diff --git a/assets/tailwindcss/layouts/_layouts.calendar.css b/assets/tailwindcss/layouts/_layouts.calendar.css new file mode 100644 index 0000000000..e38a4b4ce9 --- /dev/null +++ b/assets/tailwindcss/layouts/_layouts.calendar.css @@ -0,0 +1,552 @@ +@layer components { + .vanilla-calendar { + @apply p-4 rounded-xl opacity-100 transition-opacity relative flex flex-col min-w-[272px] max-w-full h-max w-max box-border + } + + .vanilla-calendar_multiple { + @apply w-[550px] + } + + .vanilla-calendar button:focus-visible { + @apply outline outline-1 rounded-lg + } + + .vanilla-calendar.vanilla-calendar_multiple .vanilla-calendar-days { + @apply grow-0 + } + + .vanilla-calendar_hidden { + @apply opacity-0 pointer-events-none + } + + .vanilla-calendar_to-input { + @apply absolute left-0 bottom-0 mt-1 + } + + .vanilla-calendar-controls { + @apply absolute z-20 left-0 right-0 top-0 flex justify-between items-center pt-5 px-4 pointer-events-none box-content + } + + .vanilla-calendar-arrow { + @apply relative pointer-events-auto block w-6 h-6 cursor-pointer border-0 bg-transparent before:content-[''] before:absolute before:left-0 before:right-0 before:top-0 before:bottom-0 before:mask-image-arrow before:mask-center before:mask-no-repeat before:bg-current + } + + .vanilla-calendar-arrow.vanilla-calendar-arrow_prev::before { + transform: rotateZ(90deg); + } + + .vanilla-calendar-arrow.vanilla-calendar-arrow_next::before { + transform: rotateZ(-90deg); + } + + .vanilla-calendar-grid { + @apply grid grid-cols-[repeat(auto-fill,_minmax(220px, _1fr))] gap-7 grow + } + + .vanilla-calendar-grid.vanilla-calendar-grid_disabled .vanilla-calendar-column { + @apply opacity-30 pointer-events-none + } + + .vanilla-calendar-grid.vanilla-calendar-grid_disabled .vanilla-calendar-column.vanilla-calendar-column_month, + .vanilla-calendar-grid.vanilla-calendar-grid_disabled .vanilla-calendar-column.vanilla-calendar-column_year { + @apply opacity-100 pointer-events-auto + } + + .vanilla-calendar-column { + @apply min-w-min flex flex-col + } + + .vanilla-calendar-header { + @apply relative flex items-center mb-3 + } + + .vanilla-calendar-header__content { + @apply grid grid-flow-col auto-cols-max items-center justify-center px-4 whitespace-pre-wrap grow + } + + .vanilla-calendar-month, + .vanilla-calendar-year { + @apply text-base font-bold cursor-pointer rounded p-1 border-0 bg-transparent + } + + .vanilla-calendar-month.vanilla-calendar-month_disabled, + .vanilla-calendar-year.vanilla-calendar-year_disabled { + @apply pointer-events-none + } + + .vanilla-calendar-months { + @apply grid gap-y-4 gap-x-2 grid-cols-4 items-center grow + } + + .vanilla-calendar-years { + @apply grid gap-y-4 gap-x-2 grid-cols-5 items-center grow + } + + .vanilla-calendar-months_selecting .vanilla-calendar-months__month, + .vanilla-calendar-years_selecting .vanilla-calendar-years__year { + @apply cursor-pointer + } + + .vanilla-calendar-months_selecting .vanilla-calendar-months__month .vanilla-calendar-months__month_disabled, + .vanilla-calendar-years_selecting .vanilla-calendar-years__year .vanilla-calendar-years__year_disabled { + @apply cursor-default + } + + .vanilla-calendar-months__month, + .vanilla-calendar-years__year { + @apply flex items-center justify-center h-10 text-center text-xs font-semibold p-1 rounded-lg border-0 break-all + } + + .vanilla-calendar-months__month.vanilla-calendar-months__month_disabled, + .vanilla-calendar-years__year.vanilla-calendar-years__year_disabled { + @apply pointer-events-none + } + + .vanilla-calendar-week-numbers { + @apply flex flex-col + } + + .vanilla-calendar-week-numbers__title { + @apply text-xs font-bold flex items-center justify-center mb-2 + } + + .vanilla-calendar-week-numbers__content { + @apply grid grid-flow-row items-center justify-items-center gap-y-1 + } + + .vanilla-calendar-week-number { + @apply text-xs font-semibold w-full h-full min-h-[1.875rem] min-w-[1.875rem] flex items-center justify-center cursor-pointer bg-transparent border-none p-0 m-0 + } + + .vanilla-calendar-wrapper { + @apply flex grow + } + + .vanilla-calendar-content { + @apply flex flex-col grow + } + + .vanilla-calendar-week { + @apply grid grid-cols-[repeat(7, _1fr)] justify-items-center mb-2 + } + + .vanilla-calendar-week__day { + @apply text-xs font-bold w-full h-full min-w-[1.875rem] flex items-center justify-center + } + + .vanilla-calendar-days { + @apply grid grid-cols-[repeat(7, _1fr)] gap-y-1 justify-items-center items-center grow + } + + .vanilla-calendar-days_selecting .vanilla-calendar-day__btn { + @apply cursor-pointer transition-all duration-75 + } + + .vanilla-calendar-days_selecting .vanilla-calendar-day__btn_disabled { + @apply cursor-default + } + + .vanilla-calendar-day { + @apply relative w-full h-full flex items-center justify-center + } + + .vanilla-calendar-day_hover-intermediate .vanilla-calendar-day__btn { + @apply rounded-none + } + + .vanilla-calendar-day_hover-first .vanilla-calendar-day__btn { + @apply rounded-tr-none rounded-br-none rounded-tl-lg rounded-bl-lg + } + + .vanilla-calendar-day_hover-last .vanilla-calendar-day__btn { + @apply rounded-tl-none rounded-bl-none rounded-tr-lg rounded-br-lg + } + + .vanilla-calendar-day_hover-first.vanilla-calendar-day_hover-last .vanilla-calendar-day__btn { + @apply rounded-lg + } + + .vanilla-calendar-day:focus-visible .vanilla-calendar-day__popup, + .vanilla-calendar-day:hover .vanilla-calendar-day__popup { + @apply opacity-100 pointer-events-auto + } + + .vanilla-calendar-day_selected-first .vanilla-calendar-day__btn_selected { + @apply rounded-tr-none rounded-br-none rounded-tl-lg rounded-bl-lg + } + + .vanilla-calendar-day_selected-last .vanilla-calendar-day__btn_selected { + @apply rounded-tl-none rounded-bl-none rounded-tr-lg rounded-br-lg + } + + .vanilla-calendar-day_selected-first.vanilla-calendar-day_selected-last .vanilla-calendar-day__btn_selected { + @apply rounded-tl-lg rounded-bl-lg rounded-tr-lg rounded-br-lg + } + + .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_selected { + @apply rounded-none + } + + .vanilla-calendar-day__btn { + @apply text-xs font-normal w-full h-full min-h-[1.875rem] min-w-[1.875rem] flex items-center justify-center rounded-lg border-0 p-0 cursor-default + } + + .vanilla-calendar-day__btn_today { + @apply font-bold + } + + .vanilla-calendar-day__btn_disabled { + @apply pointer-events-none + } + + .vanilla-calendar-day__popup { + transform: translateX(-50%); + @apply absolute z-20 left-1/2 top-full w-32 pt-4 pb-2 px-3 text-xs font-normal opacity-0 pointer-events-none hover:opacity-100 hover:pointer-events-auto before:absolute after:absolute + } + + .vanilla-calendar-day__popup::before { + content: ''; + @apply -z-10 left-0 bottom-0 w-full h-[calc(100%_-_8px)] block rounded-lg + } + + .vanilla-calendar-day__popup::after { + content: ''; + transform: translateX(-50%); + @apply -z-10 left-1/2 top-[1px] block h-0 w-0 border-t-0 border-x-8 border-b-8 border-solid border-t-transparent border-x-transparent + } + + .vanilla-calendar-time { + @apply grid grid-cols-[auto_1fr] gap-3 border-solid border-t border-b-0 border-l-0 border-r-0 pt-3 mt-3 + } + + .vanilla-calendar-time__content { + @apply grid grid-flow-col items-center + } + + .vanilla-calendar-time__hours { + @apply relative w-7 mr-[0.35rem] after:content-[':'] after:block after:absolute after:-right-[5px] after:top-1/2 after:mt-[calc(-50%_+_1px)] + } + + .vanilla-calendar-time__minutes { + @apply w-7 + } + + .vanilla-calendar-time__hours input, + .vanilla-calendar-time__minutes input { + @apply box-border relative block text-lg leading-[1.125rem] font-semibold text-center w-full p-[0.125rem] m-0 border-0 rounded disabled:cursor-default disabled:hover:bg-transparent focus-visible:outline-1 focus-visible:outline + } + + .vanilla-calendar-time__keeping { + @apply ml-[1px] cursor-pointer text-[11px] w-[22px] rounded mt-1 disabled:cursor-default disabled:hover:bg-transparent focus-visible:outline-1 focus-visible:outline bg-transparent border-0 p-0 + } + + .vanilla-calendar-time__ranges { + @apply grid grid-flow-row + } + + .vanilla-calendar-time__range { + @apply text-[0] relative z-10 before:left-0 after:right-0 + } + + .vanilla-calendar-time__range::before, + .vanilla-calendar-time__range::after { + content: ''; + transform: translateY(-50%); + @apply w-[1px] h-2 absolute z-10 pointer-events-none top-1/2 + } + + .vanilla-calendar-time__range input { + @apply w-full relative appearance-none h-5 cursor-pointer m-0 outline-0 + } + + .vanilla-calendar-time__range input::-webkit-slider-thumb { + @apply appearance-none -mt-2 relative z-20 box-border border border-solid h-4 w-3 shadow-none rounded cursor-pointer + } + + .vanilla-calendar-time__range input::-moz-range-thumb { + @apply relative z-20 box-border border border-solid h-4 w-3 shadow-none rounded cursor-pointer + } + + .vanilla-calendar-time__range input::-webkit-slider-runnable-track { + @apply box-border w-full h-[1px] mt-[1px] cursor-pointer shadow-none + } + + .vanilla-calendar-time__range input::-moz-range-track { + @apply box-border w-full h-[1px] mt-[1px] cursor-pointer shadow-none + } + + [data-calendar-theme="light"].vanilla-calendar { + @apply bg-white text-slate-900 + } + + [data-calendar-theme="light"].vanilla-calendar button:focus-visible { + @apply outline-orange-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-arrow { + @apply bg-transparent + } + + [data-calendar-theme="light"] .vanilla-calendar-arrow::before { + @apply bg-slate-900; + } + + [data-calendar-theme="light"] .vanilla-calendar-arrow:hover::before { + @apply bg-slate-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-header__content { + @apply text-slate-900 + } + + [data-calendar-theme="light"] .vanilla-calendar-month, + [data-calendar-theme="light"] .vanilla-calendar-year { + @apply text-slate-900 hover:text-slate-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-month.vanilla-calendar-month_not-active, + [data-calendar-theme="light"] .vanilla-calendar-year.vanilla-calendar-year_not-active { + @apply text-slate-400 + } + + [data-calendar-theme="light"] .vanilla-calendar-month.vanilla-calendar-month_disabled, + [data-calendar-theme="light"] .vanilla-calendar-year.vanilla-calendar-year_disabled { + @apply text-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-months__month { + @apply bg-white text-slate-500 hover:bg-slate-100 + } + + [data-calendar-theme="light"] .vanilla-calendar-months__month.vanilla-calendar-months__month_selected { + @apply bg-cyan-500 text-white hover:bg-cyan-500 hover:text-white + } + + [data-calendar-theme="light"] .vanilla-calendar-months__month.vanilla-calendar-months__month_disabled { + @apply text-slate-300 hover:text-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-years__year { + @apply bg-white text-slate-500 hover:bg-slate-100 + } + + [data-calendar-theme="light"] .vanilla-calendar-years__year.vanilla-calendar-years__year_selected { + @apply bg-cyan-500 text-white hover:bg-cyan-500 hover:text-white + } + + [data-calendar-theme="light"] .vanilla-calendar-years__year.vanilla-calendar-years__year_disabled { + @apply text-slate-300 hover:text-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-week-numbers__title { + @apply text-slate-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-week-number { + @apply text-slate-500 hover:text-slate-600 + } + + [data-calendar-theme="light"] .vanilla-calendar-week__day { + @apply text-slate-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-week__day_weekend { + @apply text-rose-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_selected, + [data-calendar-theme="light"] .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_selected { + @apply bg-rose-500 bg-opacity-70 text-white hover:bg-rose-500 hover:bg-opacity-70 hover:text-white + } + + [data-calendar-theme="light"] .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_selected, + [data-calendar-theme="light"] .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_selected, + [data-calendar-theme="light"] .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_selected, + [data-calendar-theme="light"] .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_selected { + @apply bg-slate-200 text-slate-500 hover:bg-slate-200 hover:text-slate-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_selected { + @apply bg-cyan-500 bg-opacity-70 text-white hover:bg-cyan-500 hover:bg-opacity-70 hover:text-white + } + + [data-calendar-theme="light"] .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_selected.vanilla-calendar-day__btn_prev, + [data-calendar-theme="light"] .vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_selected.vanilla-calendar-day__btn_next { + @apply bg-slate-200 text-slate-500 hover:bg-slate-200 hover:text-slate-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn { + @apply text-slate-900 bg-white hover:bg-slate-100 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_today { + @apply text-cyan-500 hover:text-cyan-500 bg-slate-100 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_today.vanilla-calendar-day__btn_prev, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_today.vanilla-calendar-day__btn_next { + @apply text-slate-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_prev, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_next { + @apply text-slate-400 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_disabled { + @apply text-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_hover { + @apply bg-slate-100 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday { + @apply text-rose-500 hover:bg-rose-50 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_hover, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_hover { + @apply bg-rose-50 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_disabled, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_disabled { + @apply text-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_today, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_today { + @apply text-rose-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_today.vanilla-calendar-day__btn_disabled, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_today.vanilla-calendar-day__btn_disabled { + @apply text-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_prev, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_prev, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_next, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_next { + @apply bg-white text-slate-400 hover:bg-slate-100 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_hover, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_hover, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_hover, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_hover { + @apply bg-slate-100 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_today, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_today, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_today, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_today { + @apply text-slate-400 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_disabled, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_disabled, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_disabled, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_disabled { + @apply text-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_selected, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_selected { + @apply bg-rose-500 text-white hover:bg-rose-500 hover:text-white + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_selected, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_prev.vanilla-calendar-day__btn_selected, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_weekend.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_selected, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_holiday.vanilla-calendar-day__btn_next.vanilla-calendar-day__btn_selected { + @apply bg-slate-300 text-slate-500 hover:bg-slate-300 hover:text-slate-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_selected { + @apply bg-cyan-500 text-white hover:bg-cyan-500 hover:text-white + } + + [data-calendar-theme="light"] .vanilla-calendar-day__btn_selected.vanilla-calendar-day__btn_prev, + [data-calendar-theme="light"] .vanilla-calendar-day__btn_selected.vanilla-calendar-day__btn_next { + @apply bg-slate-300 text-slate-500 hover:bg-slate-300 hover:text-slate-500 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__popup { + @apply text-slate-900 + } + + [data-calendar-theme="light"] .vanilla-calendar-day__popup::before { + @apply bg-white shadow-[0_3px_15px_rgba(85, _85, _85, _0.2)] + } + + [data-calendar-theme="light"] .vanilla-calendar-day__popup::after { + @apply border-b-white + } + + [data-calendar-theme="light"] .vanilla-calendar-time { + @apply border-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__hours { + @apply after:text-slate-900 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__hours input, + [data-calendar-theme="light"] .vanilla-calendar-time__minutes input { + @apply text-slate-900 bg-white hover:bg-orange-100 focus-visible:outline-orange-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__hours input.vanilla-calendar-is-focus, + [data-calendar-theme="light"] .vanilla-calendar-time__minutes input.vanilla-calendar-is-focus { + @apply bg-orange-100 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__keeping { + @apply text-slate-500 hover:bg-orange-100 focus-visible:outline-orange-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range input { + @apply bg-white + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range::before, + [data-calendar-theme="light"] .vanilla-calendar-time__range::after { + @apply bg-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range:hover input::-webkit-slider-thumb { + @apply border-slate-400 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range:hover input::-moz-range-thumb { + @apply border-slate-400 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range input:focus-visible::-webkit-slider-thumb { + @apply border-orange-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range input:focus-visible::-moz-range-thumb { + @apply border-orange-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range input::-webkit-slider-thumb { + @apply border-slate-300 bg-white + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range input::-moz-range-thumb { + @apply border-slate-300 bg-white + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range input::-webkit-slider-runnable-track { + @apply bg-slate-300 + } + + [data-calendar-theme="light"] .vanilla-calendar-time__range input::-moz-range-track { + @apply bg-slate-300 + } +} diff --git a/build/forums/forums.ctrl.php b/build/forums/forums.ctrl.php index e89d417021..900ef5f5da 100644 --- a/build/forums/forums.ctrl.php +++ b/build/forums/forums.ctrl.php @@ -189,7 +189,7 @@ public function index($subforum = false) { else if ($this->action == self::ACTION_VIEW_FORUM) { $groupsCallback = false; $member = $this->_model->getLoggedInMember(); - if ($member && $member->Status != 'ChoiceInactive') { + if ($member && !($member->Status == 'ChoiceInactive' || $member->Status == 'Activated')) { $noForumNewTopicButton = false; } else { // Don't offer the new topic button to 'silent' members @@ -646,7 +646,7 @@ public function showExternalLatest($showGroups = false) { $request = $this->request; $member = $this->_model->getLoggedInMember(); $showForumNewTopicButton = true; - if ($member->Status == 'ChoiceInactive') { + if ($member->Status == 'ChoiceInactive' || $member->Status == 'Activated') { $showForumNewTopicButton = false; } $this->parseRequest(); diff --git a/build/members/member.entity.php b/build/members/member.entity.php index 5939581e38..bf30fd5314 100644 --- a/build/members/member.entity.php +++ b/build/members/member.entity.php @@ -384,7 +384,10 @@ public function get_phone() { } public function get_homephonenumber() { - return $this->get_crypted($this->HomePhoneNumber, ""); + if (isset($this->HomePhoneNumber)) { + return $this->get_crypted($this->HomePhoneNumber, ""); + } + return ""; } /** diff --git a/build/search/search.model.php b/build/search/search.model.php index 49b411bb86..82b46d3bab 100644 --- a/build/search/search.model.php +++ b/build/search/search.model.php @@ -102,11 +102,11 @@ private function getOrderBy($orderBy, $direction) switch ($orderType) { case self::ORDER_ACCOM: $order .= ', (IF(mp.photoCount IS NULL, 0, 1) + IF(m.ProfileSummary != 0, 2, 0)) ASC' - . ', hosting_interest ASC, LastLogin DESC, Distance ASC'; + . ', hosting_interest ASC, LastLogin ASC, Distance ASC'; break; case self::ORDER_COMMENTS: $order .= ', (IF(mp.photoCount IS NULL, 0, 1) + IF(m.ProfileSummary != 0, 2, 0)) ASC, ' - . 'LastLogin DESC, Distance ASC'; + . 'LastLogin ASC, Distance ASC'; break; case self::ORDER_DISTANCE: $order .= ', hosting_interest DESC, LastLogin DESC'; diff --git a/fixtures/members.yml b/fixtures/members.yml index da358c0385..32d441bc54 100644 --- a/fixtures/members.yml +++ b/fixtures/members.yml @@ -3,21 +3,13 @@ App\Entity\Member: Username: 'bwadmin' BirthDate: email: - created: - updated: LastLogin: LastSwitchToActive: null - ExUserId: 0 Status: 'Active' - ChangedId: 0 city: '@NewBerlin' Latitude: '@NewBerlin->Latitude' Longitude: '@Berlin->Longitude' remindersWithoutLogin: 0 - HomePhoneNumber: 0 - CellPhoneNumber: 0 - WorkPhoneNumber: 0 - SecEmail: 0 HideAttribute: 8 FirstName: 'BW' SecondName: '' @@ -25,74 +17,40 @@ App\Entity\Member: Accommodation: 'neverask' AdditionalAccommodationInfo: 0 ILiveWith: 0 - IdentityCheckLevel: 0 - InformationToGuest: 0 - TypicOffer: null + TypicalOffer: '' Offer: 0 MaxGuest: 1 - MaxLenghtOfStay: 0 + MaxLengthOfStay: 0 Organizations: 0 Restrictions: 0 OtherRestrictions: 0 - Bday: 1 - Bmonth: 1 - Byear: 1970 - SecurityFlag: 0 - Quality: 0 ProfileSummary: 0 Occupation: 0 - CounterGuests: 0 - CounterHosts: 0 - CounterTrusts: 0 Gender: 'other' - HideGender: - GenderOfGuest: '' - MotivationForHospitality: 0 - HideBirthDate: - AdressHidden: - WebSite: 0 - ChatSkype: 0 - ChatICQ: 0 - ChatAOL: 0 - ChatMSN: 0 - ChatYahoo: 0 - ChatOthers: 0 - FutureTrips: 0 - OldTrips: 0 - LogCount: 0 + ShowGender: + ShowAge: Hobbies: 0 Books: 0 Music: 0 - PastTrips: 0 Password: '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' - PlannedTrips: 0 PleaseBring: 0 OfferGuests: 0 OfferHosts: 0 PublicTransport: 0 Movies: 0 - ChatGoogle: 0 bewelcomed: 0 registration_key: '' member_{1..5}: Username: 'member-' - BirthDate: + BirthDate: email: 'member-\@bewelcome.org' - created: - updated: - LastLogin: + LastLogin: LastSwitchToActive: null - ExUserId: 0 Status: '' - ChangedId: 0 city: '@NewBerlin' Latitude: '@NewBerlin->Latitude' Longitude: '@NewBerlin->Longitude' remindersWithoutLogin: 0 - HomePhoneNumber: 0 - CellPhoneNumber: 0 - WorkPhoneNumber: 0 - SecEmail: 0 HideAttribute: 8 FirstName: SecondName: '70%? ' @@ -100,75 +58,40 @@ App\Entity\Member: Accommodation: '' hostingInterest: '' AdditionalAccommodationInfo: 0 - ILiveWith: 0 - IdentityCheckLevel: 0 - InformationToGuest: 0 - TypicOffer: null + TypicalOffer: '' Offer: 0 MaxGuest: 1 - MaxLenghtOfStay: 2 + MaxLengthOfStay: 2 Organizations: 0 Restrictions: 0 OtherRestrictions: 0 - Bday: 1 - Bmonth: 1 - Byear: 1980 - SecurityFlag: 0 - Quality: 0 ProfileSummary: 1 Occupation: 1 - CounterGuests: 0 - CounterHosts: 0 - CounterTrusts: 0 Gender: 'female' - HideGender: - GenderOfGuest: 'male' - MotivationForHospitality: 0 - HideBirthDate: - AdressHidden: - WebSite: 1 - ChatSkype: 1 - ChatICQ: 1 - ChatAOL: 1 - ChatMSN: 0 - ChatYahoo: 0 - ChatOthers: 0 - FutureTrips: 1 - OldTrips: 1 - LogCount: 0 - Hobbies: 0 - Books: 0 - Music: 0 - PastTrips: 0 + ShowGender: + ShowAge: + Hobbies: 1 + Books: 1 + Music: 1 Password: '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' - PlannedTrips: 0 PleaseBring: 0 OfferGuests: 0 OfferHosts: 0 PublicTransport: 0 Movies: 0 - ChatGoogle: 0 bewelcomed: 0 registration_key: '' member_{6..10}: Username: 'member-' - BirthDate: + BirthDate: email: 'member-\@bewelcome.org' - created: - updated: - LastLogin: + LastLogin: LastSwitchToActive: null - ExUserId: 0 Status: 'Active' - ChangedId: 0 city: '@NewJayapura' Latitude: '@NewJayapura->Latitude' Longitude: '@NewJayapura->Longitude' remindersWithoutLogin: 0 - HomePhoneNumber: 0 - CellPhoneNumber: 0 - WorkPhoneNumber: 0 - SecEmail: 0 HideAttribute: 8 FirstName: SecondName: '70%? ' @@ -176,74 +99,41 @@ App\Entity\Member: Accommodation: '' AdditionalAccommodationInfo: 0 ILiveWith: 0 - IdentityCheckLevel: 0 - InformationToGuest: 0 - TypicOffer: null + TypicalOffer: '' Offer: 0 MaxGuest: 1 - MaxLenghtOfStay: 2 + MaxLengthOfStay: 2 Organizations: 0 Restrictions: 0 OtherRestrictions: 0 - Bday: 1 - Bmonth: 1 - Byear: 1980 - SecurityFlag: 0 - Quality: 0 ProfileSummary: 0 Occupation: 0 - CounterGuests: 0 - CounterHosts: 0 - CounterTrusts: 0 Gender: 'male' - HideGender: - GenderOfGuest: 'female' - MotivationForHospitality: 0 - HideBirthDate: + ShowGender: + ShowAge: AdressHidden: - WebSite: 0 - ChatSkype: 0 - ChatICQ: 0 - ChatAOL: 0 - ChatMSN: 0 - ChatYahoo: 0 - ChatOthers: 0 - FutureTrips: 0 - OldTrips: 0 - LogCount: 0 Hobbies: 0 Books: 0 Music: 0 - PastTrips: 0 Password: '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' - PlannedTrips: 0 PleaseBring: 0 OfferGuests: 0 OfferHosts: 0 PublicTransport: 0 Movies: 0 - ChatGoogle: 0 bewelcomed: 0 registration_key: '' member_banned: Username: 'member-banned' - BirthDate: + BirthDate: email: 'member-banned\@bewelcome.org' - created: - updated: - LastLogin: + LastLogin: LastSwitchToActive: null - ExUserId: 0 Status: 'Banned' - ChangedId: 0 city: '@NewJayapura' Latitude: '@NewJayapura->Latitude' Longitude: '@NewJayapura->Longitude' remindersWithoutLogin: 0 - HomePhoneNumber: 0 - CellPhoneNumber: 0 - WorkPhoneNumber: 0 - SecEmail: 0 HideAttribute: 8 FirstName: SecondName: '70%? ' @@ -251,74 +141,41 @@ App\Entity\Member: Accommodation: '' AdditionalAccommodationInfo: 0 ILiveWith: 0 - IdentityCheckLevel: 0 - InformationToGuest: 0 - TypicOffer: null + TypicalOffer: '' Offer: 0 MaxGuest: 1 - MaxLenghtOfStay: 2 + MaxLengthOfStay: 2 Organizations: 0 Restrictions: 0 OtherRestrictions: 0 - Bday: 1 - Bmonth: 1 - Byear: 1980 - SecurityFlag: 0 - Quality: 0 ProfileSummary: 0 Occupation: 0 - CounterGuests: 0 - CounterHosts: 0 - CounterTrusts: 0 Gender: 'male' - HideGender: - GenderOfGuest: 'female' - MotivationForHospitality: 0 - HideBirthDate: + ShowGender: + ShowAge: AdressHidden: - WebSite: 0 - ChatSkype: 0 - ChatICQ: 0 - ChatAOL: 0 - ChatMSN: 0 - ChatYahoo: 0 - ChatOthers: 0 - FutureTrips: 0 - OldTrips: 0 - LogCount: 0 Hobbies: 0 Books: 0 Music: 0 - PastTrips: 0 Password: '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' - PlannedTrips: 0 PleaseBring: 0 OfferGuests: 0 OfferHosts: 0 PublicTransport: 0 Movies: 0 - ChatGoogle: 0 bewelcomed: 0 registration_key: '' member_suspended: Username: 'member-suspended' - BirthDate: + BirthDate: email: 'member-suspended\@bewelcome.org' - created: - updated: - LastLogin: + LastLogin: LastSwitchToActive: null - ExUserId: 0 Status: 'TakenOut' - ChangedId: 0 city: '@NewJayapura' Latitude: '@Jayapura->Latitude' Longitude: '@Jayapura->Longitude' remindersWithoutLogin: 0 - HomePhoneNumber: 0 - CellPhoneNumber: 0 - WorkPhoneNumber: 0 - SecEmail: 0 HideAttribute: 8 FirstName: SecondName: '70%? ' @@ -326,52 +183,27 @@ App\Entity\Member: Accommodation: '' AdditionalAccommodationInfo: 0 ILiveWith: 0 - IdentityCheckLevel: 0 - InformationToGuest: 0 - TypicOffer: null + TypicalOffer: '' Offer: 0 MaxGuest: 1 - MaxLenghtOfStay: 2 + MaxLengthOfStay: 2 Organizations: 0 Restrictions: 0 OtherRestrictions: 0 - Bday: 1 - Bmonth: 1 - Byear: 1980 - SecurityFlag: 0 - Quality: 0 ProfileSummary: 0 Occupation: 0 - CounterGuests: 0 - CounterHosts: 0 - CounterTrusts: 0 Gender: 'male' - HideGender: - GenderOfGuest: 'female' - MotivationForHospitality: 0 - HideBirthDate: + ShowGender: + ShowAge: AdressHidden: - WebSite: 0 - ChatSkype: 0 - ChatICQ: 0 - ChatAOL: 0 - ChatMSN: 0 - ChatYahoo: 0 - ChatOthers: 0 - FutureTrips: 0 - OldTrips: 0 - LogCount: 0 Hobbies: 0 Books: 0 Music: 0 - PastTrips: 0 Password: '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' - PlannedTrips: 0 PleaseBring: 0 OfferGuests: 0 OfferHosts: 0 PublicTransport: 0 Movies: 0 - ChatGoogle: 0 bewelcomed: 0 registration_key: '' diff --git a/fixtures/preferences.yml b/fixtures/preferences.yml index e3274c913d..b081402669 100644 --- a/fixtures/preferences.yml +++ b/fixtures/preferences.yml @@ -199,7 +199,7 @@ App\Entity\Preference: Status: 'Normal' ALLOW_REQUEST_NO_PICTURE: position: 63 - codename: 'AllowContactWithNoPicture' + codename: 'AllowContactWithoutPicture' codeDescription: 'contact.allow.no.picture' description: 'Allow to be contacted by members without a picture' created: @@ -207,7 +207,7 @@ App\Entity\Preference: PossibleValues: No,Yes ALLOW_REQUEST_NO_ABOUT_ME: position: 64 - codename: 'AllowContactWithNoAboutMe' + codename: 'AllowContactWithoutAboutMe' codeDescription: 'contact.allow.no.about_me' description: 'Allow to be contacted by members without an about me section' created: diff --git a/modules/i18n/lib/words.lib.php b/modules/i18n/lib/words.lib.php index 8a689f0746..2eae6608cf 100644 --- a/modules/i18n/lib/words.lib.php +++ b/modules/i18n/lib/words.lib.php @@ -227,8 +227,14 @@ public function getFormatted($code) $word = $this->_lookup($code, $args); $translation = $this->_text_with_tr($word); - if (($translation == $code) && (!empty($args))) { - $translation .= " [" . implode($args, ",") . "]"; + if ($translation == $code) { + if (is_array($args)) { + if (!empty($args)) { + $translation .= " [" . implode(",", $args) . "]"; + } + } elseif (is_string($args)) { + $translation .= " [" . $args . "]"; + } } return $translation; } diff --git a/src/Controller/SignupController.php b/src/Controller/SignupController.php index 9a70c35cd3..76e2c1cfb4 100644 --- a/src/Controller/SignupController.php +++ b/src/Controller/SignupController.php @@ -2,31 +2,150 @@ namespace App\Controller; +use App\Doctrine\AccommodationType; +use App\Doctrine\MemberStatusType; use App\Entity\Member; +use App\Entity\MemberPreference; +use App\Entity\Preference; +use App\Form\SignupFormFinalizeType; +use App\Form\SignupFormType; +use App\Model\SignupModel; use App\Repository\MemberRepository; use App\Service\Mailer; +use App\Utilities\TranslatedFlashTrait; use App\Utilities\TranslatorTrait; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\Mapping\Entity; use Exception; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; +use Symfony\Component\Security\Http\Authentication\UserAuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\FormLoginAuthenticator; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge; +use Symfony\Contracts\Translation\TranslatorInterface; class SignupController extends AbstractController { use TranslatorTrait; + use TranslatedFlashTrait; + + private EntityManagerInterface $entityManager; + + public function __construct(EntityManagerInterface $entityManager) + { + $this->entityManager = $entityManager; + } + + /** + * @Route("/signup", name="signup", methods={"GET", "POST"})") + */ + public function signup( + Request $request, + SignupModel $signupModel, + TranslatorInterface $translator, + array $locales + ): Response { + $signupFormData = []; + if ($request->isMethod("POST")) { + $signupFormData['username'] = $request->get("username"); + } + + $signupForm = $this->createForm(SignupFormType::class, $signupFormData); + $signupForm->handleRequest($request); + + if ($signupForm->isSubmitted() && $signupForm->isValid()) { + $signupData = $signupForm->getData(); + if (!$signupModel->checkUsername($signupData['username'])) { + $signupForm->get('username')->addError( + new FormError($translator->trans('signup.username.error.not.unique')) + ); + } + if (!$signupModel->checkEmailAddress($signupData['email'])) { + $signupForm->get('email')->addError(new FormError($translator->trans('signup.email.error.not.unique'))); + } + $errors = $signupForm->getErrors(true); + $errorCount = $errors->count(); + if (0 === $errorCount) { + $locale = $request->getPreferredLanguage($locales); + $member = $signupModel->createAccount($signupData, $locale); + + return $this->redirectToRoute('signup_finalize', [ + 'username' => $member->getUsername(), + ]); + } + } + + return $this->render('signup/first.step.html.twig', [ + 'signup' => $signupForm->createView(), + ]); + } + + /** + * @Route("/signup/{username}/finalize", name="signup_finalize") + */ + public function signupFinalize( + Request $request, + Member $member, + SignupModel $signupModel + ): Response { + /** @var Member $loggedInMember */ + $loggedInMember = $this->getUser(); + + if (null !== $loggedInMember) { + return $this->redirectToRoute('members_profile', ['username' => $loggedInMember->getUsername()]); + } + + if ( + !in_array( + $member->getStatus(), + [MemberStatusType::AWAITING_MAIL_CONFIRMATION, MemberStatusType::MAIL_CONFIRMED] + ) + ) { + $this->addTranslatedFlash('notice', 'signup.activate.revisit'); + + return $this->redirectToRoute('resend_confirmation_email', ['username' => $member->getUsername()]); + } + + $finalizeForm = $this->createForm(SignupFormFinalizeType::class); + $finalizeForm->handleRequest($request); + + if ($finalizeForm->isSubmitted() && $finalizeForm->isValid()) { + if ( + AccommodationType::YES === $finalizeForm->get('accommodation')->getData() + && "0" === $finalizeForm->get('hosting_interest')->getData() + ) { + $finalizeForm + ->get('hosting_interest') + ->addError(new FormError($this->translator->trans('error.hosting.interest'))) + ; + } else { + $signupModel->updateMember($member, $finalizeForm->getData()); + $request->getSession()->set(Security::LAST_USERNAME, $member->getUsername()); + return $this->redirectToRoute('editmyprofile'); + } + } + + if (MemberStatusType::AWAITING_MAIL_CONFIRMATION === $member->getStatus()) { + $this->addTranslatedFlash('notice', 'profile.mail.not.confirmed'); + } + + return $this->render('signup/finalize.html.twig', [ + 'member' => $member, + 'finalize' => $finalizeForm->createView(), + ]); + } /** * @Route("/signup/finish", name="signup_finish") - * - * @throws Exception - * - * @return Response */ - public function finishSignup(Request $request, Mailer $mailer) + public function finishSignup(Request $request, Mailer $mailer): Response { $signupVars = $request->getSession()->get('SignupBWVars'); @@ -44,7 +163,7 @@ public function finishSignup(Request $request, Mailer $mailer) } $member->setRegistrationKey($key); - $em = $this->getDoctrine()->getManager(); + $em = $this->entityManager; $em->persist($member); $em->flush(); @@ -74,14 +193,8 @@ public function finishSignup(Request $request, Mailer $mailer) /** * @Route("/signup/resend/{username}", name="resend_confirmation_email") - * - * @param $username - * - * @throws AccessDeniedException - * - * @return Response */ - public function resendConfirmationEmail(Member $member, AuthenticationUtils $helper, Mailer $mailer) + public function resendConfirmationEmail(Member $member, AuthenticationUtils $helper, Mailer $mailer): Response { $username = $member->getUsername(); if ($helper->getLastUsername() !== $username) { @@ -115,40 +228,52 @@ public function resendConfirmationEmail(Member $member, AuthenticationUtils $hel /** * @Route("/signup/confirm/{username}/{registrationKey}", name="signup_confirm") - * - * @param $username - * @param $registrationKey - * - * @return Response */ - public function confirmEmailAddress(Request $request, $username, $registrationKey) + public function confirmEmailAddress(Request $request, string $username, string $registrationKey): Response { - $em = $this->getDoctrine()->getManager(); - /** @var MemberRepository $memberRepository */ - $memberRepository = $em->getRepository(Member::class); - /** @var Member $member */ + $loggedInMember = $this->getUser(); + $memberRepository = $this->entityManager->getRepository(Member::class); $member = $memberRepository->findOneBy(['username' => $username]); if (null === $member) { - $this->addFlash('error', $this->getTranslator()->trans('flash.signup.username.invalid')); + $this->addTranslatedFlash('error', 'flash.signup.username.invalid'); - return $this->redirectToRoute('login'); + return $this->redirectToRoute('security_login'); } + + if (null !== $loggedInMember && $member !== $loggedInMember) { + $this->addTranslatedFlash('error', 'flash.signup.wrong.user'); + + return $this->redirectToRoute('members_profile', ['username' => $username]); + } + if ($registrationKey === $member->getRegistrationKey()) { - // Yeah, successfully confirmed email address - $member - ->setStatus('Active') - ->setRegistrationKey('') - ; - $em->persist($member); - $em->flush(); + // Okay, email address confirmed. Check if account is already activated + if (null === $member->getAccommodation()) { + $member->setStatus(MemberStatusType::MAIL_CONFIRMED); + $this->addTranslatedFlash('notice', 'flash.signup.mail.confirmed'); + } else { + $member->setStatus(MemberStatusType::ACTIVE); + $this->addTranslatedFlash('notice', 'flash.signup.active'); + } + $member->setRegistrationKey(null); - $this->addFlash('notice', $this->getTranslator()->trans('flash.signup.activated')); - $request->getSession()->set(Security::LAST_USERNAME, $username); + $this->entityManager->persist($member); + $this->entityManager->flush(); - return $this->redirect('/login'); + if (null === $member->getAccommodation()) { + return $this->redirectToRoute('signup_finalize', ['username' => $member->getUsername()]); + } + + if (null === $loggedInMember) { + $request->getSession()->set(Security::LAST_USERNAME, $username); + $this->addTranslatedFlash('notice', 'flash.signup.activated'); + } + + return $this->redirectToRoute('editmyprofile'); } - $this->addFlash('error', $this->getTranslator()->trans('flash.signup.key.invalid')); - return $this->redirect('/login'); + $this->addTranslatedFlash('error', 'flash.signup.key.invalid'); + + return $this->redirectToRoute('security_login'); } } diff --git a/src/Doctrine/AccommodationType.php b/src/Doctrine/AccommodationType.php index bcddba3212..f7373261ad 100644 --- a/src/Doctrine/AccommodationType.php +++ b/src/Doctrine/AccommodationType.php @@ -16,5 +16,6 @@ class AccommodationType extends EnumType self::YES, self::MAYBE, self::NO, + null, ]; } diff --git a/src/Doctrine/MemberStatusType.php b/src/Doctrine/MemberStatusType.php index d86055489f..f518af8b29 100644 --- a/src/Doctrine/MemberStatusType.php +++ b/src/Doctrine/MemberStatusType.php @@ -6,12 +6,14 @@ class MemberStatusType extends EnumType { // Possible member statuses public const AWAITING_MAIL_CONFIRMATION = 'MailToConfirm'; + public const MAIL_CONFIRMED = 'MailConfirmed'; public const PENDING = 'Pending'; public const DUPLICATE_SIGNED = 'DuplicateSigned'; public const NEED_MORE = 'NeedMore'; public const REJECTED = 'Rejected'; public const COMPLETED_PENDING = 'CompletedPending'; public const ACTIVE = 'Active'; + public const ACCOUNT_ACTIVATED = 'Activated'; public const TAKEN_OUT = 'TakenOut'; public const BANNED = 'Banned'; public const SLEEPER = 'Sleeper'; @@ -124,5 +126,7 @@ public function getStatuses(): array self::STOP_BORING_ME, self::PASSED_AWAY, self::BUGGY, + self::ACCOUNT_ACTIVATED, + self::MAIL_CONFIRMED, ]; } diff --git a/src/Doctrine/MessageResultSetMapping.php b/src/Doctrine/MessageResultSetMapping.php index 89b1e3e2e5..dfc77c848e 100644 --- a/src/Doctrine/MessageResultSetMapping.php +++ b/src/Doctrine/MessageResultSetMapping.php @@ -20,9 +20,9 @@ public function __construct() $this->addFieldResult('m', 'SpamInfo', 'spamInfo'); $this->addFieldResult('m', 'Status', 'status'); $this->addFieldResult('m', 'InFolder', 'folder'); - $this->addMetaResult('m', 'IdParent', 'idParent'); - $this->addMetaResult('m', 'IdReceiver', 'idReceiver'); - $this->addMetaResult('m', 'IdSender', 'idSender'); + $this->addMetaResult('m', 'idParent', 'idParent'); + $this->addMetaResult('m', 'idReceiver', 'idReceiver'); + $this->addMetaResult('m', 'idSender', 'idSender'); $this->addMetaResult('m', 'initiator_id', 'initiator_id'); $this->addMetaResult('m', 'subject_id', 'subject_id'); $this->addMetaResult('m', 'request_id', 'request_id'); diff --git a/src/Entity/Address.php b/src/Entity/Address.php index 7cbbb0c9a5..3a00831c23 100644 --- a/src/Entity/Address.php +++ b/src/Entity/Address.php @@ -29,187 +29,120 @@ class Address { /** - * @var Member - * * @ORM\ManyToOne(targetEntity="Member", inversedBy="addresses") * @ORM\JoinColumn(name="IdMember", referencedColumnName="id") */ - private $member; + private Member $member; /** - * @var int - * * @ORM\Column(name="HouseNumber", type="integer", nullable=false) * * @Groups({"Member:Read"}) */ - private $houseNumber; + private int $houseNumber; /** - * @var int - * * @ORM\Column(name="StreetName", type="integer", nullable=false) * * @Groups({"Member:Read"}) */ - private $streetName; + private int $streetName; /** - * @var int - * * @ORM\Column(name="Zip", type="integer", nullable=false) * * @Groups({"Member:Read"}) */ - private $zip; + private int $zip; /** - * @var NewLocation - * * @ORM\ManyToOne(targetEntity="NewLocation") * @ORM\JoinColumn(name="IdCity", referencedColumnName="geonameId") * * @Groups({"Member:Read"}) */ - private $location; + private NewLocation $location; + + private float $latitude; + private float $longitude; /** - * @var int - * * @ORM\Column(name="Explanation", type="integer", nullable=false) */ - private $explanation; + private int $explanation; /** - * @var bool * - * @ORM\Column(name="Rank", type="boolean", nullable=false) + * @ORM\Column(name="Rank", type="integer", nullable=false) */ - private $rank = '0'; + private int $rank = 0; /** - * @var DateTime - * * @ORM\Column(name="created", type="datetime", nullable=false) */ - private $created; + private DateTime $created; /** - * @var DateTime - * * @ORM\Column(name="updated", type="datetime", nullable=false) */ - private $updated; + private DateTime $updated; /** - * @var int - * * @ORM\Column(name="IdGettingThere", type="integer", nullable=false) */ - private $gettingThere = '0'; + private int $gettingThere = 0; /** - * @var int - * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ - private $id; + private int $id; - /** - * Set member. - * - * @param Member $idmember - * @param mixed $member - * - * @return Address - */ - public function setMember($member) + public function setMember(Member $member): self { $this->member = $member; return $this; } - /** - * Get idmember. - * - * @return Member - */ - public function getMember() + public function getMember(): Member { return $this->member; } - /** - * Set housenumber. - * - * @param int $houseNumber - * - * @return Address - */ - public function setHouseNumber($houseNumber) + public function setHouseNumber(int $houseNumber): self { $this->houseNumber = $houseNumber; return $this; } - /** - * Get housenumber. - * - * @return int - */ - public function getHouseNumber() + public function getHouseNumber(): int { return $this->houseNumber; } - /** - * Set streetname. - * - * @param int $streetName - * - * @return Address - */ - public function setStreetName($streetName) + public function setStreetName(int $streetName): self { $this->streetName = $streetName; return $this; } - /** - * Get streetname. - * - * @return int - */ - public function getStreetName() + public function getStreetName(): int { return $this->streetName; } - /** - * Set zip. - * - * @param int $zip - * - * @return Address - */ - public function setZip($zip) + public function setZip(int $zip): self { $this->zip = $zip; return $this; } - /** - * Get zip. - * - * @return int - */ - public function getZip() + public function getZip(): int { return $this->zip; } @@ -226,132 +159,88 @@ public function getLocation(): NewLocation return $this->location; } - /** - * Set explanation. - * - * @param int $explanation - * - * @return Address - */ - public function setExplanation($explanation) + + public function getLatitude(): float + { + return $this->latitude; + } + + public function setLatitude(float $latitude): void + { + $this->latitude = $latitude; + } + + public function getLongitude(): float + { + return $this->longitude; + } + + public function setLongitude(float $longitude): void + { + $this->longitude = $longitude; + } + + public function setExplanation(int $explanation): self { $this->explanation = $explanation; return $this; } - /** - * Get explanation. - * - * @return int - */ - public function getExplanation() + public function getExplanation(): int { return $this->explanation; } - /** - * Set rank. - * - * @param bool $rank - * - * @return Address - */ - public function setRank($rank) + public function setRank(int $rank): self { $this->rank = $rank; return $this; } - /** - * Get rank. - * - * @return bool - */ - public function getRank() + public function getRank(): int { return $this->rank; } - /** - * Set created. - * - * @param DateTime $created - * - * @return Address - */ - public function setCreated($created) + public function setCreated(DateTime $created): self { $this->created = $created; return $this; } - /** - * Get created. - * - * @return Carbon - */ - public function getCreated() + public function getCreated(): Carbon { return Carbon::instance($this->created); } - /** - * Set updated. - * - * @param DateTime $updated - * - * @return Address - */ - public function setUpdated($updated) + public function setUpdated(DateTime $updated): self { $this->updated = $updated; return $this; } - /** - * Get updated. - * - * @return Carbon - */ - public function getUpdated() + public function getUpdated(): Carbon { return Carbon::instance($this->updated); } - /** - * Set idgettingthere. - * - * @param int $gettingThere - * - * @return Address - */ - public function setGettingThere($gettingThere) + public function setGettingThere(int $gettingThere): self { $this->gettingThere = $gettingThere; return $this; } - /** - * Get idgettingthere. - * - * @return int - */ - public function getGettingThere() + public function getGettingThere(): int { return $this->gettingThere; } - /** - * Get id. - * - * @return int - */ - public function getId() + public function getId(): int { return $this->id; } diff --git a/src/Entity/Member.php b/src/Entity/Member.php index 29c6ad38df..99f051df2f 100644 --- a/src/Entity/Member.php +++ b/src/Entity/Member.php @@ -15,11 +15,14 @@ use App\Doctrine\GroupMembershipStatusType; use App\Doctrine\LanguageLevelType; use App\Doctrine\MemberStatusType; +use App\Doctrine\TypicalOfferType; use Carbon\Carbon; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\Event\PostLoadEventArgs; use Doctrine\ORM\Mapping as ORM; use Doctrine\Persistence\Mapping\ClassMetadata; use Doctrine\Persistence\ObjectManager; @@ -51,45 +54,29 @@ class Member implements \Serializable, - ObjectManagerAware, UserInterface, PasswordHasherAwareInterface, PasswordAuthenticatedUserInterface { - public const USERNAME_REGEXP = '(?i:[a-z](?!.*[-_.][-_.])[a-z0-9-._]{2,18}[a-z0-9])'; - public const ROLE_ADMIN_ACCEPTER = 'ROLE_ADMIN_ACCEPTER'; public const ROLE_ADMIN_ADMIN = 'ROLE_ADMIN_ADMIN'; - public const ROLE_ADMIN_BETA = 'ROLE_ADMIN_BETA'; - public const ROLE_ADMIN_CHAT = 'ROLE_ADMIN_CHAT'; public const ROLE_ADMIN_CHECKER = 'ROLE_ADMIN_CHECKER'; public const ROLE_ADMIN_COMMENTS = 'ROLE_ADMIN_COMMENTS'; public const ROLE_ADMIN_COMMUNITYNEWS = 'ROLE_ADMIN_COMMUNITYNEWS'; - public const ROLE_ADMIN_CONTACTLOCATION = 'ROLE_ADMIN_CONTACTLOCATION'; - public const ROLE_ADMIN_CRYPTATION = 'ROLE_ADMIN_CRYPTATION'; - public const ROLE_ADMIN_DEBUG = 'ROLE_ADMIN_DEBUG'; public const ROLE_ADMIN_FAQ = 'ROLE_ADMIN_FAQ'; public const ROLE_ADMIN_FLAGS = 'ROLE_ADMIN_FLAGS'; public const ROLE_ADMIN_FORUMMODERATOR = 'ROLE_ADMIN_FORUMMODERATOR'; - public const ROLE_ADMIN_GREP = 'ROLE_ADMIN_GREP'; public const ROLE_ADMIN_GROUP = 'ROLE_ADMIN_GROUP'; public const ROLE_ADMIN_LOGS = 'ROLE_ADMIN_LOGS'; public const ROLE_ADMIN_MANAGESUBSCRIPTIONS = 'ROLE_ADMIN_MANAGESUBSCRIPTIONS'; - public const ROLE_ADMIN_MASSCONTACT = 'ROLE_ADMIN_MASSCONTACT'; public const ROLE_ADMIN_MASSMAIL = 'ROLE_ADMIN_MASSMAIL'; public const ROLE_ADMIN_NEWMEMBERSBEWELCOME = 'ROLE_ADMIN_NEWMEMBERSBEWELCOME'; - public const ROLE_ADMIN_PANNEL = 'ROLE_ADMIN_PANNEL'; public const ROLE_ADMIN_POLL = 'ROLE_ADMIN_POLL'; public const ROLE_ADMIN_PROFILE = 'ROLE_ADMIN_PROFILE'; - public const ROLE_ADMIN_RESPONSIBLE = 'ROLE_ADMIN_RESPONSIBLE'; public const ROLE_ADMIN_RIGHTS = 'ROLE_ADMIN_RIGHTS'; - public const ROLE_ADMIN_RUNBOT = 'ROLE_ADMIN_RUNBOT'; public const ROLE_ADMIN_SAFETYTEAM = 'ROLE_ADMIN_SAFETYTEAM'; public const ROLE_ADMIN_SQLFORVOLUNTEERS = 'ROLE_ADMIN_SQLFORVOLUNTEERS'; - public const ROLE_ADMIN_SUGGESTIONS = 'ROLE_ADMIN_SUGGESTIONS'; - public const ROLE_ADMIN_TEST = 'ROLE_ADMIN_TEST'; public const ROLE_ADMIN_TREASURER = 'ROLE_ADMIN_TREASURER'; - public const ROLE_ADMIN_VERIFIER = 'ROLE_ADMIN_VERIFIER'; public const ROLE_ADMIN_WORDS = 'ROLE_ADMIN_WORDS'; public const MEMBER_FIRSTNAME_HIDDEN = 1; @@ -97,13 +84,6 @@ class Member public const MEMBER_LASTNAME_HIDDEN = 4; /** - * @var ObjectManager - */ - protected $em; - - /** - * @var string - * * @ORM\Column(name="Username", type="string", length=32, nullable=false) * * @Groups({"Member:Read"}) @@ -112,91 +92,61 @@ class Member * * @ApiFilter(SearchFilter::class, strategy="exact") */ - protected $username; + protected string $username; /** - * @var string - * * @ORM\Column(name="Email", type="string", nullable=false) * * @Groups({"Member:Read:Owner"}) */ - protected $email; + protected string $email; /** - * @var DateTime - * * @ORM\Column(name="LastLogin", type="datetime", nullable=true) * * @Groups({"Member:Read"}) */ - protected $lastLogin = null; + protected ?DateTime $lastLogin = null; /** - * @var string - * * @ORM\Column(name="PassWord", type="string", length=100, nullable=true) */ - protected $password; + protected ?string $password = null; /** - * @var int - * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") * * @ApiProperty(identifier=false) */ - protected $id; + protected int $id; /** - * @var int - * - * @ORM\Column(name="ex_user_id", type="integer", nullable=false) - */ - private $exUserId; - - /** - * @var string - * * @ORM\Column(name="Status", type="member_status", nullable=false) */ - private $status; - - /** - * @var int - * - * @ORM\Column(name="ChangedId", type="integer", nullable=false) - */ - private $changedid = 0; + private string $status = ""; /** - * @var NewLocation - * * @ORM\ManyToOne(targetEntity="NewLocation") - * @ORM\JoinColumn(name="IdCity", referencedColumnName="geonameId") + * @ORM\JoinColumn(name="IdCity", referencedColumnName="geonameId", nullable=true) * * @Groups({"Member:Read"}) * * @ApiFilter(SearchFilter::class, strategy="ipartial", properties={"city.name", "city.country.name"}) * @ApiFilter(SearchFilter::class, strategy="exact", properties={"city.latitude", "city.longitude"}) */ - private $city; + private ?NewLocation $city = null; /** - * @var string - * * @ORM\Column(name="Latitude", type="decimal", precision=10, scale=7, nullable=true) */ - private $latitude; + private ?string $latitude; /** - * @var string - * * @ORM\Column(name="Longitude", type="decimal", precision=10, scale=7, nullable=true) */ - private $longitude; + private ?string $longitude; /** * @ORM\Column(name="NbRemindWithoutLogingIn", type="integer", nullable=false) @@ -204,531 +154,319 @@ class Member private int $remindersWithOutLogin = 0; /** - * @var int - * - * @ORM\Column(name="HomePhoneNumber", type="integer", nullable=false) - */ - private $homephonenumber; - - /** - * @var int - * - * @ORM\Column(name="CellPhoneNumber", type="integer", nullable=false) - */ - private $cellphonenumber; - - /** - * @var int - * - * @ORM\Column(name="WorkPhoneNumber", type="integer", nullable=false) - */ - private $workphonenumber; - - /** - * @var int - * - * @ORM\Column(name="SecEmail", type="integer", nullable=false) - */ - private $secemail; - - /** - * @var int - * * @ORM\Column(name="FirstName", type="string", nullable=false) * * @Groups({"Member:Read"}) */ - private $firstName = '0'; + private string $firstName = ''; /** - * @var int - * * @ORM\Column(name="SecondName", type="string", nullable=true) * * @Groups({"Member:Read"}) */ - private $secondName = null; + private ?string $secondName = null; /** - * @var int - * * @ORM\Column(name="LastName", type="string", nullable=false) * * @Groups({"Member:Read"}) */ - private $lastName = '0'; + private string $lastName = ''; /** - * @var int - * * @ORM\Column(name="HideAttribute", type="integer", nullable=false) */ - private $hideAttribute = self::MEMBER_FIRSTNAME_HIDDEN | self::MEMBER_SECONDNAME_HIDDEN | self::MEMBER_LASTNAME_HIDDEN; + private int $hideAttribute = self::MEMBER_FIRSTNAME_HIDDEN | self::MEMBER_SECONDNAME_HIDDEN | self::MEMBER_LASTNAME_HIDDEN; /** - * @var string - * - * @ORM\Column(name="Accomodation", type="accommodation", nullable=false) + * @ORM\Column(name="Accomodation", type="accommodation", nullable=true) * * @Groups({"Member:Read"}) * * @ApiFilter(SearchFilter::class, strategy="exact") */ - private $accommodation = AccommodationType::MAYBE; + private ?string $accommodation = null; /** - * @var int - * * @ORM\Column(name="AdditionalAccomodationInfo", type="integer", nullable=false) */ - private $additionalAccommodationInfo; + private int $additionalAccommodationInfo = 0; /** - * @var int - * * @ORM\Column(name="ILiveWith", type="integer", nullable=false) */ - private $ilivewith; - - /** - * @var bool - * - * @ORM\Column(name="IdentityCheckLevel", type="boolean", nullable=false) - */ - private $identitychecklevel = '000'; + private int $iLiveWith = 0; /** - * @var int - * * @ORM\Column(name="InformationToGuest", type="integer", nullable=false) */ - private $informationtoguest; + private int $informationForGuest = 0; /** - * @var string - * * @ORM\Column(name="TypicOffer", type="typical_offer", nullable=false) * * @Groups({"Member:Read"}) */ - private $typicoffer; + private string $typicalOffer = ''; /** - * @var int - * * @ORM\Column(name="Offer", type="integer", nullable=false) */ - private $offer; + private int $offer = 0; /** - * @var int - * * @ORM\Column(name="MaxGuest", type="integer", nullable=false) * * @Groups({"Member:Read"}) * * @ApiFilter(SearchFilter::class, strategy="exact") */ - private $maxguest = '0'; + private int $maxGuest = 1; /** - * @var int - * * @ORM\Column(name="MaxLenghtOfStay", type="integer", nullable=false) */ - private $maxlenghtofstay = '0'; + private int $maxLengthOfStay = 0; /** - * @var int - * * @ORM\Column(name="Organizations", type="integer", nullable=false) */ - private $organizations; + private int $organizations = 0; /** - * @var string - * * @ORM\Column(name="Restrictions", type="string", nullable=false) * * @Groups({"Member:Read"}) */ - private $restrictions; + private string $restrictions = ''; /** - * @var int - * * @ORM\Column(name="OtherRestrictions", type="integer", nullable=false) */ - private $otherrestrictions; - - /** - * @var int - * - * @ORM\Column(name="bday", type="integer", nullable=false) - */ - private $bday; - - /** - * @var int - * - * @ORM\Column(name="bmonth", type="integer", nullable=false) - */ - private $bmonth; - - /** - * @var int - * - * @ORM\Column(name="byear", type="integer", nullable=false) - */ - private $byear; + private int $otherRestrictions = 0; /** - * @var DateTime - * * @ORM\Column(name="updated", type="datetime", nullable=false) */ - private $updated; + private DateTime $updated; /** - * @var DateTime - * * @ORM\Column(name="created", type="datetime", nullable=false) * * @Groups({"Member:Read"}) */ - private $created; - - /** - * @var int - * - * @ORM\Column(name="SecurityFlag", type="integer", nullable=false) - */ - private $securityflag = '0'; - - /** - * @var string - * - * @ORM\Column(name="Quality", type="string", nullable=false) - */ - private $quality = 'NeverLog'; + private DateTime $created; /** - * @var int - * * @ORM\Column(name="ProfileSummary", type="integer", nullable=false) */ - private $profileSummary; + private int $profileSummary = 0; /** - * @var int - * * @ORM\Column(name="Occupation", type="integer", nullable=false) */ - private $occupation; - - /** - * @var int - * - * @ORM\Column(name="CounterGuests", type="integer", nullable=false) - */ - private $counterguests = '0'; - - /** - * @var int - * - * @ORM\Column(name="CounterHosts", type="integer", nullable=false) - */ - private $counterhosts = '0'; - - /** - * @var int - * - * @ORM\Column(name="CounterTrusts", type="integer", nullable=false) - */ - private $countertrusts = '0'; + private int $occupation = 0; /** - * @var string - * * @ORM\Column(name="Gender", type="string", nullable=false) */ - private $gender = 'IDontTell'; + private string $gender = 'IDontTell'; /** - * @var string - * * @ORM\Column(name="HideGender", type="string", nullable=false) */ - private $hidegender = 'No'; + private string $hideGender = 'No'; /** - * @var string - * * @ORM\Column(name="GenderOfGuest", type="string", nullable=false) */ - private $genderofguest = 'any'; - - /** - * @var int - * - * @ORM\Column(name="MotivationForHospitality", type="integer", nullable=true) - */ - private $motivationforhospitality; + private string $genderOfGuest = 'any'; /** - * @var string - * * @ORM\Column(name="HideBirthDate", type="string", nullable=false) */ - private $hideBirthDate = 'No'; + private string $hideAge = 'No'; /** - * @var DateTime - * * @ORM\Column(name="BirthDate", type="date", nullable=true) */ - private $birthdate; + private ?DateTime $birthdate = null; /** - * @var string - * * @ORM\Column(name="AdressHidden", type="string", nullable=false) */ - private $adresshidden = 'Yes'; + private string $adressHidden = 'Yes'; /** - * @var string - * * @ORM\Column(name="WebSite", type="text", length=255, nullable=true) */ - private $website; + private ?string $website = null; /** - * @var string - * * @ORM\Column(name="chat_SKYPE", type="text", length=255, nullable=true) */ - private $chatSkype; + private ?string $chatSkype = null; /** - * @var string - * * @ORM\Column(name="chat_ICQ", type="text", length=255, nullable=true) */ - private $chatIcq; + private ?string $chatIcq = null; /** - * @var string - * * @ORM\Column(name="chat_AOL", type="text", length=255, nullable=true) */ - private $chatAol; + private ?string $chatAol = null; /** - * @var string - * * @ORM\Column(name="chat_MSN", type="text", length=255, nullable=true) */ - private $chatMsn; + private ?string $chatMsn = null; /** - * @var string - * * @ORM\Column(name="chat_YAHOO", type="text", length=255, nullable=true) */ - private $chatYahoo; + private ?string $chatYahoo = null; /** - * @var string - * * @ORM\Column(name="chat_Others", type="text", length=255, nullable=true) */ - private $chatOthers; + private ?string $chatOthers = null; /** - * @var int - * * @ORM\Column(name="FutureTrips", type="integer", nullable=false) */ - private $futuretrips = '0'; + private int $futureTrips = 0; /** - * @var int - * * @ORM\Column(name="OldTrips", type="integer", nullable=false) */ - private $oldtrips = '0'; + private int $oldTrips = 0; /** - * @var int - * * @ORM\Column(name="LogCount", type="integer", nullable=false) */ - private $logcount = '0'; + private int $logcount = 0; /** - * @var int - * * @ORM\Column(name="Hobbies", type="integer", nullable=false) */ - private $hobbies; + private int $hobbies = 0; /** - * @var int - * * @ORM\Column(name="Books", type="integer", nullable=false) */ - private $books; + private int $books = 0; /** - * @var int - * * @ORM\Column(name="Music", type="integer", nullable=false) */ - private $music; + private int $music = 0; /** - * @var int - * * @ORM\Column(name="PastTrips", type="integer", nullable=false) */ - private $pasttrips; + private int $pastTrips = 0; /** - * @var int - * * @ORM\Column(name="PlannedTrips", type="integer", nullable=false) */ - private $plannedtrips; + private int $plannedTrips = 0; /** - * @var int - * * @ORM\Column(name="PleaseBring", type="integer", nullable=false) */ - private $pleasebring; + private int $pleaseBring = 0; /** - * @var int - * * @ORM\Column(name="OfferGuests", type="integer", nullable=false) */ - private $offerguests; + private int $offerGuests = 0; /** - * @var int - * * @ORM\Column(name="OfferHosts", type="integer", nullable=false) */ - private $offerhosts; + private int $offerHosts = 0; /** - * @var int - * * @ORM\Column(name="PublicTransport", type="integer", nullable=false) */ - private $publictransport; + private int $publicTransport = 0; /** - * @var int - * * @ORM\Column(name="Movies", type="integer", nullable=false) */ - private $movies; + private int $movies = 0; /** - * @var int - * * @ORM\Column(name="chat_GOOGLE", type="integer", nullable=false) */ - private $chatGoogle; + private int $chatGoogle = 0; /** - * @var DateTime - * * @ORM\Column(name="LastSwitchToActive", type="datetime", nullable=true) */ - private $lastswitchtoactive; + private ?DateTime $lastSwitchToActive = null; /** - * @var int - * - * @ORM\Column(name="bewelcomed", type="integer", nullable=false) + * @ORM\Column(name="bewelcomed", type="boolean", nullable=false) */ - private $bewelcomed; + private bool $beWelcomed = false; /** - * @var string - * - * @ORM\Column(name="registration_key", type="string", nullable=false) + * @ORM\Column(name="registration_key", type="string", nullable=true) */ - private $registrationKey; + private ?string $registrationKey = null; /** - * @var int - * * @ORM\Column(name="hosting_interest", type="integer", nullable=true) */ - private $hostingInterest; + private ?int $hostingInterest = null; /** - * @ORM\OneToMany(targetEntity="CryptedField", mappedBy="member", fetch="EAGER") + * @ORM\OneToMany(targetEntity="CryptedField", mappedBy="member") */ - private $cryptedFields; + private Collection $fields; /** - * @var ArrayCollection - * - * @ORM\OneToMany(targetEntity="RightVolunteer", mappedBy="member", fetch="LAZY") + * @ORM\OneToMany(targetEntity="RightVolunteer", mappedBy="member", fetch="EXTRA_LAZY") */ - private $volunteerRights; + private Collection $volunteerRights; /** - * @var ArrayCollection - * * @ORM\OneToMany(targetEntity="GroupMembership", mappedBy="member", cascade={"persist", "remove"}, orphanRemoval=true) */ - private $groupMemberships; + private Collection $groupMemberships; /** - * @var ArrayCollection - * * @ORM\OneToMany(targetEntity="MembersLanguagesLevel", mappedBy="member") * * @Groups({"Member:Read"}) * * @ApiFilter(SearchFilter::class, strategy="exact", properties={"languageLevels.level", "languageLevels.language.name", "languageLevels.language.englishname", "languageLevels.language.shortCode"}) */ - private $languageLevels; + private Collection $languageLevels; - /** - * @var ArrayCollection - */ - private $memberFields = null; + private array $memberFields; - /** - * @var ArrayCollection - */ - private $comments; + private Collection $comments; /** - * @var ArrayCollection + * @ORM\OneToMany(targetEntity="Relation", mappedBy="receiver", fetch="EXTRA_LAZY") */ - private $relationships; + private Collection $relations; /** - * @var ArrayCollection - * * @ORM\OneToMany(targetEntity="MemberPreference", mappedBy="member") */ - private $preferences; + private Collection $preferences; /** - * @var ArrayCollection - * * @ORM\OneToMany(targetEntity="Address", mappedBy="member") */ - private $addresses; + private Collection $addresses; + + private ?Language $preferredLanguage = null; public function __construct() { @@ -742,140 +480,48 @@ public function __construct() $this->preferences = new ArrayCollection(); } - /** - * Set exUserId. - * - * @param int $exUserId - * - * @return Member - */ - public function setExUserId($exUserId) - { - $this->exUserId = $exUserId; - - return $this; - } - - /** - * Get exUserId. - * - * @return int - */ - public function getExUserId() - { - return $this->exUserId; - } - - /** - * Set username. - * - * @param string $username - * - * @return Member - */ - public function setUsername($username) + public function setUsername(string $username): self { $this->username = $username; return $this; } - /** - * Get username. - * - * @return string - */ - public function getUsername() + public function getUsername(): string { return $this->username; } - /** - * @return string - */ - public function getUserIdentifier() + public function getUserIdentifier(): string { return $this->username; } - /** - * Set status. - * - * @param string $status - * - * @return Member - */ - public function setStatus($status) + public function setStatus(string $status): self { $this->status = $status; return $this; } - /** - * Get status. - * - * @return string - */ - public function getStatus() + public function getStatus(): string { return $this->status; } - /** - * Set changedid. - * - * @param int $changedid - * - * @return Member - */ - public function setChangedid($changedid) - { - $this->changedid = $changedid; - - return $this; - } - - /** - * Get changedid. - * - * @return int - */ - public function getChangedid() - { - return $this->changedid; - } - - /** - * Set email. - * - * @param string $email - * - * @return Member - */ - public function setEmail($email) + public function setEmail(string $email): self { $this->email = $email; return $this; } - /** - * Get email. - * - * @return string - */ - public function getEmail() + public function getEmail(): string { return $this->email; } - /** - * Set city. - * - * @return Member - */ - public function setCity(NewLocation $city) + public function setCity(NewLocation $city): self { $this->city = $city; @@ -887,1590 +533,490 @@ public function getCity(): ?NewLocation return $this->city; } - /** - * Set latitude. - * - * @param string $latitude - * - * @return Member - */ - public function setLatitude($latitude) + public function setLatitude(?float $latitude): self { $this->latitude = $latitude; return $this; } - /** - * Get latitude. - * - * @return string - */ - public function getLatitude() + public function getLatitude(): ?float { return $this->latitude; } - /** - * Set longitude. - * - * @param string $longitude - * - * @return Member - */ - public function setLongitude($longitude) + public function setLongitude(?float $longitude): self { $this->longitude = $longitude; return $this; } - /** - * Get longitude. - * - * @return string - */ - public function getLongitude() + public function getLongitude(): ?float { return $this->longitude; } - /** - * Set count of reminders without login. - * - * @param mixed $remindersWithOutLogin - */ - public function setRemindersWithOutLogin($remindersWithOutLogin): self + public function setRemindersWithOutLogin(int $remindersWithOutLogin): self { $this->remindersWithOutLogin = $remindersWithOutLogin; return $this; } - /** - * Get count of reminders without login. - */ public function getRemindersWithOutLogin(): int { return $this->remindersWithOutLogin; } - /** - * Set homephonenumber. - * - * @param int $homephonenumber - * - * @return Member - */ - public function setHomephonenumber($homephonenumber) + public function setFirstName(string $firstName): self { - $this->homephonenumber = $homephonenumber; + $this->firstName = $firstName; return $this; } - /** - * Get homephonenumber. - * - * @return int - */ - public function getHomephonenumber() + public function getFirstName(): string { - return $this->homephonenumber; + return $this->firstName; } - /** - * Set cellphonenumber. - * - * @param int $cellphonenumber - * - * @return Member - */ - public function setCellphonenumber($cellphonenumber) + public function setSecondName(?string $secondName): self { - $this->cellphonenumber = $cellphonenumber; + $this->secondName = $secondName; return $this; } - /** - * Get cellphonenumber. - * - * @return int - */ - public function getCellphonenumber() + public function getSecondName(): ?string { - return $this->cellphonenumber; + return $this->secondName; } - /** - * Set workphonenumber. - * - * @param int $workphonenumber - * - * @return Member - */ - public function setWorkphonenumber($workphonenumber) + public function setLastName(string $lastName): self { - $this->workphonenumber = $workphonenumber; + $this->lastName = $lastName; return $this; } - /** - * Get workphonenumber. - * - * @return int - */ - public function getWorkphonenumber() + public function getLastName(): string { - return $this->workphonenumber; + return $this->lastName; } - /** - * Set secemail. - * - * @param int $secemail - * - * @return Member - */ - public function setSecemail($secemail) + public function setAccommodation(?string $accommodation): self { - $this->secemail = $secemail; + $this->accommodation = $accommodation; return $this; } - /** - * Get secemail. - * - * @return int - */ - public function getSecemail() + public function getAccommodation(): ?string { - return $this->secemail; + return $this->accommodation; } - /** - * Set firstname. - * - * @param string $firstName - * - * @return Member - */ - public function setFirstName($firstName) + public function setAdditionalAccommodationinfo(int $additionalAccommodationInfo): self { - $this->firstName = $firstName; + $this->additionalAccommodationInfo = $additionalAccommodationInfo; return $this; } - /** - * Get firstname. - * - * @return string - */ - public function getFirstName() + public function getAdditionalAccommodationinfo(): int { - return $this->firstName; - } - - /** - * Set secondname. - * - * @param string $secondName - * - * @return Member - */ - public function setSecondName($secondName) - { - $this->secondName = $secondName; - - return $this; - } - - /** - * Get secondname. - * - * @return string - */ - public function getSecondName() - { - return $this->secondName; - } - - /** - * Set lastname. - * - * @param string $lastName - * - * @return Member - */ - public function setLastName($lastName) - { - $this->lastName = $lastName; - - return $this; - } - - /** - * Get lastname. - * - * @return string - */ - public function getLastName() - { - return $this->lastName; - } - - /** - * Set accommodation. - * - * @param string $accommodation - * - * @return Member - */ - public function setAccommodation($accommodation) - { - $this->accommodation = $accommodation; - - return $this; - } - - /** - * Get accommodation. - * - * @return string - */ - public function getAccommodation() - { - return $this->accommodation; - } - - /** - * Set additionalaccommodationinfo. - * - * @param int $additionalAccommodationInfo - * - * @return Member - */ - public function setAdditionalAccommodationinfo($additionalAccommodationInfo) - { - $this->additionalAccommodationInfo = $additionalAccommodationInfo; - - return $this; - } - - /** - * Get additionalaccomodationinfo. - * - * @return int - */ - public function getAdditionalAccommodationinfo() - { - return $this->additionalAccommodationInfo; - } - - /** - * Set ilivewith. - * - * @param int $ilivewith - * - * @return Member - */ - public function setIlivewith($ilivewith) - { - $this->ilivewith = $ilivewith; - - return $this; - } - - /** - * Get ilivewith. - * - * @return int - */ - public function getIlivewith() - { - return $this->ilivewith; - } - - /** - * Set identitychecklevel. - * - * @param bool $identitychecklevel - * - * @return Member - */ - public function setIdentitychecklevel($identitychecklevel) - { - $this->identitychecklevel = $identitychecklevel; - - return $this; - } - - /** - * Get identitychecklevel. - * - * @return bool - */ - public function getIdentitychecklevel() - { - return $this->identitychecklevel; - } - - /** - * Set informationtoguest. - * - * @param int $informationtoguest - * - * @return Member - */ - public function setInformationtoguest($informationtoguest) - { - $this->informationtoguest = $informationtoguest; - - return $this; - } - - /** - * Get informationtoguest. - * - * @return int - */ - public function getInformationtoguest() - { - return $this->informationtoguest; - } - - /** - * Set typicoffer. - * - * @param string $typicoffer - * - * @return Member - */ - public function setTypicoffer($typicoffer) - { - $this->typicoffer = $typicoffer; - - return $this; - } - - /** - * Get typicoffer. - * - * @return string - */ - public function getTypicoffer() - { - return $this->typicoffer; - } - - /** - * Set offer. - * - * @param int $offer - * - * @return Member - */ - public function setOffer($offer) - { - $this->offer = $offer; - - return $this; - } - - /** - * Get offer. - * - * @return int - */ - public function getOffer() - { - return $this->offer; - } - - /** - * Set maxguest. - * - * @param int $maxguest - * - * @return Member - */ - public function setMaxguest($maxguest) - { - $this->maxguest = $maxguest; - - return $this; - } - - /** - * Get maxguest. - * - * @return int - */ - public function getMaxguest() - { - return $this->maxguest; - } - - /** - * Set maxlenghtofstay. - * - * @param int $maxlenghtofstay - * - * @return Member - */ - public function setMaxlenghtofstay($maxlenghtofstay) - { - $this->maxlenghtofstay = $maxlenghtofstay; - - return $this; - } - - /** - * Get maxlenghtofstay. - * - * @return int - */ - public function getMaxlenghtofstay() - { - return $this->maxlenghtofstay; - } - - /** - * Set organizations. - * - * @param int $organizations - * - * @return Member - */ - public function setOrganizations($organizations) - { - $this->organizations = $organizations; - - return $this; - } - - /** - * Get organizations. - * - * @return int - */ - public function getOrganizations() - { - return $this->organizations; - } - - /** - * Set restrictions. - * - * @param string $restrictions - * - * @return Member - */ - public function setRestrictions($restrictions) - { - $this->restrictions = $restrictions; - - return $this; - } - - /** - * Get restrictions. - * - * @return string - */ - public function getRestrictions() - { - return $this->restrictions; - } - - /** - * Set otherrestrictions. - * - * @param int $otherrestrictions - * - * @return Member - */ - public function setOtherrestrictions($otherrestrictions) - { - $this->otherrestrictions = $otherrestrictions; - - return $this; - } - - /** - * Get otherrestrictions. - * - * @return int - */ - public function getOtherrestrictions() - { - return $this->otherrestrictions; - } - - /** - * Set bday. - * - * @param int $bday - * - * @return Member - */ - public function setBday($bday) - { - $this->bday = $bday; - - return $this; - } - - /** - * Get bday. - * - * @return int - */ - public function getBday() - { - return $this->bday; - } - - /** - * Set bmonth. - * - * @param int $bmonth - * - * @return Member - */ - public function setBmonth($bmonth) - { - $this->bmonth = $bmonth; - - return $this; - } - - /** - * Get bmonth. - * - * @return int - */ - public function getBmonth() - { - return $this->bmonth; - } - - /** - * Set byear. - * - * @param int $byear - * - * @return Member - */ - public function setByear($byear) - { - $this->byear = $byear; - - return $this; - } - - /** - * Get byear. - * - * @return int - */ - public function getByear() - { - return $this->byear; - } - - /** - * Set updated. - * - * @param DateTime $updated - * - * @return Member - */ - public function setUpdated($updated) - { - $this->updated = $updated; - - return $this; - } - - /** - * Get updated. - * - * @return DateTime - */ - public function getUpdated() - { - return $this->updated; - } - - /** - * Set created. - * - * @param DateTime $created - * - * @return Member - */ - public function setCreated($created) - { - $this->created = $created; - - return $this; - } - - public function getCreated(): ?Carbon - { - if (null !== $this->created) { - return Carbon::instance($this->created); - } - - return null; - } - - /** - * Set last login. - * - * @param DateTime $lastLogin - * - * @return Member - */ - public function setLastLogin(DateTime $lastLogin = null) - { - $this->lastLogin = $lastLogin; - - return $this; - } - - /** - * Get last login. - * - * @return ?Carbon - */ - public function getLastLogin(): ?Carbon - { - if (null !== $this->lastLogin) { - return Carbon::instance($this->lastLogin); - } - - return null; - } - - /** - * Set securityflag. - * - * @param int $securityflag - * - * @return Member - */ - public function setSecurityflag($securityflag) - { - $this->securityflag = $securityflag; - - return $this; - } - - /** - * Get securityflag. - * - * @return int - */ - public function getSecurityflag() - { - return $this->securityflag; - } - - /** - * Set quality. - * - * @param string $quality - * - * @return Member - */ - public function setQuality($quality) - { - $this->quality = $quality; - - return $this; - } - - /** - * Get quality. - * - * @return string - */ - public function getQuality() - { - return $this->quality; - } - - /** - * Set profileSummary. - * - * @param int $profileSummary - * - * @return Member - */ - public function setProfileSummary($profileSummary) - { - $this->profileSummary = $profileSummary; - - return $this; - } - - /** - * Get profileSummary. - * - * @return int - */ - public function getProfileSummary() - { - return $this->profileSummary; - } - - /** - * Set occupation. - * - * @param int $occupation - * - * @return Member - */ - public function setOccupation($occupation) - { - $this->occupation = $occupation; - - return $this; - } - - /** - * Get occupation. - * - * @return int - */ - public function getOccupation() - { - return $this->occupation; + return $this->additionalAccommodationInfo; } - /** - * Set counterguests. - * - * @param int $counterguests - * - * @return Member - */ - public function setCounterguests($counterguests) + public function setILiveWith(string $iLiveWith): self { - $this->counterguests = $counterguests; + $this->iLiveWith = $iLiveWith; return $this; } - /** - * Get counterguests. - * - * @return int - */ - public function getCounterguests() + public function getILiveWith(): string { - return $this->counterguests; + return $this->iLiveWith; } - /** - * Set counterhosts. - * - * @param int $counterhosts - * - * @return Member - */ - public function setCounterhosts($counterhosts) + public function setInformationForGuest(int $informationForGuest): self { - $this->counterhosts = $counterhosts; + $this->informationForGuest = $informationForGuest; return $this; } - /** - * Get counterhosts. - * - * @return int - */ - public function getCounterhosts() + public function getInformationForGuest(): int { - return $this->counterhosts; + return $this->informationForGuest; } - /** - * Set countertrusts. - * - * @param int $countertrusts - * - * @return Member - */ - public function setCountertrusts($countertrusts) + public function setTypicalOffer(string $typicalOffer): self { - $this->countertrusts = $countertrusts; + $this->typicalOffer = $typicalOffer; return $this; } - /** - * Get countertrusts. - * - * @return int - */ - public function getCountertrusts() + public function getTypicalOffer(): string { - return $this->countertrusts; + return $this->typicalOffer; } - public function setPassword($hashedPassword): self + public function setOffer(int $offer): self { - $this->password = $hashedPassword; + $this->offer = $offer; return $this; } - public function getPassword(): ?string + public function getOffer(): int { - return $this->password; + return $this->offer; } - public function setGender($gender): self + public function setMaxGuest(int $maxGuest): self { - $this->gender = $gender; + $this->maxGuest = $maxGuest; return $this; } - /** - * Get gender. - * - * @return string - */ - public function getGender() + public function getMaxGuest(): int { - return $this->gender; + return $this->maxGuest; } - /** - * Set hidegender. - * - * @param string $hidegender - * - * @return Member - */ - public function setHidegender($hidegender) + public function setMaxLengthOfStay(int $maxLengthOfStay): self { - $this->hidegender = $hidegender; + $this->maxLengthOfStay = $maxLengthOfStay; return $this; } - /** - * Get hidegender. - * - * @return string - */ - public function getHidegender() + public function getMaxLengthOfStay(): int { - return $this->hidegender; + return $this->maxLengthOfStay; } - /** - * Set genderofguest. - * - * @param string $genderofguest - * - * @return Member - */ - public function setGenderofguest($genderofguest) + public function setOrganizations(int $organizations): self { - $this->genderofguest = $genderofguest; + $this->organizations = $organizations; return $this; } - /** - * Get genderofguest. - * - * @return string - */ - public function getGenderofguest() + public function getOrganizations(): int { - return $this->genderofguest; + return $this->organizations; } - /** - * Set motivationforhospitality. - * - * @param int $motivationforhospitality - * - * @return Member - */ - public function setMotivationforhospitality($motivationforhospitality) + public function setRestrictions(string $restrictions): self { - $this->motivationforhospitality = $motivationforhospitality; + $this->restrictions = $restrictions; return $this; } - /** - * Get motivationforhospitality. - * - * @return int - */ - public function getMotivationforhospitality() + public function getRestrictions(): string { - return $this->motivationforhospitality; + return $this->restrictions; } - /** - * Set hidebirthdate. - * - * @param string $hideBirthDate - * - * @return Member - */ - public function setHideBirthDate($hideBirthDate) + public function setOtherRestrictions(int $otherRestrictions): self { - $this->hideBirthDate = $hideBirthDate; + $this->otherRestrictions = $otherRestrictions; return $this; } - /** - * Get hidebirthdate. - * - * @return string - */ - public function getHideBirthDate() + public function getOtherRestrictions(): int { - return $this->hideBirthDate; + return $this->otherRestrictions; } - /** - * Set birthdate. - * - * @param DateTime $birthdate - * - * @return Member - */ - public function setBirthdate($birthdate) + public function getUpdated(): ?Carbon { - $this->birthdate = $birthdate; - - return $this; - } + if (null !== $this->updated) { + return Carbon::instance($this->updated); + } - /** - * Get birthdate. - * - * @return Carbon - */ - public function getBirthdate() - { - return Carbon::instance($this->birthdate); + return null; } - /** - * Set adresshidden. - * - * @param string $adresshidden - * - * @return Member - */ - public function setAdresshidden($adresshidden) + public function getCreated(): ?Carbon { - $this->adresshidden = $adresshidden; - - return $this; - } + if (null !== $this->created) { + return Carbon::instance($this->created); + } - /** - * Get adresshidden. - * - * @return string - */ - public function getAdresshidden() - { - return $this->adresshidden; + return null; } - /** - * Set website. - * - * @param string $website - * - * @return Member - */ - public function setWebsite($website) + public function setLastLogin(?DateTime $lastLogin): self { - $this->website = $website; + $this->lastLogin = $lastLogin; return $this; } - /** - * Get website. - * - * @return string - */ - public function getWebsite() - { - return $this->website; - } - - /** - * Set chatSkype. - * - * @param string $chatSkype - * - * @return Member - */ - public function setChatSkype($chatSkype) + public function getLastLogin(): ?Carbon { - $this->chatSkype = $chatSkype; - - return $this; - } + if (null !== $this->lastLogin) { + return Carbon::instance($this->lastLogin); + } - /** - * Get chatSkype. - * - * @return string - */ - public function getChatSkype() - { - return $this->chatSkype; + return null; } - /** - * Set chatIcq. - * - * @param string $chatIcq - * - * @return Member - */ - public function setChatIcq($chatIcq) + public function setProfileSummary(int $profileSummary): self { - $this->chatIcq = $chatIcq; + $this->profileSummary = $profileSummary; return $this; } - /** - * Get chatIcq. - * - * @return string - */ - public function getChatIcq() + public function getProfileSummary(): int { - return $this->chatIcq; + return $this->profileSummary; } - /** - * Set chatAol. - * - * @param string $chatAol - * - * @return Member - */ - public function setChatAol($chatAol) + public function setOccupation(int $occupation): self { - $this->chatAol = $chatAol; + $this->occupation = $occupation; return $this; } - /** - * Get chatAol. - * - * @return string - */ - public function getChatAol() + public function getOccupation(): int { - return $this->chatAol; + return $this->occupation; } - /** - * Set chatMsn. - * - * @param string $chatMsn - * - * @return Member - */ - public function setChatMsn($chatMsn) + public function setPassword(?string $hashedPassword): self { - $this->chatMsn = $chatMsn; + $this->password = $hashedPassword; return $this; } - /** - * Get chatMsn. - * - * @return string - */ - public function getChatMsn() + public function getPassword(): ?string { - return $this->chatMsn; + return $this->password; } - /** - * Set chatYahoo. - * - * @param string $chatYahoo - * - * @return Member - */ - public function setChatYahoo($chatYahoo) + public function setGender(string $gender): self { - $this->chatYahoo = $chatYahoo; + $this->gender = $gender; return $this; } - /** - * Get chatYahoo. - * - * @return string - */ - public function getChatYahoo() + public function getGender(): string { - return $this->chatYahoo; + return $this->gender; } - /** - * Set chatOthers. - * - * @param string $chatOthers - * - * @return Member - */ - public function setChatOthers($chatOthers) + public function setShowGender(bool $show): self { - $this->chatOthers = $chatOthers; + $this->hideGender = $show ? 'No' : 'Yes'; return $this; } - /** - * Get chatOthers. - * - * @return string - */ - public function getChatOthers() + public function getShowGender(): bool { - return $this->chatOthers; + return $this->hideGender === 'No'; } - /** - * Set futuretrips. - * - * @param int $futuretrips - * - * @return Member - */ - public function setFuturetrips($futuretrips) + public function setShowAge(bool $show): self { - $this->futuretrips = $futuretrips; + $this->hideAge = $show ? 'No' : 'Yes'; return $this; } - /** - * Get futuretrips. - * - * @return int - */ - public function getFuturetrips() + public function getShowAge(): string { - return $this->futuretrips; + return $this->hideAge === 'No'; } - /** - * Set oldtrips. - * - * @param int $oldtrips - * - * @return Member - */ - public function setOldtrips($oldtrips) + public function setBirthdate(DateTime $birthdate): self { - $this->oldtrips = $oldtrips; + $this->birthdate = $birthdate; return $this; } - /** - * Get oldtrips. - * - * @return int - */ - public function getOldtrips() + public function getBirthdate(): Carbon { - return $this->oldtrips; + return Carbon::instance($this->birthdate); } - /** - * Set logcount. - * - * @param int $logcount - * - * @return Member - */ - public function setLogcount($logcount) + public function setAdressHidden(string $adressHidden): self { - $this->logcount = $logcount; + $this->adressHidden = $adressHidden; return $this; } - /** - * Get logcount. - * - * @return int - */ - public function getLogcount() + public function getAdressHidden(): string { - return $this->logcount; + return $this->adressHidden; } - /** - * Set hobbies. - * - * @param int $hobbies - * - * @return Member - */ - public function setHobbies($hobbies) + public function setHobbies(int $hobbies): self { $this->hobbies = $hobbies; return $this; } - /** - * Get hobbies. - * - * @return int - */ - public function getHobbies() + public function getHobbies(): int { return $this->hobbies; } - /** - * Set books. - * - * @param int $books - * - * @return Member - */ - public function setBooks($books) + public function setBooks(int $books): self { $this->books = $books; return $this; } - /** - * Get books. - * - * @return int - */ - public function getBooks() + public function getBooks(): int { return $this->books; } - /** - * Set music. - * - * @param int $music - * - * @return Member - */ - public function setMusic($music) + public function setMusic(int $music): self { $this->music = $music; return $this; } - /** - * Get music. - * - * @return int - */ - public function getMusic() + public function getMusic(): int { return $this->music; } - /** - * Set pasttrips. - * - * @param int $pasttrips - * - * @return Member - */ - public function setPasttrips($pasttrips) - { - $this->pasttrips = $pasttrips; - - return $this; - } - - /** - * Get pasttrips. - * - * @return int - */ - public function getPasttrips() - { - return $this->pasttrips; - } - - /** - * Set plannedtrips. - * - * @param int $plannedtrips - * - * @return Member - */ - public function setPlannedtrips($plannedtrips) + public function setPastTrips(int $pastTrips): self { - $this->plannedtrips = $plannedtrips; + $this->pastTrips = $pastTrips; return $this; } - /** - * Get plannedtrips. - * - * @return int - */ - public function getPlannedtrips() + public function getPastTrips(): int { - return $this->plannedtrips; + return $this->pastTrips; } - /** - * Set pleasebring. - * - * @param int $pleasebring - * - * @return Member - */ - public function setPleasebring($pleasebring) + public function setPlannedTrips(int $plannedTrips): self { - $this->pleasebring = $pleasebring; + $this->plannedTrips = $plannedTrips; return $this; } - /** - * Get pleasebring. - * - * @return int - */ - public function getPleasebring() + public function getPlannedTrips(): int { - return $this->pleasebring; + return $this->plannedTrips; } - /** - * Set offerguests. - * - * @param int $offerguests - * - * @return Member - */ - public function setOfferguests($offerguests) + public function setPleaseBring(int $pleaseBring): self { - $this->offerguests = $offerguests; + $this->pleaseBring = $pleaseBring; return $this; } - /** - * Get offerguests. - * - * @return int - */ - public function getOfferguests() + public function getPleaseBring(): int { - return $this->offerguests; + return $this->pleaseBring; } - /** - * Set offerhosts. - * - * @param int $offerhosts - * - * @return Member - */ - public function setOfferhosts($offerhosts) + public function setOfferGuests(int $offerGuests): self { - $this->offerhosts = $offerhosts; + $this->offerGuests = $offerGuests; return $this; } - /** - * Get offerhosts. - * - * @return int - */ - public function getOfferhosts() + public function getOfferGuests(): int { - return $this->offerhosts; + return $this->offerGuests; } - /** - * Set publictransport. - * - * @param int $publictransport - * - * @return Member - */ - public function setPublictransport($publictransport) + public function setOfferHosts(int $offerHosts): self { - $this->publictransport = $publictransport; + $this->offerHosts = $offerHosts; return $this; } - /** - * Get publictransport. - * - * @return int - */ - public function getPublictransport() + public function getOfferHosts(): int { - return $this->publictransport; + return $this->offerHosts; } - /** - * Set movies. - * - * @param int $movies - * - * @return Member - */ - public function setMovies($movies) + public function setPublicTransport(int $publicTransport): self { - $this->movies = $movies; + $this->publicTransport = $publicTransport; return $this; } - /** - * Get movies. - * - * @return int - */ - public function getMovies() + public function getPublicTransport(): int { - return $this->movies; + return $this->publicTransport; } - /** - * Set chatGoogle. - * - * @param int $chatGoogle - * - * @return Member - */ - public function setChatGoogle($chatGoogle) + public function setMovies(int $movies): self { - $this->chatGoogle = $chatGoogle; + $this->movies = $movies; return $this; } - /** - * Get chatGoogle. - * - * @return int - */ - public function getChatGoogle() + public function getMovies(): int { - return $this->chatGoogle; + return $this->movies; } - /** - * Set lastswitchtoactive. - * - * @param DateTime $lastswitchtoactive - * - * @return Member - */ - public function setLastswitchtoactive($lastswitchtoactive) + public function setLastSwitchToActive(?DateTime $lastSwitchToActive): self { - $this->lastswitchtoactive = $lastswitchtoactive; + $this->lastSwitchToActive = $lastSwitchToActive; return $this; } - /** - * Get lastswitchtoactive. - * - * @return DateTime - */ - public function getLastswitchtoactive() + public function getLastSwitchToActive(): ?DateTime { - return $this->lastswitchtoactive; + return $this->lastSwitchToActive; } - /** - * Set bewelcomed. - * - * @param int $bewelcomed - * - * @return Member - */ - public function setBewelcomed($bewelcomed) + public function setBeWelcomed(bool $beWelcomed): self { - $this->bewelcomed = $bewelcomed; + $this->beWelcomed = $beWelcomed; return $this; } - /** - * Get bewelcomed. - * - * @return int - */ - public function getBewelcomed() + public function getBeWelcomed(): bool { - return $this->bewelcomed; + return $this->beWelcomed; } - /** - * Get id. - * - * @return int - */ - public function getId() + public function getId(): int { return $this->id; } - /** - * String representation of object. - * - * @see http://php.net/manual/en/serializable.serialize.php - * - * @return string the string representation of the object or null - * - * @since 5.1.0 - */ - public function serialize() + public function serialize(): string { return serialize([ $this->id, @@ -2481,34 +1027,16 @@ public function serialize() ]); } - /** - * Constructs the object. - * - * @see http://php.net/manual/en/serializable.unserialize.php - * - * @param string $serialized

- * The string representation of the object. - *

- * - * @since 5.1.0 - */ - public function unserialize($serialized) + public function unserialize($serialized): void { list( $this->id, $this->username, $this->password, - // see section on salt below - // $this->salt ) = unserialize($serialized); } - /** - * Returns the roles granted to the user. - * - * @return array string[] The user roles - */ - public function getRoles() + public function getRoles(): array { // Grant user role to everyone $roles = [ @@ -2532,29 +1060,16 @@ public function getRoles() return $roles; } - /** - * Returns the salt that was originally used to encode the password. - * - * Return null as we use BCrypt for password hashing - * - * @return ?string - */ - public function getSalt() + public function getSalt(): ?string { return null; } - /** - * Removes sensitive data from the user. - * - * This is important if, at any given point, sensitive information like - * the plain-text password is stored on this object. - */ - public function eraseCredentials() + public function eraseCredentials(): void { } - public function isPrivileged() + public function isPrivileged(): bool { if (\in_array('ROLE_ADMIN', $this->getRoles(), true)) { return true; @@ -2563,37 +1078,16 @@ public function isPrivileged() return false; } - public function getLocale() + public function getLocale(): string { return 'en'; } - public function getVolunteerRights() + public function getVolunteerRights(): Collection { return $this->volunteerRights; } - public function getGroupMemberships() - { - return $this->groupMemberships; - } - - public function addGroupMembership(GroupMembership $groupMembership) - { - $this->groupMemberships->add($groupMembership); - - return $this; - } - - public function removeGroupMembership(GroupMembership $groupMembership) - { - if ($this->groupMemberships->contains($groupMembership)) { - $this->groupMemberships->removeElement($groupMembership); - $groupMembership->setMember(null); - } - $this->groupMemberships->remove($groupMembership); - } - public function getGroups() { $criteria = Criteria::create() @@ -2611,82 +1105,48 @@ function ($groupMembership) { ); } - public function getComments() + public function getComments(): Collection { return $this->comments; } - public function getRelationships() + public function addField(CryptedField $field): self { - return $this->comments; - } - - /** - * Add cryptedField. - * - * @return Member - */ - public function addCryptedField(CryptedField $cryptedField) - { - $this->cryptedFields[] = $cryptedField; + $this->fields[] = $field; return $this; } - /** - * Remove cryptedField. - */ - public function removeCryptedField(CryptedField $cryptedField) + public function removeField(CryptedField $field): void { - $this->cryptedFields->removeElement($cryptedField); + $this->fields->removeElement($field); } - /** - * Get cryptedFields. - * - * @return Collection - */ - public function getCryptedFields() + public function getFields(): Collection { - return $this->cryptedFields; + return $this->fields; } - /** - * Add volunteerRight. - * - * @return Member - */ - public function addVolunteerRight(RightVolunteer $volunteerRight) + public function addVolunteerRight(RightVolunteer $volunteerRight): self { - $this->volunteerRights[] = $volunteerRight; + if (!$this->volunteerRights->contains($volunteerRight)) { + $this->volunteerRights->add($volunteerRight); + } return $this; } - /** - * Remove volunteerRight. - */ - public function removeVolunteerRight(RightVolunteer $volunteerRight) + public function removeVolunteerRight(RightVolunteer $volunteerRight): void { $this->volunteerRights->removeElement($volunteerRight); } - /** - * Get addresses. - * - * @return Collection - */ - public function getAddresses() + public function getAddresses(): Collection { return $this->addresses; } - /** - * Add address. - * - * @return Member - */ - public function addAddress(Address $address) + public function addAddress(Address $address): self { if (!$this->addresses->contains($address)) { $this->addresses[] = $address; @@ -2695,133 +1155,100 @@ public function addAddress(Address $address) return $this; } - /** - * Remove address. - */ - public function removeAddress(Address $address) + public function removeAddress(Address $address): void { $this->addresses->removeElement($address); } - /** - * Add group. - * - * @return Member - */ - public function addGroup(Group $group) + public function getGroupMemberships(): Collection + { + return $this->groupMemberships; + } + + public function addGroupMembership(GroupMembership $groupMembership): self { - $this->groupMemberships[] = $group; + if (!$this->groupMemberships->contains($groupMembership)) { + $this->groupMemberships->add($groupMembership); + } return $this; } - /** - * Remove group. - */ - public function removeGroup(Group $group) + public function removeGroupMembership(GroupMembership $groupMembership): void { - $this->groupMemberships->removeElement($group); + $this->groupMemberships->removeElement($groupMembership); } - /** - * @param string $fieldName The crypted field name - * @param bool $decrypt Should the value be decrypted? - * @param string $prefix Criteria prefix - * - * @return string - */ - public function getCryptedField($fieldName, bool $decrypt = true, string $prefix = 'members') + public function getField($fieldName, bool $decrypt = true, string $prefix = 'members') { $stripped = ''; $criteria = Criteria::create() ->where(Criteria::expr()->eq('tablecolumn', $prefix . '.' . $fieldName)); - $cryptedField = $this->cryptedFields->matching($criteria)->first(); - if (false !== $cryptedField && true === $decrypt) { - $value = $cryptedField->getMemberCryptedValue(); + $field = $this->fields->matching($criteria)->first(); + if (false !== $field && true === $decrypt) { + $value = $field->getMemberCryptedValue(); $stripped = strip_tags($value); } return $stripped; } - /** - * @param int $hideAttribute - * - * @return Member - */ - public function setHideAttribute($hideAttribute) + public function setHideAttribute($hideAttribute): self { $this->hideAttribute = $hideAttribute; return $this; } - /** - * @return int - */ - public function getHideAttribute() + public function getHideAttribute(): int { return $this->hideAttribute; } - /** - * @param int $hostingInterest - * - * @return Member - */ - public function setHostingInterest($hostingInterest) + public function setHostingInterest(?int $hostingInterest): self { $this->hostingInterest = $hostingInterest; return $this; } - /** - * @return int - */ - public function getHostingInterest() + public function getHostingInterest(): ?int { return $this->hostingInterest; } - public function hasRight($rightName) + public function hasRight(string $nameOfRight): bool { $hasRight = false; $volunteerRights = $this->getVolunteerRights(); - if (null !== $volunteerRights) { - $right = $this->em->getRepository(Right::class)->findOneBy(['name' => $rightName]); - /** @var RightVolunteer $volunteerRight */ - foreach ($volunteerRights->getIterator() as $volunteerRight) { - if ($volunteerRight->getRight() === $right) { - $hasRight = true; - break; - } + /** @var RightVolunteer $volunteerRight */ + foreach ($volunteerRights->getIterator() as $volunteerRight) { + if ($volunteerRight->getRight()->getName() === $nameOfRight) { + $hasRight = true; + break; } } return $hasRight; } - public function hasRightsForLocale($locale) + public function hasRightsForLocale($locale): bool { $hasRight = false; $volunteerRights = $this->getVolunteerRights(); - if (null !== $volunteerRights) { - // first check if member has the word right - $word = $this->em->getRepository(Right::class)->findOneBy(['name' => 'Words']); - /** @var RightVolunteer $volunteerRight */ - foreach ($volunteerRights->getIterator() as $volunteerRight) { - if ($volunteerRight->getRight() === $word) { - $strScope = str_replace('"', '', str_replace(',', ';', $volunteerRight->getScope())); - $scope = explode(';', $strScope); - if (\in_array($locale, $scope, true)) { - $hasRight = true; - } - if (\in_array('All', $scope, true)) { - $hasRight = true; - } + /* \todo find way to define rights name */ + /** @var RightVolunteer $volunteerRight */ + foreach ($volunteerRights->getIterator() as $volunteerRight) { + if ($volunteerRight->getRight()->getName() === 'Words') { + $strScope = str_replace('"', '', str_replace(',', ';', $volunteerRight->getScope())); + $scope = explode(';', $strScope); + if (\in_array($locale, $scope, true)) { + $hasRight = true; + } + if (\in_array('All', $scope, true)) { + $hasRight = true; } } } @@ -2829,52 +1256,40 @@ public function hasRightsForLocale($locale) return $hasRight; } - public function getLevelForRight($rightName) + public function getLevelForRight($nameOfRight): int { - $rightName = strtolower(str_replace('ROLE_ADMIN_', '', $rightName)); + $nameOfRight = strtolower(str_replace('ROLE_ADMIN_', '', $nameOfRight)); $level = false; $volunteerRights = $this->getVolunteerRights(); - if (null !== $volunteerRights) { - $right = $this->em->getRepository(Right::class)->findOneBy(['name' => $rightName]); - /** @var RightVolunteer $volunteerRight */ - foreach ($volunteerRights->getIterator() as $volunteerRight) { - if ($volunteerRight->getRight() === $right) { - $level = $volunteerRight->getLevel(); - } + /** @var RightVolunteer $volunteerRight */ + foreach ($volunteerRights->getIterator() as $volunteerRight) { + if ($volunteerRight->getRight()->getName() === $nameOfRight) { + $level = $volunteerRight->getLevel(); } } return $level; } - /** - * @param $rightName - * - * @return array - */ - public function getScopeForRight($rightName) + public function getScopeForRight($nameOfRight): array { - $rightName = strtolower(str_replace('ROLE_ADMIN_', '', $rightName)); + $nameOfRight = strtolower(str_replace('ROLE_ADMIN_', '', $nameOfRight)); $scope = []; $volunteerRights = $this->getVolunteerRights(); - if (null !== $volunteerRights) { - // first check if member has the word right - $right = $this->em->getRepository(Right::class)->findOneBy(['name' => $rightName]); - /** @var RightVolunteer $volunteerRight */ - foreach ($volunteerRights->getIterator() as $volunteerRight) { - if ($volunteerRight->getRight() === $right) { - $scopes = str_replace(';', ',', str_replace('"', '', $volunteerRight->getScope())); - $scope = explode(',', $scopes); - } + /** @var RightVolunteer $volunteerRight */ + foreach ($volunteerRights->getIterator() as $volunteerRight) { + if ($volunteerRight->getRight()->getName() === $nameOfRight) { + $scopes = str_replace(';', ',', str_replace('"', '', $volunteerRight->getScope())); + $scope = explode(',', $scopes); } } return $scope; } - public function isBrowsable() + public function isBrowsable(): bool { if (\in_array( $this->status, @@ -2885,6 +1300,7 @@ public function isBrowsable() MemberStatusType::BUGGY, MemberStatusType::BANNED, MemberStatusType::REJECTED, + MemberStatusType::PASSED_AWAY, MemberStatusType::DUPLICATE_SIGNED, ], true @@ -2911,7 +1327,7 @@ public function isExpired(): bool public function isBanned(): bool { - return (MemberStatusType::BANNED === $this->status) ? true : false; + return MemberStatusType::BANNED === $this->status; } public function isDeniedAccess(): bool @@ -2921,7 +1337,7 @@ public function isDeniedAccess(): bool public function isNotConfirmedYet(): bool { - return (MemberStatusType::AWAITING_MAIL_CONFIRMATION === $this->status) ? true : false; + return MemberStatusType::AWAITING_MAIL_CONFIRMATION === $this->status; } public function isFirstnameShown(): bool @@ -2938,10 +1354,7 @@ public function getFirstnameOrUsername(): string return $this->username; } - /** - * @return array - */ - public function getLanguageLevels() + public function getLanguageLevels(): array { return array_filter( $this->languageLevels->toArray(), @@ -2958,10 +1371,7 @@ function (/** @var MembersLanguagesLevel */ $k) { ); } - /** - * @return array - */ - public function getSkilledLanguageLevels() + public function getSkilledLanguageLevels(): array { $criteria = Criteria::create()->where(Criteria::expr()->orX( Criteria::expr()->neq('level', LanguageLevelType::BEGINNER), @@ -2972,10 +1382,7 @@ public function getSkilledLanguageLevels() ->toArray(); } - /** - * @return $this - */ - public function addLanguageLevel(MembersLanguagesLevel $level) + public function addLanguageLevel(MembersLanguagesLevel $level): self { if (!$this->languageLevels->contains($level)) { $this->languageLevels->add($level); @@ -2985,10 +1392,7 @@ public function addLanguageLevel(MembersLanguagesLevel $level) return $this; } - /** - * @return $this - */ - public function removeLanguageLevel(MembersLanguagesLevel $level) + public function removeLanguageLevel(MembersLanguagesLevel $level): self { if ($this->languageLevels->contains($level)) { $this->languageLevels->removeElement($level); @@ -2998,10 +1402,7 @@ public function removeLanguageLevel(MembersLanguagesLevel $level) return $this; } - /** - * @return array - */ - public function getLanguages() + public function getLanguages(): array { return array_map( function ($level) { @@ -3011,10 +1412,7 @@ function ($level) { ); } - /** - * @return MemberPreference - */ - public function getMemberPreference(Preference $preference) + public function getMemberPreference(Preference $preference): MemberPreference { // Check if member has preference $criteria = Criteria::create()->where(Criteria::expr()->eq('preference', $preference)); @@ -3030,10 +1428,7 @@ public function getMemberPreference(Preference $preference) return $memberPreference; } - /** - * @return string - */ - public function getMemberPreferenceValue(Preference $preference) + public function getMemberPreferenceValue(Preference $preference): string { $value = $preference->getDefaultValue(); @@ -3053,9 +1448,10 @@ public function getMemberPreferenceValue(Preference $preference) * * @ORM\PrePersist */ - public function onPrePersist() + public function onPrePersist(): void { $this->created = new DateTime('now'); + $this->updated = $this->created; } /** @@ -3068,20 +1464,22 @@ public function onPreUpdate() $this->updated = new DateTime('now'); } - /** - * @return Language - */ - public function getPreferredLanguage() + public function getPreferredLanguage(): ?Language + { + return $this->preferredLanguage; + } + + public function initializePreferredLanguage(EntityManagerInterface $entityManager): void { // Get preference for locale - $preferenceRepository = $this->em->getRepository(Preference::class); + $preferenceRepository = $entityManager->getRepository(Preference::class); /** @var Preference $preference */ $preference = $preferenceRepository->findOneBy([ 'codename' => Preference::LOCALE, ]); $languageId = $this->getMemberPreferenceValue($preference); - $languageRepository = $this->em->getRepository(Language::class); + $languageRepository = $entityManager->getRepository(Language::class); /** @var Language $language */ $language = $languageRepository->findOneBy([ 'id' => $languageId, @@ -3094,37 +1492,7 @@ public function getPreferredLanguage() ]); } - return $language; - } - - public function setPreferredLanguage(Language $language): self - { - // Get current preference if any - $preferenceRepository = $this->em->getRepository(Preference::class); - /** @var Preference $preference */ - $preference = $preferenceRepository->findOneBy(['codename' => Preference::LOCALE]); - if (null === $preference) { - return $this; - } - - $memberPreferenceRepository = $this->em->getRepository(MemberPreference::class); - /** @var MemberPreference $memberPreference */ - $memberPreference = $memberPreferenceRepository->findOneBy(['preference' => $preference, 'member' => $this]); - - if ($memberPreference) { - $memberPreference->setValue($language->getId()); - } else { - $memberPreference = new MemberPreference(); - $memberPreference - ->setMember($this) - ->setPreference($preference) - ->setValue($language->getId()) - ; - } - $this->em->persist($memberPreference); - $this->em->flush(); - - return $this; + $this->preferredLanguage = $language; } /** @@ -3159,110 +1527,81 @@ public function removePreference(MemberPreference $preference): self } /** - * Provides an array collection of all translated items of a profile. - * - * Needs to be called explicitly - * - * @Groups({"Member:Read"}) + * @ORM\PostLoad */ - public function getMemberFields(): array + public function postLoad(PostLoadEventArgs $args) { - if (null === $this->memberFields) { - $memberTranslationRepository = $this->em->getRepository(MemberTranslation::class); - /** @var MemberTranslation[] $memberTranslations */ - $memberTranslations = $memberTranslationRepository->findBy(['owner' => $this]); - - $memberFields = []; - foreach ($memberTranslations as $memberTranslation) { - $tableColumn = $memberTranslation->getTablecolumn(); - if ('members.' !== substr($tableColumn, 0, 8)) { - continue; - } - $tableColumn = str_ireplace('members.', '', $tableColumn); - - $memberFields[$memberTranslation->getLanguage()->getShortCode()][$tableColumn] = $memberTranslation->getSentence(); - } - - // Normalize array: make sure for all locales all fields are set, use first locale as fallback for the other - $fallback = array_key_first($memberFields); - $fields = [ - 'Occupation', - 'ILiveWith', - 'MaxLenghtOfStay', - 'MotivationForHospitality', - 'Offer', - 'Organizations', - 'AdditionalAccomodationInfo', - 'OtherRestrictions', - 'InformationToGuest', - 'Hobbies', - 'Books', - 'Music', - 'Movies', - 'PleaseBring', - 'OfferGuests', - 'OfferHosts', - 'PublicTransport', - 'PastTrips', - 'PlannedTrips', - 'ProfileSummary', - ]; - - foreach (array_keys($memberFields) as $locale) { - foreach ($fields as $field) { - if (!isset($memberFields[$locale][$field])) { - // Check if field exists in fallback locale - if (isset($memberFields[$fallback][$field])) { - $memberFields[$locale][$field] = $memberFields[$fallback][$field]; - } else { - // Hack. Set field to empty value and make sure it is also set for next next locale - $memberFields[$fallback][$field] = ''; - $memberFields[$locale][$field] = ''; - } - } - } - } - $this->memberFields = $memberFields; - } + $entityManager = $args->getObjectManager(); - return $this->memberFields; - } - - public function getPhoneNumbers() - { - $phoneNumbers = [ - 'HomePhoneNumber' => $this->getCryptedField('HomePhoneNumber'), - 'CellPhoneNumber' => $this->getCryptedField('CellPhoneNumber'), - 'WorkPhoneNumber' => $this->getCryptedField('WorkPhoneNumber'), - ]; + $this->initializeMemberFields($entityManager); - return $phoneNumbers; + $this->initializePreferredLanguage($entityManager); } /** - * @Groups({"Member:Read"}) + * Provides an array of all translated items of a profile. + * + * Is called when a member is loaded from the database (adds a penalty) */ - public function getMessengers() + public function initializeMemberFields(EntityManagerInterface $entityManager): array { - $messengers = [ - 'GOOGLE' => $this->getCryptedField('chat_GOOGLE'), - 'SKYPE' => $this->getCryptedField('chat_SKYPE'), - 'Others' => $this->getCryptedField('chat_Others'), + $memberTranslationRepository = $entityManager->getRepository(MemberTranslation::class); + /** @var MemberTranslation[] $memberTranslations */ + $memberTranslations = $memberTranslationRepository->findBy(['owner' => $this]); + + $memberFields = []; + foreach ($memberTranslations as $memberTranslation) { + $tableColumn = $memberTranslation->getTableColumn(); + if ('members.' !== substr($tableColumn, 0, 8)) { + continue; + } + $tableColumn = str_ireplace('members.', '', $tableColumn); + + $memberFields[$memberTranslation->getLanguage()->getShortCode()][$tableColumn] = $memberTranslation->getSentence(); + } + + // Normalize array: make sure for all locales all fields are set, use first locale as fallback for the other + $fallback = array_key_first($memberFields); + $fields = [ + 'Occupation', + 'ILiveWith', + 'MaxLenghtOfStay', + 'MotivationForHospitality', + 'Offer', + 'Organizations', + 'AdditionalAccomodationInfo', + 'OtherRestrictions', + 'InformationToGuest', + 'Hobbies', + 'Books', + 'Music', + 'Movies', + 'PleaseBring', + 'OfferGuests', + 'OfferHosts', + 'PublicTransport', + 'PastTrips', + 'PlannedTrips', + 'ProfileSummary', ]; - return $messengers; - } + foreach (array_keys($memberFields) as $locale) { + foreach ($fields as $field) { + if (!isset($memberFields[$locale][$field])) { + // Check if field exists in fallback locale + if (isset($memberFields[$fallback][$field])) { + $memberFields[$locale][$field] = $memberFields[$fallback][$field]; + } else { + // Hack. Set field to empty value and make sure it is also set for next next locale + $memberFields[$fallback][$field] = ''; + $memberFields[$locale][$field] = ''; + } + } + } + } + $this->memberFields = $memberFields; - /** - * Injects responsible ObjectManager and the ClassMetadata into this persistent object. - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @return void - */ - public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata) - { - $this->em = $objectManager; + return $this->memberFields; } public function getRegistrationKey(): string @@ -3270,10 +1609,7 @@ public function getRegistrationKey(): string return $this->registrationKey; } - /** - * @return Member - */ - public function setRegistrationKey(string $registrationKey): self + public function setRegistrationKey(?string $registrationKey): self { $this->registrationKey = $registrationKey; @@ -3295,6 +1631,10 @@ public function getCountry(): ?NewLocation */ public function getAge(): int { + if (null === $this->birthdate) { + return 0; + } + $birthday = $this->getBirthdate(); return $birthday->diffInYears(); @@ -3340,4 +1680,32 @@ public function getPasswordHasherName(): ?string return null; } + + public function getRelations(): Collection + { + return $this->relations; + } + + public function addRelation(Relation $relation): self + { + if (!$this->relations->contains($relation)) { + $this->relations[] = $relation; + $relation->setOwner($this); + } + + return $this; + } + + public function removeRelation(Relation $relation): self + { + if ($this->relations->contains($relation)) { + $this->relations->removeElement($relation); + + if ($relation->getOwner() === $this) { + $relation->setOwner(null); + } + } + + return $this; + } } diff --git a/src/EventListener/AuthListener.php b/src/EventListener/AuthListener.php index e704ae0fb6..090edf3afc 100644 --- a/src/EventListener/AuthListener.php +++ b/src/EventListener/AuthListener.php @@ -6,6 +6,7 @@ use App\Entity\Member; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Contracts\Translation\TranslatorInterface; /** * Listens for interactive login to set the member status to active in case the login was done from an OutOfRemind or @@ -13,8 +14,7 @@ */ class AuthListener { - /** @var EntityManagerInterface */ - private $entityManager; + private EntityManagerInterface $entityManager; public function __construct(EntityManagerInterface $entityManager) { @@ -25,12 +25,10 @@ public function onAuthenticationSuccess(InteractiveLoginEvent $event) { /** @var Member $member */ $member = $event->getAuthenticationToken()->getUser(); - if (MemberStatusType::ACTIVE !== $member->getStatus() && MemberStatusType::CHOICE_INACTIVE !== $member->getStatus()) { + if (MemberStatusType::OUT_OF_REMIND === $member->getStatus()) { $member->setStatus(MemberStatusType::ACTIVE); + $this->entityManager->persist($member); + $this->entityManager->flush(); } - $member->setRemindersWithOutLogin(100); - - $this->entityManager->persist($member); - $this->entityManager->flush(); } } diff --git a/src/EventListener/UserLocaleListener.php b/src/EventListener/UserLocaleListener.php index 4b9b3db504..4ef7bf02f9 100644 --- a/src/EventListener/UserLocaleListener.php +++ b/src/EventListener/UserLocaleListener.php @@ -8,6 +8,7 @@ use Doctrine\ORM\EntityManagerInterface; use PVars; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\AcceptHeader; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; @@ -18,23 +19,16 @@ */ class UserLocaleListener implements EventSubscriberInterface { - /** - * @var Session - */ - protected $session; - - /** - * @var EntityManager - */ - private $em; + private EntityManagerInterface $entityManager; + private array $locales; /** * UserLocaleListener constructor. */ - public function __construct(SessionInterface $session, EntityManagerInterface $em) + public function __construct(EntityManagerInterface $entityManager, array $locales) { - $this->session = $session; - $this->em = $em; + $this->entityManager = $entityManager; + $this->locales = $locales; } /** @@ -43,29 +37,34 @@ public function __construct(SessionInterface $session, EntityManagerInterface $e public function onInteractiveLogin(InteractiveLoginEvent $event) { $request = $event->getRequest(); + $session = $request->getSession(); /** @var Member $user */ $user = $event->getAuthenticationToken()->getUser(); $language = $user->getPreferredLanguage(); - if ($language) { - $locale = $language->getShortCode(); - } else { - $locale = $this->session->get('_locale', 'en'); - $languageRepository = $this->em->getRepository(Language::class); + if (null === $language) { + $language = $request->getPreferredLanguage($this->locales); + + // \todo: Search for a matching language in the list of UI languages + + $languageRepository = $this->entityManager->getRepository(Language::class); $language = $languageRepository->findOneBy([ - 'shortCode' => $locale, + 'shortCode' => $language, ]); + $locale = (null === $language) ? 'en' : $language->getShortCode(); + } else { + $locale = $language->getShortCode(); } PVars::register('lang', $locale); $request->setLocale($locale); - $this->session->set('IdLanguage', $language->getId()); - $this->session->set('_locale', $locale); - $this->session->set('lang', $locale); + $session->set('IdLanguage', $language->getId()); + $session->set('_locale', $locale); + $session->set('lang', $locale); } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ SecurityEvents::INTERACTIVE_LOGIN => 'onInteractiveLogin', diff --git a/src/EventSubscriber/AuthenticationEventSubscriber.php b/src/EventSubscriber/AuthenticationEventSubscriber.php index 2df049176f..595c4f869e 100644 --- a/src/EventSubscriber/AuthenticationEventSubscriber.php +++ b/src/EventSubscriber/AuthenticationEventSubscriber.php @@ -76,7 +76,7 @@ public function onKernelResponse(ResponseEvent $event) $member->setLastLogin(new DateTime()); $status = $member->getStatus(); - if (MemberStatusType::CHOICE_INACTIVE !== $status) { + if (MemberStatusType::OUT_OF_REMIND === $status) { $member->setStatus(MemberStatusType::ACTIVE); } diff --git a/src/Form/SignupFormFinalizeType.php b/src/Form/SignupFormFinalizeType.php new file mode 100644 index 0000000000..01b74afd2a --- /dev/null +++ b/src/Form/SignupFormFinalizeType.php @@ -0,0 +1,143 @@ +translator = $translator; + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('name', TextType::class, [ + 'label' => 'label.name', + 'attr' => [ + 'placeholder' => 'placeholder.name', + ], + 'help' => 'help.name', + 'required' => false, + 'constraints' => [ + new NotBlank([ + 'message' => 'error.name', + ]), + ], + ]) + ->add('birthdate', DateType::class, [ + 'label' => 'label.birthdate', + 'attr' => [ + 'placeholder' => 'placeholder.birthdate', + 'class' => 'js-datepicker o-input', + ], + 'help' => 'help.birthdate', + 'widget' => 'single_text', + 'html5' => false, + 'required' => false, + 'constraints' => [ + new NotBlank([ + 'message' => 'error.birthdate', + ]), + ], + ]) + ->add('gender', ChoiceType::class, [ + 'label' => 'label.gender', + 'expanded' => true, + 'multiple' => false, + 'help' => 'help.gender', + 'choices' => [ + $this->translator->trans('male') => 'male', + $this->translator->trans('female') => 'female', + $this->translator->trans('other') => 'other', + ], + 'required' => false, + 'constraints' => [ + new NotNull([ + 'message' => 'error.gender', + ]), + ], + ]) + ->add('location', SetLocationType::class, [ + 'attr' => [ + 'class' => 'js-location-picker', + ], + 'error_bubbling' => true, + 'help' => 'help.location', + ]) + ->add('accommodation', ChoiceType::class, [ + 'label' => 'label.accommodation', + 'expanded' => true, + 'multiple' => false, + 'help' => 'help.accommodation', + 'choices' => [ + $this->translator->trans('accommodation.no') => AccommodationType::NO, + $this->translator->trans('accommodation.yes') => AccommodationType::YES, + ], + 'required' => false, + 'constraints' => [ + new NotNull([ + 'message' => 'error.accommodation', + ]), + ], + ]) + ->add('hosting_interest', RangeType::class, [ + 'label' => 'label.hosting_interest', + 'help' => 'help.hosting_interest', + 'required' => false, + 'attr' => [ + 'min' => 0, + 'max' => 10, + ], + ]) + ->add('newsletters', CheckboxType::class, [ + 'label' => 'signup.label.newsletters', + 'required' => false + ]) + ->add('local_events', CheckboxType::class, [ + 'label' => 'signup.label.local_events', + 'required' => false + ]) + ->add('trips_notifications', ChoiceType::class, [ + 'label' => 'label.trips_notifications', + 'help' => 'help.trips_notifications', + 'expanded' => false, + 'multiple' => false, + 'choices' => [ + $this->translator->trans('trips.never') => 'never', + $this->translator->trans('trips.immediately') => 'immediately', + $this->translator->trans('trips.daily') => 'daily', + $this->translator->trans('trips.weekly') => 'weekly', + $this->translator->trans('trips.biweekly') => 'biweekly', + $this->translator->trans('trips.monthly') => 'monthly', + ], + 'required' => false, + ]) + ; + } +} diff --git a/src/Form/SignupFormType.php b/src/Form/SignupFormType.php new file mode 100644 index 0000000000..145d53f306 --- /dev/null +++ b/src/Form/SignupFormType.php @@ -0,0 +1,90 @@ +usernamePattern = $usernamePattern; + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('username', TextType::class, [ + 'label' => 'label.username', + 'attr' => [ + 'placeholder' => 'placeholder.username', + ], + 'help' => 'help.username', + 'help_html' => true, + 'required' => false, + 'constraints' => [ + new NotBlank([ + 'message' => 'signup.error.username', + ]), + new Regex($this->usernamePattern, 'signup.error.username.pattern'), + ], + ]) + ->add('email', EmailType::class, [ + 'label' => 'label.email', + 'attr' => [ + 'placeholder' => 'placeholder.email', + ], + 'help' => 'help.email', + 'required' => false, + 'constraints' => [ + new NotBlank([ + 'message' => 'signup.error.email.blank', + ]), + new Email() + ], + ]) + ->add('password', PasswordType::class, [ + 'label' => 'label.password', + 'attr' => [ + 'placeholder' => 'placeholder.password', + ], + 'help' => 'help.password', + 'required' => false, + 'constraints' => [ + new NotBlank([ + 'message' => 'signup.error.password.blank', + ]), + new Length(['min' => 6]), + ], + ]) + ->add('terms_privacy', CheckboxType::class, [ + 'label' => 'signup.label.terms', + 'label_html' => true, + 'help' => 'help.terms', + 'mapped' => false, + 'required' => false, + 'constraints' => [ + new IsTrue([ + 'message' => 'signup.error.terms_privacy' + ]), + ], + ]) + ; + } +} diff --git a/src/Model/SignupModel.php b/src/Model/SignupModel.php new file mode 100644 index 0000000000..c81e1d1947 --- /dev/null +++ b/src/Model/SignupModel.php @@ -0,0 +1,201 @@ +entityManager = $entityManager; + $this->passwordHasherFactory = $passwordHasherFactory; + $this->mailer = $mailer; + $this->translator = $translator; + } + + public function createAccount(array $signupData, ?string $locale): Member + { + $member = new Member(); + $member->setStatus(MemberStatusType::AWAITING_MAIL_CONFIRMATION); + $member->setUsername($signupData['username']); + $member->setEmail($signupData['email']); + + $nanoClient = new Client(); + $member->setRegistrationKey($nanoClient->generateId(16, Client::MODE_DYNAMIC)); + + $passwordHasher = $this->passwordHasherFactory->getPasswordHasher($member); + $hashedPassword = $passwordHasher->hash($signupData['password']); + + $member->setPassword($hashedPassword); + + $this->entityManager->persist($member); + $this->entityManager->flush(); + + $preference = $this->entityManager->getRepository(Preference::class)->findOneBy([ + 'codename' => Preference::LOCALE + ]); + + $memberPreference = new MemberPreference(); + $memberPreference + ->setMember($member) + ->setPreference($preference) + ->setValue($locale) + ; + + $this->entityManager->persist($memberPreference); + $this->entityManager->flush(); + + $member->initializePreferredLanguage($this->entityManager); + + $parameters = [ + 'subject' => 'signup.confirm.email', + 'username' => $signupData['username'], + 'email_address' => $signupData['email'], + 'key' => $member->getRegistrationKey(), + ]; + + $this->mailer->sendSignupEmail($member, 'signup', $parameters); + + return $member; + } + + public function updateMember(Member $member, array $data): void + { + $location = $this->entityManager->getRepository(NewLocation::class)->findOneBy([ + 'geonameId' => $data['location']['geoname_id'] + ]); + + $member + ->setCity($location) + ->setLatitude($data['location']['latitude']) + ->setLongitude($data['location']['longitude']) + ->setFirstName($data['name']) + ->setBirthdate($data['birthdate']) + ->setGender($data['gender']) + ->setAccommodation($data['accommodation']) + ->setHostingInterest($data['hosting_interest'] ?? null) + ->setShowGender(false) + ->setShowAge(false) + ; + + if (MemberStatusType::MAIL_CONFIRMED === $member->getStatus()) { + $member->setStatus(MemberStatusType::ACTIVE); + } else { + $member->setStatus(MemberStatusType::ACCOUNT_ACTIVATED); + } + + $this->entityManager->persist($member); + + $address = new Address(); + $address + ->setMember($member) + ->setLocation($location) + // Set next ones to 0 as the are not set to have a default NULL value in the current database + ->setHouseNumber(0) + ->setExplanation(0) + ->setGettingThere(0) + ->setStreetName(0) + ->setRank(1) + ->setZip(0) + ; + + $memberRepository = $this->entityManager->getRepository(Member::class); + $admin = $memberRepository->findOneBy(['username' => 'bwadmin']); + if (null !== $admin) { + $firstMessage = new Message(); + $subject = new Subject(); + $subjectText = $this->translator->trans('signup.welcome.subject', ['username' => $member->getUsername()]); + $subject->setSubject($subjectText); + $messageText = $this->translator->trans('signup.welcome.body', ['username' => $member->getUsername()]); + $firstMessage + ->setSubject($subject) + ->setMessage($messageText) + ->setReceiver($member) + ->setSender($admin) + ; + + $this->entityManager->persist($subject); + $this->entityManager->persist($firstMessage); + } + + $this->entityManager->persist($address); + + $newsletterValue = $data['newsletters'] ? 'Yes' : 'No'; + $preference = $this->entityManager->getRepository(Preference::class)->findOneBy([ + 'codename' => Preference::NEWSLETTERS_VIA_EMAIL + ]); + + $newsletterPreference = new MemberPreference(); + $newsletterPreference + ->setMember($member) + ->setPreference($preference) + ->setValue($newsletterValue) + ; + $this->entityManager->persist($newsletterPreference); + + $localeEventsValue = $data['local_events'] ? 'Yes' : 'No'; + $preference = $this->entityManager->getRepository(Preference::class)->findOneBy([ + 'codename' => Preference::LOCAL_EVENT_NOTIFICATIONS + ]); + + $localEventsPreference = new MemberPreference(); + $localEventsPreference + ->setMember($member) + ->setPreference($preference) + ->setValue($localeEventsValue) + ; + $this->entityManager->persist($localEventsPreference); + + $this->entityManager->flush(); + } + + public function checkUsername(string $username): bool + { + $memberRepository = $this->entityManager->getRepository(Member::class); + $member = $memberRepository->findOneBy(['username' => $username]); + + if (null !== $member) { + return false; + } + + return true; + } + + public function checkEmailAddress(string $email): bool + { + $memberRepository = $this->entityManager->getRepository(Member::class); + $member = $memberRepository->findOneBy(['email' => $email]); + + if (null !== $member) { + return false; + } + + return true; + } +} diff --git a/src/Repository/ActivityRepository.php b/src/Repository/ActivityRepository.php index 7b6228f557..c3b8a90311 100644 --- a/src/Repository/ActivityRepository.php +++ b/src/Repository/ActivityRepository.php @@ -96,6 +96,10 @@ public function queryProblematicActivities() */ public function findUpcomingAroundLocation(Member $member, $online, $limit = 5) { + if (null === $member->getCity()) { + return []; + } + $qb = $this->getUpcomingAroundLocationQueryBuilder($member, $online); $query = $qb @@ -113,6 +117,10 @@ public function findUpcomingAroundLocation(Member $member, $online, $limit = 5) */ public function getUpcomingAroundLocationCount(Member $member, $online): int { + if (null === $member->getCity()) { + return 0; + } + $qb = $this->getUpcomingAroundLocationQueryBuilder($member, $online); $qb ->select('count(a.id) AS cnt') @@ -145,7 +153,7 @@ private function getActivitiesRadius(Member $member) * * @return QueryBuilder */ - private function getUpcomingAroundLocationQueryBuilder(Member $member, $online) + private function getUpcomingAroundLocationQueryBuilder(Member $member, $online): ?QueryBuilder { $location = $member->getCity(); $distance = $this->getActivitiesRadius($member); diff --git a/src/Repository/ForumPostRepository.php b/src/Repository/ForumPostRepository.php index 79b49d9f52..103547cc44 100644 --- a/src/Repository/ForumPostRepository.php +++ b/src/Repository/ForumPostRepository.php @@ -22,7 +22,7 @@ public function getForumPostsByMemberCount(Member $member): int ; } - public function getForumPostsByMember(Member $member, string $search, int $page, int $itemsPerPage = 20): PagerFanta + public function getForumPostsByMember(Member $member, string $search, int $page, int $itemsPerPage): PagerFanta { $queryBuilder = $this->getForumPostsByMemberQueryBuilder($member); if (!empty($search)) { diff --git a/src/Repository/MemberRepository.php b/src/Repository/MemberRepository.php index 1bd53a8e48..f7cd2cb222 100644 --- a/src/Repository/MemberRepository.php +++ b/src/Repository/MemberRepository.php @@ -73,7 +73,8 @@ public function loadUserByUsername(string $username) public function findByProfileInfo($term) { return $this->createQueryBuilder('u') - ->where('u.username like :term OR u.email like :term') + ->where('u.username like :term') + ->orWhere('u.email like :term') ->setParameter('term', '%' . $term . '%') ->setMaxResults(20) ->getQuery() diff --git a/src/Repository/SubtripRepository.php b/src/Repository/SubtripRepository.php index 8e87ef4648..c88b3627bf 100644 --- a/src/Repository/SubtripRepository.php +++ b/src/Repository/SubtripRepository.php @@ -28,7 +28,7 @@ public function getVisitorsCount(Member $member, int $distance = 20, int $durati $queryBuilder ->select('count(s.id)') ->andWhere('t.countOfTravellers <= :maxguest') - ->setParameter(':maxguest', $member->getMaxguest()) + ->setParameter(':maxguest', $member->getMaxGuest()) ; return @@ -43,7 +43,7 @@ public function getLegsInAreaMaxGuests(Member $member, int $distance = 20, int $ $queryBuilder = $this->getLegsInAreaQueryBuilder($member, $distance, $duration); $queryBuilder ->andWhere('t.countOfTravellers <= :maxguest') - ->setParameter(':maxguest', $member->getMaxguest()) + ->setParameter(':maxguest', $member->getMaxGuest()) ->setMaxResults(5) ; diff --git a/src/Routing/LegacyLoader.php b/src/Routing/LegacyLoader.php index 1e80fcb961..97e8b74ee2 100644 --- a/src/Routing/LegacyLoader.php +++ b/src/Routing/LegacyLoader.php @@ -98,21 +98,8 @@ public function load($resource, string $type = null) $this->addRouteDirectly('group_user_all', '/members/{username}/groups'); $this->addRouteDirectly('group_add_related_group', '/groups/{groupId}/selectrelatedgroup'); $this->addRouteDirectly('group_invite_member', '/groups/{groupId}/invitemembers/search'); - $this->addRouteDirectly('signup', '/signup'); - $this->addRouteDirectly('signup_1', '/signup/1'); - $this->addRouteDirectly('signup_2', '/signup/2'); - $this->addRouteDirectly('signup_3', '/signup/3'); - $this->addRouteDirectly('signup_4', '/signup/4'); - $this->addRouteDirectly('signup_email_check', '/signup/checkemail'); - $this->addRouteDirectly('signup_handle_check', '/signup/checkhandle'); - $this->addRouteDirectly('deleteprofile', '/deleteprofile'); $this->addRouteDirectly('editmyprofile', '/editmyprofile'); $this->addRouteDirectly('editmyprofile_locale', '/editmyprofile/{locale}'); - $this->addRouteDirectly('donate', '/donate'); - $this->addRouteDirectly('donate_list', '/donate/list'); - $this->addRouteDirectly('donate_cancel', '/donate/cancel'); - $this->addRouteDirectly('donate_done', '/donate/done'); - $this->addRouteDirectly('donate_notify', '/donate/notify'); $this->addRouteDirectly('gallery_show_user', '/gallery/show/user/{username}'); $this->addRouteDirectly('gallery_show_user_images', '/gallery/show/user/{username}/pictures'); $this->addRouteDirectly('gallery_show_user_images_pages', '/gallery/show/user/{username}/pictures/=page{pageNo}'); diff --git a/src/Twig/Extension.php b/src/Twig/Extension.php index 16e20c35d7..0a4f885f7b 100644 --- a/src/Twig/Extension.php +++ b/src/Twig/Extension.php @@ -173,15 +173,9 @@ public function truncate(string $text, int $length = 100, string $ellipsis = '&# */ public function urlUpdate(string $text): string { - $text = preg_replace( - '/src="http[s]?:\/\/[^\/]*?bewelcome\.org\//i', - 'src="/', - $text - ); - return preg_replace( - '/href="http[s]?:\/\/[^\/]*?bewelcome\.org\//i', - 'href="/', + '/(src|href)="http[s]?:\/\/(www|beta)\.bewelcome\.org\//i', + '$1="/', $text ); } diff --git a/templates/about/feedback.received.html.twig b/templates/about/feedback.received.html.twig index 22a5f990b8..da298cca8c 100644 --- a/templates/about/feedback.received.html.twig +++ b/templates/about/feedback.received.html.twig @@ -11,7 +11,6 @@

{{ 'feedbackdisclaimer' | trans | purify | nl2br }}

-

{{ 'feedback.thank.you'|trans }}

{{ 'feedback.send.more' | trans }}

diff --git a/templates/admin/comment/overview.html.twig b/templates/admin/comment/overview.html.twig index 1ffd25f8eb..dda4ed91dd 100644 --- a/templates/admin/comment/overview.html.twig +++ b/templates/admin/comment/overview.html.twig @@ -33,9 +33,9 @@ {{ macros.avatarstack(comment.fromMember.Username, 50) }} {{ 'comment.quality' | trans }}
- {{ ('CommentQuality_' ~ comment.Quality) | lower | trans }} ({{ 'written' | trans }} {{ comment.created }}{% if comment.created != comment.updated %} — {{ 'updated' | trans }} {{ comment.updated }}{% endif %})
+ {{ ('CommentQuality_' ~ comment.Quality) | lower | trans }} ({{ 'written' | trans }} {{ comment.created }}{% if not comment.updated is null and comment.created != comment.updated %} — {{ 'updated' | trans }} {{ comment.updated }}{% endif %})
{{ 'comment.text' | trans }}
- {{ comment.TextFree | nl2br }}
+ {{ comment.TextFree | nl2br }}
{{ 'comment.know' | trans }}
{% set relations = comment.relations | split(',') %} {% for relation in relations %}{{ ('profile.comment.relation.' ~ relation) | lower | trans({'username': comment.toMember.Username}) }} {% endfor %} diff --git a/templates/base-lite.html.twig b/templates/base-lite.html.twig index d3f05816b1..dd764b79dd 100644 --- a/templates/base-lite.html.twig +++ b/templates/base-lite.html.twig @@ -1,6 +1,6 @@ {% import 'macros.twig' as macros %} - + @@ -26,7 +26,8 @@ {{ encore_entry_link_tags('bewelcome') }} {{ encore_entry_link_tags('tailwind') }} - + {% block stylesheets %}{% endblock %} +