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 / cgi-bin / discus_staff / show.cgi < prev   
Text File  |  1999-01-29  |  3KB  |  89 lines

  1. #!/usr/bin/perl
  2. $discus_conf = '/usr/local/www/www.acheron.org/discus_admin_116439176/discus.conf';
  3. #Discus board show script
  4. #-------------------------------------------------------------------------------
  5. # This script is copyright (c) 1998 by DiscusWare, LLC, all rights reserved.
  6. # Its use is subject to the license agreement that can be found at the following
  7. # URL:  http://www.chem.hope.edu/discus/license
  8. #-------------------------------------------------------------------------------
  9. if (open (FILE, "$discus_conf")) {
  10.     @file = <FILE>;
  11.     close (FILE);
  12.     $evals = "";
  13.     foreach $line (@file) {
  14.         if ($line =~ /^(\w+)=(.*)/) {
  15.             $varname = $1;
  16.             $value = $2;
  17.             $value =~ s/'/\\'/g; $value =~ s/\r//g;
  18.             $evals .= "\$$varname='$value'; ";
  19.         }
  20.     }
  21.     eval($evals);
  22.     require "$admin_dir/source/src-board-subs-common";
  23. } else {
  24.     print "Content-type: text/html\n\n";
  25.     print "<HTML><HEAD><TITLE>Script Execution Error</TITLE></HEAD>\n";
  26.     print "<BODY BGCOLOR=#ffffff TEXT=#000000>\n";
  27.     print "<H1>Script Execution Error</H1>\n";
  28.     print "Discus scripts could not execute because the discus.conf file\n";
  29.     print "could not be opened.";
  30.     print "<P>Reason: <FONT COLOR=#ff0000><B>$!</B></FONT>" if $!;
  31.     print "<P>This generally indicates a setup error of some kind.\n";
  32.     print "Consult the <A HREF=\"http://www.chem.hope.edu/discus/rc\">Discus ";
  33.     print "Resource Center</A> for troubleshooting information.</BODY></HTML>\n";
  34.     exit(0);
  35. }
  36. &read_cookie;
  37. $query_string = $ENV{'QUERY_STRING'};
  38. $query_string =~ m|(\d+)/(\d+)|;
  39. $topic = $1; $page = $2;
  40. if ($topic == 0) {
  41.     $query_string = $COOKIE{'curloc' . $COOKIE_ID};
  42.     $query_string =~ m|(\d+)/(\d+)|;
  43.     $topic = $1; $page = $2;
  44. }
  45. if (-e "$message_dir/$topic") {
  46.     $secure = 0;
  47. } else {
  48.     $secure = 1;
  49. }
  50. if ($interface eq "noframes") {
  51.     &seturl("$message_url/$topic/$page.$ext") if $secure == 0;
  52.     &seturl("$script_url/board-auth.$cgi_extension?file=/$topic/$page.$ext") if $secure == 1;
  53.     exit(0);
  54. }
  55. $file = "$html_dir/messages/$topic/$page.$ext";
  56. if (open (BOARD, "$html_dir/board.html")) {
  57.     @board = <BOARD>;
  58.     close (BOARD);
  59.     if (!grep(/<FRAME Src=/i, @board)) {
  60.         if (!$secure) {
  61.             &seturl("$message_url/$topic/$page.$ext");
  62.         } else {
  63.             if (-e "$secdir/$topic/$page.$ext") {
  64.                 &seturl("$script_url/board-auth.$cgi_extension?file=/$topic/$page.$ext");
  65.             } else {
  66.                 &error_message("Invalid Page", "The requested page does not exist.");
  67.             }
  68.         }
  69.         exit(0);
  70.     }
  71.     &header;
  72.     foreach $line (@board) {
  73.         if ($line =~ m|<FRAME Src="([^"]*)messages/board-topics.html"|i) {
  74.             print "<FRAME SRC=\"$html_url/messages/board-topics.html\" Name=\"Main\">\n" if $topic == 0;
  75.             print "<FRAME Src=\"$html_url/messages/$topic/$page.$ext\" Name=\"Main\">\n" if ($topic != 0 && !$secure);
  76.             print "<FRAME Src=\"$script_url/board-auth.$cgi_extension?file=/$topic/$page.$ext\" Name=\"Main\">\n" if ($topic != 0 && $secure);
  77.         } elsif ($line =~ m|<FRAME Src="board-menu.$ext"|i) {
  78.             print "<FRAME Src=\"$html_url/board-menu.$ext\" Name=\"Menu\">\n";
  79.         } elsif ($line =~ m|<FRAME Src="board-menu.html"|i) {
  80.             print "<FRAME Src=\"$html_url/board-menu.html\" Name=\"Menu\">\n";
  81.         } else {
  82.             print $line;
  83.         }
  84.     }
  85.     exit(0);
  86. } else {
  87.     &error_message("File Error", "The file <TT>board.html</TT> has been deleted.  Please ask the administrator of this board to restore that file.");
  88. }
  89.