#!/usr/local/bin/perl require './init.cgi'; require './subr1.cgi'; require './cookie.cgi'; $bbsname = "list.cgi"; &getSetup(2); # 設定読み込み(1=読込後初期化) $yen = $setup{'yen'}; @zeiTable = ("<外税>","<内税>"); $tanni = $zeiTable[$setup{'zei'}]; require './setcolor.cgi'; &readColor; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if ($ENV{'QUERY_STRING'} ne '') { $buffer .= "\&$ENV{'QUERY_STRING'}"; } @pairs = split(/&/,$buffer); 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; $value =~ s/"//g; $value =~ s///g; $value =~ s/\n//g; $value =~ s/\r//g; $value =~ s/\f//g; $value =~ s/\t//g; $in{$name} .= "\0" if (defined($in{$name})); $in{$name} .= $value; } if ($in{'cmd'} eq "logout") { require './cookie.cgi'; # クッキー・ログイン管理 &logout; } $COOKIE{'LOGIN'} = &decCookie("LOGIN"); if ($in{'cmd'} eq "remember") { require './list2.cgi'; require './cookie.cgi'; &rememberPut(); exit; } elsif ($in{'cmd'} eq "reviews") { require './list2.cgi'; &review($in{'filename'}); exit; } elsif ($in{'file'} ne "") { require './list2.cgi'; &viewFile("$in{'category'}/$in{'file'}"); exit; } elsif ($in{'cmd'} eq "tokushoho" || $in{'cmd'} eq "payment") { require './list2.cgi'; &viewMado($in{'cmd'}); exit; } elsif ($in{'cmd'} eq "img") { require './list2.cgi'; &viewImage($in{'filename'}); exit; } elsif ($in{'cmd'} eq "img2") { require './list2.cgi'; &viewImageHTML($in{'filename'}); exit; } if ($in{'cmd'} eq "memory") { require './list2.cgi'; require './cookie.cgi'; ($rememberID) = &decCookie("remember"); &viewList("あとで検討っ!リスト",""); } else { &getCate; if (! -e $cateFile || ! $in{'cate'}) { $in{'category'} = $searchDir = "default"; } else { $searchDir = ""; } if ($in{'category'} ne "") { $page = $goods_page; $viewTitle = "商品の一覧"; } else { $page = $cate_page; $viewTitle = "商品カテゴリ"; } $target = $goods_dir . $in{'category'}; &viewList($viewTitle,$target); } sub viewList { local($viewTitle,$targetDir) = @_; @BASE = @list = (); if ($in{'cmd'} eq "memory") { # あとで検討っ!リスト $page = $goods_page; if (open(RID,"$tmp_dir$rememberID")) { while() { s/\n//g; ($category,$file) = split(/\t/,$_,2); push(@BASE,"$category\t$file"); } close(RID); } @BASE = reverse @BASE; } elsif ($in{'category'} ne "") { # 商品リスト if (!-e $targetDir) { &error("エラー","お探しのページが見つかりません。"); } $check = (eval { opendir(DIR,$targetDir); }, $@ eq ""); if (!$check) { &error("致命的なエラー","Can't get directory"); } @list = readdir(DIR); @list = sort { $b <=> $a; } @list; foreach $dir (@list) { next if $dir eq '.'; next if $dir eq '..'; if ($searchDir eq "" && $dir eq "default") { next; } if ($in{'category'} eq "" && $cateName{$dir} eq "") { next; } if (-d "$targetDir/$dir/") { push(@BASE,$dir); } } close(DIR); } else { # カテゴリーリスト if (!-e $targetDir) { &error("エラー","お探しのページが見つかりません。"); } foreach $dir (@addCateValue) { next if $dir eq '.'; next if $dir eq '..'; if ($searchDir eq "" && $dir eq "default") { next; } if ($in{'category'} eq "" && $cateName{$dir} eq "") { next; } if (-d "$targetDir/$dir/") { push(@BASE,$dir); } } } if ($in{'ff'} eq '') { $FF = 0; } else { $FF = $in{'ff'}; } $TO = $FF + $page - 1; if ($TO > $#BASE) { $TO = $#BASE; } $hit = 0; $next_num = ''; foreach $num ($FF .. $#BASE) { $filename = $BASE[$num]; if ($in{'ff'} ne '') { $allhits = $in{'allhits'}; if ($hit == $page) { last; } else { push(@NEW,$filename); $hit++; } } else { ##if ($allhits % $page == 0) { push(@Index,$num); } if ($hit < $page) { $hit++; push(@NEW,$filename); } $allhits++; } } $in{'allhits'} = $allhits; $count_new = @NEW; if ($in{'allhits'} == 0) { if ($in{'cmd'} eq "memory") { &error("あとで検討っ!リスト","一覧はありません。"); } else { &error("エラー","お探しの一覧はありません。"); } } if (open(F,$infoFile)) { @INFO = ; close(F); foreach $i (@INFO) { $i =~ s/\n//g; ($key,$val) = split(/\t/,$i,2); $setup{$key} .= "\n" if (defined($setup{$key})); $setup{$key} .= $val; } $main = &tag_ok($setup{'main'}); $head = &tag_ok($setup{'head'}); $mid = &tag_ok($setup{'mid'}); $foot = &tag_ok($setup{'end'}); } if (-e "$tmp_dir$logofile") { if (open(F,"$tmp_dir$logoType")) { $ctype = ; close(F); } $LOGO = "\"LOGO\""; } print &HtmlTop("bgcolor=#FFFFFF"); print <<"EOF";
EOF if ($COOKIE{'LOGIN'} eq "OK") { print "
【管理者ログイン中】 ログアウト
\n"; } print <<"EOF";
$LOGO
$head
EOF # タブ表示 if ($in{'cmd'} eq "memory") { print <<"EOF"; EOF $colspan = 5; } elsif (! -e $cateFile || ! $in{'cate'}) { print <<"EOF"; EOF $colspan = 3; } elsif ($in{'category'} ne "") { print <<"EOF"; EOF $colspan = 7; } else { print <<"EOF"; EOF $colspan = 7; } print <<"EOF";

  商品のカテゴリ

  あとで検討っ!リスト

  $viewTitle

  商品のカテゴリ

  $cateName{$in{'category'}}

  あとで検討っ!リスト

  $viewTitle

  商品の一覧

  あとで検討っ!リスト
EOF if ($in{'vp'} eq "") { $in{'vp'} = 1; } $n = $vp = 0; for ($jump = $page; $jump < $in{'allhits'} + $page; $jump += $page) { $vp++; $ffv = ($vp - 1) * $page; $last_page++; } $start = $in{'vp'} - 9; if ($start < 1) { $start = 1; } $end = $in{'vp'} + 9; if ($end >= $last_page) { $end = $last_page; } $n = $vp = 0; foreach $vp ($start .. $end) { $ffv = ($vp - 1) * $page; $title = ''; if ($vp == $in{'vp'}) { $page_now = $vp; last; } } $FROM = $page_now * $page - ($page - 1); $LAST = $FROM + $count_new - 1; print <<"EOF";
$mid
  $in{'allhits'}件中$FROM\-$LAST件目(ページNo.$page_now)
EOF if ($in{'category'} eq "") { print <<"EOF"; EOF } print <<"EOF";
EOF if ($in{'category'} ne "" || $in{'cmd'} eq "memory") { # 商品の一覧 print <<"EOF"; EOF } $f = 0; $f2 = $page; @col = ("#f8f8f8","#ffffff"); foreach $filename (@NEW) { if ($in{'category'} ne "" || $in{'cmd'} eq "memory") { if ($in{'cmd'} eq "memory") { ($in{'category'},$filename) = split(/\t/,$filename,2); } if (! open(F,"$goods_dir$in{'category'}/$filename/index.cgi")) { next; } @lines = ; close(F); undef %setup2; foreach $line (@lines) { ($key,$val) = split(/\t/,$line,2); $setup2{$key} .= "\0" if (defined($setup2{$key})); $setup2{$key} .= $val; } $setup2{'Fee'} = &keta($setup2{'Fee'}); if ($setup2{'Bold'}) { $bold1 = ""; $bold2 = ""; } # 太字指定 else { $bold1 = $bold2 = ""; } $col++; if ($setup2{'Rev'}) { $bgcolor = "bgcolor=#ffff99"; } # 反転指定 else { $bgcolor = "bgcolor=$col[$col % 2]"; } if ($setup2{'img'}) { $photo = "\"\""; } else { $photo = ""; } if ($in{'cmd'} eq "memory") { $memodel = " [削除]"; $memodelAll = ""; } else { $memodel = ""; } $setup2{'Title'} =~ s/\n//g; print "\n"; print "\n"; print "\n"; $br = ""; } else { @list = (); if (eval { opendir(DIR,"$targetDir$filename"); }, $@ eq "") { @list = readdir(DIR); close(DIR); $kazu = @list - 2; $kazu2 = " ($kazu)"; } if ($kazu == 0) { print "\n"; } else { print "\n"; } $br = "
\n"; } } print <<"EOF";

写真
商 品 名
金額 $tanni
$photo$bold1$setup2{'Title'}$bold2$memodel$setup2{'Fee'} $yen
$cateName{$filename}$kazu2
$cateName{$filename}$kazu2

$memodelAll
 ・特定商取引法に基づく表\示$br  ・お支払い方法について
$main
EOF if ($in{'vp'} eq "") { $in{'vp'} = 1; } print "\n"; print <<"EOF";
[ "; $start = $in{'vp'} - 9; if ($start < 1) { $start = 1; } elsif ($start == 1) { ; } elsif ($start > 2) { print "1 .."; } else { print "1"; } $end = $in{'vp'} + 9; if ($end >= $last_page) { $end = $last_page; } elsif ($end < $last_page - 1) { $last_link = " .. $last_page\n"; } else { $last_link = " $last_page\n"; } $n = $vp = 0; foreach $vp ($start .. $end) { $ffv = ($vp - 1) * $page; $title = ''; if ($vp == $in{'vp'}) { print " $vp"; $n = 1; $page_now = $vp; } elsif ($vp == 1) { print "1 "; } else { if ($n) { $n = 0; $Next_link = "次へ"; $next = $vp; } else { $next = $vp; } print " $next"; } } print "$last_link ]"; print "  $Next_link買物カゴへ
$foot

EOF exit; } sub error { local (@msg) = @_; local ($i); print &HtmlTop("bgcolor=#FFFFFF"); print <<"EOF";

  $msg[0] 

EOF print "
    \n"; foreach $i (1 .. $#msg) { print "
  • $msg[$i]\n"; } print "

\n"; if ($in{'cmd'} eq "memory") { print <<"EOF"; [ 商品情報へ ] EOF } else { print <<"EOF"; [ もどる ] EOF } print <<"EOF";

EOF print &HtmlBot; exit; } sub error2 { local (@msg) = @_; local ($i); print &HtmlTop("bgcolor=#FFFFFF"); print <<"EOF";

  $msg[0] 

EOF print "
    \n"; foreach $i (1 .. $#msg) { print "
  • $msg[$i]\n"; } print "

\n"; if ($in{'cmd'} eq "memory") { print <<"EOF"; [ 商品情報へ ] EOF } else { print <<"EOF"; [ もどる ] EOF } print <<"EOF";

EOF print &HtmlBot; exit; }