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} - +
@@ -411,7 +411,7 @@ {_additional_field_text} - + diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js index 6b1cfb35..e6229b28 100644 --- a/Web/static/js/al_wall.js +++ b/Web/static/js/al_wall.js @@ -2905,12 +2905,12 @@ u(document).on("click", "#additional_field_append", (e) => { ${tr("additional_field_name")} - +
${tr("additional_field_text")} - + ${tr("additional_field_place")}