[Rt-commit] rt branch, 4.4/insert-raw-html-articles, created. rt-4.4.2-225-g20a561b0c

Maureen Mirville maureen at bestpractical.com
Thu May 3 09:41:56 EDT 2018


The branch, 4.4/insert-raw-html-articles has been created
        at  20a561b0cc9b647d28d89e9c9369660e36e02dd2 (commit)

- Log -----------------------------------------------------------------
commit 20a561b0cc9b647d28d89e9c9369660e36e02dd2
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Thu May 3 09:34:38 2018 -0400

    Add option to allow raw HTML to display in articles

diff --git a/share/html/Admin/Articles/Classes/Modify.html b/share/html/Admin/Articles/Classes/Modify.html
index ef3f50317..88ec3c552 100644
--- a/share/html/Admin/Articles/Classes/Modify.html
+++ b/share/html/Admin/Articles/Classes/Modify.html
@@ -92,6 +92,10 @@
     <input type="checkbox" id="Include-Summary" name="Include-Summary" value="1" <% $include{Summary} %>>
     <label for="Include-Summary"><&|/l&>Include article summary</&></label>
 </li>
+<li>
+     <input type="checkbox" id="Include-RawHTML" name="Include-RawHTML" value="1" <% $include{RawHTML} %>>
+     <label for="Include-RawHTML"><&|/l&>Allow raw HTML (potentially unsafe)</&></label>
+</li>
 % if ( $cfs ) {
 % while (my $cf = $cfs->Next) {
 <li><&|/l, $cf->Name &>Include custom field '[_1]'</&>
@@ -187,7 +191,7 @@ if ((defined $Enabled && $Enabled == 1) or (not defined $Enabled and $Create)) {
     $Disabled = 1;
 }
 
-my %include = (Name => 1, Summary => 1);
+my %include = (Name => 1, Summary => 1, RawHTML => 1);
 my $subject_cfs = [];
 my $subject_cf_labels = {};
 
diff --git a/share/html/Articles/Article/Elements/Preformatted b/share/html/Articles/Article/Elements/Preformatted
index 74e5af058..c8e38e86f 100644
--- a/share/html/Articles/Article/Elements/Preformatted
+++ b/share/html/Articles/Article/Elements/Preformatted
@@ -83,8 +83,9 @@
 %   }
 % }
 <%init>
+
 my $class = $Article->ClassObj;
-my %include = (Name => 1, Summary => 1);
+my %include = (Name => 1, Summary => 1, RawHTML => 1);
 my $cfs = $class->ArticleCustomFields;
 $include{"CF-Title-".$_->Id} = $include{"CF-Value-".$_->Id} = 1 while $_ = $cfs->Next;
 $include{$_} = not $class->FirstAttribute("Skip-$_") for keys %include;
@@ -102,6 +103,7 @@ my $get_content = sub {
         content => \$content,
     );
 
+return $content unless !$include{'RawHTML'};
     if ( $content =~ /<.{1,5}>/ ) {
         $content = RT::Interface::Email::ConvertHTMLToText( $content );
     }

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


More information about the rt-commit mailing list