Esempio n. 1
0
        public void SaveComment(CommentInfo comment)
        {
            var portalSecurity = new PortalSecurity();

            if (!String.IsNullOrEmpty(comment.Comment))
            {
                comment.Comment = HttpUtility.HtmlDecode(portalSecurity.InputFilter(comment.Comment, PortalSecurity.FilterFlag.NoScripting));
                comment.Comment = portalSecurity.InputFilter(comment.Comment, Security.PortalSecurity.FilterFlag.NoMarkup);
            }
            //TODO: enable once the profanity filter is working properly.
            //objCommentInfo.Comment = portalSecurity.Remove(objCommentInfo.Comment, DotNetNuke.Security.PortalSecurity.ConfigType.ListController, "ProfanityFilter", DotNetNuke.Security.PortalSecurity.FilterScope.PortalList);

            if (comment.Comment != null && comment.Comment.Length > 2000)
            {
                comment.Comment = comment.Comment.Substring(0, 1999);
            }
            string xml = null;

            if (comment.CommentXML != null)
            {
                xml = comment.CommentXML.OuterXml;
            }

            comment.CommentId = _dataService.Journal_Comment_Save(comment.JournalId, comment.CommentId, comment.UserId, comment.Comment, xml);
            var newComment = GetComment(comment.CommentId);

            comment.DateCreated = newComment.DateCreated;
            comment.DateUpdated = newComment.DateUpdated;
        }
        public void SaveComment(CommentInfo comment)
        {
            var portalSecurity = PortalSecurity.Instance;

            if (!String.IsNullOrEmpty(comment.Comment))
            {
                comment.Comment =
                    portalSecurity.InputFilter(comment.Comment, PortalSecurity.FilterFlag.NoScripting);
            }
            //TODO: enable once the profanity filter is working properly.
            //objCommentInfo.Comment = portalSecurity.Remove(objCommentInfo.Comment, DotNetNuke.Security.PortalSecurity.ConfigType.ListController, "ProfanityFilter", DotNetNuke.Security.PortalSecurity.FilterScope.PortalList);

            string xml = null;

            if (comment.CommentXML != null)
            {
                xml = comment.CommentXML.OuterXml;
            }

            comment.CommentId = _dataService.Journal_Comment_Save(comment.JournalId, comment.CommentId, comment.UserId, comment.Comment, xml, Null.NullDate);

            var newComment = GetComment(comment.CommentId);

            comment.DateCreated = newComment.DateCreated;
            comment.DateUpdated = newComment.DateUpdated;
        }