# Ir-i-BBS - interface for ezWeb
# ---------------------------------
# Copyright (c) 1999 by Irao Computer System, All rights reserved.
#
my $copyright_ez = "1999 by Irao.";
#ここまで変更厳禁
$ezMail1 = 'DEST="device:home/goto?svc=Email&SUB=sendMsg" VARS="TO=';
$ezMail2 = 'DEST="mailto:';
$ezMail = ($ENV{'HTTP_X_UP_SUBNO'} =~ /[a-z][a-z]\.ezweb/)? $ezMail2 : $ezMail1;
$sendRef = ($send_referer_ez)? ' SENDREFERER="TRUE"' : '';
$d_markable =~ tr/a-z/A-Z/;
$d_public =~ tr/a-z/A-Z/;
my $next_ez = 0;
my $end_mes = 0;
sub ez_mail_encode {
my ($m) = @_;
$m =~ s/([^-0-9a-zA-Z@._])/'%'.unpack 'H2',$1/eg;
return $m;
}
sub about_ez {
$about_data_ez = &load_about;
$buffer =<<"EOB";
$ezweb_title
$version
$about_data_ez
$copyright_ez
All rights reserved.
EOB
&$output_buffer;
exit;
}
sub top_ez {
my($attribute, $d_ispublic, $returl, $top_data_ez);
local ($topez);
$d_ispublic = "$d_markable $d_public";
$attribute .= ' MARKABLE="' . $d_markable . '"'
if ($d_markable =~ /(TRUE|FALSE)/);
$attribute .= ' PUBLIC="' . $d_public . '"'
if ($d_public =~ /(TRUE|FALSE)/);
$attribute .= ' ACCESSDOMAIN="' . $d_accessdomain . '"'
if (($d_accessdomain ne "") && ($d_ispublic =~ /FALSE/));
$attribute .= ' ACCESSPATH="' . $d_accesspath . '"'
if (($d_accesspath ne "") && ($d_ispublic =~ /FALSE/));
$returl = (($ret_ez) && ($ret_ez !~ /^\s*$/))? $ret_ez : '';
$topez = "true";
$top_data_ez = &load_about;
$returl =<<"EOR" if ($returl);
EOR
my ($addition);
$addition = "
$version" if ($print_version);
my $counterStr = '' . $mobile_counter_front_str . $a_count . $mobile_counter_back_str
if ($mobile_counter_mode and $enable_counter);
my $anounce;
my $ezlast = (exists $COOKIE{'EzLAx'})? $COOKIE{'EzLAx'} : undef;
if (not defined $ezlast or (stat($bbs_data_file))[9] > $ezlast) {
my $expDate = &get_gmt(86400*$cookDaysEz);
my $now = time;
$cook = "Set-Cookie: EzLAx=$now; expires=$expDate\n";
undef $ezlast;
$anounce = '更新されました. 再読込します';
print <<"EOB";
Content-Type: multipart/mixed;boundary="--EZweb"
$cook
----EZweb
Content-Type: application/x-up-cacheop
OpCode=InvalidateSVC&Operand=$ENV{'SCRIPT_NAME'}%3Fstart
----EZweb
EOB
}
$buffer =<<"EOB";
$returl
$ezweb_title$addition
$counterStr
$anounce
$top_data_ez
$copyright_ez
All rights reserved.
EOB
&$output_buffer;
if (not defined $ezlast) {
print "----EZweb--\n\n";
}
exit;
}
sub reload_ez {
print <<"EOB";
Content-Type: multipart/mixed;boundary="--EZweb"
----EZweb
Content-Type: application/x-up-cacheop
OpCode=InvalidateSVC&Operand=$ENV{'SCRIPT_NAME'}
----EZweb
Content-Type: text/x-hdml;charset=Shift_JIS
----EZweb--
EOB
exit;
}
sub write_ez_body {
my ($cname, $cmail, $cseed);
$cname = $COOKIE{'name'};
$cmail = $COOKIE{'email'};
$cseed = $COOKIE{'seed'};
my $postdata = 'action=regist&name=$(nm)&email=$(ma)&subject=$(sb)';
$postdata .= '&message=$(ms)&pass=$(pw)';
&wri_mod_body($cname, $cmail, "", "", $cseed, '記入', $postdata);
exit;
}
sub change_ez_body {
my ($contact, $rettop);
if (($contact_admin) &&
($email_admin =~ /^[a-zA-Z0-9\.\-]+\@[a-zA-Z0-9\.\-]+$/)) {
my $emad = $email_admin;
$emad =~ s/^\s+//;
$emad =~ s/\s+$//;
my $emad2 = &ez_mail_encode($emad);
$contact =<<"EOC";
管理人に連絡する
EOC
}
$rettop = (($ret_local) && ($ret_local !~ /^\s*$/))? $ret_local : '';
$rettop =<<"EOR" if ($rettop);
トップに戻る
EOR
my ($logmode);
if (($save_log) && (-e $bbs_log_file)) {
$logmode = '掲示板の過去ログ';
}
$buffer = <<"EOB";
次から動作を選んでください
掲示板に書込む
再読込する
記事を検索
記事の修正
記事を削除
掲示板の概要
${rettop}${logmode}${contact}掲示板の設定
管理パス変更
EOB
&$output_buffer;
exit;
}
sub view_ez_head {
my ($arg) = @_;
require $ir_i_def_pl if ($imchr_title);
$end_mes = 0;
if ($arg) {
$next_ez = $start + $page_max;
if ($arg <= $page_max + $start) {
$next_ez = $arg - 1;
$end_mes = 1;
}
} else {
$next_ez = 0;
}
$buffer =<<"EOB";
EOB
$ecclen = length($buffer) if ($ez_auto);
}
sub view_ez_body {
my ($line) = @_;
my $line_number = $i;
unless ($line) {
$buffer .= <<'EOB';
投稿はありません
EOB
return;
}
my ($subject, $name, $mail, $web, $message, $date, $host,
$addr, $agent, $pass, $unkey) = split("\t", $line);
chomp $unkey;
$date = &conv_date_imode($date);
$message = &conv_imchr($message);
$subject = &conv_imchr($subject);
$name = &conv_imchr($name);
$message = &conv_jschr($message);
$subject = &conv_jschr($subject);
$name = &conv_jschr($name);
if ($mail ne "") {
my $ml = $mail;
$ml =~ s/^\s+//;
$ml =~ s/\s+$//;
my $ml2 = &ez_mail_encode($ml);
$name = <<"EON";
$name
EON
}
$sc = '[\x00-\x7F]';
$wc = '[\x81-\x9F\xE0-\xFA][\x40-\x7E\x80-\xFB]';
$name =~ s/^(($sc|$wc)*)?\$/$1\$/g;
$subject =~ s/^(($sc|$wc)*)?\$/$1\$/g;
$message =~ s/^(($sc|$wc)*)?\$/$1\$/g;
my $template =<<"EOT";
$date
$subject
$name
$message
EOT
my $mlog = '&mode=log' if ($FORM{'mode'} =~ /^log$/i);
my $next_action = "";
my $smode = ($FORM{'q'})? '&q=$(str)&l=$(lgc)' : '';
my ($tlen, $maxlen);
$tlen = length($template);
$maxlen = $ez_auto_size * 1024;
if (($ez_auto) && ($ecclen + $tlen > $maxlen) && !($force)) {
$buffer =~ s/<(ACTION TYPE="ACCEPT" LABEL="次)へ(" TASK="GO" DEST=)"#NUM${line_number}">/<${1}${2}"?start=$line_number$mlog$smode">/;
return 1;
}
if (($next_ez) && ($line_number < ($next_ez - 1))) {
my $next_ln = $line_number + 1;
$next_action = <<"EON";
EON
} elsif (($next_ez) && (!($end_mes))) {
$next_action = <<"EON";
EON
} else {
if ($line_number == ($next_ez - 1)) {
my $next_ln = $line_number + 1;
$next_action = <<"EON";
EON
} else {
$next_action = <<'EON';
EON
}
}
$buffer .=<<"EOB";
$next_action
$template
EOB
if ($ez_auto) {
$ecclen += $tlen;
$ecclen += length(qq/$next_action/);
}
return 0;
}
sub view_ez_foot {
&$output_buffer;
}
sub view_ez_nums {
# Does nothing
}
sub logmenu_ez_body {
my ($contact, $rettop);
if (($contact_admin) &&
($email_admin =~ /^[a-zA-Z0-9\.\-]+\@[a-zA-Z0-9\.\-]+$/)) {
my $emad = $email_admin;
$emad =~ s/^\s+//;
$emad =~ s/\s+$//;
my $emad2 = &ez_mail_encode($emad);
$contact =<<"EOC";
管理人に連絡する
EOC
}
$rettop = (($ret_local) && ($ret_local !~ /^\s*$/))? $ret_local : '';
$rettop =<<"EOR" if ($rettop);
トップに戻る
EOR
$buffer = <<"EOB";
次から動作を選んでください
通常モード
記事を検索
掲示板の概要
$rettop
$contact
掲示板の設定
管理パス変更
EOB
&$output_buffer;
exit;
}
sub view_log_ez_head {
my ($arg) = @_;
require $ir_i_def_pl if ($imchr_title);
$end_mes = 0;
if ($arg) {
$next_ez = $start + $page_max;
if ($arg <= $page_max + $start) {
$next_ez = $arg - 1;
$end_mes = 1;
}
} else {
$next_ez = 0;
}
$buffer =<<"EOB";
EOB
$ecclen = length($buffer) if ($ez_auto);
}
sub view_log_ez {
$view_head = 'view_log_ez_head';
$view_body = 'view_ez_body';
$view_foot = 'view_ez_foot';
}
sub delete_ez_head {
my ($arg) = @_;
require $ir_i_def_pl if ($imchr_title);
$end_mes = 0;
if ($arg) {
$next_ez = $start + $page_max;
if ($arg <= $page_max + $start) {
$next_ez = $arg - 1;
$end_mes = 1;
}
} else {
$next_ez = 0;
}
$next_dele = "";
unless ($end_mes) {
$next_dele = <<"EON";
次の $page_max 件の記事
EON
}
$next_dele .= <<'EON';
記事一覧に戻る
EON
$buffer = <<"EOB";
削除パス:
次から削除する記事を選んでください
EOB
}
sub delete_ez_body {
my ($line) = @_;
my $line_number = $_;
unless ($line) {
$buffer .= <<'EOB';
削除する投稿はありません
記事一覧に戻る
EOB
return;
}
my ($subject, $name, $mail, $web, $message, $date, $host,
$addr, $agent, $pass, $unkey) = split("\t", $line);
chomp $unkey;
$date = &conv_date_imode($date);
$message = &conv_imchr($message);
$subject = &conv_imchr($subject);
$name = &conv_imchr($name);
$message = &conv_jschr($message);
$subject = &conv_jschr($subject);
$name = &conv_jschr($name);
$buffer .= <<"EOB";
$date $subject $name
EOB
}
sub delete_ez_foot {
$buffer .= <<"EOB";
$next_dele
EOB
&$output_buffer;
}
sub delete_ez {
$view_head = 'delete_ez_head';
$view_body = 'delete_ez_body';
$view_foot = 'delete_ez_foot';
&view;
}
sub certify_ez_body {
require $ir_i_def_pl if ($imchr_title);
&file_lock("$bbs_data_file");
&make_new() unless (-e "$bbs_data_file");
open FHI, "$bbs_data_file" || &bdf_error("ファイルが開けません");
@mes = ;
close FHI;
&file_unlock("$bbs_data_file");
$data = "";
unless ($#mes < 0) {
foreach (@mes) {
my ($num, $pass) = &get_delete_key_pass($_);
if ($num eq $FORM{'key'}) {
$data = $_;
last;
}
}
}
&error("記事が見つかりませんでした") if ($data eq "");
my ($subject, $name, $mail, $web, $message, $date, $host,
$addr, $agent, $pass, $unkey) = split("\t", $data);
$pass = $FORM{'pass'};
chomp $unkey;
$date = &conv_date_imode($date);
$message = &conv_imchr($message);
$subject = &conv_imchr($subject);
$name = &conv_imchr($name);
$message = &conv_jschr($message);
$subject = &conv_jschr($subject);
$name = &conv_jschr($name);
$buffer = <<"EOB";
次の投稿記事を削除しますがよろしいですか?
$date
$subject
$name
$message
EOB
&$output_buffer;
exit;
}
sub select_ez_head {
my ($arg) = @_;
require $ir_i_def_pl if ($imchr_title);
$end_mes = 0;
if ($arg) {
$next_ez = $start + $page_max;
if ($arg <= $page_max + $start) {
$next_ez = $arg - 1;
$end_mes = 1;
}
} else {
$next_ez = 0;
}
$next_dele = "";
unless ($end_mes) {
$next_dele = <<"EON";
次の $page_max 件の記事
EON
}
$next_dele .= <<'EON';
記事一覧に戻る
EON
$buffer = <<"EOB";
削除パス:
次から修正する記事を選んでください
EOB
}
sub select_ez_body {
my ($line) = @_;
my $line_number = $_;
unless ($line) {
$buffer .= <<'EOB';
修正する投稿はありません
記事一覧に戻る
EOB
return;
}
my ($subject, $name, $mail, $web, $message, $date, $host,
$addr, $agent, $pass, $unkey) = split("\t", $line);
chomp $unkey;
$date = &conv_date_imode($date);
$message = &conv_imchr($message);
$subject = &conv_imchr($subject);
$name = &conv_imchr($name);
$message = &conv_jschr($message);
$subject = &conv_jschr($subject);
$name = &conv_jschr($name);
$buffer .= <<"EOB";
$date $subject $name
EOB
}
sub select_ez_foot {
&delete_ez_foot();
}
sub select_ez {
$view_head = 'select_ez_head';
$view_body = 'select_ez_body';
$view_foot = 'select_ez_foot';
&view;
}
sub modify_ez {
my ($subject, $name, $email, $web, $message, $pass, $num) = &modify();
$message =~ s/
/\n/gi;
map {
s/\&/\&/g;
s/\"/\"/g; # "
s/>/\>/g;
s/\</g;
} ($subject, $name, $message);
my $postdata = 'action=modify&name=$(nm)&email=$(ma)&subject=$(sb)';
$postdata .= '&message=$(ms)&pnew=$(pw)&mod=' . $num . '&pass=' . $pass;
&wri_mod_body($name, $email, $subject, $message, $pass, '修正', $postdata);
exit;
}
sub wri_mod_body {
my($name, $email, $subject, $message, $pass, $word, $post) = @_;
$buffer = <<"EOB";
$wordを開始します。よろしければ「開始」を選んで下さい。
いったん回線を切っても結構\です。
名前:
E-mail:
題名:
本文:
削除パス(削除する時に使います):
EOB
&$output_buffer;
}
sub error_ez {
my ($s) = @_;
$buffer = <<"EOB";
$ezweb_title
$version
$s
EOB
&$output_buffer;
}
sub search_body_ez {
my ($mlog, $mlogic, $next_deck);
$mlog = '&mode=log' if ($FORM{'mode'} =~ /^log$/i);
if ($term_logic_enabled) {
$mlogic =<<'EOM';
AND
OR
EOM
}
$next_deck = ($term_logic_enabled)? '#CLGC' : '#SEND';
$buffer = <<"EOB";
$ezweb_title
$version
記事の検索
検索語句を記入します。「記入」を選んで下さい。
検索語句:
$mlogic
EOB
&$output_buffer;
exit;
}
sub search_ez_head {
my ($arg, $data) = @_;
&$view_head($arg);
# &view_ez_head($arg);
}
sub search_ez_foot {
&$output_buffer;
}
sub set_master_mode_ez {
$buffer = <<"EOB";
$ezweb_title
$version
マスターキー設定
マスターキーの設定を開始します。「開始」を選んで下さい。
新パスワード:
新パスワード:
(確認のためもう一度入力してください)
EOB
&$output_buffer;
exit;
}
sub set_init_mode_ez {
local ($title, $email_admin, $envimgpath, $email_send);
local ($sendmail, $email_to, $email_from, $email_subj);
local ($bbs_url);
my ($def_pass) = $FORM{'new1'} if ($FORM{'action'} eq 'set_master');
$init_exist = &load_init($init_file);
my ($email_send_on, $email_send_off);
$email_send_on = ($email_send == 1)? 'checked' : '';
$email_send_off = ($email_send == 0)? 'checked' : '';
my $bbs_admin = $bbs_local . '?action=ch_master' .
'&authorize=' . $COOKIE{'authorize'};
my $scr_path = 'http://' . $ENV{'SERVER_NAME'} . $ENV{'SCRIPT_NAME'};
$bbs_url = $scr_path
if ($bbs_url =~ /^\s*$/);
my $postdata = 'action=set_init&authorize=' . $COOKIE{'authorize'} . '&title=$(bt)&email_admin=$(am)&bbs_url=$(bu)&env_img_path=$(ip)&email_send=$(pn)&sendmail=$(sm)&email_from=$(fm)&email_to=$(tm)&email_subj=$(sj)';
$buffer = <<"EOB";
設定を開始します。よろしければ「開始」を選んで下さい。
いったん回線を切っても結構\です。
掲示板タイトル:
管理者メールアドレス:
掲示板URL(絶対パス):
画像へのパス:
投稿通知:
する
しない
sendmail:
宛先:
送信者:
題名:
設定を書き込みます。よろしければ「設定」を選んで下さい。
EOB
&$output_buffer;
exit;
}
sub authorize_ez {
my ($msg) = @_;
$buffer = <<"EOB";
$msg
パスワード認証
パスワード:
EOB
&$output_buffer;
exit;
}
sub output_buffer_ez {
my ($header, $footer);
$header =<<"EOH";
Content-Type: text/x-hdml;charset=Shift_JIS
EOH
$footer =<<"EOF";
EOF
&subst_secure if ($limit_mode);
print "$header";
print "$buffer";
print "$footer";
}
1;