[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-153-g87270c3

Thomas Sibley trs at bestpractical.com
Thu Oct 14 15:25:21 EDT 2010


The branch, 3.9-trunk has been updated
       via  87270c317484ff14092dca3e4af3307962837296 (commit)
      from  61bd854089880aae80acc5d567647a9b2e7c3856 (commit)

Summary of changes:
 share/html/NoAuth/js/util.js |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 87270c317484ff14092dca3e4af3307962837296
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Oct 14 15:16:21 2010 -0400

    Fix an HTML encoding bug with the rich text editor
    
    The code to HTML encode the textarea content before handing it to
    FCKeditor was commented out.  This was introduced by
    22703a517b17e3b12929dfe78eb6d592cad1e73c, which was only supposed to
    move the Javascript from <head> to util.js.

diff --git a/share/html/NoAuth/js/util.js b/share/html/NoAuth/js/util.js
index 827b8fd..6cfe2db 100644
--- a/share/html/NoAuth/js/util.js
+++ b/share/html/NoAuth/js/util.js
@@ -258,13 +258,21 @@ function ReplaceAllTextareas(encoded) {
         var textArea = allTextAreas[i];
         if (jQuery(textArea).hasClass("messagebox")) {
             // Turn the original plain text content into HTML
-            // if (encoded == 0) textArea.value = textArea.value .replace( /&/g, "&amp;") .replace( /</g, "&lt;") .replace( />/g, "&gt;") .replace( /\n/g, "\n<br />");
+            if (encoded == 0) {
+                textArea.value = textArea.value
+                    .replace(/&/g,  "&amp;")
+                    .replace(/</g,  "&lt;")
+                    .replace(/>/g,  "&gt;")
+                    .replace(/\n/g, "\n<br />");
+            }
+            // For this javascript
             var FCKeditorEncoded = document.createElement('input');
             FCKeditorEncoded.setAttribute('type', 'hidden');
             FCKeditorEncoded.setAttribute('name', 'FCKeditorEncoded');
             FCKeditorEncoded.setAttribute('value', '1');
             textArea.parentNode.appendChild(FCKeditorEncoded);
 
+            // For fckeditor
             var typeField = document.createElement('input');
             typeField.setAttribute('type', 'hidden');
             typeField.setAttribute('name', textArea.name + 'Type');

-----------------------------------------------------------------------


More information about the Rt-commit mailing list