#!/usr/bin/perl -w $| = 1; ##################################### # # # RobBoard v1.0 # # Copyright 1999 by Rob Eisler # # rob@robplanet.com # # http://www.robplanet.com # # # # Last modified on Jan 13, '99 # # # ##################################### # # Copyright Notice: # Copyright 1999 Robert S. Eisler. All Rights Reserved. # # This code may be used and modified by anyone so long as this header and # copyright information remains intact. By using this code you agree to # indemnify Robert S. Eisler from any liability that might arise from its # use. You must obtain written consent before selling or redistributing # this code. # ##################################### # declare the variables $boarddir = '.'; $boardurl = 'http://www.moscow.byx.ru/forum/'; $cgi = 'http://www.moscow.byx.ru/forum/robboard.cgi'; $indexcgi = 'http://www.moscow.byx.ru/forum/index.cgi'; $queryswitch = '?'; $style = 0; $threaded = 1; $maximum = 1; $maxdisplay = 50; $fontface = 'arial'; $fontsize = 2; $tablecolor1 = 'black'; $tablecolor2 = 'white'; $tablecolor3 = 'white'; $fontcolor1 = 'white'; $fontcolor2 = 'black'; $fontcolor3 = 'black'; ######################################################################### # Don't change anything below here unless you know what you're doing :) # ######################################################################### $datadir = "$boarddir/data"; $datafile = "$boarddir/data.txt"; $index_t = "$boarddir/index_t.html"; $page_t = "$boarddir/page_t.html"; $use_cgi = 1; $LOCK_EX = 2; $LOCK_UN = 8; &readform; if(!$page){ $page = 1; } print "Content-type: text/html\n\n"; open (FILE, "$datafile") || &fatal_error("Unable to open $datafile"); &lock(FILE); @messages = ; &unlock(FILE); close(FILE); $messagecount = 0; $threadcount = 0; for ($a = 0; $a < @messages; $a++) { ($mnum[$a],$msub[$a],$mfollow[$a],$mname[$a],$memail[$a],$mdate[$a],$mip[$a],$mbrowser[$a],$chop) = split(/``/,$messages[$a]); $messagecount++; if ($mfollow[$a] == 1) { $threadcount++; } } $pages = ( int($messagecount/$maxdisplay) == ($messagecount/$maxdisplay) ) ? int($messagecount/$maxdisplay) : int(($messagecount/$maxdisplay)+1); open (FILE, "$index_t") || &fatal_error("Unable to open $index_t"); &lock(FILE); @template = ; &unlock(FILE); close(FILE); for ($a = 0; $a < @template; $a++) { $_ = $template[$a]; if (//) { if ($style == 1) { $displaycounter = 0; $itzapizza = 0; $remember = $mnum[0]; print "\n"; for ($b = 0; $b < @messages; $b++) { if ($mfollow[$b] > 1) { $itzapizza++; } else { unless ($b == 0 || $threaded == 0) { print "\n"; if ($itzapizza == 0) { print "\n"; $remember = $mnum[$b]; } $displaycounter++; open (FILE, "$datadir/$mnum[$b]\.txt") || &fatal_error("Unable to open $mnum[$b]\.txt"); &lock(FILE); @body = ; &unlock(FILE); close(FILE); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } if ($displaycounter >= $maxdisplay && $maximum == 1 && $action ne 'showall') { $b = @messages; } } unless (@messages == 0 || $threaded == 0) { print "\n"; if ($itzapizza == 0) { print "\n"; } print "
Thread Info:No more messages in this thread.\n"; } else { print "$itzapizza more message(s) in this thread.\n"; $itzapizza = 0; } print "Post / View this thread.
$mdate[$b]
Отправленно:$mname[$b]
Тема:$msub[$b]
Текст сообщения:@body
Нет больше сообщений в этом thread.\n"; } else { print "$itzapizza more message(s) in this thread.\n"; } print "Отправить / Посмотреть эту thread.
\n"; } else { $last = 1; print "\n"; } } } elsif (//) { print "
\n"; print "\n"; print "\n"; print "\n\n"; print "\n"; print "\n\n"; print "\n"; print "\n\n"; print "\n"; print "\n\n"; print "\n"; print "
Ваше Имя:
Ваш E-Mail:
Тема сообщения:
Текст сообщения:
"; print " "; print "
\n\n"; } elsif (//) { print "$messagecount\n"; } elsif (//) { print "$threadcount\n"; } elsif (//) { if ($maximum == 1 && $action ne 'showall' && @messages > $maxdisplay) { print "$maxdisplay\n"; } else { print "все\n"; } } elsif (//) { if ($maximum == 1 && $action ne 'showall' && @messages > $maxdisplay) { print "Показать все сообщения\n"; } } elsif (//) { for($i=1;$i<=$pages;$i++) { if($i == $page){ print "$i "; } else { print "$i "; } } } else { print "$_"; } } sub fatal_error { local($e) = @_; print "\n"; print " RobBoard Fatal Error \n"; print "\n"; print "
\n"; print "

RobMail Fatal Error

\n"; print "
\n"; print "RobBoard experienced an unrecoverable error. The error seems\n"; print "to be:

\n"; print "$e

\n\n"; print "If this error continues, you should contact the administrator.

\n"; print "RobBoard Main\n"; print "

\n"; print "
"; print "
\n"; exit; } sub readform { read(STDIN, $input, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $input); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $FORM{$name} = $value; } $what = $FORM{'what'}; @vars = split(/&/, $ENV{QUERY_STRING}); foreach $var (@vars) { ($v,$i) = split(/=/, $var); $v =~ tr/+/ /; $v =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $i =~ tr/+/ /; $i =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $i =~ s///g; $INFO{$v} = $i; } $action = $INFO{'action'}; $startat = $INFO{'startat'}; $page = $INFO{'page'}; } sub lock { local($file)=@_; flock($file, $LOCK_EX); } sub unlock { local($file)=@_; flock($file, $LOCK_UN); }