--- suikawiki/script/wiki.cgi 2002/12/30 03:20:06 1.42 +++ suikawiki/script/wiki.cgi 2003/01/01 01:29:04 1.43 @@ -7,63 +7,23 @@ use strict; use lib qw(./WalWiki/lib); use CGI::Carp qw(fatalsToBrowser); + +require 'wikidata/suikawiki-config.ph'; use Yuki::DiffText qw(difftext); use Fcntl; -# -# You MUST modify following '$modifier_...' variables. -# -# my $modifier_dbtype = 'AnyDBM_File'; # Fast, not available on some server, page size limited. -# 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 '/' - ## - MUST NOT include [&<>"] and/or non-URI characters -our %uri; -$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. -# -my $dataname = "$modifier_dir_data/wiki"; -my $infoname = "$modifier_dir_data/info"; -my $diffname = "$modifier_dir_data/diff"; -my $use_exists = 0; # If you can use 'exists' method for your DB. -############################## -my $FrontPage = 'HomePage'; -my $IndexPage = 'IndexPage'; -my $SearchPage = 'SearchPage'; -my $CreatePage = 'CreatePage'; -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 = ( searched => '^\[\[#searched:([^\]]+)\]\]$', - form => qw/\[\[\#form(?:\(([A-Za-z0-9-]+)\))?:'((?:[^'\\]|\\.)*)':'((?:[^'\\]|\\.)*)'(?::'((?:[^'\\]|\\.)*)')?\]\]/, + form => qr/\[\[\#form(?:\(([A-Za-z0-9-]+)\))?:'((?:[^'\\]|\\.)*)':'((?:[^'\\]|\\.)*)'(?::'((?:[^'\\]|\\.)*)')?\]\]/, ); +our ($modifier_dbtype,$url_cgi,%uri,%PathTo,$use_exists); +our (%PageName,$kanjicode,$lang,%fixedpage); + ############################## my $info_LastModified = 'LastModified'; my $info_IsFrozen = 'IsFrozen'; ############################## -my $kanjicode = 'euc'; -my $lang = 'ja'; -my %fixedpage = ( - $IndexPage => 1, - $ErrorPage => 1, - $RssPage => 1, - RecentChanges => 1, - AdminChangePassword => 1, - CompletedSuccessfully => 1, - WikiUserAgentList => 1, -); my %form; my %database; my %infobase; @@ -71,8 +31,8 @@ my %interwiki; ############################## my %page_command = ( - $IndexPage => 'index', - $RssPage => 'rss', + $PageName{IndexPage} => 'index', + $PageName{RssPage} => 'rss', AdminChangePassword => 'adminchangepasswordform', ); my %command_do = ( @@ -226,7 +186,7 @@ if ($form{mynewpassword} ne $form{mynewpassword2}) { &print_error(&Resource('Error:PasswordMismatch')); } - my ($validpassword_crypt) = &get_info($AdminSpecialPage, 'AdminPassword'); + my ($validpassword_crypt) = &get_info($PageName{AdminSpecialPage}, 'AdminPassword'); if ($validpassword_crypt) { if (not &valid_password($form{myoldpassword})) { # &send_mail_to_admin(<<"EOD", "AdminChangePassword"); @@ -242,7 +202,7 @@ my $salt1 = $token[(time | $$) % scalar(@token)]; my $salt2 = $token[($sec + $min*60 + $hour*60*60) % scalar(@token)]; my $crypted = crypt($form{mynewpassword}, "$salt1$salt2"); - &set_info($AdminSpecialPage, 'AdminPassword', $crypted); + &set_info($PageName{AdminSpecialPage}, 'AdminPassword', $crypted); &print_header('CompletedSuccessfully', -noindex => 1); &print_message(&Resource('Error:PasswordIsChanged')); @@ -252,7 +212,7 @@ sub do_index { wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); wiki::useragent::add ($ENV{HTTP_USER_AGENT}); - &print_header($IndexPage); + &print_header($PageName{IndexPage}); print qq(
$msg
); - &print_footer($ErrorPage); + &print_footer($PageName{ErrorPage}); exit(0); } @@ -450,10 +410,10 @@ ]} @{[&Resource('ViewThisPage',escape=>1)]} | @{[&Resource('ShowMapOfThisPage',escape=>1)]} | - @{[&Resource('GoToCreatePage',escape=>1)]} | - @{[&Resource('GoToIndexPage',escape=>1)]} | - @{[&Resource('GoToHomePage',escape=>1)]} | - @{[&Resource('GoToSearchPage',escape=>1)]} | + @{[&Resource('GoToCreatePage',escape=>1)]} | + @{[&Resource('GoToIndexPage',escape=>1)]} | + @{[&Resource('GoToHomePage',escape=>1)]} | + @{[&Resource('GoToSearchPage',escape=>1)]} | @{[&Resource('GoSomewhere',escape=>1)]} | @{[&Resource('GoToRecentChanges',escape=>1)]} @@ -467,12 +427,12 @@ push @link, {rel=>'edit', href=>"$url_cgi?mycmd=adminedit;mypage=@{[&encode($page)]}", class=>"wiki-command", title=>&Resource('AdminEditThisPageLink')} if &is_editable ($page) || &is_frozen ($page); push @link, {rel=>'view', href=>"$url_cgi?mycmd=read;mypage=@{[&encode($page)]};x-p=@{[time.[0..9]->[rand 10]]}", class=>'wiki-command', title=>&Resource('ViewThisPageLink')}; push @link, {rel=>'myself', href=>"$url_cgi?@{[&encode($page)]}", class=>'wiki', title=>&Resource('GoToMyselfLink')}; - push @link, {rel=>'index', href=>"$url_cgi?$IndexPage", class=>'wiki', title=>&Resource('GoToIndexPageLink')}; - push @link, {rel=>'home', href=>"$url_cgi?$FrontPage", class=>'wiki', title=>&Resource('GoToHomePageLink')}; + push @link, {rel=>'index', href=>"$url_cgi?$PageName{IndexPage}", class=>'wiki', title=>&Resource('GoToIndexPageLink')}; + push @link, {rel=>'home', href=>"$url_cgi?$PageName{FrontPage}", class=>'wiki', title=>&Resource('GoToHomePageLink')}; push @link, {rel=>'News', href=>"$url_cgi?WikiNews", class=>'wiki', title=>&Resource('GoToWikiNewsLink')}; push @link, {rel=>'News', href=>"$url_cgi?RecentChanges", class=>"wiki", title=>&Resource('GoToRecentChangesLink')}; - push @link, {rel=>'News', href=>"$url_cgi?$RssPage", class=>"wiki", title=>&Resource('GoToRssPageLink'), type=>'application/xml'}; - push @link, {rel=>'search', href=>"$url_cgi?$SearchPage", class=>'wiki', title=>&Resource('GoToSearchPageLink')}; + push @link, {rel=>'News', href=>"$url_cgi?$PageName{RssPage}", class=>"wiki", title=>&Resource('GoToRssPageLink'), type=>'application/xml'}; + push @link, {rel=>'search', href=>"$url_cgi?$PageName{SearchPage}", class=>'wiki', title=>&Resource('GoToSearchPageLink')}; push @link, {rel=>'help', href=>"$url_cgi?WikiHelp", class=>'wiki', title=>&Resource('GoToWikiHelpLink')}; push @link, {rel=>'copyright', href=>"$url_cgi?WikiPageLicense", class=>'wiki', title=>&Resource('GoToWikiPageLicenseLink')}; push @link, {rel=>'jump', href=>qq(javascript:var%20WikiName=prompt('Please%20input%20the%20WikiName:','','Jump%20to%20SuikaWiki');if(WikiName)%7B_content.location.href='$url_cgi%3F'+encodeURIComponent(WikiName)%7D), class=>'wiki-cmd', title=>&Resource('JumpToLink')}; @@ -500,8 +460,8 @@ sub print_footer { my ($page, $lm) = @_; my $epage = &encode ($page); - my $cvslog1 = q$Revision: 1.42 $; - my $cvslog2 = q$Date: 2002/12/30 03:20:06 $; + my $cvslog1 = q$Revision: 1.43 $; + my $cvslog2 = q$Date: 2003/01/01 01:29:04 $; print_navigate_links ($page); print <<"EOD"; @{[ $lm ? qq(