diff --git a/docs/upgrades/upgrade_5.1.2-5.2.0.sql b/docs/upgrades/upgrade_5.1.2-5.2.0.sql index 7b0cc425a..a4a04293d 100644 --- a/docs/upgrades/upgrade_5.1.2-5.2.0.sql +++ b/docs/upgrades/upgrade_5.1.2-5.2.0.sql @@ -3338,6 +3338,10 @@ delete from international where languageId=1 and namespace='HttpProxy' and inter insert into international (internationalId,languageId,namespace,message,lastUpdated) values (9,1,'HttpProxy','Cookie Jar', 1047835842); delete from international where languageId=1 and namespace='HttpProxy' and internationalId=5; insert into international (internationalId,languageId,namespace,message,lastUpdated) values (5,1,'HttpProxy','Allow proxying of other domains?', 1047835817); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=891; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (891,1,'WebGUI','Only negate macros.', 1047838859); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=526; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (526,1,'WebGUI','Remove JavaScript and negate macros.', 1047838780); diff --git a/lib/WebGUI/HTML.pm b/lib/WebGUI/HTML.pm index 4c033d863..d5583f479 100644 --- a/lib/WebGUI/HTML.pm +++ b/lib/WebGUI/HTML.pm @@ -97,7 +97,7 @@ sub filter { if ($type eq "all") { $filter = HTML::TagFilter->new(allow=>{'none'},strip_comments=>1); $html = $filter->filter($_[0]); - return WebGUI::Macro::filter($html); + return WebGUI::Macro::negate($html); } elsif ($type eq "javascript") { $html = $_[0]; $html =~ s/\//ixsg; @@ -115,9 +115,9 @@ sub filter { $html =~ s/onKeyDown/removed/ixsg; $html =~ s/onSubmit/removed/ixsg; $html =~ s/onReset/removed/ixsg; - $html = WebGUI::Macro::filter($html); + $html = WebGUI::Macro::negate($html); } elsif ($type eq "macros") { - return WebGUI::Macro::filter($_[0]); + return WebGUI::Macro::negate($_[0]); } elsif ($type eq "none") { return $_[0]; } else { diff --git a/lib/WebGUI/Macro.pm b/lib/WebGUI/Macro.pm index f55ff8f48..a8476c57c 100644 --- a/lib/WebGUI/Macro.pm +++ b/lib/WebGUI/Macro.pm @@ -123,6 +123,29 @@ sub getParams { return @param; } +#------------------------------------------------------------------- + +=head2 negate ( html ) + +Nullifies all macros in this content segment. + +=over + +=item html + +A string of HTML to be processed. + +=back + +=cut + +sub negate { + my $html = $_[0]; + $html =~ s/\^/\&\#94\;/g; + return $html; +} + + #------------------------------------------------------------------- =head2 process ( html )