home *** CD-ROM | disk | FTP | other *** search
/ ftp.sunet.sepub/pictures / 2014.11.ftp.sunet.se-pictures.tar / ftp.sunet.se / pub / pictures / ACiD-artpacks / www / mirrors / acheron / discus_admin_116439176 / source / src-board-subs-common < prev   
Text File  |  1999-01-29  |  35KB  |  968 lines

  1. # FILE: src-board-subs-common
  2. #-------------------------------------------------------------------------------
  3. # This script is copyright (c) 1998 by DiscusWare, LLC, all rights reserved.
  4. # Its use is subject to the license agreement that can be found at the following
  5. # URL:  http://www.chem.hope.edu/discus/license
  6. #-------------------------------------------------------------------------------
  7. #
  8. # The following indicates the version information for this distribution.
  9. # This is available to you through the Version Manager.
  10.  
  11. $release_version = "3.00";
  12. $free_revision = "3";
  13. $pro_revision = "p5";
  14.  
  15. #-------------------------------------------------------------------------------
  16.  
  17. $url_to_default_image = "$html_url/clipart/your_image.gif";
  18. $titlej = &JavaScript_prepare($title);
  19. $message_dir = "$html_dir/messages";
  20. $message_url = "$html_url/messages";
  21. $cgiurl = "$script_url/board-admin.$cgi_extension";
  22. $cgiurl1 = "$script_url/board-admin-1.$cgi_extension";
  23. $cgiurl2 = "$script_url/board-admin-2.$cgi_extension";
  24. $cgiurl3 = "$script_url/board-admin-3.$cgi_extension";
  25. $cgiurlm = "$script_url/board-admin-menuonly.$cgi_extension";
  26. $secdir = "$admin_dir/secure";
  27. sub header {
  28.     print "Content-type: text/html\n\n";
  29. }
  30. $fs = "<FONT FACE=\"Verdana,Arial,Helvetica\" SIZE=2>";
  31. undef %GLOBAL_OPTIONS;
  32. undef %FORM;
  33. undef %COOKIE;
  34. open (OPT, "$admin_dir/options.txt"); @opt = <OPT>; close (OPT);
  35. foreach $line (@opt) {
  36.     if ($line =~ m|^(\w+)=(.*)|) {
  37.         $GLOBAL_OPTIONS{$1} = $2;
  38.     }
  39. }
  40. &read_declarations;
  41. undef %ev;
  42. sub ex {
  43.     local ($function_name) = shift (@_);
  44.     local (@params, @file, $o);
  45.     @params = @_;
  46.     local ($tmp, $file, $num, $sub, @sub, @s1, @s2, $tmpvar);
  47.     if (!$ev{$function_name}) {
  48.         $tmp = $/;
  49.         $/ = "#---SEPARATOR---#";
  50.         ($file, $num) = split(/-/, $funct{$function_name});
  51.         $file .= "_$pro_fileid" if $file >= 100;
  52.         open (FILE, "$admin_dir/source/src-board-subs-$file"); @file = <FILE>; close (FILE);
  53.         $sub = $file[$num];
  54.         $/ = $tmp;
  55.         @sub = split(/\n/, $sub); @s1 = grep(/^#REQ:/, @sub); @s2 = grep(!/^#/, @sub);
  56.         foreach $tempvar (@s1) {
  57.             $tempvar =~ m|^#REQ:(\w+)|; $o = $1; &ex($o);
  58.         }
  59.         $tempvar = join("\n", @s2); eval $tempvar;
  60.         $ev{$function_name} = $1;
  61.     }
  62.     if (scalar(@params) > 0) {
  63.         $tempvar = "\@result = &$function_name(\@params);"; eval $tempvar; return @result;
  64.     } else {
  65.         return 0;
  66.     }
  67. }
  68. sub lock {
  69.     local ($filename) = @_;
  70.     open (LOCK, "$admin_dir/locks.txt") || &error_message("File Locking Error", "Could not open file $admin_dir/locks.txt.  Make sure $admin_dir/locks.txt exists and is world writable.");
  71.     @LOCK = <LOCK>;
  72.     close (LOCK);
  73.     $time = time;
  74.     if (($ll) = grep(/\*/, @LOCK)) {
  75.         ($timest) = split(/,/, $ll);
  76.         if ((time - $timest) <= 180) {
  77.             $es = $L{'FILELOCKREGEN'};
  78.             $t = (180 - (time - $timest));
  79.             $es =~ s/\%sec/$t/g;
  80.             &error_message("$L{'FILELOCKERROR'}", "$es");
  81.         } else {
  82.             @LOCK = grep(!/\*/, @LOCK);
  83.         }
  84.     }
  85.     if (!grep(/,$filename\s*$/, @LOCK)) {
  86.         open (LOCK, ">>$admin_dir/locks.txt") || &error_message("File Locking Error", "Could not append file $admin_dir/locks.txt.  Make sure $admin_dir/locks.txt exists and is world writable.");
  87.         print LOCK "$time,$filename\n";
  88.         close (LOCK);
  89.         return 1;
  90.     } else {
  91.         $ctr = 0;
  92.         ($line) = grep(/,$filename\s*$/, @LOCK);
  93.         ($time_l) = split(/,/, $line);
  94.         if ($time > ($time_l + 5)) {
  95.             @LOCK = grep(!/,$filename\s*$/, @LOCK);
  96.             push (@LOCK, "$time,$filename\n");
  97.             open (LOCK, ">$admin_dir/locks.txt") || &error_message("File Locking Error", "Could not write file $admin_dir/locks.txt.  Make sure $admin_dir/locks.txt exists and is world writable.");
  98.             print LOCK @LOCK;
  99.             close (LOCK);
  100.             return 1;
  101.         } else {
  102.             for ($ctr = 0; $ctr <= 100; $ctr++) {
  103.                 open (LOCK, "$admin_dir/locks.txt");
  104.                 @LOCK = <LOCK>;
  105.                 close (LOCK);
  106.                 $time = time;
  107.                 if (!grep(/,$filename\s*$/, @LOCK)) {
  108.                     open (LOCK, ">>$admin_dir/locks.txt") || &error_message("File Locking Error", "Could not append file $admin_dir/locks.txt.  Make sure $admin_dir/locks.txt exists and is world writable.");
  109.                     print LOCK "$time,$filename\n";
  110.                     close (LOCK);
  111.                     return 1;
  112.                 }
  113.             }
  114.             &error_message("$L{'FILELOCKERROR'}", "$L{FILEISLOCKED}", 0, 1);
  115.         }
  116.     }
  117. }
  118. sub unlock {
  119.     local ($filename) = @_;
  120.     open (LOCK, "$admin_dir/locks.txt") || &error_message("File Unlocking Error", "Could not open file $admin_dir/locks.txt.  Make sure $admin_dir/locks.txt exists and is world writable.");
  121.     @LOCK = <LOCK>;
  122.     close (LOCK);
  123.     @LOCK = grep(!/,$filename\s*$/, @LOCK) if $filename ne "*";
  124.     @LOCK = grep(!/\*/, @LOCK) if $filename eq "*";
  125.     if (scalar(@LOCK) == 0) {
  126.         push (@LOCK, "#\n");
  127.     }
  128.     open (LOCK, ">$admin_dir/locks.txt") || &error_message("File Unlocking Error", "Could not open file $admin_dir/locks.txt (System returned error: $!).  Make sure $admin_dir/locks.txt exists and is world writable.");
  129.     print LOCK @LOCK;
  130.     close (LOCK);
  131. }
  132. sub parse_form {
  133.     undef %FORM;
  134.     if ($ENV{'CONTENT_LENGTH'} != 0) {
  135.         read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  136.         @pairs = split(/&/, $buffer);
  137.         foreach $pair (@pairs) {
  138.             ($name, $value) = split(/=/, $pair);
  139.             $value =~ tr/+/ /;
  140.             $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  141.             $value =~ s/<!--#(\w*)(\s*)(\w*)(\s*)=(\s*)"([^"]*)"(.*)-->//g;
  142.             $value =~ s/\r//g;
  143.             if ($FORM{$name} eq "") {
  144.                 $FORM{$name} = $value;
  145.             } else {
  146.                 $FORM{$name} .= ",$value";
  147.             }
  148.         }
  149.     }
  150.     $ENV{'QUERY_STRING'} =~ s/#(.*)$//;
  151.     if ($ENV{'QUERY_STRING'} ne "") {
  152.         $command = $ENV{'QUERY_STRING'};
  153.         @pairs = split(/&/, $command);
  154.         foreach $pair (@pairs) {
  155.             ($name, $value) = split(/=/, $pair);
  156.             $value = &unescape($value);
  157.             $FORM{$name} = $value if $FORM{$name} eq "";
  158.         }
  159.     }
  160. }
  161. sub error_message {
  162.     local ($reason, $explanation, $flag, $noerr) = @_;
  163.     $excl_pt = $!;
  164.     &header;
  165.     &ex('printuntil', 1, 1, 0, "$reason") if !$flag;
  166.     print "<!-Discus Program Error Message-!>\n";
  167.     print "$fs<FONT SIZE=4 COLOR=#ff0000><CENTER><B>$reason</B></CENTER></FONT>\n";
  168.     print "<HR><P>\n";
  169.     print "<!-Begin Error Message-!>\n";
  170.     print "<FONT FACE='Courier New' SIZE=2>$explanation<P>\n";
  171.     if ($excl_pt && !$noerr) {
  172.         print "\$!: <FONT COLOR=#ff0000><B>$excl_pt</B></FONT><P>";
  173.     }
  174.     if ($@ && !$noerr) {
  175.         print "\$\@: <FONT COLOR=#ff0000><B>$@</B></FONT><P>";
  176.     }
  177.     print "</FONT>\n";
  178.     print "<!-End Error Message-!>\n";
  179.     print "<P>Please contact <B>$contact</B> if this problem persists.\n";
  180.     &ex('printuntil',3, 17, 0, "$reason") if !$flag;
  181.     exit(0);
  182. }
  183. sub extract {
  184.     local ($strin, $error_trapping) = @_;
  185.     local ($line, $filename, @file,$key);
  186.     undef %level_number;
  187.     $_ = "/$strin";
  188.     $secure = 0;
  189.     /.*\/(\d+)\/(\d+)\.$ext/;
  190.     $f1 = $1;
  191.     $f2 = $2;
  192.     &error_message('Undefined Error',"Undefined Error extracting file!  Input file $_ is not a valid file!", 0, 1) if $f1 eq "";
  193.     $filename = "$message_dir/$f1/$f2.$ext"; $filename2 = "";
  194.     if (!-e "$message_dir/$f1") {
  195.         $filename2 = "$secdir/$f1/$f2.$ext";
  196.         $secure = 1;
  197.     }
  198.     $filename = $filename2 if $filename2 ne "";
  199.     if (!-e $filename) {
  200.         if (-e "$filename.NEW") {
  201.             &lock($filename);
  202.             if (!-e $filename && -e "$filename.NEW") {
  203.                 if ($platform eq "NT" || $NT || $platform =~ m|NT|i) {
  204.                     $code = 0;
  205.                 } else {
  206.                     $code = rename("$filename.NEW", "$filename");
  207.                 }
  208.                 if ($code != 1 || !-e $filename) {
  209.                     open (FILE, "$filename.NEW");
  210.                     @file = <FILE>;
  211.                     close (FILE);
  212.                     open (FILE, ">$filename");
  213.                     print FILE @file;
  214.                     close (FILE);
  215.                     unlink ("$filename.NEW");
  216.                 }
  217.                 chmod (0666, "$filename");
  218.             }
  219.             &unlock($filename);
  220.         }
  221.     }
  222.     if (open (FILE_EXTRACT, $filename)) {
  223.         @file = <FILE_EXTRACT>;
  224.         close (FILE_EXTRACT);
  225.         foreach $line (@file) {
  226.             $_ = $line;
  227.             $topic_name = $2 if /<!--Topic: (\d+)\/(.*)-->/;
  228.             $topic_number = $1 if /<!--Topic: (\d+)\/(.*)-->/;
  229.             $owner = $1 if /<!--Owner: (\w+)-->/;
  230.             if (/<!--Level (\d+): (\d+)\/(.*)-->/) {
  231.                 $key = $1;
  232.                 $level_name{$key} = $3;
  233.                 $level_number{$key} = $2;
  234.             }
  235.             $me_name = $2 if /<!--Me: (\d+)\/(.*)-->/;
  236.             $me_number = $1 if /<!--Me: (\d+)\/(.*)-->/;
  237.             $parent_number = $1 if /<!--Parent: (\d+)/;
  238.             if (/<!--Param: (\w+)-->/) {
  239.                 $param = $1;
  240.             }
  241.         }
  242.         return 1;
  243.     } else {
  244.         &error_message('Undefined Error',"Undefined Error extracting file!  <I>$filename</I> could not be opened!") if $error_trapping == 0;
  245.         $topic_name = "<B>Corrupted Topic File</B>";
  246.         $topic_number = $f1;
  247.         $owner = "unknown";
  248.         return 0;
  249.     }    
  250. }
  251. sub JavaScript_prepare {
  252.     local ($str, $param) = @_;
  253.     $str =~ s/<IMG SRC="[^"]*" ALT="([^"]*)">/\[$1\]/g;
  254.     $str =~ s/<([^>]*)>//g;
  255.     $str =~ s/\n//g;
  256.     if ($param == 1) {
  257.         $str =~ s/([^\w&#; ])/&makeord($1)/ge;
  258.     } else {
  259.         $str =~ s/&#(\d+);//g;
  260.         $str =~ s/'//g;
  261.         $str =~ s/"//g;
  262.         $str =~ s/"//g;
  263.         $str =~ s/&//g;
  264.     }
  265.     return $str;
  266. }
  267. sub makeord {
  268.     local ($o, $num) = @_;
  269.     if (ord($o) <= 126) {
  270.         $num = ord($o);
  271.         return "&#$num;";
  272.     } else {
  273.         return $o;
  274.     }
  275. }
  276. sub remove_links {
  277.     local ($string) = @_;
  278.     local ($str);
  279.     $str = $string;
  280.     $str =~ s/<A\s([^>]*)>//g;
  281.     $str =~ s/<\/A>//g;
  282.     return $str;
  283. }
  284. sub read_cookie {
  285.     $buffer = $ENV{'HTTP_COOKIE'};
  286.     @pairs = split(/; /, $buffer);
  287.     foreach $pair (@pairs) {
  288.         ($name, $value) = split(/=/, $pair);
  289.         $value =~ tr/+/ /;
  290.         $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  291.         $COOKIE{$name} = $value;
  292.     }
  293. }
  294. sub escape {
  295.     local ($input) = @_;
  296.     local ($string);
  297.     $string = $input;
  298.     $string =~ s/([^\w ])/sprintf("%%%02lx", ord($1))/eg;
  299.     $string =~ tr/ /+/;
  300.     return $string;
  301. }
  302. sub unescape {
  303.     local ($input) = @_;
  304.     local ($string);
  305.     $string = $input;
  306.     $string =~ tr/+/ /;
  307.     $string =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  308.     return $string;
  309. }
  310. sub remove_html {
  311.     local ($string, $flag) = @_;
  312.     local ($str);
  313.     $str = $string;
  314.     $str =~ s/<IMG SRC="[^"]*" ALT="([^"]*)">/\[$1\]/g;
  315.     $str =~ s/<[^>]*>//g;
  316.     $str =~ s/&#(\d+);//g if $flag == 0;
  317.     return $str;
  318. }
  319. sub seturl {
  320.     local ($targeturl) = @_;
  321.     if (!($nph_server)) {
  322.         print "Location: $targeturl\n\n";
  323.         exit(0);
  324.     } else {
  325.         &header;
  326.         print "<HTML><HEAD><TITLE>Document Moved</TITLE>\n";
  327.         print "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=$targeturl\">\n";
  328.         print "</HEAD>\n";
  329.         print "<BODY>\n";
  330.         print "<NOSCRIPT>\n";
  331.         print "<A HREF=\"$targeturl\">Please click here</A>\n";
  332.         print "</NOSCRIPT>\n";
  333.         print "</BODY></HTML>\n";
  334.         exit(0);
  335.     }
  336. }
  337. sub getfn {
  338.     local ($input) = @_;
  339.     local ($before, $after, $m, $o);
  340.     if ($input =~ m|(.*)/|) {
  341.         $before = "$1/";
  342.         $after = $';
  343.     } else {
  344.         $after = $input;
  345.     }
  346.     while ($after =~ m|(.)|g) {
  347.         $m = $1; $o = ord($m);
  348.         if ($m eq "." || $m =~ /\w/ || $m eq "-") {
  349.             $before .= $m;
  350.         } else {
  351.             $before .= "$o";
  352.         }
  353.     }
  354.     return $before;
  355. }
  356. sub print_cookie_string {
  357.     local ($username_in, $password_in, $password_to_crypt_in) = @_;
  358.     $username_in = "" if $ALREADY_SET_USERNAME;
  359.     $password_in = "" if $ALREADY_SET_PWIN;
  360.     $password_to_crypt_in = "" if $ALREADY_SET_PWCIN;
  361.     $store_cookies = 1 if $GLOBAL_OPTIONS{'cookies'};
  362.     if ($pro) {
  363.         &ex('pro_cookies', $username_in, $password_in, $password_to_crypt_in);
  364.         return 1;
  365.     } else {
  366.         return 0 if !$store_cookies;
  367.         print "Set-cookie: user$COOKIE_ID=$username_in; path=/\n" if $username_in;
  368.         $ALREADY_SET_USERNAME = 1 if $username_in;
  369.         print "Set-cookie: rpwd$COOKIE_ID=", "x" x $password_in, "; path=/\n" if $password_in;
  370.         $ALREADY_SET_PWIN = 1 if $password_in;
  371.         print "Set-cookie: cpwd$COOKIE_ID=" if $password_to_crypt_in;
  372.         print crypt($password_to_crypt_in, "cookie") if $password_to_crypt_in;
  373.         print "; path=/\n" if $password_to_crypt_in;
  374.         $ALREADY_SET_PWCIN = 1 if $password_to_crypt_in;
  375.         return 1;
  376.     }
  377. }
  378. sub get_page {
  379.     local ($topic, $page, $meta_override) = @_;
  380.     local ($head, $announce, $announce_src, $sublist, $about, $about_src, $message, $message_src, $flag, $color, $lm);
  381.     local ($save, @file);
  382.     if (-e "$html_dir/messages/$topic/$page.$ext") {
  383.         open (FILE, "$html_dir/messages/$topic/$page.$ext");
  384.         $secure = 0;
  385.     } else {
  386.         open (FILE, "$secdir/$topic/$page.$ext");
  387.         $secure = 1;
  388.     }
  389.     @file = <FILE>;
  390.     close (FILE);
  391.     @file_last_got = @file;
  392.     foreach $_ (@file) {
  393.         if (/^<!--Topic/ || /^<!--Level/ || /^<!--Me:/ || /^<!--Param/ || /^<!--Parent/ || /^<!--Owner/) {
  394.             $head .= $_;
  395.         } elsif (/^\s*$/) {
  396.             next;
  397.         } elsif (/^<BODY BGCOLOR="([^"]*)" TEXT="([^"]*)" LINK="([^"]*)" VLINK="([^"]*)" ALINK="([^"]*)" BACKGROUND="([^"]*)"/i) {
  398.             $color = join("\t", $1, $2, $3, $4, $5, $6);
  399.         } elsif (/^<BODY BGCOLOR="([^"]*)" TEXT="([^"]*)" LINK="([^"]*)" VLINK="([^"]*)" ALINK="([^"]*)"/i) {
  400.             $color = join("\t", $1, $2, $3, $4, $5, "");
  401.         } elsif (/^<BASEFONT SIZE="([^"]*)"><FONT FACE="([^"]*)">/i) {
  402.             $color .= "\t$1\t$2";
  403.         } elsif (/^<A NAME="([^P].*)">/) {
  404.             $lm = $1;
  405.         } elsif (/^<!-Top: (\d+)-!>/) {
  406.             $sublist .= $_;
  407.         } elsif (/^<!-URL: (\d+)-!>/) {
  408.             $sublist .= $_;
  409.         } elsif (/^<!--About-->/) {
  410.             $flag = 1;
  411.         } elsif (/^<!--Source:/) {
  412.             $flag = 2;
  413.         } elsif ($flag == 1) {
  414.             $about .= $_ if (!/^<HR>/ && !/^-->/);
  415.         } elsif ($flag == 2 && m|^<!--/About-->|) {
  416.             $flag = 0;
  417.         } elsif ($flag == 2) {
  418.             $about_src .= $_ if !/^-->/;
  419.         } elsif (/^<!--Announcement-->/) {
  420.             $flag = 15;
  421.         } elsif (/^<!--Announcement Source:/) {
  422.             $flag = 16;
  423.         } elsif ($flag == 15) {
  424.             $announce .= $_ if (!/^<HR>/ && !/^-->/);
  425.         } elsif ($flag == 16 && m|^<!--/Announcement-->|) {
  426.             $flag = 0;
  427.         } elsif ($flag == 16) {
  428.             $announce_src .= $_ if !/^-->/;
  429.         } elsif (m|<!-Post: (\d+)-!>|) {
  430.             $flag = 3; $save = $1;
  431.             $message .= $_;
  432.         } elsif (m|<!-/Post: $save-!>|) {
  433.             $flag = 0;
  434.             $message .= $_;
  435.         } elsif ($flag == 3) {
  436.             $message .= $_;
  437.         } elsif (/^<!--Message Source/) {
  438.             $flag = 4;
  439.         } elsif ($flag == 4 && /^-->/) {
  440.             $flag = 0;
  441.         } elsif ($flag == 4) {
  442.             $message_src .= $_;
  443.         } elsif (m|^<META NAME="DESCRIPTION" CONTENT="([^"]*)">|) {
  444.             $meta_description = $1 if !$meta_override;
  445.         } elsif (m|^<META NAME="KEYWORDS" CONTENT="([^"]*)">|) {
  446.             $meta_keywords = $1 if !$meta_override;
  447.         } elsif (m|^<META NAME="ROBOTS" CONTENT="([^"]*)">|) {
  448.             $meta_robots = $1 if !$meta_override;
  449.         }
  450.     }
  451.     if ($color eq "") {
  452.         $color = "ffffff\t000000\t0000ff\t800080\tff0000\t\t2\tVerdana,Arial,Helvetica";
  453.     }
  454.     return ($head, $color, $lm, $announce, $announce_src, $sublist, $about, $about_src, $message, $message_src);
  455. }
  456. sub set_page {
  457.     local ($topic, $page, $head, $color, $timestr, $announcement_variable, $announcement_source_variable, $subtopic_variable, $about_variable, $about_source_variable, $message_variable, $message_source_variable, $templatefile, $addfile, $timesaver) = @_;
  458.     return 0 if $page eq "";
  459.     local (@tfile, $line, $param, $owner, $levelj, $navline, $navbar, $str, $file, @file);
  460.     $message_variable = &add_message_icons($message_variable);
  461.     if ($templatefile) {
  462.         @tfile = split(/\n/, $templatefile);
  463.         foreach $line (@tfile) {
  464.             $line .= "\n";
  465.         }
  466.         @tfile = grep(/\S/, @tfile);
  467.     } else {
  468.         if (open (TFILE, "$html_dir/messages/$topic/newpage.conf")) {
  469.             @tfile = <TFILE>;
  470.             close (TFILE);
  471.         } elsif (open (TFILE, "$secdir/$topic/newpage.conf")) {
  472.             @tfile = <TFILE>;
  473.             close (TFILE);
  474.         } else {
  475.             open (TFILE, "$admin_dir/newpage.conf");
  476.             @tfile = <TFILE>;
  477.             close (TFILE);
  478.         }
  479.     }
  480.     if (!(grep(/<!--Start-->/, @tfile))) {
  481.         &error_message("Save Error", "The newpage.conf template has been corrupted; unable to save your change", 0, 1);
  482.     }
  483.     if (!(grep(/\$subtopic_variable/, @tfile)) || !(grep(/\$about_variable/, @tfile)) || !(grep(/\$message_variable/, @tfile)) || !(grep(/\$message_source_variable/, @tfile)) || !(grep(/\$about_source_variable/, @tfile)) || !(grep(/\$head/, @tfile))) {
  484.         &error_message("Save Error", "The newpage.conf template has been corrupted; unable to save your change", 0, 1);
  485.     }
  486.     local ($bgcolor, $text, $link, $vlink, $alink, $image, $size, $face) = split(/\t/, $color);
  487.     local (%level_number, %level_name, $topic_number, $topic_name, $me_number, $me_name);
  488.     foreach $line (split(/\n/, $head)) {
  489.         if ($line =~ m|<!--Topic: (\d+)/(.*)-->|) {
  490.             ($topic_number, $topic_name) = ($1, $2);
  491.         } elsif ($line =~ m|<!--Level (\d+): (\d+)/(.*)-->|) {
  492.             $level_number{$1} = $2; $level_name{$1} = $3;
  493.         } elsif ($line =~ m|<!--Me: (\d+)/(.*)-->|) {
  494.             $me_number = $1; $me_name = $2;
  495.         } elsif ($line =~ m|<!--Param: (.*)-->|) {
  496.             $param = $1;
  497.         } elsif ($line =~ m|<!--Owner: (.*)-->|) {
  498.             $owner = $1;
  499.         }
  500.     }
  501.     $navline = "<A HREF=\"$html_url/messages/board-topics.html\" onMouseOver=\"return setStatus('$L{NBRETURN} $titlej main page')\">$title</A>: ";
  502.     if ($topic_number != $me_number) {
  503.         $levelj = &JavaScript_prepare($topic_name);
  504.         $navline .= "<A HREF=\"$html_url/messages/$topic_number/$topic_number.$ext\"";
  505.         $navline .= " onMouseOver=\"return setStatus('$L{NBRETURN} $levelj')\">";
  506.         $navline .= "$topic_name</A>: ";
  507.     } else {
  508.         $navline .= "$topic_name";
  509.     }
  510.     foreach $line (sort by_number keys(%level_number)) {
  511.         if ($level_number{$line} != $me_number) {
  512.             $levelj = &JavaScript_prepare($level_name{$line});
  513.             $navline .= "<A HREF=\"$html_url/messages/$topic_number/$level_number{$line}.$ext\"";
  514.             $navline .= " onMouseOver=\"return setStatus('$L{NBRETURN} $levelj')\">";
  515.             $navline .= "$level_name{$line}</A>:\n";
  516.         } else {
  517.             $navline .= "$level_name{$line}";
  518.         }
  519.     }
  520.     $str = &JavaScript_prepare($navline);
  521.     $navbar = $navline;
  522.     local (@users, @addfile, $line_2, @valid, $privpub);
  523.     if ($addfile) {
  524.         @addfile = split(/\n/, $addfile);
  525.         foreach $line (@addfile) {
  526.             $line .= "\n";
  527.             if ($line =~ m|<!-/Identification Tag - LEAVE THIS HERE-!>|) {
  528.                 $line .= "<INPUT TYPE=HIDDEN NAME=HTTP_REFERER VALUE=//$topic/$page.$ext>\n";
  529.             }
  530.         }
  531.         @addfile = grep(/\S/, @addfile);
  532.     } else {
  533.         open (POST, "$admin_dir/posting.txt"); @post = <POST>; close (POST);
  534.         ($line) = grep(/^$topic:/, @post);
  535.         ($t, $ip) = split(/:/, $line);
  536.         if ($ip eq "") {
  537.             $privpub = "private";
  538.         } else {
  539.             $privpub = "public";
  540.         }
  541.         open (POST, "$admin_dir/postoptions.txt"); @post = <POST>; close (POST);
  542.         ($line) = grep(/^$topic:/, @post);
  543.         ($t, $an) = split(/:/, $line);
  544.         $anflag = $an;
  545.         $anflag = 1 if ($GLOBAL_OPTIONS{'anonymous'} == 0 && $GLOBAL_OPTIONS{'options_used'} == 1);
  546.         if (open(FILExx, "$message_dir/$topic/addmessage.conf")) {
  547.             @addfile = <FILExx>;
  548.             close (FILExx);
  549.         } elsif (open(FILExx, "$secdir/$topic/addmessage.conf")) {
  550.             @addfile = <FILExx>;
  551.             close (FILExx);
  552.         } elsif ($line =~ m|::::\s*$| && !-e "$message_dir/$topic/addmessage.conf" && !-e "$secdir/$topic/addmessage.conf") {
  553.             $l = $L{BPPOSTINGDISABLEDDESCR};
  554.             $l =~ s|\%aopen|<A HREF="$script_url/board-contact.$cgi_extension">|g;
  555.             $l =~ s|\%aclose|</A>|g;
  556.             @addfile = ("<HR><CENTER><TABLE BGCOLOR=#ffcccc><TR><TD><FONT FACE=\"$face\" SIZE=\"$size\" COLOR=000000><B>$l</B></FONT></TD></TR></TABLE>");
  557.         } else {        
  558.             open (FILExx, "$admin_dir/addmessage-$privpub.conf");
  559.             @addfile = <FILExx>;
  560.             close (FILExx);
  561.         }
  562.         foreach $line_2 (@addfile) {
  563.             if ($line_2 =~ m|<!-/Identification Tag - LEAVE THIS HERE-!>|) {
  564.                 $line_2 .= "<INPUT TYPE=HIDDEN NAME=HTTP_REFERER VALUE=//$topic/$page.$ext>\n";
  565.             }
  566.             $line_2 =~ s/<!-FONT-!>/<FONT FACE="$face" SIZE="$size">/g;
  567.             $line_2 =~ s/<!-POST TO CGI-!>/$script_url\/board-post.$cgi_extension/g;
  568.         }
  569.         @addfile = grep(!/^<!-Anon-!>/, @addfile) if $anflag;
  570.     }
  571.     undef @file;
  572.     local ($flag, $navflag, $flag2, $pagetitle, @array);
  573.     @array = split(/\n/, $subtopic_variable); @array = grep(/\S/, @array); $subtopic_variable = join("\n", @array);
  574.     @array = split(/\n/, $about_variable); @array = grep(/\S/, @array); $about_variable = join("\n", @array);
  575.     @array = split(/\n/, $about_source_variable); @array = grep(/\S/, @array); $about_source_variable = join("\n", @array);
  576.     @array = split(/\n/, $message_variable); @array = grep(/\S/, @array); $message_variable = join("\n", @array);
  577.     @array = split(/\n/, $message_source_variable); @array = grep(/\S/, @array); $message_source_variable = join("\n", @array);
  578.     $pagetitle = $me_name;
  579.     $flag = 0; $navflag = 0; $flag2 = 0;
  580.     foreach $line (@tfile) {
  581.         if ($line =~ /<!--Start-->/) {
  582.             $flag = 1;
  583.         } elsif ($flag == 1) {
  584.             if ($line =~ m|<!--Navbar|) {
  585.                 $navflag = 1;
  586.                 push (@file, "<!--Navbar-->\n<B>\n$navbar\n</B>\n<!--/Navbar-->\n");
  587.             } elsif ($navflag == 1) {
  588.                 $navflag = 0 if $line =~ m|<!--/Navbar|;
  589.             } else {
  590.                 if ($line =~ m|\$(\w+)|) {
  591.                     $line =~ s/\\/\\\\/g;
  592.                     $line =~ s/"/\\"/g;
  593.                     $line = eval("\"$line\"");
  594.                 }
  595.                 if ($line =~ /\[Read addmessage.txt\]/ || $line =~ /\[Read addmessage.conf\]/) {
  596.                     push (@file, @addfile);
  597.                 } else {
  598.                     if ($line =~ m|<!--Sublist-->|) {
  599.                         push (@file, "<!--Sublist--><!--Off\n") if $param !~ m|Sublist|;
  600.                         push (@file, "<!--Sublist-->\n") if $param =~ m|Sublist|;
  601.                     } elsif ($line =~ m|<!--/Sublist-->|) {
  602.                         push (@file, "-->\n<!--/Sublist-->\n") if $param !~ m|Sublist|;
  603.                         push (@file, "<!--/Sublist-->\n") if $param =~ m|Sublist|;
  604.                     } elsif ($line =~ m|<!--Create-->|) {
  605.                         push (@file, "<!--Create--><!--Off\n") if $param !~ m|Create|;
  606.                         push (@file, "<!--Create-->\n") if $param =~ m|Create|;
  607.                     } elsif ($line =~ m|<!--/Create-->|) {
  608.                         push (@file, "-->\n<!--/Create-->\n") if $param !~ m|Create|;
  609.                         push (@file, "<!--/Create-->\n") if $param =~ m|Create|;
  610.                     } elsif ($line =~ m|<!--About-->|) {
  611.                         push (@file, "<!--About--><!--Off\n") if $param !~ m|About|;
  612.                         push (@file, "<!--About-->\n") if $param =~ m|About|;
  613.                     } elsif ($line =~ m|<!--Source:|) {
  614.                         push (@file, "-->\n<!--Source:\n") if $param !~ m|About|;
  615.                         push (@file, "<!--Source:\n") if $param =~ m|About|;
  616.                     } elsif ($line =~ m|<!--Messages-->|) {
  617.                         push (@file, "<!--Messages--><!--Off\n") if $param !~ m|Messages|;
  618.                         push (@file, "<!--Messages-->\n") if $param =~ m|Messages|;
  619.                     } elsif ($line =~ m|<!--/Messages-->|) {
  620.                         push (@file, "-->\n<!--/Messages-->\n") if $param !~ m|Messages|;
  621.                         push (@file, "<!--/Messages-->\n") if $param =~ m|Messages|;
  622.                     } elsif ($line =~ m|<!--Add-->|) {
  623.                         push (@file, "<!--Add--><!--Off\n") if $param !~ m|Add|;
  624.                         push (@file, "<!--Add-->\n") if $param =~ m|Add|;
  625.                     } elsif ($line =~ m|<!--/Add-->|) {
  626.                         push (@file, "-->\n<!--/Add-->\n") if $param !~ m|Add|;
  627.                         push (@file, "<!--/Add-->\n") if $param =~ m|Add|;
  628.                     } elsif ($line =~ m|<!--Announcement-->|) {
  629.                         push (@file, "<!--Announcement--><!--Off\n") if $param !~ m|Announcement|;
  630.                         push (@file, "<!--Announcement-->\n") if $param =~ m|Announcement|;
  631.                     } elsif ($line =~ m|<!--Announcement Source:|) {
  632.                         push (@file, "-->\n<!--Announcement Source:\n") if $param !~ m|Announcement|;
  633.                         push (@file, "<!--Announcement Source:\n") if $param =~ m|Announcement|;
  634.                     } else {
  635.                         push (@file, $line);
  636.                     }
  637.                 }
  638.             }
  639.         }
  640.     }
  641.     @file = grep(/\S/, @file);
  642.     if ($timesaver && join("", @file) eq join("", @file_last_got)) {
  643.         return 0;
  644.     }    
  645.     if (-e "$html_dir/messages/$topic") {
  646.         $filename = "$html_dir/messages/$topic/$page.$ext";
  647.     } else {
  648.         $filename = "$secdir/$topic/$page.$ext";
  649.     }
  650.     open (FILE, ">$filename.NEW") || &error_message("File Save - Write Error", "Could not open $filename.NEW for writing.");
  651.     print FILE @file;
  652.     close (FILE);
  653.     if (-e "$filename.NEW") {
  654.         $fsize_desired = scalar(@file);
  655.         $fsize = -s "$filename.NEW";
  656.         if ($fsize < $fsize_desired) {
  657.             undef $!;
  658.             unlink ("$filename.NEW");
  659.             &error_message("File Save - Write Error", "Error trying to write to $filename -- source file has wrong length (Desired: $fsize_desired; actual: $fsize).  Check your disk quota!");
  660.         }    
  661.         if ($platform eq "NT" || $NT || $platform =~ m|NT|i) {
  662.             $code = 0;
  663.         } else {
  664.             $code = rename("$filename.NEW", "$filename");
  665.         }
  666.         if ($code != 1 || !-e $filename) {
  667.             open (FILE, ">$filename");
  668.             print FILE @file;
  669.             close (FILE);
  670.             $fsize = -s "$filename";
  671.             if ($fsize < $fsize_desired) {
  672.                 undef $!;
  673.                 &error_message("File Save - Write Error", "Error trying to write to $filename -- source file has wrong length (Desired: $fsize_desired; actual: $fsize).  Check your disk quota!");
  674.             }    
  675.             unlink ("$filename.NEW");
  676.         }
  677.         chmod (0666, "$filename");
  678.     } else {
  679.         &error_message("File Save - Write Error", "Could not open $filename.NEW for reading.");
  680.     }
  681.     return 1;
  682. }
  683. sub add_message_icons {
  684.     local ($message_in) = @_;
  685.     local (@M, @C, @P);
  686.     @M = split(/\n/, $message_in);
  687.     @C = grep(/^<!-Post: (\d+)/, @M);
  688.     undef @P;
  689.     foreach $c (@C) {
  690.         $c =~ m|<!-Post: (\d+)|;
  691.         push (@P, $1);
  692.     }
  693.     $ctr = 0; $flag = 0;
  694.     foreach $line (@M) {
  695.         if ($line =~ m|<!-Post: (\d+)|) {
  696.             $pid = $1;
  697.             $line = "<!-Post: $pid-!><A NAME=\"POST$pid\">\n";
  698.             $flag = 1;
  699.         } elsif ($flag == 1 && $line =~ m|^<HR>|) {
  700.             $flag = 2;
  701.         } elsif ($flag == 2) {
  702.             if ($line =~ m|<!-Icons-!>(.*)<!-/Icons-!>|) {
  703.                 $line = $';
  704.             }
  705.             if ($GLOBAL_OPTIONS{'message_icons'} == 1) {
  706.                 $line2 = "<!-Icons-!>";
  707.                 if ($GLOBAL_OPTIONS{'message_icon_top'} eq "") {
  708.                     $GLOBAL_OPTIONS{'message_icon_top'} = "mark_top.gif";
  709.                     $GLOBAL_OPTIONS{'message_icon_up'} = "mark_up.gif";
  710.                     $GLOBAL_OPTIONS{'message_icon_down'} = "mark_down.gif";
  711.                     $GLOBAL_OPTIONS{'message_icon_bottom'} = "mark_bottom.gif";
  712.                     $GLOBAL_OPTIONS{'message_icon_link'} = "tree_m.gif";
  713.                 }
  714.                 $line2 .= "<A HREF=\"#MT\"><IMG SRC=\"$html_url/icons/$GLOBAL_OPTIONS{'message_icon_top'}\" HEIGHT=12 WIDTH=12 BORDER=0 ALT=\"$L{MESSAGE_ICON_TOP}\"></A>" if $GLOBAL_OPTIONS{'message_icon_top'};
  715.                 $line2 .= "<A HREF=\"#POST" . $P[$ctr-1] . "\"><IMG SRC=\"$html_url/icons/$GLOBAL_OPTIONS{'message_icon_up'}\" HEIGHT=12 WIDTH=12 BORDER=0 ALT=\"$L{MESSAGE_ICON_UP}\"></A>" if ($ctr > 0 && $GLOBAL_OPTIONS{'message_icon_up'});
  716.                 $line2 .= "<A HREF=\"#MT\"><IMG SRC=\"$html_url/icons/$GLOBAL_OPTIONS{'message_icon_up'}\" HEIGHT=12 WIDTH=12 BORDER=0 ALT=\"$L{MESSAGE_ICON_UP}\"></A>" if ($ctr == 0 && $GLOBAL_OPTIONS{'message_icon_up'});
  717.                 $line2 .= "<A HREF=\"#POST" . $P[$ctr+1] . "\"><IMG SRC=\"$html_url/icons/$GLOBAL_OPTIONS{'message_icon_down'}\" HEIGHT=12 WIDTH=12 BORDER=0 ALT=\"$L{MESSAGE_ICON_DOWN}\"></A>" if ($ctr < (scalar(@P) - 1) && $GLOBAL_OPTIONS{'message_icon_down'});
  718.                 $line2 .= "<A HREF=\"#MB\"><IMG SRC=\"$html_url/icons/$GLOBAL_OPTIONS{'message_icon_down'}\" HEIGHT=12 WIDTH=12 BORDER=0 ALT=\"$L{MESSAGE_ICON_DOWN}\"></A>" if ($ctr == (scalar(@P) - 1) && $GLOBAL_OPTIONS{'message_icon_down'});
  719.                 $line2 .= "<A HREF=\"#MB\"><IMG SRC=\"$html_url/icons/$GLOBAL_OPTIONS{'message_icon_bottom'}\" HEIGHT=12 WIDTH=12 BORDER=0 ALT=\"$L{MESSAGE_ICON_BOTTOM}\"></A>" if $GLOBAL_OPTIONS{'message_icon_bottom'};
  720.                 $line2 .= "<A HREF=\"#POST" . $P[$ctr] . "\"><IMG SRC=\"$html_url/icons/$GLOBAL_OPTIONS{'message_icon_link'}\" HEIGHT=16 WIDTH=20 BORDER=0 ALT=\"$L{MESSAGE_ICON_LINK}\"></A>" if $GLOBAL_OPTIONS{'message_icon_link'};
  721.                 $line = "$line2  <!-/Icons-!>$line";
  722.             }
  723.             $ctr += 1;
  724.             $flag = 0;
  725.         }
  726.     }
  727.     return join("\n", @M);
  728. }
  729.  
  730. sub by_number {
  731.     $a <=> $b;
  732. }
  733. sub read_declarations {
  734.     $funct{'add_topic'} = "1-1";
  735.     $funct{'remove_topic'} = "1-2";
  736.     $funct{'rename_topic'} = "1-3";
  737.     $funct{'reorder_topics'} = "1-4";
  738.     $funct{'change_main_message'} = "1-5";
  739.     $funct{'register_discus'} = "1-6";
  740.     $funct{'change_topic_group'} = "1-7";
  741.     $funct{'preview_board_colors'} = "1-8";
  742.     $funct{'change_board_colors'} = "1-9";
  743.     $funct{'change_board_toppage'} = "1-10";
  744.     $funct{'add_page'} = "2-1";
  745.     $funct{'rename_topic_form'} = "2-2";
  746.     $funct{'change_topic_group_form'} = "2-3";
  747.     $funct{'add_moderator'} = "2-4";
  748.     $funct{'delete_moderator'} = "2-5";
  749.     $funct{'save_top_meta_tags'} = "2-6";
  750.     $funct{'save_topic_meta_tags'} = "2-7";
  751.     $funct{'upgrade_file_structure'} = "2-8";
  752.     $funct{'rename_subtopic_form'} = "2-9";
  753.     $funct{'rename_link_form'} = "2-10";
  754.     $funct{'rename_subtopic'} = "2-11";
  755.     $funct{'rename_link'} = "2-12";
  756.     $funct{'reorder_subtopics'} = "2-13";
  757.     $funct{'email_configuration'} = "2-14";
  758.     $funct{'html_to_webtags'} = "2-15";
  759.     $funct{'page_mgr_1'} = "3-1";
  760.     $funct{'page_mgr_2'} = "3-2";
  761.     $funct{'board_manager'} = "4-1";
  762.     $funct{'build_graphical_tree'} = "4-2";
  763.     $funct{'admin_main_menu'} = "4-3";
  764.     $funct{'front_page'} = "4-4";
  765.     $funct{'viewmessage'} = "4-5";
  766.     $funct{'moderator_mgr'} = "4-6";
  767.     $funct{'save_profile_information'} = "4-7";
  768.     $funct{'save_description'} = "4-8";
  769.     $funct{'remove_message'} = "4-9";
  770.     $funct{'first_pass'} = "4-10";
  771.     $funct{'notification_message'} = "4-11";
  772.     $funct{'preview_admin_message'} = "5-1";
  773.     $funct{'change_about_message'} = "5-2";
  774.     $funct{'remove_page'} = "5-3";
  775.     $funct{'move_page'} = "5-4";
  776.     $funct{'printuntil'} = "5-5";
  777.     $funct{'remove_swearing'} = "5-6";
  778.     $funct{'access_mgr_2'} = "5-7";
  779.     $funct{'send_email_message'} = "5-8";
  780.     $funct{'change_announce_message'} = "5-9";
  781.     $funct{'manage_images'} = "5-10";
  782.     $funct{'reapply_webtags'} = "5-11";
  783.     $funct{'profile_editor_screen'} = "5-12";
  784.     $funct{'verify_owner'} = "5-13";
  785.     $funct{'profanity_editor'} = "5-14";
  786.     $funct{'cuss_save'} = "5-15";
  787.     $funct{'group_mgr'} = "6-1";
  788.     $funct{'add_group'} = "6-2";
  789.     $funct{'delete_group'} = "6-3";
  790.     $funct{'edit_group'} = "6-4";
  791.     $funct{'delete_moderator_from_group'} = "6-5";
  792.     $funct{'add_to_group'} = "6-6";
  793.     $funct{'move_message_form'} = "6-7";
  794.     $funct{'move_message'} = "6-8";
  795.     $funct{'edit_message_form'} = "6-9";
  796.     $funct{'save_edited_message'} = "6-10";
  797.     $funct{'reorder_messages'} = "6-11";
  798.     $funct{'email_notification'} = "7-1";
  799.     $funct{'user_mgr_1'} = "7-2";
  800.     $funct{'user_mgr_2'} = "7-3";
  801.     $funct{'add_user'} = "7-4";
  802.     $funct{'version_manager'} = "7-5";
  803.     $funct{'preview_user_list'} = "7-6";
  804.     $funct{'modify_list'} = "7-7";
  805.     $funct{'add_user_list'} = "7-8";
  806.     $funct{'delete_user'} = "7-9";
  807.     $funct{'posting_options'} = "7-10";
  808.     $funct{'change_title_message'} = "7-11";
  809.     $funct{'change_addmessage'} = "7-12";
  810.     $funct{'change_layout'} = "8-1";
  811.     $funct{'options_mgr'} = "8-2";
  812.     $funct{'extract_lastmodified'} = "8-3";
  813.     $funct{'prepare_navbar'} = "8-4";
  814.     $funct{'webtags'} = "8-5";
  815.     $funct{'change_private_and_public'} = "8-6";
  816.     $funct{'page_manager_navbar'} = "8-7";
  817.     $funct{'graphic_browser_select'} = "8-8";
  818.     $funct{'move_subtopic_form'} = "8-9";
  819.     $funct{'recurse'} = "8-10";
  820.     $funct{'new_file'} = "8-11";
  821.     $funct{'access_edit_simple'} = "8-12";
  822.     $funct{'determine_addmessage'} = "8-13";
  823.     $funct{'post_message'} = "9-1";
  824.     $funct{'get_date_time'} = "9-2";
  825.     $funct{'get_number'} = "9-3";
  826.     $funct{'check_owner'} = "9-4";
  827.     $funct{'extract_colorsonly'} = "9-5";
  828.     $funct{'verify_user_password'} = "9-6";
  829.     $funct{'update_time'} = "9-7";
  830.     $funct{'verify_postread_privileges'} = "9-8";
  831.     $funct{'options_save'} = "9-9";
  832.     $funct{'email_configurator'} = "9-10";
  833.     $funct{'compare_profiles'} = "10-1";
  834.     $funct{'display_profile_differences'} = "10-2";
  835.     $funct{'data_recovery'} = "10-3";
  836.     $funct{'data_recovery_action'} = "10-4";
  837.     $funct{'data_recovery_top'} = "10-5";
  838.     $funct{'auto_configure_email'} = "10-6";
  839.     $funct{'admin_from_here'} = "10-7";
  840.         
  841. #  --------- DISCUS PRO    ---------
  842.     
  843.     $funct{'log_authorization'} = "100-1";
  844.     $funct{'get_authorized_topics'} = "100-2";
  845.     $funct{'userapp_result'} = "100-3";
  846.     $funct{'topic_security'} = "100-4";
  847.     $funct{'access_edit'} = "100-5";
  848.     $funct{'email_notification_pro'} = "100-6";
  849.     $funct{'log_analysis_1'} = "100-7";
  850.     $funct{'log_analysis_access'} = "100-8";
  851.     $funct{'log_analysis_by_user'} = "100-9";
  852.     $funct{'show_secure_image'} = "101-1";
  853.     $funct{'check_queue_status'} = "101-2";
  854.     $funct{'send_message_to_queue'} = "101-3";
  855.     $funct{'queue_submitted'} = "101-4";
  856.     $funct{'check_queue'} = "101-5";
  857.     $funct{'register_1'} = "101-6";
  858.     $funct{'register_2'} = "101-7";
  859.     $funct{'_get_group_info'} = "101-8";
  860.     $funct{'register_thanks'} = "101-9";
  861.     $funct{'user_selfreg_config'} = "101-10";
  862.     $funct{'user_selfreg_config_save'} = "101-11";
  863.     $funct{'userapp_1'} = "101-12";
  864.     $funct{'userapp_framesetter'} = "101-13";
  865.     $funct{'userapp_2'} = "101-14";
  866.     $funct{'userapp_disp'} = "101-15";
  867.     $funct{'userapp_action'} = "101-16";
  868.     $funct{'reg_configurator'} = "101-17";
  869.     $funct{'save_selfreg_config'} = "101-18";
  870.     $funct{'save_selfreg_config_rs'} = "101-19";
  871.     $funct{'save_selfreg_config_welcome'} = "101-20";
  872.     $funct{'define_mime_types'} = "102-1";
  873.     $funct{'parse_filename'} = "102-2";
  874.     $funct{'attachment_upload'} = "102-3";
  875.     $funct{'manage_attachments'} = "102-4";
  876.     $funct{'compare_source'} = "102-5";
  877.     $funct{'email_list'} = "102-6";
  878.     $funct{'access_mgr_2_pro'} = "102-7";
  879.     $funct{'access_edit_configure'} = "102-8";
  880.     $funct{'aedit_pro'} = "102-9";
  881.     $funct{'advanced_access_editor'} = "102-10";
  882.     $funct{'display_profile'} = "103-1";
  883.     $funct{'display_picture'} = "103-2";
  884.     $funct{'compare_profiles_PRO'} = "103-3";
  885.     $funct{'display_profile_differences_PRO'} = "103-4";
  886.     $funct{'read_profile'} = "103-5";
  887.     $funct{'synchronize_PRO'} = "103-6";
  888.     $funct{'profile_editor_screen_PRO'} = "103-7";
  889.     $funct{'image_handler_PRO'} = "103-8";
  890.     $funct{'create_blank_profile_file'} = "103-9";
  891.     $funct{'notify_save_pro'} = "103-10";
  892.     $funct{'prefs_save_pro'} = "103-11";
  893.     $funct{'info_save_pro'} = "103-12";
  894.     $funct{'clear_picture'} = "103-13";
  895.     $funct{'edit_post_form'} = "103-14";
  896.     $funct{'edit_message_action'} = "103-15";
  897.     $funct{'get_preferences'} = "103-16";
  898.     $funct{'pro_cookies'} = "103-17";
  899.     $funct{'validate_auths'} = "103-18";
  900.     $funct{'select_by_subtopics'} = "103-19";
  901.     $funct{'archive_mgr'} = "104-1";
  902.     $funct{'prune_messages'} = "104-2";
  903.     $funct{'ip_ban_form'} = "104-3";
  904.     $funct{'check_ban_ip'} = "104-4";
  905.     $funct{'save_archive_options'} = "104-5";
  906.     $funct{'auto_prune'} = "104-6";
  907.     $funct{'rtf_to_webtags'} = "105-1";
  908.     $funct{'spellcheck'} = "105-2";
  909.     $funct{'profile_fields'} = "105-3";
  910.     $funct{'profile_fields_save'} = "105-4";
  911.     $funct{'queue_mgr_1'} = "106-1";
  912.     $funct{'queue_frames'} = "106-2";
  913.     $funct{'queue_mgr_disp'} = "106-3";
  914.     $funct{'queue_edit'} = "106-4";
  915.     $funct{'queue_action'} = "106-5";
  916.     $funct{'backup_mgr'} = "106-6";
  917.     $funct{'create_backup'} = "106-7";
  918.     $funct{'bumgr'} = "106-8";
  919.     $funct{'restore_action'} = "106-9";
  920.     $funct{'compress_uncompress'} = "106-10";
  921.     $funct{'open_archive_interface'} = "106-11";
  922.     $funct{'manual_restore'} = "106-12";
  923.     undef %evaluated;
  924. }
  925. open (LANG, "$admin_dir/language.conf");
  926. @lang = <LANG>;
  927. close (LANG);
  928. if (-e "$admin_dir/language_pro.conf") {
  929.     open (LANG, "$admin_dir/language_pro.conf");
  930.     @lang2 = <LANG>;
  931.     close (LANG);
  932.     push (@lang, @lang2);
  933. }
  934. undef %lang;
  935. @lang = grep(!/^#/, @lang);
  936. @lang = grep(/\S/, @lang);
  937. $cur = "";
  938. foreach $line (@lang) {
  939.     $line =~ s/##(.*)//;
  940.     $line =~ s/^\s+//;
  941.     $line =~ s/\s+$//;
  942.     if ($line =~ m|^\$(\w+)|) {
  943.         $cur = $1; $del = "";
  944.     } elsif ($line =~ m|^\@(\w+)\((.)\)|) {
  945.         $cur = $1; $del = $2;
  946.     } elsif ($del ne "") {
  947.         @arr = split(/$del/, $line);
  948.         foreach $a (@arr) {
  949.             $a =~ s/^\s+//;
  950.             $a =~ s/\s+$//;
  951.         }
  952.         $evst = "\@$cur = (";
  953.         foreach $a (@arr) {
  954.             $evst .= "'$a',";
  955.         }
  956.         chop ($evst); $evst .= ");";
  957.         eval $evst;
  958.     } elsif ($cur ne "") {
  959.         $L{$cur} .= $line . " ";
  960.     }
  961. }
  962. foreach $key (keys(%L)) {
  963.     $L{$key} =~ s/^\s+//;
  964.     $L{$key} =~ s/\s+$//;
  965. }
  966. &ex('check_ban_ip', 1) if $pro;
  967. 1;
  968.