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 / hirez / cgi-bin / discus / board-post-form.cgi < prev    next >
Text File  |  1999-02-12  |  5KB  |  137 lines

  1. #!/usr/bin/perl
  2. $discus_conf = '/usr/local/www/www.hirez.org/discus_admin_149349189/discus.conf';
  3. #Discus board posting form 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. &parse_form;
  37. &read_cookie;
  38. if ($FORM{'HTTP_REFERER'} ne "") {
  39.     $_ = $FORM{'HTTP_REFERER'};
  40. } else {
  41.     $_ = $ENV{'HTTP_REFERER'};
  42.     $FORM{'HTTP_REFERER'} = $ENV{'HTTP_REFERER'};
  43. }
  44. &extract($_);
  45. &header;
  46. ($bgcolor,$text,$link,$vlink,$alink,$face,$size,$image) = &ex('extract_colorsonly', 1);
  47. $strg = &JavaScript_prepare ($topic_name);
  48. $str = "$L{BPFCREATETITLE}";
  49. &ex('printuntil', 1, 1, $topic_number, $str);
  50. print "<FORM Action=\"$script_url/board-post.$cgi_extension\" Method=Post NAME=userpass>\n";
  51. print "<CENTER><FONT SIZE=+1><B>$str</B></FONT></CENTER>\n<HR>\n";
  52. &ex('printuntil', 3, 3, $topic_number, $str, 0, 1);
  53. print "<strong><A HREF=\"$message_url/board-topics.html\" onMouseOver=\"window.status = '$L{NBRETURN}", "$titlej $L{NBMAINPAGE}'; return true\">$title</A>:\n";
  54. $file = "$topic_number/$topic_number.$ext";
  55. print "<A HREF=\"$message_url/$file\" onMouseOver=\"window.status = '$L{NBRETURN} ", "$strg'; return true\">$topic_name</A>: " if -e "$message_dir/$file";
  56. print "<A HREF=\"$script_url/board-auth.$cgi_extension?file=/$file\" onMouseOver=\"window.status = '$L{NBRETURN} ", "$strg'; return true\">$topic_name</A>: " if !-e "$message_dir/$file";
  57. foreach $key (keys(%level_number)) {
  58.     $strg = "$L{NBRETURN} " . &JavaScript_prepare ($level_name{$key});
  59.     $file = "$topic_number/$level_number{$key}.$ext";
  60.     print "<A HREF=\"$message_url/$file" if -e "$message_dir/$file";
  61.     print "<A HREF=\"$script_url/board-auth.$cgi_extension?file=/$file" if !-e "$message_dir/$file";
  62.     print "\" onMouseOver=\"window.status = '$strg'; return true\">$level_name{$key}</A>: \n";
  63. }
  64. &ex('printuntil', 5, 5, $topic_number, $str, 0, 1);
  65. open (FILE, "$admin_dir/posting.txt");
  66. @file = <FILE>; close (FILE);
  67. @file = grep(/\S/, @file);
  68. if (grep(/^$topic_number:/, @file)) {
  69.     ($line) = grep(/^$topic_number:/, @file);
  70.     $line =~ s/\s+$//;
  71.     @file = grep(!/^$topic_number:/, @file);
  72.     ($tn, $ip, $usr, $mod, $pas) = split(/:/, $line);
  73.     $disabled = 1 if ($ip eq "" && $usr eq "" && $mod eq "" && $pas !~ /\S/);
  74. }    
  75. print <<End_Of_File;
  76. $L{BPFCREATETITLE}
  77. </strong>
  78. <HR>
  79. End_Of_File
  80. if ($disabled == 0) {
  81.     print <<End_Of_File;
  82. <BR>
  83. $L{BPFSUBJECT}
  84. <P>
  85. <TABLE><TR><TD>
  86. <Input Type="Text" Name="subject" Size=53>
  87. </TD></TR></TABLE><BR>
  88. <INPUT type=hidden name="HTTP_REFERER" value="$FORM{'HTTP_REFERER'}">
  89. <INPUT type=hidden name="new_conversation" value="1">
  90. <P>
  91. <HR>
  92. End_Of_File
  93. }
  94. &ex('printuntil', 7, 13, $topic_number, $str, 0, 1);
  95. if ($disabled == 1) {
  96.     $l = $L{BPPOSTINGDISABLEDDESCR};
  97.     $l =~ s/\%aopen/<A HREF="$script_url\/board-contact.$cgi_extension">/g;
  98.     $l =~ s/\%aclose/<\/A>/g;
  99.     print "<P><CENTER><TABLE BGCOLOR=#ffcccc><TR><TD><FONT FACE=\"$face\" SIZE=\"$size\" COLOR=000000><B>$l</B></FONT></TD></TR></TABLE>";
  100. } else {
  101.     ($template, $addfile) = &ex('determine_addmessage', $topic_number);
  102.     @file = split(/\n/, $addfile);
  103.     foreach $line (@file) {
  104.         $line .= "\n";
  105.         $line =~ s/<!-FONT-!>/<FONT FACE="$face" SIZE="$size">/g;
  106.         $line = "" if $line =~ m|FORM>|;
  107.     }
  108.     $flag = 0;
  109.     foreach $line (@file) {
  110.         if ($line =~ /<!-Conversation - LEAVE THIS HERE!-!>/) {
  111.             $flag = 1;
  112.         } elsif ($line =~ /<!-\/Identification/) {
  113.             $flag = 0;
  114.         } elsif ($line =~ /<!-Skip next line-!>/) {
  115.             $flag = 2+$flag;
  116.         } elsif ($flag >= 2) {
  117.             $flag -= 2;
  118.         } elsif ($line =~ /<!-Submit button included-!>/) {
  119.             $submit_included = 1;
  120.         } elsif ($line =~ m|^<!-Anon-!>|) {
  121.             next if $anon;
  122.             next if ($GLOBAL_OPTIONS{'anonymous'} == 0 && $GLOBAL_OPTIONS{'options_used'} == 1);
  123.             print $line;
  124.         } elsif ($flag == 1) {
  125.             print $line;
  126.         }
  127.     }
  128.     print "<HR>\n";
  129.     if ($submit_included == 0) {
  130.         print "<CENTER>\n";
  131.         print "<INPUT TYPE=\"submit\" Name=submit VALUE=\"$L{BPPREVIEWPOST}\">\n";
  132.         print "</CENTER><HR></FORM>\n";
  133.     }
  134. }
  135. &ex('printuntil', 15, 17, $topic_number, $str, 0, 1);
  136. exit(0);
  137.