#!/usr/bin/perl use Suika::CGI; Suika::CGI::Error::die('open', file => $Suika::CGI::param{file}) unless -e $Suika::CGI::param{file}; Suika::CGI::Error::die('open', file => $Suika::CGI::param{file}) unless $Suika::CGI::param{file} =~ m#\.(?:h2h|hnf|html|txt)(?:\.(?:jis|euc|sjis|sj3|ej3))?$#; if ($Suika::CGI::param{file} =~ m#^/usr/local/apache/htdocs/okuchuu/blue-oceans/([\x00-\xFF]+)$#) { Suika::CGI::Error::die('open', file => $Suika::CGI::param{file}) unless $main::ENV{REMOTE_USER} =~ m#^(?:fujii|wakaba)$#; $Suika::CGI::param{uri} ||= 'http://suika.fam.cx/okuchuu/blue-oceans/'.$1; } elsif ($Suika::CGI::param{file} =~ m#^/usr/local/apache/htdocs/([\x00-\xFF]+)$#) { Suika::CGI::Error::die('open', file => $Suika::CGI::param{file}) unless $main::ENV{REMOTE_USER} eq 'wakaba'; $Suika::CGI::param{uri} ||= 'http://suika.fam.cx/'.$1; } elsif ($Suika::CGI::param{file} =~ m#^/home/wakaba/public_html/([\x00-\xFF]+)$#) { Suika::CGI::Error::die('open', file => $Suika::CGI::param{file}) unless $main::ENV{REMOTE_USER} eq 'wakaba'; $Suika::CGI::param{uri} ||= 'http://suika.fam.cx/~wakaba/'.$1; } else { ## Permissionally deny. Suika::CGI::Error::die('open', file => $Suika::CGI::param{file}); } if ($Suika::CGI::param{mode} eq 'post') { print edit_post(%Suika::CGI::param); } else { print edit_input(%Suika::CGI::param); } sub edit_input { my %o = @_; open H2H, $o{file} or Suika::CGI::Error::die('open', file => $o{file}); my $h2h = _html(join('', )); close H2H; jcode::jis(< $o{file}

•ÒW

–{•¶:

[/] [$o{uri}]
EOH } sub edit_post { my %o = @_; Suika::CGI::Error::die('empty') unless $o{body}; open H2H, '> '.$o{file} or Suika::CGI::Error::die('write', file => $o{file}); print H2H $o{body}; close H2H; edit_input(%o); } sub _html { my $s = shift; $s =~ s/&/&/g; $s =~ s//>/g; $s =~ s/"/"/g; $s; } 1;