Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsWikiWikiSupport for handling XML code content -  Bug & Solution ProposedSupport for handling XML code content - Bug & Solution Proposed
Previous
 
Next
New Post
6/15/2009 2:46 AM
 

For technical articles, it's often useful to be able to have html code in the wiki content.   However, I noticed that the WIKI doesn't support xml content in the body.  I figured out the html contents were being htmlDecoded and re-encoded in this routine:

        Private Function FilterStrings(ByVal strInput As String) As String
            'setup up list of search terms as items may be used twice
            Dim TempInput As String = strInput
            Dim listStrings As New List(Of String)
            listStrings.Add("<script[^>]*>.*?</script[^><]*>")
...

           listStrings.Add(" ")
            listStrings.Add("alert[\s(&nbsp;)]*\([\s(&nbsp;)]*'?[\s(&nbsp;)]*[""(&quot;)]?")

            Dim options As RegexOptions = RegexOptions.IgnoreCase Or RegexOptions.Singleline
            Dim strReplacement As String = " "

            'check if text contains encoded angle brackets, if it does it we decode it to check the plain text
            If TempInput.Contains("&gt;") = True And TempInput.Contains("&lt;") = True Then
                'text is encoded, so decode and try again
                TempInput = HttpContext.Current.Server.HtmlDecode(TempInput)
                For Each s As String In listStrings
                    TempInput = Regex.Replace(TempInput, s, strReplacement, options)
                Next

                'Re-encode
                TempInput = HttpContext.Current.Server.HtmlEncode(TempInput)

The problem with this is it converts content like this:

<html><body>
&lt;myCode&gt;
HelloWorld();
&lt;myCode&gt
</body></html>

into content like this:


<html><body>
<myCode>
HelloWorld();
</myCode>
</body></html>

The data is then decoded and stored away.  When it's later loaded back up, the myCode part will never be escaped properly.    As a simple solution, I just removed the NoScripting flag like such:

        Private Sub SaveAndContinue()
            Dim objSec As New DotNetNuke.Security.PortalSecurity
            'SaveTopic(objSec.InputFilter(HttpUtility.HtmlDecode(Me.teContent.Text), DotNetNuke.Security.PortalSecurity.FilterFlag.NoScripting).Replace("iframe", ""), Me.AllowDiscuss.Checked, Me.AllowRating.Checked)
            'HttpUtility.HtmlDecode(objSec.InputFilter(Me.teContent.Text, PortalSecurity.FilterFlag.NoScripting))
            SaveTopic(Me.teContent.Text, _
                      Me.AllowDiscuss.Checked, _
                      Me.AllowRating.Checked, _
                      objSec.InputFilter(Me.txtTitle.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup), _
                      objSec.InputFilter(Me.txtDescription.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup), _
                      objSec.InputFilter(Me.txtKeywords.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup) _
                      )
        End Sub

My thoughts are this looks like a bug in the InputFiltering routine of DNN.   The sample presented obviously doesn't have any script, but yet the routine produces an unwanted side affect.   Some other workaround solution might be to have a module setting to allow what type of content are allowed in the wiki.

 

 

 
New Post
6/18/2009 10:50 AM
 

This is especially annoying when you are trying to use the Wiki for almost exclusively technical articles.  Any bug fix in quick patch would be gratefully received (I'm not keen to fish around in the DNN source!).

 
New Post
6/21/2009 1:44 AM
 

This is fixed in the next release. I'll try to get it moving in the next couple of weeks. You can get the code from Codeplex and build it yourself if you wish for an immediate fix.


Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsWikiWikiSupport for handling XML code content -  Bug & Solution ProposedSupport for handling XML code content - Bug & Solution Proposed


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out