close(MAIN);
open(MAIN,">$basedir/$mesgfile") || die $!;
if ($followup == 0) {
foreach $main_line (@main) {
if ($main_line =~ //) {
print MAIN "\n";
print MAIN "
print MAIN "(0)\n";
print MAIN "
- \n";
print MAIN "
}
else {
print MAIN "$main_line";
}
}
}
else {
foreach $main_line (@main) {
$work = 0;
if ($main_line =~ /
- /) {
-
href=\"$mesgdir/$num\.$ext\">$subject - $name $date\n";
print MAIN "(0)\n";
print MAIN "- \n";
print MAIN "
}
elsif ($main_line =~ /\((.*)\)/) {
$response_num = $1;
$num_responses = $2;
$num_responses++;
foreach $followup_num (@followup_num) {
if ($followup_num == $response_num) {
print MAIN "($num_responses)\n";
$work = 1;
}
}
if ($work != 1) {
print MAIN "$main_line";
}
}
else {
print MAIN "$main_line";
}
}
}
close(MAIN);
}
############################################
# Add Followup Threading to Individual Pages
sub thread_pages {
foreach $followup_num (@followup_num) {
open(FOLLOWUP,"$basedir/$mesgdir/$followup_num\.$ext");
@followup_lines =;
close(FOLLOWUP);
open(FOLLOWUP,">$basedir/$mesgdir/$followup_num\.$ext");
foreach $followup_line (@followup_lines) {
$work = 0;
if ($followup_line =~ /- /) {
-
href=\"$num\.$ext\">$subject $name $date\n";
print FOLLOWUP "(0)\n";
print FOLLOWUP "- \n";
print FOLLOWUP "
}
elsif ($followup_line =~ /\((.*)\)/) {
$response_num = $1;
$num_responses = $2;
$num_responses++;
foreach $followup_num (@followup_num) {
if ($followup_num == $response_num) {
print FOLLOWUP "($num_responses)\n";
$work = 1;
}
}
if ($work != 1) {
print FOLLOWUP "$followup_line";
}
}
else {
print FOLLOWUP "$followup_line";
}
}
close(FOLLOWUP);
}
}
sub return_html {
print "Content-type: text/html\n\n";
print "Message Added: $subject \n";
print "
\n";Message Added: $subject
print "The following information was added to the message board:
size=7 width=75%>\n";
print "Name: $name
\n";
print "E-Mail: $email
\n";
print "Subject: $subject
\n";
print "Body of Message:\n";
print "$body\n";
if ($message_url) {
print "Link: href=\"$message_url\">$message_url_title
\n";
}
if ($message_img) {
print "Image:
\n";
}
print "Added on Date: $date\n";
print "
\n";
print "[ Go to Your \n";
Message ] [ $title ]
print "
}
sub increment_num {
open(NUM,">$basedir/$datafile") || die $!;
print NUM "$num";
close(NUM);
}
sub error {
$error = $_[0];
print "Content-type: text/html\n\n";
if ($error eq 'no_name') {
print "$title ERROR: No Name \n";
print "
\n";ERROR: No Name
print "You forgot to fill in the 'Name' field in your posting.
Correct it below and re-submit. The necessary fields are: Name, Subject
and Message.\n";
&rest_of_form;
}
elsif ($error eq 'no_subject') {
print "$title ERROR: No Subject \n";
print "
\n";ERROR: No Subject
print "You forgot to fill in the 'Subject' field in your posting.
Correct it below and re-submit. The necessary fields are: Name, Subject
and Message.\n";
&rest_of_form;
}
elsif ($error eq 'no_body') {
print "$title ERROR: No Message \n";
print "
\n";ERROR: No Message
print "You forgot to fill in the 'Message' fieldin your posting.
Correct it below and re-submit. The necessary fields are: Name, Subjectand
Message.\n";
&rest_of_form;
}
else {
print "ERROR! Undefined.\n";
}
exit;
}
sub rest_of_form {
print "
print FOLLOWUP "- \n";
print FOLLOWUP " -
href=\"$num\.$ext\">$subject $name $date\n";
print MAIN "
- \n";
print MAIN "