From 245816508f6503bf7dc207cfdd9980b16f0e963e Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:13:09 +0300 Subject: [PATCH] add maxlength --- Web/Presenters/UserPresenter.php | 10 ++++++++-- Web/Presenters/templates/User/Edit.xml | 4 ++-- Web/static/js/al_wall.js | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 41c2db1e..dc8fb02c 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -315,12 +315,18 @@ final class UserPresenter extends OpenVKPresenter \openvk\Web\Models\Entities\UserInfoEntities\AdditionalField::resetByOwner($this->user->id); foreach($items as $new_field_info) { + $name = ovk_proc_strtr($new_field_info["name"], 50); + $text = ovk_proc_strtr($new_field_info["text"], 1000); + if(ctype_space($name) || ctype_space($text)) { + continue; + } + $place = (int)($new_field_info["place"]); $new_field = new \openvk\Web\Models\Entities\UserInfoEntities\AdditionalField; $new_field->setOwner($this->user->id); - $new_field->setName(ovk_proc_strtr($new_field_info["name"], 50)); - $new_field->setText(ovk_proc_strtr($new_field_info["text"], 1000)); + $new_field->setName($name); + $new_field->setText($text); $new_field->setPlace([0, 1][$place] ? $place : 0); $new_field->save(); diff --git a/Web/Presenters/templates/User/Edit.xml b/Web/Presenters/templates/User/Edit.xml index 163ea6a2..0cc70a63 100644 --- a/Web/Presenters/templates/User/Edit.xml +++ b/Web/Presenters/templates/User/Edit.xml @@ -400,7 +400,7 @@ {_additional_field_name}