#!/usr/bin/perl use strict; #use lib 'C:\Inetpub\wwwroot\Sites\asp\echoingw\members\login.'; use lib '.'; use MyBoard; my ($msgid, $sth, $rv, $count, $msg, $resp); # untaint the query string if ($ENV{QUERY_STRING} =~ /^(\d+)$/) { $msgid = $1; } else { &dienice("$ENV{QUERY_STRING} isn't a valid message number."); } $sth = $dbh->prepare("select *, date_format(date, '%W, %M %e, %Y') as nicedate, date_format(date, '%l:%i %p') as nicetime from messages where (messages.id=? or thread_id=?) order by thread_id, date") or &dbdie; $rv = $sth->execute($msgid, $msgid); if ($rv < 1) { &dienice("Message $msgid does not exist."); } $msg = $sth->fetchrow_hashref; # if the FIRST message is a follow-up, redirect them to the entire # page for that message thread. if ($msg->{thread_id} != 0) { print $cgi->redirect("$url/message.cgi?$msg->{thread_id}#$msg->{id}"); exit; } &do_header("$btitle: $msg->{nicedate}: $msg->{subject}"); ## BEGIN HEADER PAGE CONTENT ## print qq(); &showpost($msg); $resp = 0; while ($msg = $sth->fetchrow_hashref) { if ($resp == 0) { print qq(Comments
\n);
$resp = 1;
}
&showpost($msg);
}
&do_footer;
sub showpost {
my($hdr);
my($msg) = @_;
# Ban Filter Curse.
# my($searchstr, $i);
# my(@searchstr) = "$msg->{message}";
# foreach $i (@searchstr) {
# chomp($i);
# $sth = $dbh->prepare("select curse from xcurse") or &dbdie;
# $rv = $sth->execute;
# while (my($curse) = $sth->fetchrow_array) {
# if ($i = $curse) {
# $msg->{message} =~ s/$curse/#!@%/ig;
# }
# }
# }
# Convert hard returns to line returns in post.
$msg->{message} =~ s/\r/
/g;
# Stip all HTML Tags and convert to &alt characters.
$msg->{message} =~ s/</g;
$msg->{message} =~ s/>/g;
# Convert
tag back to HTML.
$msg->{message} =~ s/<br/
{message} =~ s/>br/
{message} =~ s/\[i\]/\/g;
$msg->{message} =~ s/\[\/i\]/\<\/i>/g;
# Bold
$msg->{message} =~ s/\[b\]/\/g;
$msg->{message} =~ s/\[\/b\]/\<\/b>/g;
# Underline
$msg->{message}=~ s/\[u\]/\/g;
$msg->{message} =~ s/\[\/u\]/\<\/u>/g;
# Lists
$msg->{message}=~ s/\[ul\]/\/g; # ul tags
$msg->{message} =~ s/\[\/ul\]/\<\/ul>/g;
$msg->{message}=~ s/\[ol\]/\
/g; # ol tags
$msg->{message} =~ s/\[\/ol\]/\<\/ol>/g;
$msg->{message}=~ s/\[li\]/\
":""'eig;
$msg->{message} =~ s/\[img\]/\
{message} =~ s/\[\/img\]/\"\ border=\"0\">/g;
# Convert