package Set; use base Bbs; use strict; sub cookie {my($expire,$mons,$wdays,$time,$spid,$name,$mail);$expire = $_[0]->conf('cookie_expire') || 86400;my($sec,$min,$hour,$day,$mon,$year,$wday) = gmtime( time + $expire );$mons = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)[$mon];$wdays = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)[$wday];$year += 1900;$day = "0$day" if ($day < 10);$time = "$wdays, $day-$mons-$year 00:00:00 GMT";$spid = $_[0]->cookie('SPID') || $_[0]->get_spid();$name = $_[0]->from('name');$mail = $_[0]->from('mail');if ( $_[0]->conf('cookie_jcode_encode') eq 'checked' ) {eval{require Jcode;Jcode::convert(\$name, 'ucs2', 'sjis');$name =~ s/(..)/'%u'.unpack("H*",$1)/eg;Jcode::convert(\$mail, 'ucs2', 'sjis');$mail =~ s/(..)/'%u'.unpack("H*",$1)/eg;};} if ( $ENV{'HTTP_USER_AGENT'} =~ /mac/i ) {$name =~ s/([^\w\=\& ])/'%'.unpack('H2',$1)/eg;$name =~ tr/ /+/;$mail =~ s/([^\w\=\& ])/'%'.unpack('H2',$1)/eg;$mail =~ tr/ /+/;}$_[0]->headerfields( 'Set-Cookie: SPID=' => "$spid; expires=$time; path=/", 'Set-Cookie: NAME=' => "$name; expires=$time; path=/", 'Set-Cookie: MAIL=' => "$mail; expires=$time; path=/" );$_[0];} sub id { my($id_setting,$mail,$date,$id,$use_cap); $id_setting = $_[0]->setting('ID_DISP'); $mail = $_[0]->from('mail'); $date = $_[0]->from('date'); $id = $_[0]->get_id(); $use_cap = $_[0]->flag('cap'); return $_[0] if $id_setting eq 'none' || $id_setting eq ''; $_[0]->from( 'date' => "$date iD:???" ), return $_[0] if ($id_setting eq 'force' || $id_setting eq 'show') && $use_cap; $_[0]->from( 'date' => "$date iD:$id" ), return $_[0] if $id_setting eq 'force'; if($id_setting eq 'show'){ $_[0]->from( 'date' => "$date iD:$id" ), return $_[0] if index($mail, 'show') > -1; $_[0]->from( 'date' => "$date iD:" ),return $_[0] if index($mail, 'snow') > -1; $_[0]->from( 'date' => "$date iD:???" ), return $_[0] if index($mail, 'sage') > -1; } $_[0]->from( 'date' => "$date iD:$id" ); $_[0]; } sub permission {my $dat = $_[0]->path('dat').($_[0]->from('key')||$_[0]->from('time')).'.dat';my $index = $_[0]->path('bbs').$_[0]->conf('index');my $subject = $_[0]->path('subject').$_[0]->conf('subject');my $subback = $_[0]->path('subback').$_[0]->conf('subback');my $response = $_[0]->path('bbs').$_[0]->conf('response');my $thread = $_[0]->path('bbs').$_[0]->conf('thread');umask 0;chmod $_[0]->permission('dat'), $dat;chmod $_[0]->permission('index'), $index;chmod $_[0]->permission('subject'), $subject;chmod $_[0]->permission('subback'), $subback;chmod $_[0]->permission('response'), $response;chmod $_[0]->permission('thread'), $thread;$_[0];} 1; __END__