diff --git a/lib/WebGUI/HTML.pm b/lib/WebGUI/HTML.pm index a23ab17a6..a7df86b3f 100644 --- a/lib/WebGUI/HTML.pm +++ b/lib/WebGUI/HTML.pm @@ -25,6 +25,7 @@ use WebGUI::Session; =head1 SYNOPSIS use WebGUI::HTML; + $html = WebGUI::HTML::cleanSegment($html); $html = WebGUI::HTML::filter($html); =head1 DESCRIPTION @@ -38,6 +39,33 @@ use WebGUI::Session; =cut +#------------------------------------------------------------------- + +=head2 cleanSegment ( html ) + + Returns an HTML segment that has been stripped of the tag + and anything before it, as well as the tag and anything + after it. + + NOTE: This filter does have one exception, it leaves anything before + the tag that is enclosed in tags. + +=item html + + The HTML segment you want cleaned. + +=cut + +sub cleanSegment { + my ($style, $value); + $value = $_[0]; + $value =~ m/(\)/ixsg; + $style = $1; + $value =~ s/\A.*?\(.*?)/$style$1/ixsg; + $value =~ s/(.*?)\<\/body\>.*?\z/$1/ixsg; + return $value; +} + #------------------------------------------------------------------- =head2 filter ( html [, filter ] ) diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm index 8540adaa3..04c6189f2 100644 --- a/lib/WebGUI/Wobject.pm +++ b/lib/WebGUI/Wobject.pm @@ -19,6 +19,8 @@ use DBI; use strict qw(subs vars); use Tie::IxHash; use WebGUI::DateTime; +use WebGUI::HTML; +use WebGUI::HTMLForm; use WebGUI::Icon; use WebGUI::International; use WebGUI::Macro; @@ -436,6 +438,7 @@ sub www_editSave { $templatePosition = $session{form}{templatePosition} || 'A'; $startDate = setToEpoch($session{form}{startDate}) || setToEpoch(time()); $endDate = setToEpoch($session{form}{endDate}) || setToEpoch(time()+315360000); + $session{form}{description} = WebGUI::HTML::cleanSegment($session{form}{description}); $_[0]->set({ title=>$title, displayTitle=>$session{form}{displayTitle},