Changeset 1172

Show
Ignore:
Timestamp:
2007-12-04 13:26:38 (8 months ago)
Author:
fredck
Message:

Fixed #294 : The HtmlEncodeOutput setting is enforced by the editor component, to avoid having to set ValidateRequest="false" on pages using the editor.

Location:
FCKeditor.Net/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor.Net/trunk/FCKeditorConfigurations.cs

    r1167 r1172  
    7070                        } 
    7171 
     72                        // To avoid the "A potentially dangerous Request.Form value was 
     73                        // detected from the client" error, forcing developers to set 
     74                        // validateRequest=false in their pages, we are forcing 
     75                        // HtmlEncodeOutput to "true", if not defined. (#294) 
     76                        if ( !_Configs.Contains( "HtmlEncodeOutput" ) ) 
     77                        { 
     78                                if ( osParams.Length > 0 ) 
     79                                        osParams.Append( "&" ) ; 
     80 
     81                                osParams.Append( "HtmlEncodeOutput=true" ) ; 
     82                        } 
     83 
    7284                        return osParams.ToString() ; 
    7385                } 
  • FCKeditor.Net/trunk/FCKeditor.cs

    r1167 r1172  
    321321                } 
    322322 
     323                [Category( "Configurations" )] 
     324                public bool HtmlEncodeOutput 
     325                { 
     326                        set { this.Config[ "HtmlEncodeOutput" ] = ( value ? "true" : "false" ); } 
     327                } 
     328 
    323329                #endregion 
    324330 
     
    446452                public bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection) 
    447453                { 
    448                         if ( postCollection[postDataKey] != this.Value ) 
    449                         { 
    450                                 this.Value = postCollection[postDataKey] ; 
     454                        string postedValue = postCollection[postDataKey] ; 
     455 
     456                        // Revert the HtmlEncodeOutput changes. 
     457                        if ( this.Config["HtmlEncodeOutput"] != "false" ) 
     458                        { 
     459                                postedValue = postedValue.Replace( "&", "&" ) ; 
     460                                postedValue = postedValue.Replace( "&lt;", "<" ) ; 
     461                                postedValue = postedValue.Replace( "&gt;", ">" ) ; 
     462                        } 
     463 
     464                        if ( postedValue != this.Value ) 
     465                        { 
     466                                this.Value = postedValue ; 
    451467                                return true ; 
    452468                        } 
  • FCKeditor.Net/trunk/_whatsnew.html

    r1165 r1172  
    5252                        the <strong>FCKeditor.CreateHtml</strong> function, which returns the HTML needed 
    5353                        to create an editor instance in the page.</li> 
     54                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/294">#294</a>] The HtmlEncodeOutput 
     55                        setting is enforced by the editor component, to avoid having to set ValidateRequest="false" on pages using the editor.</li> 
    5456        </ul> 
    5557        <p>