From 842c911000388bdccb5bd25ffef18b42477329c4 Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Mon, 13 Jan 2014 18:07:18 +0700 Subject: [PATCH] fix fields --- .../modules/topic/entity/TopicType.entity.class.php | 12 ++++++++++++ .../skin/developer/forms/form.add.content.tpl | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/application/classes/modules/topic/entity/TopicType.entity.class.php b/application/classes/modules/topic/entity/TopicType.entity.class.php index 1e2de2fc..698ca6cd 100644 --- a/application/classes/modules/topic/entity/TopicType.entity.class.php +++ b/application/classes/modules/topic/entity/TopicType.entity.class.php @@ -32,8 +32,20 @@ class ModuleTopic_EntityTopicType extends Entity { array('name, name_many','string','max'=>200,'min'=>1,'allowEmpty'=>false), array('code','regexp','pattern'=>"#^[a-z0-9_]{1,30}$#",'allowEmpty'=>false), array('code','code_unique'), + array('name','check_name'), + array('name_many','check_name_many'), ); + public function ValidateCheckName() { + $this->setName(htmlspecialchars($this->getName())); + return true; + } + + public function ValidateCheckNameMany() { + $this->setNameMany(htmlspecialchars($this->getNameMany())); + return true; + } + public function ValidateCodeUnique() { if ($oType=$this->Topic_GetTopicTypeByCode($this->getCode())) { if ($oType->getId()!=$this->getId()) { diff --git a/application/frontend/skin/developer/forms/form.add.content.tpl b/application/frontend/skin/developer/forms/form.add.content.tpl index 8ad0fa2c..d34fe88c 100644 --- a/application/frontend/skin/developer/forms/form.add.content.tpl +++ b/application/frontend/skin/developer/forms/form.add.content.tpl @@ -65,7 +65,7 @@ {* Заголовок топика *} {include file='forms/fields/form.field.text.tpl' sFieldName = 'topic[topic_title]' - sFieldValue = {($oTopicEdit) ? $oTopicEdit->getTitle() : '' } + sFieldValue = {(($oTopicEdit) ? $oTopicEdit->getTitle() : '')|escape:'html' } sFieldEntityField = 'topic_title' sFieldEntity = 'ModuleTopic_EntityTopic' sFieldNote = $aLang.topic_create_title_notice @@ -79,7 +79,7 @@ {* TODO: Max length for poll and link *} {include file='forms/fields/form.field.textarea.tpl' sFieldName = 'topic[topic_text_source]' - sFieldValue = {($oTopicEdit) ? $oTopicEdit->getTextSource() : '' } + sFieldValue = {(($oTopicEdit) ? $oTopicEdit->getTextSource() : '')|escape:'html' } sFieldRules = 'required="true" rangelength="[2,'|cat:$oConfig->Get('module.topic.max_length')|cat:']"' sFieldLabel = $aLang.topic_create_text sFieldClasses = 'width-full js-editor'} @@ -96,7 +96,7 @@ {* Теги *} {include file='forms/fields/form.field.text.tpl' sFieldName = 'topic[topic_tags]' - sFieldValue = {($oTopicEdit) ? $oTopicEdit->getTags() : '' } + sFieldValue = {(($oTopicEdit) ? $oTopicEdit->getTags() : '')|escape:'html' } sFieldRules = 'required="true" rangetags="[1,15]"' sFieldNote = $aLang.topic_create_tags_notice sFieldLabel = $aLang.topic_create_tags