#!/usr/bin/perl
# please inser the correct perl path in the line above
#*******************************************************************************
# WonderCatStudio Bulletin Board System 7.30
# BBS Note 7.x
# 2000/12/07 >> LastModify 2002/05/30
# Created by WonderCatStudio NoraNeko
# English version provided by shounen.org
#***********************************************************************************
######################################################
########## Settings (Changes not required) ##########
######################################################
$BBS_Version = '7.30b7';
#-----------------------------------------------------------------------------
sub AdminPassCheck;
sub AdminPageOpen;
sub BrowsCss;
sub CountFileOpen;
sub DelImageFile();
sub errorexit;
sub escape();
sub unescape();
sub FileAnalyze();
sub FileListCheck();
sub FileLogDel();
sub FileLogList;
sub FileLogWrite();
sub FileLogResWrite();
sub FileSave();
sub FastBoot;
sub FormMultipart;
sub Function;
sub filelock;
sub fileunlock;
sub fl();
sub call();
sub randstr;
sub CatalogOpen;
sub CookieWrite;
sub GetCookie;
sub GetFileCookie;
sub GetBrowse;
sub GetDate();
sub GetForm;
sub GetMsgPassword();
sub HelpOpen;
sub Initialize;
sub ImgContinue;
sub ImgReplace;
sub MsgCov;
sub MsgConvert;
sub MsgConvEsc();
sub MsgWrite;
sub MsgDelete;
sub MsgReflesh;
sub PostCheck;
sub PasswordCheck();
sub PageOpen;
sub PageForm;
sub PaintInt;
sub PaletteOpen();
sub Panic;
sub Restore;
sub SetPCH_Size;
#----------------------------------------------------------
#Do NOT edit the information regarding the version of this code
$paint_cgi= './paint.cgi' if($paint_cgi eq '');
$Version='BBS NOTE '.$BBS_Version.' ';
require './config.cgi';
errorexit ('1','There is a version regarding the config.cgi','「config.cgi」'.$CONFIG_VERSION.' はこの '.$BBS_Version.' Version does not match! Please recheck your codes and try again.') if($CONFIG_VERSION ne 'Fair Rain');
$cookie_file="$FileSave_DIR/cookie.log";
$lock_sleep=1;
$lock_try = 5;
$lock_sec = 60;
$lockdir = "$FileSave_DIR/lock";
&call('Initialize');
require $skin_cgi;
$maxData=$MaxUpLoadData;
$siiApplet_Use = 1 if(!defined $siiApplet_Use);
my $c=' Client Program Module '.$ModuleVer if($ModuleVer);
$ClientVer.=$d.'www.shounen.org" TARGET="_blank">Shounen.org 'if$siiApplet_Use;
$ClientVer.=$c.'www.gt.sakura.ne.jp/~ocosama/" TARGET="_blank">Shii-chan Oekaki 'if$siiApplet_Use;
$ClientVer.=' Client Program Ono Oekaki'if$PictureBBSApplet_Use;
$ClientVer.=$c.'www.geocities.co.jp/SiliconValley-SanJose/8609/" TARGET="_blank">Nina Oekaki 'if$BBSPainterApplet_Use;
&Function;
#------------------------------------------------------------
sub Function{
&Captor if($fc eq 'captor');
&FormMultipart;
&call('Function');
if($fc eq 'write'){&MsgWrite;&MsgReflesh;&PageOpen}
elsif($fc eq 'page'){&AdminPassCheck if$FORM{'password'};&PageOpen}
elsif($fc eq 'repost'){&RePostOpen}
elsif($fc eq 'post'){&PostOpen}
elsif($fc eq 'delete'){&MsgDelete}
elsif($fc eq 'del'){&AdminPassCheck;&MsgDelete}
elsif($fc eq 'continue'){&ImgContinue}
elsif($fc eq 'pch_size'){&SetPCH_Size}
elsif($fc eq 'help'){&HelpOpen}
elsif($fc eq 'admin'){&AdminPageOpen}
elsif($fc eq 'reflesh'){&AdminPassCheck;&MsgReflesh;&PageOpen}
elsif($fc eq 'restore'){&AdminPassCheck;&Restore}
elsif($fc =~ /paint|open/){&PaintOpen}
&PageOpen;
}
#############################################################
#Page Open
#
sub PageOpen{
&call('PageOpen');
$FORM{'mode'}=$MODE_TOGGLE_TURN[0] if($FORM{'mode'} eq '');
if($fc eq 'write'){&CookieWrite}
elsif($fc eq 'rev'){
&call('Receive');
if(-e $cookie_file){&GetFileCookie}else{&GetCookie}$fc='page';
}
else{
&GetCookie;
if(!"$fc$FORM{mode}$FORM{sort}"){
$FORM{mode} = $COOKIE{mode} if($COOKIE{mode});
$FORM{sort} = $COOKIE{sort} if($COOKIE{sort});
}
if($COOKIE{mode} ne $FORM{mode} || $COOKIE{sort} ne $FORM{sort}){
&GetDate();
&CookieWrite;
}
}
&CatalogOpen if($FORM{'mode'} eq 'catalog' && $fc ne 'rev');
$FORM{'page'}=1 if ($FORM{'page'} eq '');
$page=(($FORM{'page'}-1) * $ViewMessage);
&FileLogList;
if ($LogTotal == 0 && !$adminMode){&FastBoot};
&PageForm;
&GetBrowse;
$LayerForm_Use=($USER_OS=~/Win/ && $AGENT eq 'MSIE')?$LayerForm_Use:0;
print "Content-type: text/html\n$Exp\n";
&HTML_HEAD;print $SKIN_MAIN_FORMAT;
#Administrator Mode View
if($adminMode){
$REFLESH='
「'.$IndexFile.'」has been refreshed.
'if$index_reflesh_Use;
print <
* Administrator Mode *
$login$REFLESH
「$FileSave_DIR」is analyzing the files in the directory.
Entire log size as well as entire image size has been collected here.
EOF
exit
_SUB_
}
##################################################
#Message and Tag check
#
sub MsgCov{eval << '_SUB_';
&call('MsgCov');
if($jcode_pl=~/jcode/){
&jcode'convert(*name,"sjis");
&jcode'convert(*title,"sjis");
&jcode'convert(*mail,"sjis");
&jcode'convert(*mesg,"sjis");
}
&MsgConvEsc(\$name);
&MsgConvEsc(\$mail,1);
&MsgConvEsc(\$url,1);
&MsgConvEsc(\$title);
&MsgConvEsc(\$mesg);
#Check
if($name eq ""){errorexit ('post','You have not entered your name.','You have not enter your name. Please go back and enter in the required elements.')}
if($title eq ""&&$Input_Title){errorexit ('post','You have not entered your title.','You have not enter your title. Please go back and enter in the required elements.')}
if($mesg eq ""){errorexit ('post','You have not entered your message.','You have not enter your message. Please go back and enter in the required elements.')};
&MsgConvert;
_SUB_
}
sub MsgConvert{eval << '_SUB_';
&call('MsgConvert');
if(!$mail && $Input_Mail){
if($fc eq 'captor'){print "Content-type: text/plain\n\nerror\n Error! \n Your email address has not been entered. \n Please go back and enter in the required elements.";exit};
errorexit ('post','You have not entered your email address.','You have not enter your email address. Please go back and enter in the required elements.')
}
if(length $mail > 0 && $mail !~ /(.*)\@(.*)\.(.*)/){errorexit ('post','You have entered an incorrect email address format.','Please only use letters and numbers.')}
if(length $name > $Maxnamelen){$len=length $name;errorexit ('post','Your name contains too many characters.',"Please go back and try again. You currently have $len<\/FONT> characters. \ This board's character limit is $Maxnamelen characters.<\/FONT>")}
if(length $title > $Maxtitlelen){$len=length $title;errorexit ('post','Your title contains too many characters.',"Please go back and try again. You currently have $len<\/FONT> characters. \ This board's character limit is $Maxmaillen characters.<\/FONT>")}
if(length $mail > $Maxmaillen){$len=length $mail;errorexit ('post','Your email address contains too many characters.',"Please go back and try again. You currently have $len<\/FONT> characters. \ This board's character limit is $Maxmaillen characters.<\/FONT>")}
if(length $url > $MaxURLlen){$len=length $url;errorexit ('post','Your URL contains too many characters.',"Please go back and try again. You currently have $len<\/FONT> characters. \/ character limit. $MaxURLlen characters.<\/FONT>")}
if(length $mesg > $Maxmesg){$len=length $mesg;errorexit ('post','Your message contains too many characters.',"Please go back and try again. You currently have $len<\/FONT> characters. \ This board's character limit is $Maxmesg characters.<\/FONT>")}
$RankCmt=$RankCmt+$mesglen;
#-------------------------- Tag Usage -------------------------------
if($TAGS_Use){
local($msg,$end,@parts,@NeedCnt,$pre_flag);
$mesg =~ s/\<\;BR>/\n/ig;
$mesg =~ s/\<\;P>/\n\n/ig;
my @parts = split(/(>)/,$mesg);
my $end = pop @parts;
foreach(@parts){
if(index $_,'<' > -1){
local($n,$aliment,$need,$slash,@l);
foreach $need(@l=@OKTags){
($need,@tag_element) = split /:/,$need;
if(s/\<\;(\/)?$need(.*|$)/<$1$need/i){
$slash=$1;
if($need eq 'PRE'){
$pre_flag = $pre_flag != 1?1:0;
}
if($slash eq ''){
$NeedCnt[$n]++;
}else{
$NeedCnt[$n]--;
}
if(!$pre_flag){
$aliment = $2;
$aliment =~ s/\=/\&equ\;/gi;
$aliment =~ s/\&equ\;\"\;([\w-.!~*'();\/?:\@\&\+\$,%\#\x80-\xFF]+)\"\;(\s|$)/\&equ\;\"\;$1\e\"\;$2/g;
$URLAutoLink=0 if($need eq 'A');
if($need eq 'FONT'){
$aliment =~ s/\bSIZE\&equ\;\"\;(\w*)(?:\e)\"\;/size=\"$1\"/i;
$aliment =~ s/\bCOLOR\&equ\;\"\;([\w\#]*)(?:\e)\"\;/color=\"$1\"/i;
$aliment =~ s/\bFACE\&equ\;\"\;(.*)(?:\e)\"\;/face=\"$1\"/i;
}elsif($need eq 'DIV'){
$aliment =~ s/\bALIGN\&equ\;\"\;(CENTER|LEFT|RIGHT)(?:\e)\"\;/align=\"$1\"/i;
}
foreach $e(@tag_element){
$aliment =~ s/(\s*)$e\&equ\;\"\;([^ ]*)(?:\e)\"\;/$1$e\=\"$2\"/si;
}
undef %tag_element;
}elsif($need ne 'PRE'){s/\<\;/}
$aliment =~ s/(?:\e|\"\;|\&equ\;)//g;
$aliment =~ s/(?: *)$//g;
last
}
$n++
}
$_.=$aliment
}
$msg .= $_
}
$n=0;
my($error,$tag,$s);
foreach(@NeedCnt){
if($_>0){
($tag) = split /:/,$OKTags[$n],1;
$s = "$_ places" if $_>1;
$error.= "<$tag>$s ";
}
$n++
}
errorexit ('post','You have not closed one fo your tags.',"$errorIn order for message to send, you MUST make sure all of your tags are closed.")if($error);
$mesg = $msg.$end;
}
#----------------------------------------------------------------------
#Linkage
if($URLAutoLink){$mesg =~ s/https?:\/\/([-_.!~*'()\w;\/?:\@&=+\$,%#]+)/http\:\/\/$1<\/A>/ig};
if($MailAutoLink){$mesg =~ s/mailto\:([\w\.\?\#\_\:\;\/\%\&\$\"\!\'\(\)\=\~\^\-\+\|\@]*)/$1<\/A>/ig};
#Breaks
$mesg=~ s/\x0D\x0A/\n/g;
$mesg=~ s/\x0D/\n/g;
$mesg=~ s/\x0A/\n/g;
if($Msg_Quotation){
for($m=0;$m<2;$m++){$mesg=~ s/(^|\n)(>|>|#)(.+)(\n|$)/$1$Msg_Quot_Font$2$3$Msg_Quot_Font_End$4/g}
}
$LineCntCapa=($mesg =~ s/\n\n/
$F BBS Configurations *Canvas's biggest resolution is "at the image's greatest resolution".
$F Maximum log entries
$F $LogMax entries
$F Maximum message size
$F $Maxmesg byte
$F Maximum response message size
$F $MaxResmesg byte
$F Maximum paint image size
$F $MaxPaintData byte
$F Maximum animation data size
$F $MaxAnimeData byte
$F Maximum thumbnail data size
$F $MaxThumbnailData byte
$F Maximum upload data size
$F $MaxUpLoadData byte
$F Maximum received resolution
$F $maxImageWidth x $maxImageHeight
$F Maximum canvas size
$F $viewLimitW x $viewLimitH
EOF
if($TAGS_Use){
print '
'.$F.' Listed below are tags you can use. *Tags must be closed in order for message to send. ';
foreach(@OKTags){print "\<\;$_\>\;\ \;"}
print '