X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FWeb%2FForum.pm;h=6b122c67e30122e36a8a11320db66388bb339179;hb=5bdf7f1c03127ec37bd29852ebc0279431ad93aa;hp=59b8625c0526382c657f5f4f2d1e70d1649fc49a;hpb=0de73d6e8744b300650b12edae899f6a865c58a8;p=ndwebbie.git diff --git a/ND/Web/Forum.pm b/ND/Web/Forum.pm index 59b8625..6b122c6 100644 --- a/ND/Web/Forum.pm +++ b/ND/Web/Forum.pm @@ -37,7 +37,7 @@ sub viewForumThread { $template->param(Id => $thread->{id}); $template->param(Post => $thread->{post}); - my $posts = $ND::DBH->prepare(q{SELECT u.username,date_trunc('minute',fp.time::timestamp) AS time,fp.message,COALESCE(fp.time > ftv.time,TRUE) AS unread + 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 WHERE ft.ftid = $1 ORDER BY fp.time ASC @@ -58,9 +58,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});