X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FWeb%2FForum.pm;h=cbeb747083524a5240cb457af4c3867629b4b55c;hb=031327dbddb9665e0d5003dbc65d6956da9ea8b1;hp=1b06b8a6cbfff3b9aadfce60e79263d67ad054de;hpb=06830a05ebd5541e52f8ca4e421286c1313420c7;p=ndwebbie.git diff --git a/ND/Web/Forum.pm b/ND/Web/Forum.pm index 1b06b8a..cbeb747 100644 --- a/ND/Web/Forum.pm +++ b/ND/Web/Forum.pm @@ -25,8 +25,7 @@ use HTML::Template; use ND::Web::Include; require Exporter; -our @ISA = qw/Exporter/; - +our @ISA = qw/Exporter/; our @EXPORT = qw/viewForumThread addForumPost addForumThread markThreadAsRead/; sub viewForumThread { @@ -38,7 +37,7 @@ sub viewForumThread { $template->param(Post => $thread->{post}); my $posts = $ND::DBH->prepare(q{SELECT u.username,date_trunc('seconds',fp.time::timestamp) AS time,fp.message,COALESCE(fp.time > ftv.time,TRUE) AS unread -FROM forum_threads ft JOIN forum_posts fp USING (ftid) JOIN users u USING (uid) LEFT OUTER JOIN (SELECT * FROM forum_thread_visits WHERE uid = $2) ftv ON ftv.ftid = ft.ftid +FROM forum_threads ft JOIN forum_posts fp USING (ftid) JOIN users u ON u.uid = fp.uid LEFT OUTER JOIN (SELECT * FROM forum_thread_visits WHERE uid = $2) ftv ON ftv.ftid = ft.ftid WHERE ft.ftid = $1 ORDER BY fp.time ASC }); @@ -58,9 +57,13 @@ ORDER BY fp.time ASC my $text = parseMarkup(escapeHTML(param('message'))); $text .= p b $@ if $@; push @posts,{message => $text, unread => 1, username => 'PREVIEW', Time => 'Not submitted yet', NewPosts => $old ? 1 : 0}; + + $text = escapeHTML param('message'); + $text =~ s/\x{3}\d\d?//g; #mirc color TODO: possibly match until \x{0F} and change to [color] block + $text =~ s/[^\x{9}\x{A}\x{D}\x{20}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]//g; + $template->param(Message => $text); } $template->param(Posts => \@posts); - $template->param(Message => param('message')); markThreadAsRead($thread->{id});