示例#1
0
        public static guidanceItem transform_into_guidanceItem(this TeamMentor_Article article)
        {
            if (article.isNull())
            {
                return(null);
            }
            return(new guidanceItem()
            {
                id = article.Metadata.Id.str(),
                id_original = article.Metadata.Id_History,
                title = article.Metadata.Title,

                Technology = article.Metadata.Technology,
                phase = article.Metadata.Phase,
                Category = article.Metadata.Category,
                Rule_Type = article.Metadata.Type,

                content = article.Content.Data.Value
            });
        }
示例#2
0
        //this causes  double encoding problems with some properties (like the Title on Html Editor) , but removing it opens up more XSS on other viewers (like the Table)
        public static TeamMentor_Article htmlEncode(this TeamMentor_Article article)
        {
            if (article.isNull())
            {
                return(null);
            }
            var metaData = article.Metadata;

            foreach (var prop in metaData.type().properties())
            {
                if (prop.PropertyType == typeof(string))
                {
                    var value = (string)metaData.prop(prop.Name);
                    metaData.prop(prop.Name, Encoder.HtmlEncode(value));
                }
            }
            if (TMConfig.Current.SanitizeHtmlContent)
            {
                article.Content.Data.Value = Sanitizer.GetSafeHtmlFragment(article.Content.Data.Value);
                article.Content.Sanitized  = true;
            }

            return(article);
        }