# FILE: src-board-subs-5 # Copyright (c) 1998, Kevin W. Paulisse and William F. Polik, all rights reserved # Licensed under the Discus license agreement # http://www.chem.hope.edu/discus #---SEPARATOR---# #REQ:extract_colorsonly sub preview_admin_message { local ($message_source, $message_formatted, $username, $referer, $action, $mtitle) = @_; &header; print "Preview of $mtitle\n"; print "\n"; ($bgcolor, $text, $link, $vlink, $alink, $face, $size, $img) = &extract_colorsonly; print "$fs\n"; print "
Preview of $mtitle
\n
\n"; if ($mtitle eq "About Message") { local (@array) = ("$topic_number:$topic_name"); foreach $key (sort by_number keys(%level_number)) { push (@array, "$level_number{$key}:$level_name{$key}"); } print "Page Manager: \n"; foreach $line (@array) { ($number,$name) = split(/:/, $line, 2); print ""; print "$name"; print ": \n"; } } elsif ($mtitle eq "Main Message") { print "Board Manager: "; } print "Preview of $mtitle\n"; print "

\n"; print "A preview of your message appears below. If you used any "; print "formatting tags in your message, please check to see that your "; print "formatting is displayed correctly in the preview.

\n"; print "\n"; print "
$message_formatted"; print "

\n"; print "


Revise $mtitle

\n"; print "
"; print "
\n"; print "

\n\n"; print "\n"; print "\n"; print "\n"; print "\n" if $message_formatted !~ /

FORMATTING/i; print "\n" if $referer; print "

\n"; exit(0); } #---SEPARATOR---# sub change_about_message { local ($file, $source, $formatted) = @_; local (@file, $messageflag, $line, $source_esc, $topic, $page); if ($file =~ m|/(\d+)/(\d+)\.$ext|) { ($topic, $page) = ($1, $2); } else { &error_message("Change About Message Error", "Could not open requested file"); } &lock("$message_dir/$topic/$page.$ext"); local ($head, $color, $lm, $sublist, $about, $about_src, $message, $message_src) = &get_page($topic, $page); &set_page($topic, $page, $head, $color, $lm, $sublist, $formatted, &escape($source), $message, $message_src); &unlock("$message_dir/$topic/$page.$ext"); } #---SEPARATOR---# #REQ:recurse sub remove_page { local ($topic_number, $parent, $page_number) = @_; local ($pn, @pn, @lines, $line, $filename, $filenumber, @ps); @pn = split(/,/, $page_number); foreach $pn (@pn) { $pn =~ s/^0//g; } &lock("$message_dir/$topic_number/$parent.$ext"); local ($head, $color, $lm, $sublist, $about, $about_src, $message, $message_src) = &get_page($topic_number, $parent); @lines = split(/\n/, $sublist); foreach $line (@lines) { $filenumber = "-NONE-"; $filenumber = $1 if $line =~ m||; $filenumber = $1 if $line =~ m||; if (grep(/^$filenumber$/, @pn)) { $line = ""; push (@ps, $filenumber); } } $sublist = join("\n", grep(/\S/, @lines)); &set_page($topic_number, $parent, $head, $color, $lm, $sublist, $about, $about_src, $message, $message_src); &unlock("$message_dir/$topic_number/$parent.$ext"); foreach $filenumber (@ps) { &recurse ($topic_number, $filenumber, "delete"); } } #---SEPARATOR---# #REQ:get_date_time sub move_page { local ($old_topic, $page_number, $old_parent, $new_topic, $new_parent) = @_; &lock("$message_dir/$old_topic/$old_parent.$ext"); local ($head1, $color1, $lm1, $sublist1, $about1, $about_src1, $message1, $message_src1) = &get_page($old_topic, $old_parent); local (@temp, $headstr, $nextkey, $owner, $line, $param, @tomove, $temp, @pn); local ($t1, $t2, $t3); undef @message_move_move_page; @pn = split(/,/, $page_number); @temp = split(/\n/, $sublist1); foreach $line (@temp) { $line =~ m||; $temp = $2; if (grep(/^$temp$/, @pn)) { push (@tomove, $line) if ($old_topic != $new_topic || $old_parent != $new_parent); $line = ""; } } $sublist1 = join("\n", grep(/\S/, @temp)); &set_page($old_topic, $old_parent, $head1, $color1, $lm1, $sublist1, $about1, $about_src1, $message1, $message_src1); &unlock("$message_dir/$old_topic/$old_parent.$ext"); &lock("$message_dir/$new_topic/$new_parent.$ext"); local ($head2, $color2, $lm2, $sublist2, $about2, $about_src2, $message2, $message_src2) = &get_page($new_topic, $new_parent); if ($new_topic != $old_topic) { foreach $line (@tomove) { $line =~ s|/messages/$old_topic/(\d+).$ext|/messages/$new_topic/$1.$ext|g; } } $sublist2 .= join("\n", @tomove); @temp = split(/\n/, $head2); foreach $line (@temp) { if ($line =~ m||) { $owner = $1; } elsif ($line =~ m||) { ($t1, $t2, $t3) = ($1, $2, $3); $headstr .= "$line\n"; $nextkey = $t1; } elsif ($line =~ m||) { $param = $1; } } $nextkey += 1; &set_page($new_topic, $new_parent, $head2, $color2, $lm2, $sublist2, $about2, $about_src2, $message2, $message_src2); &unlock("$message_dir/$new_topic/$new_parent.$ext"); foreach $line (@tomove) { if ($line =~ m||) { ®enerate_pages($headstr, $old_topic, $1, "", $owner, $new_topic, $nextkey, $new_parent); } } if (scalar(@message_move_move_page)) { local (@LOG); &lock("$admin_dir/log.txt"); open (LOG, "$admin_dir/log.txt"); @LOG = ; close (LOG); local ($indx, $who, $when, $where, $rest); foreach $line (@LOG) { ($indx, $who, $when, $where, $rest) = split(/;/, $line, 5); if (grep(/^$indx$/, @message_move_move_page)) { ($tpc, $page) = split(/\//, $where); $line = join(";", $indx, $who, $when, "$new_topic/$page", $rest); } } open (LOG, ">$admin_dir/log.txt"); print LOG @LOG; close (LOG); &unlock("$admin_dir/log.txt"); } } sub regenerate_pages { local ($headstr, $topic, $page, $additional, $owner, $new_topic, $nextkey, $parent) = @_; &lock("$message_dir/$topic/$page.$ext"); local ($head1, $color1, $lm1, $sublist1, $about1, $about_src1, $message1, $message_src1) = &get_page($topic, $page); local ($line, @head, $newhead, $me_name, $param, $me_number); @head = split(/\n/, $head1); foreach $line (@head) { if ($line =~ m||) { ($me_number, $me_name) = ($1, $2); } elsif ($line =~ m||) { $param = $1; } } $newhead = $headstr; $newhead .= $additional; $newhead .= "\n"; $additional .= "\n"; $nextkey += 1; $newhead .= "\n"; $newhead .= "\n"; $newhead .= "\n"; $newhead .= "\n"; local ($numb, $exten, @msg); @msg = split(/\n/, $message1); if ($new_topic != $topic) { foreach $line (@msg) { while ($line =~ m|$html_dir/messages/$new_topic/$numb.$exten"); eval 'binmode(FILE_D);'; while () { print FILE_D; } close (FILE_D); close (FILE_S); unlink ("$html_dir/messages/$topic/$numb.$exten"); $line =~ s||) { push (@message_move_move_page, $1); } } } $message1 = join("\n", @msg); &set_page($new_topic, $page, $newhead, $color1, $lm1, $sublist1, $about1, $about_src1, $message1, $message_src1); &unlock("$message_dir/$topic/$page.$ext"); @msg = split(/\n/, $sublist1); foreach $line (@msg) { if ($line =~ m||) { $numb = $1; if ($new_topic != $topic) { $line =~ s|$html_url/messages/$topic/(\d+).$ext|$html_url/messages/$new_topic/$1.$ext|; } ®enerate_pages($headstr, $topic, $numb, $additional, $owner, $new_topic, $nextkey, $me_number); } } $sublist1 = join("\n", @msg); if ($new_topic != $topic) { unlink ("$html_dir/messages/$topic/$page.$ext"); } } #---SEPARATOR---# #REQ:extract_colorsonly sub printuntil { local ($start, $finish, $topic_number, $title, $flag) = @_; if (open (FILEx, "$html_dir/messages/$topic_number/newpage.txt")) { @file = ; close (FILEx); } else { open (FILExx, "$admin_dir/newpage.txt"); @file = ; close (FILExx); } $cpos = 0; eval '($bgcolor, $text, $link, $vlink, $alink, $face, $size, $image) = &extract_colorsonly;' if $flag == 0; foreach $line (@file) { while ($line =~ /\$(\w+)/) { $this = eval "\$$1"; $line = $` . $this . $'; } } foreach $line (@file) { if ($line =~ m||) { $cpos = 1; } elsif ($line =~ m||) { $cpos = 2; } elsif ($line =~ m||) { $cpos = 3; } elsif ($line =~ m||) { $cpos = 4; } elsif ($line =~ m||) { $cpos = 5; } elsif ($line =~ m||) { $cpos = 6; } elsif ($line =~ m||) { $cpos = 7; } elsif ($line =~ m||) { $cpos = 8; } elsif ($line =~ m||) { $cpos = 9; } elsif ($line =~ m||) { $cpos = 10; } elsif ($line =~ m||) { $cpos = 11; } elsif ($line =~ m||) { $cpos = 12; } elsif ($line =~ m||) { $cpos = 13; } elsif ($line =~ m||) { $cpos = 14; } elsif ($line =~ m||) { $cpos = 15; } elsif ($line =~ m|| && $cpos == 16) { $cpos = 17; } elsif ($line =~ m|= $start && $cpos <= $finish) { print $line; } } } #---SEPARATOR---# sub passwd_success { &header; print "Password Changed\n"; print "$fs
Password Changed

"; print 'You must select "Log In Again" and log in with your new password!'; }