| 1 |
#!/usr/bin/perl
|
| 2 |
|
| 3 |
=pod
|
| 4 |
|
| 5 |
uri_add.cgi
|
| 6 |
Chuubu-no-uri `whatsnew' maintenor
|
| 7 |
|
| 8 |
Copyright the Watermeron Project 2000-2001.
|
| 9 |
Change:
|
| 10 |
2001-05-12 wakaba
|
| 11 |
- Rename template: .uri-template -> uri.ja.htt
|
| 12 |
2001-05-06 wakaba
|
| 13 |
- Rewrite for Suika-server spec.
|
| 14 |
|
| 15 |
=cut
|
| 16 |
|
| 17 |
require Suika::CGI;
|
| 18 |
|
| 19 |
if (($Suika::CGI::param{mode} eq 'add' && $Suika::CGI::param{comment})) {
|
| 20 |
Suika::CGI::Error::die('id') if ($Suika::CGI::param{uid} ne 'MatsumotoTakeshi');
|
| 21 |
open D, '>> whatnew.dat' or Suika::CGI::Error::die('write', file => 'whatnew.dat');
|
| 22 |
print D $Suika::CGI::param{comment}."\n";
|
| 23 |
close D;
|
| 24 |
open D, 'whatnew.dat' or Suika::CGI::Error::die('open', file => 'whatnew.dat');
|
| 25 |
@D = <D>;
|
| 26 |
close D;
|
| 27 |
|
| 28 |
my ($s, $n);
|
| 29 |
for (0...9) {
|
| 30 |
$n = $#D - $_;
|
| 31 |
next if $n < 0;
|
| 32 |
$s .= '<li>'.$D[$n];
|
| 33 |
}
|
| 34 |
$s = '<ul>'.$s.'</ul>' if $s;
|
| 35 |
open H, 'uri.ja.htt' or Suika::CGI::Error::die('open', file => 'uri.ja.htt');
|
| 36 |
@H = <H>;
|
| 37 |
close H;
|
| 38 |
$" = ''; my $h = "@H";
|
| 39 |
$h =~ s/<!-- ::whatnew:: -->/$s/g;
|
| 40 |
&jcode::convert(\$h,'jis','euc');
|
| 41 |
open D, '> uri.ja.html' or Suika::CGI::Error::die('write', file => 'uri.ja.html');
|
| 42 |
print D $h;
|
| 43 |
close D;
|
| 44 |
|
| 45 |
Suika::CGI::Log::updated($Suika::CGI::rooturi.'chuubu/uri','ちゅーぶの瓜','和');
|
| 46 |
print "Location: uri-add?mode=relong\n\n";
|
| 47 |
} elsif ($Suika::CGI::param{mode} eq 're') {
|
| 48 |
open D, 'whatnew.dat' or Suika::CGI::Error::die('open', file => 'whatnew.dat');
|
| 49 |
@D = <D>;
|
| 50 |
close D;
|
| 51 |
my $s;
|
| 52 |
for (0...9) {
|
| 53 |
next if $#D-$_ < 0;
|
| 54 |
$s .= '<li>'.$D[$#D-$_] if $D[$#D-$_] =~ /./;
|
| 55 |
}
|
| 56 |
$s = "<ul>$s</ul>" if $s;
|
| 57 |
open H, 'uri.ja.htt' or Suika::CGI::Error::die('open', file => 'uri.ja.htt');
|
| 58 |
@H = <H>;
|
| 59 |
close H;
|
| 60 |
$" = ''; my $h = "@H";
|
| 61 |
$h =~ s/<!-- ::whatnew:: -->/$s/g;
|
| 62 |
&jcode::convert(\$h,'jis','euc');
|
| 63 |
open D, '> uri.ja.html' or Suika::CGI::Error::die('write', file => 'uri.ja.html');
|
| 64 |
print D $h;
|
| 65 |
close D;
|
| 66 |
Suika::CGI::Log::updated($Suika::CGI::rooturi.'chuubu/uri','ちゅーぶの瓜','和');
|
| 67 |
print "Location: uri-add?mode=relong\n\n";
|
| 68 |
} elsif ($Suika::CGI::param{mode} eq 'relong') {
|
| 69 |
open D, 'whatnew.dat' or Suika::CGI::Error::die('open', file => 'whatnew.dat');
|
| 70 |
@D = <D>;
|
| 71 |
close D;
|
| 72 |
my $s;
|
| 73 |
for (0...$#D) {
|
| 74 |
next if $#D-$_ < 0;
|
| 75 |
$s .= '<li>'.$D[$#D-$_] if $D[$#D-$_] =~ /./;
|
| 76 |
}
|
| 77 |
$s = "<ul>$s</ul>" if $s;
|
| 78 |
open H, 'uri.ja.htt' or Suika::CGI::Error::die('open', file => 'uri.ja.htt');
|
| 79 |
@H = <H>;
|
| 80 |
close H;
|
| 81 |
$" = ''; my $h = "@H";
|
| 82 |
$h =~ s/<!-- ::whatnew:: -->/$s/g;
|
| 83 |
&jcode::convert(\$h,'jis','euc');
|
| 84 |
open D, '> uri-all.ja.html' or Suika::CGI::Error::die('write', file => 'uri-all.ja.html');
|
| 85 |
print D $h;
|
| 86 |
close D;
|
| 87 |
Suika::CGI::Log::updated($Suika::CGI::rooturi.'chuubu/uri-all','ちゅーぶの瓜','和');
|
| 88 |
}
|
| 89 |
print "Location: uri\n\n";
|