# FILE: src-board-subs-8 #------------------------------------------------------------------------------- # This script is copyright (c) 1998 by DiscusWare, LLC, all rights reserved. # Its use is subject to the license agreement that can be found at the following # URL: http://www.chem.hope.edu/discus/license #------------------------------------------------------------------------------- #---SEPARATOR---# sub change_layout { local ($topic_number,$page_number, $param) = @_; &lock("$message_dir/$topic_number/$page_number.$ext"); local ($head, $color, $lm, $ann, $ann_src, $sublist, $about, $about_src, $message, $message_src) = &get_page($topic_number, $page_number); local (@head, $line); @head = split(/\n/, $head); foreach $line (@head) { if ($line =~ m|"; } } $head = join("\n", grep(/\S/, @head)); &set_page($topic_number, $page_number, $head, $color, $lm, $ann, $ann_src, $sublist, $about, $about_src, $message, $message_src); &unlock("$message_dir/$topic_number/$page_number.$ext"); } #---SEPARATOR---# sub options_mgr { &header; print "Options Manager\n"; print '$fs\n"; print "
Options Manager
\n"; print "
\n"; print "This screen allows you to set several parameters that apply to the\n"; print "entire board. To make a change effective, you must click the\n"; print ""Save Options" button at the bottom of this page.

\n"; print "

\n"; print "\n"; print "\n"; print "\n"; print "
$fs"; print "Activation of Scripts\n"; print "
\n"; print " Administration enabled
\n"; print " E-mail notification enabled"; print "
\n"; print " Posting enabled
\n"; print " Server is capable of sending e-mail messages"; print " (Configure)"; print "
\n"; if ($pro) { print " User self-registration enabled (Configure)
\n"; } print "
\n"; print "Conversation/Message Options\n"; print "
\n"; print " Activate URLs and e-mail addresses in posts
"; print " Allow posts as "Anonymous"
"; print " Capitalize first letter in user-created subject lines
"; if (!$pro) { print " Cookie option - remember username/password in cookies
"; } print " Double post protection (prevents duplicate postings)
"; print " E-mail addresses on posts
"; } else { print "> E-mail addresses/links to profile on posts
"; } print " Full names on posts
"; print " Icons () by posts"; if ($GLOBAL_OPTIONS{'message_icons'}) { $fl = 0; $fl = 1 if !($GLOBAL_OPTIONS{'message_icon_top'} || $GLOBAL_OPTIONS{'message_icon_up'} || $GLOBAL_OPTIONS{'message_icon_down'} || $GLOBAL_OPTIONS{'message_icon_bottom'} || $GLOBAL_OPTIONS{'message_icon_link'}); print "
    \n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
    $fs", "Top icon:
    $fs", "Up icon:
    $fs", "Down icon:
    $fs", "Bottom icon:
    $fs", "Link icon:
\n"; } else { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; } print " IP addresses on posts
"; print " Perform HTML to formatting tag conversion
\n"; if ($pro) { print " Perform RTF to formatting tag conversion
\n"; } print " Profanity checker (Edit word list)
\n"; print " Username in (parentheses) on posts
\n"; print " Users may change their passwords
\n"; if ($pro) { print " Users may edit their own posts within "; print " minutes
\n"; } print "
\n"; print "Image"; print " and Attachment" if $pro; print " Uploading Options\n"; print "
\n"; print " Image uploading"; print " and attachment uploading" if $pro; print " enabled

\n"; print "File size limits: (a value of \"0\" indicates no limit)

\n"; print "\n"; } else { print " VALUE=0>\n"; } print "$fs kb for public posters
\n"; print "\n"; } else { print " VALUE=0>\n"; } print "$fs kb for registered posters

\n"; print "

\n"; if ($pro) { &ex('ip_ban_form', 1); print "Log Analysis Configuration\n"; print "
The Log Analysis tool allows analysis of the server's access log\n"; print "to determine "reads" of pages. You must specify the name of your\n"; print "primary log file if you wish to analyze the access log. If you don't\n"; print "know where your server's primary log file is, ask your server administrator.\n"; print "If your server\n"; print "stores additional old log files, you can also specify those file names.

\n"; $g = $GLOBAL_OPTIONS{'access_log'}; if ($g ne "" && $g ne "0") { $g =~ s/\\/\//g; if ($g !~ m|^([\w\-\.\+\/\:]+)$|) { print "Warning! The current primary log filename is invalid!\n"; } elsif (!-e $g) { print "Warning! The currently specified primary log file does not exist!\n"; } elsif (!-r $g) { print "Warning! The currently specified primary log file is not readable!\n"; } } foreach $gl (keys(%GLOBAL_OPTIONS)) { if ($gl =~ m|^access_log|) { $GLOBAL_OPTIONS{$gl} = "" if $GLOBAL_OPTIONS{$gl} eq "0"; } } print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$fs", "Primary Log File:
$fs", "Old Log File #1:
$fs", "Old Log File #2:
$fs", "Old Log File #3:
$fs", "Old Log File #4:
\n"; print "

\n"; print "Mailing List Generation\n"; print "

\n"; print "

\n"; } print "Message Size Limits\n"; print "

\n"; print "This section allows you to limit the length of messages posted by your visitors.\n"; print "This option is presented mainly to protect against spammers. Keep in mind that\n"; print "1 kb = 1000 characters, or about 200 words.

\n"; print "Message size limits: (a value of \"0\" indicates no limit)

\n"; print "\n"; } else { print " VALUE=0>\n"; } print "$fs kb for public posters
\n"; print "\n"; } else { print " VALUE=0>\n"; } print "$fs kb for registered posters

\n"; print "

\n"; print "Order of Items\n"; print "
\n"; print "By default, when new subtopics or messages are added through the user interface, the new\n"; print "subtopic or message is added to the bottom of the list. You\n"; print "can reverse the order, which would cause the new subtopic or\n"; print "message to be added to the top of the list. You can also choose to\n"; print "automatically alphabetize the subtopic list.

\n"; print "\n"; print "\n"; print "\n"; print "\n"; open (FILE, "$message_dir/board-topics.html"); @lines = ; close(FILE); @rs = split(/,/, $GLOBAL_OPTIONS{'reverse_subs'}); @rm = split(/,/, $GLOBAL_OPTIONS{'reverse_msgs'}); @as = split(/,/, $GLOBAL_OPTIONS{'alphabet_subs'}); foreach $line (@lines) { $_ = $line; if (//) { $filename = "$message_dir/$1/$1.$ext"; $num = $1; &extract($filename); print "\n"; print "\n"; print "\n"; print "\n"; } } print "
$fsReverse
Subtopic
Order
$fsAlphabetize
Subtopic
Order
$fsReverse
Message
Order
$fsTopic
$fs$topic_name
\n"; print "

\n"; if ($pro) { print "Profiles\n"; print "
\n"; print "The following option allows you to configure the fields that are presented to users for their profile information.

\n"; print "

\n"; } print "Time Zone\n"; print "
\n"; print "Number of hours to add to or subtract from the time reported by the server.\n"; print "The current server time is "; ($dt) = &ex('get_date_time', "long", 0, 591); print "$dt. To add 3 hours to this time, you would enter "3" in the\n"; print "blank; to subtract 2 hours from this time, you would enter "-2"\n"; print "in the blank.

\n"; print "Hours to add/subtract from time: \n"; } else { print " VALUE=0>\n"; } print "

$fs

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

\n"; print "
\n"; exit(0); } #---SEPARATOR---# sub extract_lastmodified { local ($file) = @_; local ($topic_number, $filenum) = split(/:/, $file); local ($filename); $filename = "$message_dir/$topic_number/$filenum.$ext" if -e "$message_dir/$topic_number/$filenum.$ext"; $filename = "$secdir/$topic_number/$filenum.$ext" if !-e "$message_dir/$topic_number/$filenum.$ext"; $filename = "$message_dir/board-topics.html" if $filenum == 0; &lock($filename); local (@file, $line); open (FILELM, $filename); @file = ; close (FILELM); &unlock($filename); foreach $line (@file) { if ($line =~ //) { return $1; } } return ""; } #---SEPARATOR---# #REQ:extract_colorsonly sub prepare_navbar { local (@file) = @_; local ($line, $navstr, $type, $numb, $text, $topic_number, $javastr,$lastone); local ($bgcolor, $text, $link, $vlink, $alink, $face, $size, $image) = &extract_colorsonly; $navstr = "$title: "; foreach $line (@file) { $_ = $line; if (m|^|) { $type = $1; $numb = $4; $text = $5; $javastr = &JavaScript_prepare ($text); if ($type eq "Topic") { $topic_number = $numb; $file = "$topic_number/$topic_number.$ext"; $navstr .= ""; $navstr .= "$text"; $navstr .= ": "; $lastone = $text; } elsif ($type eq "Level") { $file = "$topic_number/$numb.$ext"; $navstr .= ""; $navstr .= "$text"; $navstr .= ": "; $lastone = $text; } } } chop ($navstr); chop ($navstr); while ($navstr !~ / $maxtest; } } if ($maxtest > 0) { @splits = split(/,/, $v6, $maxtest); } $sc = scalar(@splits); if ($v2 eq "link" || $v2 eq "topurl" || $v2 eq "newurl") { $splits[0] =~ s/\,/\%2C/g; $splits[0] =~ s/\+/\%2B/g; if ($splits[0] =~ m|<| || $splits[0] =~ m|>|) { $f = $L{NONESTHTML}; $f =~ s/\%code/$v2/g; return ("!Error", $f); } } if ($v2 eq "attach" || $v2 eq $L{ATTACH_TAG_NAME} || $v2 eq "image" || $v2 eq $L{IMAGE_TAG_NAME}) { $f = $L{NONESTHTML}; $f =~ s/\%code/$v2/g; return ("!Error", $f) if ($splits[0] =~ m|<| || $splits[0] =~ m|>|); } while ($temp =~ m%\|(\d+)\|%) { $temp = join("", $`, $splits[($1)-1], $'); } if ($sc < $maxtest) { $wnarg = $L{WRONGNUMBEROFARGUMENTS}; $wnarg =~ s/\%code/$v2/g; $wnarg =~ s/\%required/$maxtest/g; $wnarg =~ s/\%your/$sc/g; return ("!Error", "$wnarg"); } if ($v2 eq "table" || $v2 eq "tablenb" || $v2 eq $L{TABLE_TAG} || $v2 eq $L{TABLE_NB_TAG}) { if ($temp =~ m|\t|) { $temp =~ s%\t%%g; } else { $temp =~ s%,%%g; } $temp =~ s%
%%g; } elsif ($v2 eq "list" || $v2 eq $L{LIST_TAG}) { $temp =~ s%
%
  • %g; } $text_in = join("", $v1, $temp, $v7); } else { $sc = $L{CODEDOESNOTEXIST}; $sc =~ s/\%code/$v2/g; if ($v2 eq "attach" && !$pro) { $sc .= "

    $L{FEATURE_NOT_SUPPORTED_DESCR}\n"; } return ("!Error", "$sc"); } } return ($messages, $text_in); } sub escape_input { local ($stringin) = @_; $_ = $stringin; s/&/&/g; s//\>/g; s/"/"/g; s/\\\\/\/g; s/\\\{/{/g; s/\\\}/}/g; s/\\,/,/g; s/\(/(/g; s/\)/)/g; s/\[/[/g; s/\]/]/g; s/\*/*/g; s/\+/+/g; s/\|/|/g; s/'/'/g; s/\r\n/\n/g; s/\r/\n/g; s/\n/
    /g; return $_; } sub read_tags { local ($cont_code) = @_; undef %char; undef %tags; undef $str; open (WTCONF, "<$webtags_conf_file"); while () { next if /^#/; s/^\s*//; s/\s*$//; if ($str) { if (m|\\$|) { $str .= $`; } else { if ($cont =~ m|^[cC]|) { $char{$code} = join("", $str, $_); } elsif ($cont >= $cont_code) { $tags{$code} = join("", $str, $_); $str_ = $tags{$code}; while ($str_ =~ m|!VAR\((\w+)\)!|) { $before = $`; $after = $'; $f = $1; $f = "\$" . $f; $f =~ s/"/\\"/g; $result = eval qq/"$f"/; $str_ = $before . $result . $after; } $tags{$code} = $str_; } $str = ""; next; } } if (($cont, $code, $act) = m|^([cC0-9])\s*(\S+)\s*(.*)|) { if ($act =~ m|\\$|) { $str = $`; next; } $code = &escape_input($code); if ($cont =~ m|^[cC]|) { $char{$code} = $act; } elsif ($cont > $cont_code) { next if ($cont == 1 && $GLOBAL_OPTIONS{'images'} == 0 && $GLOBAL_OPTIONS{'options_used'} == 1); next if $code eq "attach" && !$pro; $tags{$code} = $act; $str_ = $tags{$code}; while ($str_ =~ m|!VAR\((\w+)\)!|) { $before = $`; $after = $'; $f = $1; $f = "\$" . $f; $f =~ s/"/\\"/g; $result = eval qq/"$f"/; $str_ = $before . $result . $after; } $tags{$code} = $str_; } } } close (WTCONF); } #---SEPARATOR---# #REQ:extract_colorsonly sub change_private_and_public { local ($topic_number, $me_number, $text, $was_public) = @_; if (open(FILEx, "$message_dir/$topic_number/newpage.conf")) { @newpgfile = ; close (FILEx); } elsif (open(FILEx, "$secdir/$topic_number/newpage.conf")) { @newpgfile = ; close (FILEx); } else { open (FILEx, "$admin_dir/newpage.conf"); @newpgfile = ; close (FILEx); } $public = 0; $newpage = join("", @newpgfile); if ($text eq "") { $topic = $topic_number; open (SECURITY, "$admin_dir/postoptions.txt"); @options = ; close (SECURITY); ($ps) = grep(/^$topic:/, @options); $ps =~ s/\s+$//; ($topic, $anon, $full, $email) = split(/:/, $ps); open (FILE, "$admin_dir/posting.txt"); @file = ; close (FILE); @file = grep(/\S/, @file); if (grep(/^$topic:/, @file)) { ($line) = grep(/^$topic:/, @file); $line =~ s/\s+$//; @file = grep(!/^$topic:/, @file); ($tn, $ip, $usr, $mod, $pas) = split(/:/, $line); local ($bgcolor, $text, $link, $vlink, $alink, $face, $size, $img) = &extract_colorsonly; if ($ip eq "" && $usr eq "" && $mod eq "" && $pas eq "") { $ac = $L{BPPOSTINGDISABLEDDESCR}; $ac =~ s#\%aopen##g; $ac =~ s#\%aclose##g; $L{BPPOSTINGDISABLEDDESCR} = $ac; $af = "


    $L{BPPOSTINGDISABLEDDESCR}
    "; $public = 2; } elsif ($ip eq "") { if (open (ADDFILE, "$message_dir/$topic/addmessage.conf")) { @af = ; close (ADDFILE); } elsif (open (ADDFILE, "$secdir/$topic/addmessage.conf")) { @af = ; close (ADDFILE); } elsif (open (ADDFILE, "$admin_dir/addmessage-private.conf")) { @af = ; close (ADDFILE); } @af = grep(!/^/, @af) if ($anon == 1 || ($GLOBAL_OPTIONS{'options_used'} && !$GLOBAL_OPTIONS{'anonymous'})); $af = join("", @af); $af =~ s///g; $af =~ s//$script_url\/board-post.$cgi_extension/g; $public = 0; } else { @ip = split(/,/, $ip); if (grep(/^~$/, @ip)) { $fi = "public"; $public = 1; } else { $fi = "private"; $public = 0; } if (open (ADDFILE, "$message_dir/$topic/addmessage.conf")) { @af = ; close (ADDFILE); } elsif (open (ADDFILE, "$secdir/$topic/addmessage.conf")) { @af = ; close (ADDFILE); } elsif (open (ADDFILE, "$admin_dir/addmessage-$fi.conf")) { @af = ; close (ADDFILE); } @af = grep(!/^/, @af) if ($anon == 1 || ($GLOBAL_OPTIONS{'options_used'} && !$GLOBAL_OPTIONS{'anonymous'})); $af = join("", @af); $af =~ s///g; $af =~ s//$script_url\/board-post.$cgi_extension/g; } } $text = $af; if (!$MUST_REGENERATE_PAGES) { if ($was_public == 1 && $public == 1) { return 1; } elsif ($was_public == 0 && $public == 0) { return 1; } } } &lock("*"); &_change_private_and_public($topic_number, $me_number, $newpage, $text); &unlock("*"); } sub _change_private_and_public { local ($topic_number, $me_number, $newpage, $text) = @_; local ($line, @sl); ($head, $color, $lm, $ann, $ann_src, $sublist, $about, $about_src, $message, $message_src) = &get_page($topic_number, $me_number); &set_page($topic_number, $me_number, $head, $color, $lm, $ann, $ann_src, $sublist, $about, $about_src, $message, $message_src, $newpage, $text, 1); @sl = split(/\n/, $sublist); @sl = grep(/|) { &_change_private_and_public($topic_number, $1, $newpage, $text); } } } #---SEPARATOR---# sub page_manager_navbar { local ($topic_number, $page_number, $closing_text) = @_; local ($head) = &get_page($topic_number, $page_number); local ($number, $name, @array, %level, $str, @head, $topic_name, $line); print "
    \nPage Manager:\n"; @head = split(/\n/, $head); foreach $line (@head) { if ($line =~ m||) { $level{$1} = "$2:$3"; } elsif ($line =~ m||) { @array = ("$1:$2"); } } foreach $key (sort by_number keys(%level)) { push (@array, $level{$key}); } foreach $line (@array) { ($number,$name) = split(/:/, $line, 2); print ""; print "$name:\n"; } print "$closing_text\n
    \n\n"; } #---SEPARATOR---# #REQ:page_manager_navbar #REQ:build_graphical_tree sub graphic_browser_select { local ($topic_number, $page_number, $username) = @_; &header; $topic_number_hold = $topic_number; $page_number_hold = $me_number; print "Show All Subtopics\n"; print "$fs\n"; print "
    Show All Subtopics
    \n"; &page_manager_navbar($topic_number, $page_number, "Show All Subtopics"); print "Select a page to edit:

    \n"; open (TOPFILE, "$message_dir/board-topics.html"); @topfile = ; close (TOPFILE); $topic_numbers = ""; foreach $line (@topfile) { if ($line =~ //) { $num = $1; &extract("//$num/$num.$ext"); if (&verify_owner($owner,$username)) { $topic_numbers .= "$num,"; } } } &build_graphical_tree($username, $topic_numbers, "$topic_number_hold/$page_number_hold", "", "\n"; } #---SEPARATOR---# #REQ:build_graphical_tree #REQ:page_manager_navbar sub move_subtopic_form { local ($topic_number_hold, $me_number_hold, $username, $plural, $singular, $ref) = @_; &header; print "Move Subtopic$plural\n"; print "\n"; print "$fs

    Move Subtopic$plural
    \n"; &page_manager_navbar($topic_number_hold, $me_number_hold, "Move Subtopic$plural"); print "

    Select a destination for the subtopic$plural you wish to move by clicking on\n"; print "the folder icon ()\n"; print "next to the destination.

    \n"; open (TOPFILE, "$message_dir/board-topics.html"); @topfile = ; close (TOPFILE); $topic_numbers = ""; foreach $line (@topfile) { if ($line =~ //) { $num = $1; &extract("//$num/$num.$ext"); if (&verify_owner($owner,$username)) { $topic_numbers .= "$num,"; } } } &build_graphical_tree ($username, $topic_numbers, "$topic_number_hold/$me_number_hold", "

    \n"; } #---SEPARATOR---# #REQ:manage_images #REQ:manage_attachments #REQ:determine_addmessage sub recurse { local ($topic_number, $starting_page_number, $action, $parameter) = @_; undef @RECURSE_filenames; &lock("*"); $secure = 1 if !-e "$message_dir/$topic_number"; $secure = 0 if -e "$message_dir/$topic_number"; &build_list($topic_number, $starting_page_number, $secure); &recurse_delete($topic_number) if $action eq "delete"; &recurse_chgrp($parameter, $topic_number) if $action eq "chgrp"; &recurse_rename($action, $parameter) if $action =~ m|^rename:|; &unlock("*"); } sub recurse_rename { local ($action, $newname) = @_; ($template, $addfile) = &determine_addmessage($topic); $action =~ m|^rename:(.*)|; $type = $1; foreach $filename (@RECURSE_filenames) { @hd = split(/\n/, $head{$filename}); foreach $line (@hd) { if ($line =~ /"; } elsif ($line =~ /"; } } $head{$filename} = join("\n", @hd); &set_page($topic{$filename}, $page{$filename}, $head{$filename}, $color{$filename}, $lm{$filename}, $ann{$filename}, $ann_src{$filename}, $sublist{$filename}, $about{$filename}, $about_src{$filename}, $message{$filename}, $message_src{$filename}, $template, $addfile); } } sub recurse_chgrp { local ($group, $topic) = @_; ($template, $addfile) = &determine_addmessage($topic); foreach $filename (@RECURSE_filenames) { $head{$filename} =~ s///; &set_page($topic{$filename}, $page{$filename}, $head{$filename}, $color{$filename}, $lm{$filename}, $ann{$filename}, $ann_src{$filename}, $sublist{$filename}, $about{$filename}, $about_src{$filename}, $message{$filename}, $message_src{$filename}, $template, $addfile); } } sub recurse_delete { local ($topic_number) = @_; open (LOG, "$admin_dir/log.txt"); @LOG = ; close (LOG); foreach $file (@RECURSE_filenames) { $m = $message{$file}; while ($m =~ m||) { $n = $1; $m = join("", $`, $'); @LOG = grep(!/^$n;/, @LOG); } &manage_images(&unescape($message_src{$file}), $topic_number, 0, "delete"); &manage_attachments(&unescape($message_src{$file}), $topic_number, 0, "delete") if $pro; unlink($file); } open (LOG, ">$admin_dir/log.txt"); print LOG @LOG; close (LOG); } sub build_list { local ($topic, $page, $secured) = @_; local ($filename, @sl, $line); $filename = "$message_dir/$topic/$page.$ext" if $secured == 0; $filename = "$secdir/$topic/$page.$ext" if $secured == 1; push (@RECURSE_filenames, $filename); ($head{$filename}, $color{$filename}, $lm{$filename}, $ann{$filename}, $ann_src{$filename}, $sublist{$filename}, $about{$filename}, $about_src{$filename}, $message{$filename}, $message_src{$filename}) = &get_page($topic, $page); $topic{$filename} = $topic; $page{$filename} = $page; @sl = split(/\n/, $sublist{$filename}); foreach $line (@sl) { if ($line =~ m||) { &build_list($topic, $1, $secured); } } } #---SEPARATOR---# #REQ:extract_colorsonly #REQ:get_date_time sub new_file { local ($topic_number, $page_number, $parent, $group, $pagetitle, $param, $forcetime) = @_; local ($head, $color, $lm, $sublist, $about, $about_src, $message, $message_src); local (@head, $line, $maxkey); $param = "Sublist" if $param eq ""; if ($parent == 0) { local ($bg, $tx, $li, $vl, $al, $fa, $si, $im) = &extract_colorsonly; $color = join("\t", $bg, $tx, $li, $vl, $al, $im, $si, $fa); $head = "\n"; $head .= "\n"; $head .= "\n"; } else { &lock("$message_dir/$topic_number/$parent.$ext"); ($head, $color, $lm, $ann, $ann_src, $sublist, $about, $about_src, $message, $message_src) = &get_page($topic_number, $parent); @head = split(/\n/, $head); foreach $line (@head) { if ($line =~ m|\n"; $head .= "\n"; $head .= "\n"; $head .= "\n"; } $head .= "\n"; local ($timestr) = &get_date_time('long', $forcetime); $timestr =~ s/\W//g; &set_page($topic_number, $page_number, $head, $color, $timestr, "", "", "", "", "", "", ""); } #---SEPARATOR---# #REQ:change_private_and_public #REQ:extract_colorsonly sub access_edit_simple { local ($topic, $file, $public, $modgroup, $usergroup, $modall, $userall, $owner, $killit) = @_; &lock("$admin_dir/$file.txt"); open (FILE, "$admin_dir/$file.txt") || &error_message("File open error", "Could not open $admin_dir/$file.txt!"); @file = ; close (FILE); @file = grep(/\S/, @file); if (grep(/^$topic:/, @file)) { ($line) = grep(/^$topic:/, @file); @file = grep(!/^$topic:/, @file); ($tn, $ip, $usr, $mod, $pas) = split(/:/, $line); } else { $line = "$topic::::"; $ip = ""; $usr = ""; $mod = ""; $pas = "\n"; } @ip = split(/,/, $ip); @mod = split(/,/, $mod); @usr = split(/,/, $usr); $was_public = 0; $was_public = 1 if $ip ne ""; $was_public = 2 if $line =~ /::::\s*$/; @ip = grep(!/^~$/, @ip); push (@ip, "~") if $public; $ip = join(",", @ip); @mod = grep(!/^$owner$/, @mod); push (@mod, $owner) if ($modgroup && !$modall); $mod = join(",", @mod); @usr = grep(!/^$owner$/, @usr); push (@usr, $owner) if ($usergroup && !$userall); $usr = join(",", @usr); @mod = grep(!/^~$/, @mod); push (@mod, "~") if $modall; $mod = join(",", @mod); @usr = grep(!/^~$/, @usr); push (@usr, "~") if $userall; $usr = join(",", @usr); $line = join(":", $topic, $ip, $usr, $mod, $pas); push (@file, $line) if $killit ne "Disable All Posting"; push (@file, "$topic:" . ":::\n") if $killit eq "Disable All Posting"; $was_public = 2 if $killit eq "Disable"; open (FILE, ">$admin_dir/$file.txt") || &error_message("File write error", "Could not write $admin_dir/$file.txt because: $!!"); print FILE @file; close (FILE); &unlock("$admin_dir/$file.txt"); if ($file eq "posting") { if (($was_public == 1 || $was_public == 2 || $MUST_REGENERATE_PAGES) && !$public && !-e "$secdir/$topic/addmessage.conf" && !-e "$message_dir/$topic/addmessage.conf") { ($bgcolor, $text, $link, $vlink, $alink, $face, $size, $image) = &extract_colorsonly; if ($killit eq "Disable") { $ac = $L{BPPOSTINGDISABLEDDESCR}; $ac =~ s#\%aopen#
    #g; $ac =~ s#\%aclose##g; $L{BPPOSTINGDISABLEDDESCR} = $ac; $af = "
    $L{BPPOSTINGDISABLEDDESCR}
    "; } else { open (ADDFILE, "$admin_dir/addmessage-private.conf"); @af = ; close (ADDFILE); @af = grep(!/^/, @af) if $MUST_REGENERATE_PAGES == 1; $af = join("", @af); $af =~ s///g; $af =~ s//$script_url\/board-post.$cgi_extension/g; } &change_private_and_public($topic, $topic, $af); } elsif (($was_public == 0 || $was_public == 2 || $MUST_REGENERATE_PAGES) && $public && !-e "$secdir/$topic/addmessage.conf" && !-e "$message_dir/$topic/addmessage.conf") { ($bgcolor, $text, $link, $vlink, $alink, $face, $size, $image) = &extract_colorsonly; if ($killit eq "Disable") { $ac = $L{BPPOSTINGDISABLEDDESCR}; $ac =~ s#\%aopen##g; $ac =~ s#\%aclose##g; $L{BPPOSTINGDISABLEDDESCR} = $ac; $af = "
    $L{BPPOSTINGDISABLEDDESCR}
    "; } else { open (ADDFILE, "$admin_dir/addmessage-public.conf"); @af = ; close (ADDFILE); @af = grep(!/^/, @af) if $MUST_REGENERATE_PAGES == 1; $af = join("", @af); $af =~ s///g; $af =~ s//$script_url\/board-post.$cgi_extension/g; } &change_private_and_public($topic, $topic, $af); } } } #---SEPARATOR---# #REQ:extract_colorsonly sub determine_addmessage { local ($topic_number) = @_; if (open(FILEx, "$message_dir/$topic_number/newpage.conf")) { @newpgfile = ; close (FILEx); } elsif (open(FILEx, "$secdir/$topic_number/newpage.conf")) { @newpgfile = ; close (FILEx); } else { open (FILEx, "$admin_dir/newpage.conf"); @newpgfile = ; close (FILEx); } $topic = $topic_number; open (POST, "$admin_dir/postoptions.txt"); @post = ; close (POST); ($line) = grep(/^$topic:/, @post); ($t, $an) = split(/:/, $line); $anflag = $an; $anflag = 1 if ($GLOBAL_OPTIONS{'anonymous'} == 0 && $GLOBAL_OPTIONS{'options_used'} == 1); local ($bgcolor, $text, $link, $vlink, $alink, $face, $size, $image) = &extract_colorsonly; if (open(FILExx, "$message_dir/$topic/addmessage.conf")) { @addfile = ; close (FILExx); } elsif (open(FILExx, "$secdir/$topic/addmessage.conf")) { @addfile = ; close (FILExx); } else { open (FILE, "$admin_dir/posting.txt"); @file = ; close (FILE); @file = grep(/\S/, @file); if (grep(/^$topic:/, @file)) { ($line) = grep(/^$topic:/, @file); $line =~ s/\s+$//; @file = grep(!/^$topic:/, @file); ($tn, $ip, $usr, $mod, $pas) = split(/:/, $line); local ($bgcolor, $text, $link, $vlink, $alink, $face, $size, $img) = &extract_colorsonly; if ($ip eq "" && $usr eq "" && $mod eq "" && $pas eq "") { $ac = $L{BPPOSTINGDISABLEDDESCR}; $ac =~ s#\%aopen##g; $ac =~ s#\%aclose##g; $L{BPPOSTINGDISABLEDDESCR} = $ac; $af = "
    $L{BPPOSTINGDISABLEDDESCR}
    "; $public = 2; } elsif ($ip eq "") { open (ADDFILE, "$admin_dir/addmessage-private.conf"); @af = ; close (ADDFILE); $af = join("", @af); $af =~ s///g; $af =~ s//$script_url\/board-post.$cgi_extension/g; $public = 0; } else { @ip = split(/,/, $ip); if (grep(/^~$/, @ip)) { $fi = "public"; } else { $fi = "private"; } open (ADDFILE, "$admin_dir/addmessage-$fi.conf"); @af = ; close (ADDFILE); $af = join("", @af); $af =~ s///g; $af =~ s//$script_url\/board-post.$cgi_extension/g; } @addfile = split(/\n/, $af); } } @addfile = grep(!/^/, @addfile) if $anflag; $addfile = join("\n", @addfile); $addfile .= "\n"; $addfile =~ s///g; $addfile =~ s//$script_url\/board-post.$cgi_extension/g; $template = join("\n", @newpgfile); $template .= "\n"; return ($template, $addfile); }