--- suikawiki/script/wiki.cgi 2002/12/25 02:04:11 1.41 +++ suikawiki/script/wiki.cgi 2002/12/30 03:20:06 1.42 @@ -16,16 +16,14 @@ # my $modifier_dbtype = 'dbmopen'; # Fast, not available on some server, page size limited. my $modifier_dbtype = 'YukiWikiDB'; # Slow, available on all environment. my $modifier_dir_data = './wikidata'; # Your data directory. -our $url_cgi = '/~wakaba/-temp/wiki/wiki'; ## MUST be started by '/' -############################## -# -# You MAY modify following variables. -# -$SuikaWiki::Plugin::plugin_directory = q(./SuikaWiki/Plugin/); -my $file_touch = "$modifier_dir_data/touched.txt"; +our $url_cgi = '/~wakaba/-temp/wiki/wiki'; + ## - MUST be started by '/' + ## - MUST NOT include [&<>"] and/or non-URI characters our %uri; -$uri{stylesheet} = $url_cgi.'?mycmd=TEXT_CSS;mypage=WikiHTMLStyle'; +$uri{wiki} = $url_cgi; $uri{cvs_wikipage} = '/gate/cvs/wakaba/suikawiki/wiki/'; +$SuikaWiki::Plugin::plugin_directory = q(./SuikaWiki/Plugin/); +my $file_touch = "$modifier_dir_data/touched.txt"; ############################## # # You MAY, but do NOT NEED modify following variables. @@ -42,6 +40,9 @@ my $ErrorPage = 'ErrorPage'; my $RssPage = 'RssPage'; my $AdminSpecialPage = 'Admin Special Page'; # must include spaces. +my %PageName = ( + DefaultStyleForHTML => 'WikiHTMLStyle', +); ############################## my %fmt; ## formatter objects my %embed_command = ( @@ -56,15 +57,12 @@ my $lang = 'ja'; my %fixedpage = ( $IndexPage => 1, - $CreatePage => 1, $ErrorPage => 1, $RssPage => 1, RecentChanges => 1, - $SearchPage => 1, AdminChangePassword => 1, CompletedSuccessfully => 1, WikiUserAgentList => 1, - WikiPluginInfo => 1, ); my %form; my %database; @@ -74,11 +72,8 @@ ############################## my %page_command = ( $IndexPage => 'index', - $SearchPage => 'searchform', - $CreatePage => 'create', $RssPage => 'rss', AdminChangePassword => 'adminchangepasswordform', - WikiPluginInfo => 'x_WikiPluginInfo', ); my %command_do = ( read => \&do_read, @@ -90,15 +85,11 @@ write => \&do_write, index => \&do_index, searchform => \&do_searchform, - search => \&do_search, - create => \&do_create, - createresult => \&do_createresult, comment => \&do_comment, RandomJump => \&do_random_jump, rss => \&do_rss, diff => \&do_diff, wikiform => \&do_wikiform, - x_WikiPluginInfo => \&do_wikiplugininfo, map => \&do_map, ); my $UA = ''; ## User agent name @@ -112,7 +103,7 @@ if ($command_do{$form{mycmd}}) { &{$command_do{$form{mycmd}}}; } else { - &{$command_do{$form{read}}}; + &{$command_do{read}}; } &close_db; } @@ -137,14 +128,14 @@ $cf = $1 if $content =~ s#^(?:/\*\s*|[\#<]\?)?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.\x0D\x0A][^\x0D\x0A]*)?)[\x0D\x0A]+##s; if ($cf =~ m!^(?:\#\?)?SuikaWiki/0.9(?:$|\s)!) { #print gmtime."Header...\n"; - &print_header ($form{mypage}, -last_modified => $lm, - -content_format => $cf, -noindex => $cf =~ /obsoleted="yes"/); + &print_header ($form{mypage}, -last_modified => $lm, -expires => time + 120, + -content_format => $cf, -noindex => ($cf =~ /obsoleted="yes"/ ? 1 : 0)); #print "\n". gmtime."Body...\n"; &print_content ($content, content_format => $cf, last_modified => $lm, -toc => \@toc); print &text_to_html (q([[#comment]])) if $cf !~ /obsoleted="yes"/ && !$fixedpage{$form{mypage}}; } else { - &print_header($form{mypage}, -last_modified => $lm); + &print_header($form{mypage}, -expires => time + 120, -last_modified => $lm); print "
@{[&escape($content)]}"; } if ($c) { @@ -167,6 +158,7 @@ my $lm = gmtime &get_info($form{mypage}, $info_LastModified); print "Content-Type: text/css; charset=@{[&get_charset_name($kanjicode)]}\n"; print "Last-Modified: $lm\n"; + print "Expires: @{[scalar gmtime time+3600]}\n"; ## TODO: don't use asctime print "\n"; print $content; } else { @@ -188,12 +180,14 @@ sub do_edit { my ($page) = &unarmor_name(&armor_name($form{mypage})); - &print_header($page, -noindex => 1); if (not &is_editable($page)) { + &print_header($page, -noindex => 1); &print_message(&Resource('Error:ThisPageIsUneditable')); } elsif (&is_frozen($page)) { + &print_header($page, -noindex => 1); &print_message(&Resource('Error:ThisPageIsUneditable')); } else { + &print_header($page, -noindex => 1, -expires => time+60); &print_editform($database{$page}, &get_info($page, $info_LastModified), admin=>0); } wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); @@ -335,20 +329,6 @@ } } -sub do_searchform { - &print_header($SearchPage); - &print_searchform(""); - &print_footer($SearchPage); -} - -sub do_search { - my $word = $form{mymsg}; - &print_header($SearchPage); - &print_searchform(&escape($word)); - print scalar get_search_result ($word, -output_not_found => 1, -match_myself => 1); - &print_footer($SearchPage); -} - sub get_search_result ($;%) { my $word = lc shift; my %option = @_; @@ -372,19 +352,6 @@ wantarray? ($r, scalar @r): $r; } -sub do_create { - &print_header($CreatePage); - print <<"EOD"; - -EOD - &print_footer($CreatePage); -} - sub do_random_jump { my @list = keys %database; my $name = &encode ($list[rand @list]); @@ -421,6 +388,9 @@ } } print qq{Last-Modified: @{[scalar gmtime $option{-last_modified}]}\n} if $option{-last_modified}; + if ($option{-expires}) { + print qq{Expires: @{[scalar gmtime $option{-expires}]}\n}; + } if ($UA =~ m#Mozilla/2#) { my $ct = qq{text/html; charset=@{[&get_charset_name($kanjicode,compatible=>1)]}}; print qq{Content-Type: $ct\n}; @@ -431,8 +401,9 @@ print qq{Content-Type: text/html; charset=@{[&get_charset_name($kanjicode)]}\n}; } push @head, qq(