Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/Comics.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use strict;
use warnings;
use utf8;
use Carp;
use HTML::Entities;

package Comics;

Expand Down Expand Up @@ -457,7 +458,7 @@ sub statmsg {
for ( @{ $stats->{fail} } ) {
my $t = $_->[1];
$t =~ s/ at .*//s;
$res .= $_->[0] . " ($t)
";
$res .= encode_entities($_->[0]) . " ($t)
";
}
$res .= "\">$fail fail</span>";
}
Expand Down
22 changes: 14 additions & 8 deletions lib/Comics/Plugin/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ The tag is used to generate file names for images and HTML fragments.

=cut

use HTML::Entities;

sub register {
my ( $pkg, $init ) = @_;

Expand Down Expand Up @@ -114,24 +116,28 @@ sub html {

my $res =
qq{<table class="toontable" cellpadding="0" cellspacing="0">\n} .
qq{ <tr><td nowrap align="left" valign="top">} .
qq{<b>} . _html($self->{name}) . qq{</b><br>\n} .
qq{ <tr><td nowrap="1" align="left" valign="top">} .
qq{<b>} . _html($self->{name}) . qq{</b><br />\n} .
qq{ <font size="-2">Last update: } .
localtime($state->{update}) .
qq{</font><br><br></td>\n} .
qq{</font><br /><br /></td>\n} .
qq{ </tr>\n <tr><td><a href="$self->{url}?$::uuid">} .
qq{<img class="toonimage" };

# Alt and title are extracted from HTML, so they should be
# properly escaped.
$res .= qq{alt="} . $state->{c_alt} . qq{" }
if $state->{c_alt};
$res .= qq{title="} . $state->{c_title} . qq{" }
if $state->{c_title};
if (my $alt = $state->{c_alt}) {
$alt = encode_entities($alt);
$res .= qq{alt="} . $alt . qq{" }
}
if (my $ttl = $state->{c_title}) {
$ttl = encode_entities $ttl);
$res .= qq{title="} . $ttl . qq{" }
}
$res .= qq{width="$w" height="$h" }
if $w && $h;

$res .= qq{src="$state->{c_img}"></a></td>\n </tr>\n</table>\n};
$res .= qq{src="$state->{c_img}" /></a></td>\n </tr>\n</table>\n};

return $res;
}
Expand Down