Bugzilla – Attachment 74113 Details for
Bug 12123
HTML notices can break the notice viewer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[ALTERNATIVE-PATCH] Bug 12123: Do not render HTML in notice viewer if invalid
Bug-12123-Do-not-render-HTML-in-notice-viewer-if-i.patch (text/plain), 2.28 KB, created by
Jonathan Druart
on 2018-04-12 16:16:32 UTC
(
hide
)
Description:
[ALTERNATIVE-PATCH] Bug 12123: Do not render HTML in notice viewer if invalid
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-04-12 16:16:32 UTC
Size:
2.28 KB
patch
obsolete
>From 029980b06e7b0038eb913107951605520d5ea5f4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 12 Apr 2018 13:15:00 -0300 >Subject: [PATCH] Bug 12123: Do not render HTML in notice viewer if invalid > >If a notice contains malformed HTML it should not be displayed. >--- > koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt | 8 +++++++- > members/notices.pl | 11 ++++++++++- > 2 files changed, 17 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >index fecf201ed5..0b4463da29 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >@@ -42,7 +42,13 @@ > <td> > <a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id %]" href="#">[% QUEUED_MESSAGE.subject %]</a> > <div id="notice[% QUEUED_MESSAGE.message_id %]" class="notice"> >- [% QUEUED_MESSAGE.content FILTER html_line_break %] >+ [% IF QUEUED_MESSAGE.malformed %] >+ <p style="color: red;">Note: This notice does not contain valid HTML elements.</p> >+ [% QUEUED_MESSAGE.content FILTER html_line_break FILTER html %] >+ [% ELSE %] >+ [% QUEUED_MESSAGE.content FILTER html_line_break %] >+ [% END %] >+ </code> > </div> > </td> > <td> >diff --git a/members/notices.pl b/members/notices.pl >index f307393b63..72ec5c8055 100755 >--- a/members/notices.pl >+++ b/members/notices.pl >@@ -20,9 +20,11 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >+use CGI qw ( -utf8 ); >+use XML::Simple; >+ > use C4::Auth; > use C4::Output; >-use CGI qw ( -utf8 ); > use C4::Members; > use C4::Letters; > use C4::Members::Attributes qw(GetBorrowerAttributes); >@@ -74,6 +76,13 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { > ); > } > >+for my $m ( @$queued_messages ) { >+ eval { XML::Simple->new->XMLin($m->{content}); }; >+ if ( $@ ) { >+ $m->{malformed} = 1; >+ } >+} >+ > $template->param( > patron => $patron, > QUEUED_MESSAGES => $queued_messages, >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12123
:
27402
|
27403
|
33863
|
33876
|
33882
|
33885
|
33888
|
33950
|
33976
|
73650
|
73758
|
74113
|
74169