# FILE: src-board-subs-4 #------------------------------------------------------------------------------- # 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---# #REQ:extract_colorsonly sub board_manager { local ($username) = @_; $append = "?username=$username&action=menu"; open (FILE, "$message_dir/board-topics.html") || &error_message("File Error", "Could not open top file (board-topics.html)."); @lines = ; close(FILE); undef @topic_number; undef @topic_name; undef @group; $count = 0; $topics = ""; foreach $line (@lines) { $_ = $line; if (//) { $count = $count + 1; $filename = "$message_dir/$1/$1.$ext"; $num = $1; push (@topic_number, $1); $ev{$num} = &extract ($filename, 1); push (@topics, "$num:$topic_name (\u$owner)"); push (@group, $owner); } } &header; print "Board Manager\n"; print "\n"; print '$fs\n"; print "
Board Manager
\n"; print "
\n"; print "\n"; print "

Title Message

\n"; print "
\n"; print "\n"; print "\n"; print "
"; print "$fs", "Enter the text for your "Title Message" in the area below. The "Title Message" appears above the list of topics, and contains the board logo by default.

\n"; print "

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

\n"; print "


\n"; print "

Topics

\n"; print "
\n"; print "\n"; print "\n"; $c = "ffffcc"; print "\n"; $counter = 0; $ctr = 0; $ct = scalar(@topics); foreach $thing (@topics) { if ($thing =~ /^(\d+):(.*)/) { $num = $1; $descr = $2; print ""; $counter += 1; if ($c eq "ffffcc") { $c = "ffffff"; } else { $c = "ffffcc"; } print ""; print "\n"; print ""; $name2 = &JavaScript_prepare($descr); print ""; print "" if $ev{$num}; print "" if !$ev{$num}; print "\n"; print "" if $ev{$num}; print "" if !$ev{$num}; print "\n"; print ""; print "\n"; } } if ($counter > 0) { print ""; print "\n"; print ""; print "\n"; print ""; print ""; print ""; print "\n"; print ""; print "\n"; print ""; print "\n"; print "\n"; } print "
 Order MarkDelGrp Prop Topic (group) 
  "; print " "; print " "; $ctr += 1; print "      $fs"; print "$descr" if $ev{$num}; print "$descr" if !$ev{$num}; print " 
  (Marked)     
 
\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "

Add a Topic

\n"; print "
\n"; print "\n"; print "\n"; print "
"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$fs", "Topic Name:
$fs", "Topic Group:
$fs", "Posting Privileges:  "; print "
$fs", "Initial Content:  "; print "
\n"; print "

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

\n"; print "

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

Main Message

\n"; print "
\n"; print "\n"; print "\n"; print "
"; print "$fs", "Enter the text for your "Main Message" in the area below. The "Main Message" appears below the list of topics.

\n"; print "

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

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

Board Appearance

\n"; print "
\n"; ($bgcolor,$text,$link,$vlink,$alink,$face,$size, $image) = &extract_colorsonly; print "
"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$fs", "Background:
\n"; print "
THIS IS A SAMPLE OF YOUR COLORS

\n"; print "Text Color
\n"; print "Unvisited Link
\n"; print "Visited Link
\n"; print "Active Link
\n"; print "Smaller Text

$fs", "Text:
$fs", "Link:
$fs", "Visited Link:
$fs", "Active Link:
$fs", "Font Face:
$fs", "Font Size:
$fs", "Background Image:

\n"; print "$fs Check this box if you are moving the board from one server to another\n"; print "

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

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

Top Page Options

\n"; print "
$fs"; if (open (FILE, "$admin_dir/frontpage_conf.txt")) { @file = ; close (FILE); foreach $line (@file) { $line =~ m|^(\w+)=(.*)|; $FPCONFIG{$1} = $2; } } else { $FPCONFIG{"Bold"} = "1"; $FPCONFIG{"Group"} = "0"; $FPCONFIG{"Date"} = "1"; $FPCONFIG{"Lock"} = "1"; print "Error reading $admin_dir/frontpage_conf.txt. Make "; print "sure file exists and is readable/writable!

\n"; } print " Topic names in Bold
\n"; print " Display group name in (parentheses)
\n"; print " Display last modified date
\n"; if ($pro) { print " Indicate private topics with lock icon ()
\n"; print " Do not display private topics on the topic list

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

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

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

META Tags

\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
"; print "$fs", "You can specify META tags, used by search engines when indexing\n"; print "pages, for the topics page on this board using the text entry boxes below.\n"; print "Do not use HTML or Discus formatting codes in your META tags.\n"; print "To learn more about how to use META tags, consult your favorite search\n"; print "engine.

\n"; @metatags = grep(/^\n"; print "

$fs", "Description:|; print "VALUE=\"$1\""; } print ">
$fs", "Key Words:|; print "VALUE=\"$1\""; } print ">
$fs", "Robots:|; print "VALUE=\"$1\""; } print ">

\n"; print " Apply to all pages on board

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

\n"; print "\n"; exit(0); } #---SEPARATOR---# sub build_graphical_tree { local ($username, $topics, $present, $iconlink, $textlink, $stopflag, $stop_present, $skipformstuff, $nsbug) = @_; undef @aarr; undef @barr; undef @carr; undef @darr; if ($topics eq "**") { undef @fav; open (TOP_FILE, "$message_dir/board-topics.html"); @top = ; close (TOP_FILE); undef @topics; &ex('get_preferences', 1); if ($PREF{'last_favs'}) { @fav = split(/,/, $PREF{'favorites'}); } else { $PREF{'favorites'} = ""; } foreach $line (@top) { if ($line =~ //) { $o = $1; next if ($PREF{'favorites'} ne "" && !grep(/^$o$/, @fav)); if (-e "$message_dir/$o") { push (@topics, $o); } else { @auth = &ex('validate_auths', $o); push (@topics, $o) if grep(/^$o$/, @auth); } } } $topics = join(",", @topics); &header; &ex('printuntil',1, 1, 0, "$L{TVTITLE}"); print "
$L{TVTITLE}

"; } @topics = split(/,/, $topics) if $topics ne "*"; open (TOP_FILE, "$message_dir/board-topics.html"); @top = ; close (TOP_FILE); foreach $line (@top) { if ($line =~ //) { $o = $1; $lastnum = $o if (grep(/^$o$/, @topics) || $topics eq "*"); push (@topics, $o) if $topics eq "*"; } } $LAST_TOPIC = $lastnum; if ($present eq "*") { $topic_number = $topics[0]; $me_number = $topics[0]; $expl = $topic_number; $present = "$topic_number/$me_number"; } else { $present =~ m|(\d+)/(\d+)|; $topic_number = $1; $me_number = $2; $expl = $topic_number; } print "$title"; print " -- $ph{main}" if $ph{main}; print "
\n"; print "\n"; local ($ie3); $ie3 = 0; $ie3 = 1 if $ENV{'HTTP_USER_AGENT'} =~ m|MSIE 3\.|; $nsbug = 1 if $ie3; if (!$nsbug) { print "\n"; } else { for ($i = 0; $i < scalar(@aarr); $i++) { if (length($aarr[$i]) == 0) { if ($barr[$i] == $LAST_TOPIC) { print ""; } else { print ""; } } else { while ($aarr[$i] =~ m|(\w)|g) { print ""; } } if ($carr[$i] =~ m|^LINK\t(.*)\t(.*)|) { $url = $1; $target = $2; print ""; if ($textlink ne "") { print "
$darr[$i]
\n"; } else { print "$darr[$i]
\n"; } } else { print ""; ($topic) = split(/\//, $carr[$i]); if ($textlink ne "") { print "$textlink$carr[$i]\">$darr[$i]
\n" if $secured{$topic} == 0; print "$darr[$i]
\n" if $secured{$topic} == 1; } else { print "$darr[$i]
\n"; } } } } } sub descend_tree { local ($topic_number,$page_number,$level,$show,$stopflag,$iconlink,$textlink,$present) = @_; local (@file,$line,$number,$filename,$lastnum,$page,$name,$stopflag1,$iconlink1,$cutnow); local (@present) = split(/,/, $present); $filename = "$message_dir/$topic_number/$page_number.$ext"; open (FILE, $filename) if -e $filename; open (FILE, "$secdir/$topic_number/$page_number.$ext") if !-e $filename; @file = ; close (FILE); foreach $line (@file) { $lastnum = $1 if $line =~ //; $lastnum = $1 if $line =~ //; } foreach $line (@file) { if ($line =~ /
  • ]*>(.*)<\/A>/) { $page = $1; $name = $2; substr($show, $level, 1) = "1" if $page != $lastnum; substr($show, $level, 1) = "0" if $page == $lastnum; if (grep(/^$page$/, @present) && $stopflag) { $global_cutoff = 1; $cutnow = 1; } $iconlink1 = $iconlink; $iconlink1 = "" if $global_cutoff != 0; $textlink1 = $textlink; $textlink1 =~ s//$topic_number\/$page/g; &drawicon($level, $show, $iconlink1, $page, $stopflag, $topic_number, $name, $textlink1); &descend_tree($topic_number, $page, $level+1, $show, $stopflag, $iconlink, $textlink, $present); $global_cutoff = 0 if $cutnow == 1; $cutnow = 0 if $cutnow == 1; $iconlink = $iconlink1; } elsif ($line =~ m|
  • ]+>(.*)<\/A>|) { $page = $1; $link = $2; $target = $3; $name = $4; substr($show, $level, 1) = "1" if $page != $lastnum; substr($show, $level, 1) = "0" if $page == $lastnum; &drawicon($level, $show, "*LINK*", $page, $stopflag, $topic_number, $name, $textlink1, $link, $target); } } } sub drawicon { local ($level, $show, $iconlink, $page, $stopflag, $topic_number, $name, $textlink, $link, $target) = @_; local ($astr, $bstr, $name_returned); $name_returned = &JavaScript_prepare($name, 1); $astr = "i" if $topic_number != $LAST_TOPIC; $astr = "j" if $topic_number == $LAST_TOPIC; for ($i = 0; $i < $level; $i++) { $img = "j" if substr($show, $i, 1) == 0; $img = "i" if substr($show, $i, 1) == 1; $astr .= $img; } $astr .= "e" if substr($show, $level, 1) == 1; $astr .= "f" if substr($show, $level, 1) == 0; push (@aarr, $astr); push (@barr, $page); push (@carr, "$topic_number/$page.$ext") if ($global_cutoff == 0 && $iconlink ne "*LINK*"); push (@carr, "") if $global_cutoff == 1; push (@carr, "LINK\t$link\t$target") if ($iconlink eq "*LINK*" && $global_cutoff == 0); $nsn = "$topic_number/$page"; if (scalar(keys(%ph))) { $ph{$nsn} += 0; $name_returned .= " -- $ph{$nsn}" if $iconlink ne "*LINK*"; } push (@darr, $name_returned); push (@earr, $secured{$topic_number}); } #---SEPARATOR---# #REQ:get_date_time sub admin_main_menu { local ($user, $crypted_pass_1, $flag) = @_; $ts = time; $host = $ENV{'REMOTE_HOST'}; $addr = $ENV{'REMOTE_ADDR'}; $crypted_pass_2 = crypt($crypted_pass_1, "cookie"); print "Set-Cookie: pass$COOKIE_ID=$crypted_pass_2; path=/\n"; &header; print "$titlej Administration\n"; print "\n"; print "\n"; print "\n"; print "You must specify a password!

    \n"; print "You must set your password before continuing.

    \n"; print "

  • Set your password\n"; print "
  • Cancel\n"; print "\n"; exit(0); } print "onLoad=\"menuload()\">\n"; print "
    \n"; print "$fs\n"; &lock("$admin_dir/adminlog.txt"); open (ADMINLOG, "$admin_dir/adminlog.txt"); @a = ; close (ADMINLOG); $flc = 0; undef @flc; foreach $line (@a) { if ($line =~ m|^$user;([^;]+);([^;]+);(\d+);(.*)|) { ($rh, $ra, $dt, $ok) = ($1, $2, $3, $4); if ($ok ne "ok") { $flc += 1; push (@flc, join("", "Failed Login on ", (&ex('get_date_time', 'long', $dt))[0], " from $rh")); } else { $ll = "Last Login on " . (&ex('get_date_time', 'short', $dt))[0] . " from $rh"; } $line = ""; } } @a = grep(/\S/, @a); push (@a, "$user;$host;$addr;$ts;ok\n"); open (ADMINLOG, ">$admin_dir/adminlog.txt"); print ADMINLOG @a; close (ADMINLOG); &unlock("$admin_dir/adminlog.txt"); if ($flc) { print "$flc failed login"; print "s" if $flc > 1; print " since last access (see bottom for details)

    \n"; } print "\n"; if (-e "$html_dir/index.html") { print "Go to Board

    \n"; print " Moderator Functions
    \n"; print " "; print "Page Manager
    \n"; print " "; print "Access Manager
    \n"; print " "; print "User Manager
    \n"; if ($pro) { &ex('userapp_1', $username, "", 2); } print " "; print "Profile Editor
    \n"; if ($pro) { @qm = &ex('check_queue', $user); $q = scalar(@qm); $qm = "$q Queued Message" if $q > 0; $qm .= "s" if $q > 1; $qm .= "" if $q > 0; $qm = "Queue Manager" if $q == 0; print " "; print "$qm
    \n"; print " "; print "Log Analysis
    \n"; } print " "; print "Log In Again

    \n"; print " Instructions
    \n"; print " "; print "Administration
    \n"; print " "; print "Formatting
    \n"; if ($FORM{'username'} eq $superuser) { print "
    \n"; print " Superuser Functions
    \n"; print " "; print "Board Manager
    \n"; print " "; print "Moderator Manager
    \n"; print " "; print "Group Manager
    \n"; print " "; print "Version Manager
    \n"; if ($pro) { print " "; print "Archive Manager
    \n"; print " "; print "Backup Manager
    \n"; } print " "; print "Data Recovery
    \n"; print " "; print "Options Manager
    \n"; } print "

    $ll

    \n"; foreach $fl (@flc) { print "

  • $fl\n"; } print "\n"; print "\n"; exit(0); } #---SEPARATOR---# sub front_page { &header; print "$title Administration\n"; print "\n"; print "$fs
    Administration
    \n"; print "
    \n"; print "
    \n"; print "
    \n"; print "\n"; print "
    $fs"; print "Username:
    $fs", "Password:
    \n"; print "

    $fs\n"; print "\n"; if ($FORM{'startfrom'} ne "") { print "\n"; } print "

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

    \n"; print "\n"; print "The administration program will store internal information\n"; print "in a COOKIE. For this to work, you must have cookies\n"; print "enabled on your browser! Also, be sure to exit the browser\n"; print "when you are done so that the information in the cookie will\n"; print "be reset.\n"; print "\n"; exit(0); } #---SEPARATOR---# #REQ:page_manager_navbar sub viewmessage { local ($topic_number, $me_number, $index) = @_; local (@file, $line, $flag, $post, $postby, $postbyflag); local ($head, $color, $lm, $ann, $ann_src, $sublist, $about, $about_src, $message, $message_src) = &get_page($topic_number, $me_number); @file = split(/\n/, $message); foreach $line (@file) { last if $line =~ //; if ($line =~ //) { $flag = 1; } elsif ($flag == 1) { if ($postbyflag == 0 && $line =~ /\n$//g; $post =~ s/^
    //; &header; print "Message Viewer\n"; print "\n"; print "\n"; print "\n"; print "$fs\n"; print "
    View Message
    \n"; &page_manager_navbar($topic_number, $me_number, "View Message"); if (!-e "$message_dir/$topic_number") { while ($post =~ m|]*)>|g) { $tn = $1; $pn = $2; $ex = $3; $post = join("", $`, "", $'); } while ($post =~ m|
    ([^(.*?)
    ([^<]+) \(([^>]+)\)
    |) { ($file, $icon, $type, $descr, $topic, $fakefile, $size) = ($1, $2, $3, $4, $5, $6, $7); $post = join("", $`, "
    $descr
    $fakefile ($size)
    ", $'); } } ($bgcolor, $text, $link, $vlink, $alink, $img, $size, $face) = split(/\t/, $color); print "\n"; print "
    "; print "$postby\n$post
    \n"; print "
    \n"; exit(0); } #---SEPARATOR---# sub moderator_mgr { open (PASSWD, "$admin_dir/passwd.txt") || &error_message("File Error", "Cannot open moderator password file (passwd.txt)! (Code 040601)"); @passwd = ; close (PASSWD); $count = scalar(@passwd); &header; print "Moderator Manager\n"; print "\n"; print "\n\n"; print "$fs\n"; print "
    Moderator Manager
    \n
    \n"; print "

    Moderators

    \n"; print "\n"; $bgcolor = "ffffcc"; $c = 0; $ct = scalar(@passwd); print "\n"; undef @mod; foreach $line (sort(@passwd)) { ($user, $encpass, $email, $fullname, $profile, $email2, $last) = split(/:/, $line); print ""; if ($bgcolor eq "ffffcc") { $bgcolor = "ffffff"; } else { $bgcolor = "ffffcc"; } $num = $user; print ""; print "" if $user ne $superuser; print "" if $user eq $superuser; print "\n"; print ""; print "\n"; print ""; print "\n"; } if ($ct > 0) { print ""; print "\n"; print ""; print ""; print "\n"; print ""; print "\n"; print ""; print "\n"; print "\n"; } print "
     MarkDel Edit Moderator 
     "; print " "; print " "; $c++; print "  N/A  $fs\u$user "; if ($fullname ne "" && $fullname ne "none" && $fullname ne "fullname") { print "($fullname)" if ($email eq "" || $email eq "email"); print "($fullname)" if ($email ne "" && $email ne "email"); } print " 
     (Marked)     
     
    \n"; print "\n"; print "\n"; print "\n"; print "
    \n"; print "
    \n"; print "

    Add a Moderator

    \n"; print "
    "; print "
    $fs", "Username:"; print ""; print "
    $fs", "Password:"; print ""; print "
    $fs", "Verify Password:"; print ""; print "
    $fs", "E-mail (optional):"; print ""; print "
    $fs", "Full name (optional):"; print ""; print "
     
    \n"; print ""; print "
    \n"; print "
    \n"; print "\n"; print "\n"; print "\n"; print "
    \n"; exit(0); } #---SEPARATOR---# sub save_profile_information { local ($password_new, $email_new, $fullname_new, $edit_new, $notify_new, $lastcheck_new, $group_new, @modify_lines) = @_; &lock("$admin_dir/passwd.txt"); &lock("$admin_dir/users.txt"); open (PASSWD, "$admin_dir/passwd.txt"); @passwd = ; close (PASSWD); open (USERS, "$admin_dir/users.txt"); @users = ; close (USERS); $pass_save = ""; foreach $line (@modify_lines) { $line =~ s/\n$//; local ($file, $user, $pass, $email, $fullname, $edit, $notify, $lastcheck, $group) = split(/:/, $line); if ($edit == 2 && $USER_FLAG == 1) { $email_new = ""; } $pass = $password_new if $password_new ne ""; $pass_save = $pass if $pass_save eq ""; $pass = $pass_save; $pass = $PASS_SAVE if $PASS_SAVE; $email = $email_new if $email_new ne ""; $fullname = $fullname_new if $fullname_new ne ""; $fullname =~ s/\(//g; $fullname =~ s/\)//g; $edit = $edit_new if $edit_new ne ""; $notify = $notify_new if $notify_new ne ""; $lastcheck = $lastcheck_new if $lastcheck_new ne ""; $group = $group_new if $group_new ne ""; if ($file eq "USERS") { foreach $line_2 (@users) { $line_2_test = "USERS:$line_2"; $line_2_test =~ s/\n$//; if ($line_2_test eq $line) { $line_2 = join(":", $user, $pass, $email, $fullname, $edit, $notify, $lastcheck, "$group\n"); } } } elsif ($file eq "PASSWD") { foreach $line_2 (@passwd) { $line_2_test = "PASSWD:$line_2"; $line_2_test =~ s/\n$//; if ($line_2_test eq $line) { $line_2 = join(":", $user, $pass, $email, $fullname, $edit, $notify, "$lastcheck\n"); } } } } open (PASSWD, ">$admin_dir/passwd.txt"); print PASSWD @passwd; close (PASSWD); open (USERS, ">$admin_dir/users.txt"); print USERS @users; close (USERS); &unlock("$admin_dir/passwd.txt"); &unlock("$admin_dir/users.txt"); } #---SEPARATOR---# sub save_description { local ($topic_number, $formatted, $escaped_source) = @_; &lock("$message_dir/board-topics.html"); open (TOP, "$message_dir/board-topics.html"); @top = ; close (TOP); $flag1 = 0; $flag2 = 0; foreach $line (@top) { if ($line =~ m||) { $line = "

    $formatted

    \n"; $flag1 = 1; } elsif ($line =~ m||) { $line = "$escaped_source\n"; $flag2 = 1; } } if ($flag1 == 0) { foreach $line (@top) { if ($line =~ m||) { $line =~ s/

    //i; $line .= "

    $formatted

    \n"; } } } if ($flag2 == 0) { foreach $line (@top) { if ($line =~ m|