1 |
#!/usr/bin/perl |
#!/usr/bin/perl |
|
# |
|
2 |
# wiki.cgi - This is YukiWiki, yet another Wiki clone. |
# wiki.cgi - This is YukiWiki, yet another Wiki clone. |
3 |
# |
# |
|
# Copyright (C) 2000-2002 by Hiroshi Yuki. |
|
|
# <hyuki@hyuki.com> |
|
|
# http://www.hyuki.com/yukiwiki/ |
|
|
# |
|
4 |
# This program is free software; you can redistribute it and/or |
# This program is free software; you can redistribute it and/or |
5 |
# modify it under the same terms as Perl itself. |
# modify it under the same terms as Perl itself. |
|
# |
|
|
# walwiki.cgi based on yukiwiki.cgi - Yet another WikiWikiWeb clone. |
|
|
|
|
|
# Walrus add (debug) start |
|
|
my $walrus_log; |
|
|
my $walrus_debugging = 0; |
|
|
# Walrus add (debug) end |
|
6 |
|
|
|
# Libraries. |
|
7 |
use strict; |
use strict; |
8 |
use lib qw(./WalWiki/lib); |
use lib qw(./lib); |
|
use CGI qw(:standard); |
|
9 |
use CGI::Carp qw(fatalsToBrowser); |
use CGI::Carp qw(fatalsToBrowser); |
10 |
use Yuki::RSS; |
our $VERSION = do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
11 |
use Yuki::DiffText qw(difftext); |
|
12 |
use Yuki::YukiWikiDB; |
require 'wikidata/suikawiki-config.ph'; |
|
use AnyDBM_File; |
|
|
require 'jcode.pl'; |
|
|
require Jcode; |
|
13 |
use Fcntl; |
use Fcntl; |
|
my $version = '2.0.beta1.2002-05-29'; |
|
|
my $walversion; |
|
|
############################## |
|
|
# |
|
|
# You MUST modify following '$modifier_...' variables. |
|
|
# |
|
|
my $modifier_mail = 'w@suika.fam.cx'; # Your mail address, like 'walrus@digit.que.ne.jp'. |
|
|
my $modifier_url = 'http://suika.fam.cx/~wakaba/'; # Your web page, like 'http://digit.que.ne.jp/work/'. |
|
|
my $modifier_name = '和'; # Your name, like 'Makio Tsukamoto'. |
|
|
# 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_sendmail = '/usr/sbin/sendmail -t -n'; # Your sendmail. |
|
|
my $modifier_sendmail = ''; # If you don't need mail notification. |
|
|
my $modifier_dir_data = './wikidata'; # Your data directory. |
|
|
my $modifier_rss_title = "SuikaWiki $walversion"; |
|
|
my $modifier_rss_link = 'http://suika.fam.cx/~wakaba/-temp/wiki2/wiki'; # Blank is not allowed. |
|
|
my $modifier_rss_description = 'This is SuikaWiki'; |
|
14 |
############################## |
############################## |
|
# |
|
|
# You MAY modify following variables. |
|
|
# |
|
|
my $file_touch = "$modifier_dir_data/touched.txt"; |
|
|
my $file_resource = "$modifier_dir_data/resource.txt"; |
|
|
my $file_FrontPage = "$modifier_dir_data/frontpage.txt"; |
|
|
my $file_conflict = "$modifier_dir_data/conflict.txt"; |
|
|
my $file_format = "$modifier_dir_data/format.txt"; |
|
|
my $url_cgi = '/~wakaba/-temp/wiki/wiki'; ## MUST be started from '/' |
|
|
my $url_stylesheet = $url_cgi.'?mycmd=TEXT_CSS;mypage=WikiHTMLStyle'; |
|
|
my $icontag = '<img src="/icons/folder" alt="*" width="40" height="40" />'; |
|
|
my $maxrecent = 50; |
|
|
my $cols = 80; |
|
|
my $rows = 20; |
|
|
############################## |
|
|
# |
|
|
# 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 $editchar = '?'; |
|
|
my $subject_delimiter = ' - '; |
|
|
my $use_autoimg = 1; # automatically convert image URL into <img> tag. |
|
|
my $use_exists = 0; # If you can use 'exists' method for your DB. |
|
|
############################## |
|
|
my $InterWikiName = 'InterWikiName'; |
|
|
my $RecentChanges = 'RecentChanges'; |
|
|
my $AdminChangePassword = 'AdminChangePassword'; |
|
|
my $CompletedSuccessfully = 'CompletedSuccessfully'; |
|
|
my $FrontPage = 'HomePage'; |
|
|
my $IndexPage = 'IndexPage'; |
|
|
my $SearchPage = 'SearchPage'; |
|
|
my $CreatePage = 'CreatePage'; |
|
|
my $ErrorPage = 'ErrorPage'; |
|
|
my $RssPage = 'RssPage'; |
|
|
my $NAME_OF_WikiPageLicense = 'WikiPageLicense'; |
|
|
my $AdminSpecialPage = 'Admin Special Page'; # must include spaces. |
|
|
############################## |
|
|
my $bracket_name = '\[\[(\S+?)\]\]'; |
|
|
my $embedded_name = '\[\[(#\S+?)\]\]'; |
|
15 |
my %fmt; ## formatter objects |
my %fmt; ## formatter objects |
|
############################## |
|
|
my $embed_comment = '[[#comment]]'; |
|
|
my $embed_rcomment = '[[#rcomment]]'; |
|
|
my $embed_comment_Name_Prompt = '名前:'; |
|
|
my $DEFAULT_embed_comment_name = '名無しさん'; |
|
|
my $embed_interwiki = '^\[\[#(box|text|password):(\S+)\]\]$'; # Walrus add (5) |
|
16 |
my %embed_command = ( |
my %embed_command = ( |
17 |
searched => '^\[\[#searched:([^\]]+)\]\]$', |
searched => '^\[\[#searched:([^\]]+)\]\]$', |
18 |
form => qw/\[\[\#form(?:\(([A-Za-z0-9-]+)\))?:'((?:[^'\\]|\\.)*)':'((?:[^'\\]|\\.)*)'(?::'((?:[^'\\]|\\.)*)')?\]\]/, |
form => qr/\[\[\#form(?:\(([A-Za-z0-9-]+)\))?:'((?:[^'\\]|\\.)*)':'((?:[^'\\]|\\.)*)'(?::'((?:[^'\\]|\\.)*)')?\]\]/, |
19 |
); |
); |
20 |
|
our ($modifier_dbtype,$url_cgi,%uri,%PathTo,$use_exists); |
21 |
|
our (%PageName,$kanjicode,$lang,%FixedPage); |
22 |
|
|
23 |
############################## |
############################## |
24 |
my $info_LastModified = 'LastModified'; |
my $info_LastModified = 'LastModified'; |
25 |
my $info_IsFrozen = 'IsFrozen'; |
my $info_IsFrozen = 'IsFrozen'; |
|
my $info_AdminPassword = 'AdminPassword'; |
|
26 |
############################## |
############################## |
|
my $kanjicode = 'euc'; |
|
|
my $charset = 'EUC-JP'; |
|
|
my $lang = 'ja'; |
|
|
my %fixedpage = ( |
|
|
$IndexPage => 1, |
|
|
$CreatePage => 1, |
|
|
$ErrorPage => 1, |
|
|
$RssPage => 1, |
|
|
$RecentChanges => 1, |
|
|
$SearchPage => 1, |
|
|
$AdminChangePassword => 1, |
|
|
$CompletedSuccessfully => 1, |
|
|
#$FrontPage => 1, |
|
|
WikiUserAgentList => 1, |
|
|
); |
|
27 |
my %form; |
my %form; |
28 |
my %database; |
our %database; |
29 |
|
our $database; |
30 |
my %infobase; |
my %infobase; |
|
my %diffbase; |
|
|
my %resource; |
|
31 |
my %interwiki; |
my %interwiki; |
32 |
############################## |
############################## |
33 |
my %page_command = ( |
my %page_command = ( |
34 |
$IndexPage => 'index', |
$PageName{RssPage} => 'rss', |
|
$SearchPage => 'searchform', |
|
|
$CreatePage => 'create', |
|
|
$RssPage => 'rss', |
|
|
$AdminChangePassword => 'adminchangepasswordform', |
|
|
#$FrontPage => 'FrontPage', |
|
35 |
); |
); |
36 |
my %command_do = ( |
my %command_do = ( |
37 |
read => \&do_read, |
read => \&do_read, |
38 |
TEXT_CSS => \&do_output_css, |
TEXT_CSS => \&do_output_css, |
39 |
edit => \&do_edit, |
edit => \&do_edit, |
40 |
adminedit => \&do_adminedit, |
adminedit => \&do_adminedit, |
|
adminchangepasswordform => \&do_adminchangepasswordform, |
|
41 |
adminchangepassword => \&do_adminchangepassword, |
adminchangepassword => \&do_adminchangepassword, |
42 |
write => \&do_write, |
write => \&do_write, |
|
index => \&do_index, |
|
43 |
searchform => \&do_searchform, |
searchform => \&do_searchform, |
|
search => \&do_search, |
|
|
create => \&do_create, |
|
|
createresult => \&do_createresult, |
|
|
FrontPage => \&do_FrontPage, |
|
44 |
comment => \&do_comment, |
comment => \&do_comment, |
45 |
RandomJump => \&do_random_jump, |
RandomJump => \&do_random_jump, |
46 |
rss => \&do_rss, |
rss => \&do_rss, |
47 |
diff => \&do_diff, |
diff => \&do_diff, |
48 |
interwikibox => \&do_interwiki_box, # Walrus add (5) |
wikiform => \&do_wikiform, |
49 |
wikiform => \&do_wikiform, |
map => \&do_map, |
50 |
); |
); |
|
############################## |
|
|
my $walversion = '2.0.beta1.wal.1'; # Walrus add (1) |
|
|
############################## |
|
|
# &test_convert; |
|
51 |
my $UA = ''; ## User agent name |
my $UA = ''; ## User agent name |
52 |
&main; |
$| = 1; |
|
exit(0); |
|
53 |
############################## |
############################## |
54 |
|
|
55 |
sub main { |
sub main { |
56 |
$UA = $main::ENV{HTTP_USER_AGENT}; |
$UA = $main::ENV{HTTP_USER_AGENT}; |
|
&init_resource; |
|
57 |
&open_db; |
&open_db; |
58 |
&init_form; |
&init_form; |
|
&init_InterWikiName; |
|
59 |
if ($command_do{$form{mycmd}}) { |
if ($command_do{$form{mycmd}}) { |
60 |
&{$command_do{$form{mycmd}}}; |
&{$command_do{$form{mycmd}}}; |
61 |
} else { |
} else { |
62 |
&do_FrontPage; |
&{$command_do{read}}; |
63 |
} |
} |
64 |
&close_db; |
&close_db; |
65 |
} |
} |
66 |
|
|
67 |
sub do_read { |
sub do_read { |
68 |
my $content = $database{$form{mypage}}; |
my $content = $database{$form{mypage}}; |
69 |
|
#print "content-type:text/plain;charset=euc-jp\n\n".gmtime."Get Lastmodified\n"; |
70 |
my $lm = &get_info($form{mypage}, $info_LastModified); |
my $lm = &get_info($form{mypage}, $info_LastModified); |
71 |
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); |
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); |
72 |
wiki::useragent::add ($ENV{HTTP_USER_AGENT}); |
wiki::useragent::add ($ENV{HTTP_USER_AGENT}); |
73 |
|
#print gmtime."Search...\n"; |
74 |
my ($r, $c) = get_search_result ($form{mypage}); |
my ($r, $c) = get_search_result ($form{mypage}); |
75 |
my $rl = wiki::referer::list_html ($form{mypage}); |
my $rl = wiki::referer::list_html ($form{mypage}); |
76 |
my @toc; |
my @toc; |
77 |
push @toc, qq(-<a href="#wikipage-see-also">See Also</a>) if $c; |
push @toc, qq(-<a href="#wikipage-see-also">@{[&Resource('SeeAlso',escape=>1)]}</a>) if $c; |
78 |
push @toc, qq(-<a href="#wikipage-referer">参照元</a>) if $rl; |
push @toc, qq(-<a href="#wikipage-referer">@{[&Resource('Referers',escape=>1)]}</a>) if $rl; |
79 |
my $cf = 'SuikaWiki/0.9'; |
my $cf = 'SuikaWiki/0.9'; |
80 |
## Should be support at least: |
## Should be support at least: |
81 |
## - 'SuikaWiki/0.9' CRLF |
## - 'SuikaWiki/0.9' CRLF |
83 |
## - "/*" WSP* 'W3C-CSS/' ("1.0" / "2.0") "*/" CRLF |
## - "/*" WSP* 'W3C-CSS/' ("1.0" / "2.0") "*/" CRLF |
84 |
$cf = $1 if $content =~ s#^(?:/\*\s*|[\#<]\?)?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.\x0D\x0A][^\x0D\x0A]*)?)[\x0D\x0A]+##s; |
$cf = $1 if $content =~ s#^(?:/\*\s*|[\#<]\?)?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.\x0D\x0A][^\x0D\x0A]*)?)[\x0D\x0A]+##s; |
85 |
if ($cf =~ m!^(?:\#\?)?SuikaWiki/0.9(?:$|\s)!) { |
if ($cf =~ m!^(?:\#\?)?SuikaWiki/0.9(?:$|\s)!) { |
86 |
&print_header ($form{mypage}, -last_modified => $lm, |
#print gmtime."Header...\n"; |
87 |
-content_format => $cf, -noindex => $cf =~ /obsoleted="yes"/); |
&print_header ($form{mypage}, -last_modified => $lm, -expires => time + 120, |
88 |
|
-content_format => $cf, -noindex => ($cf =~ /obsoleted="yes"/ ? 1 : 0)); |
89 |
|
#print "\n". gmtime."Body...\n"; |
90 |
&print_content ($content, content_format => $cf, last_modified => $lm, |
&print_content ($content, content_format => $cf, last_modified => $lm, |
91 |
-toc => \@toc); |
-toc => \@toc); |
92 |
print &text_to_html (q([[#comment]])) if $cf !~ /obsoleted="yes"/ && !$fixedpage{$form{mypage}}; |
print &text_to_html (q([[#comment]])) if $cf !~ /obsoleted="yes"/ && !$FixedPage{$form{mypage}}; |
93 |
} else { |
} else { |
94 |
&print_header($form{mypage}, -last_modified => $lm); |
&print_header($form{mypage}, -expires => time + 120, -last_modified => $lm); |
95 |
print "<pre>@{[&escape($content)]}</pre>"; |
print "<pre>@{[&escape($content)]}</pre>"; |
96 |
} |
} |
97 |
if ($c) { |
if ($c) { |
98 |
print qq{<h2 @{[&id_and_name('wikipage-see-also')]}>See also</h2>}; |
print qq{<h2 @{[&id_and_name('wikipage-see-also')]}>@{[&Resource('SeeAlso',escape=>1)]}</h2>}; |
99 |
print $r; |
print $r; |
100 |
} |
} |
101 |
if ($rl) { |
if ($rl) { |
102 |
print qq(<div @{[&id_and_name('wikipage-referer')]}><h2>参照元</h2>\n$rl</div>\n); |
print qq(<div @{[&id_and_name('wikipage-referer')]}><h2>@{[&Resource('Referers',escape=>1)]}</h2>\n$rl</div>\n); |
103 |
} |
} |
104 |
|
#print "\n". gmtime."Footer...\n"; |
105 |
&print_footer($form{mypage}, $lm); |
&print_footer($form{mypage}, $lm); |
106 |
|
#print "\n". gmtime."Fin...\n"; |
107 |
} |
} |
108 |
|
|
109 |
sub do_output_css { |
sub do_output_css { |
110 |
|
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); |
111 |
|
wiki::useragent::add ($ENV{HTTP_USER_AGENT}); |
112 |
my $content = $database{$form{mypage}}; |
my $content = $database{$form{mypage}}; |
113 |
if ($content =~ m#^\s*/\*\s*W3C-CSS#) { |
if ($content =~ m#^\s*/\*\s*W3C-CSS#) { |
114 |
my $lm = &get_info($form{mypage}, $info_LastModified); |
my $lm = gmtime &get_info($form{mypage}, $info_LastModified); |
115 |
print "Content-Type: text/css; charset=$charset\n"; |
print "Content-Type: text/css; charset=@{[&get_charset_name($kanjicode)]}\n"; |
116 |
print "Last-Modified: $lm\n"; |
print "Last-Modified: $lm\n"; |
117 |
|
print "Expires: @{[scalar gmtime time+3600]}\n"; ## TODO: don't use asctime |
118 |
print "\n"; |
print "\n"; |
119 |
print $content; |
print $content; |
120 |
} else { |
} else { |
127 |
|
|
128 |
sub id_and_name ($) { |
sub id_and_name ($) { |
129 |
my $name = shift; |
my $name = shift; |
130 |
if ($UA =~ m#Mozilla/[12]\.#) { |
if ($UA =~ m#Mozilla/[12]\.|Microsoft Internet Explorer#) { |
131 |
qq{id="$name"><a name="$name"></a}; |
qq{id="$name"><a name="$name"></a}; |
132 |
} else { |
} else { |
133 |
qq{id="$name"}; |
qq{id="$name"}; |
136 |
|
|
137 |
sub do_edit { |
sub do_edit { |
138 |
my ($page) = &unarmor_name(&armor_name($form{mypage})); |
my ($page) = &unarmor_name(&armor_name($form{mypage})); |
|
&print_header($page, -noindex => 1); |
|
139 |
if (not &is_editable($page)) { |
if (not &is_editable($page)) { |
140 |
&print_message($resource{cantchange}); |
&print_header($page, -noindex => 1, -expires => time+60); |
141 |
|
&print_message(&Resource('Error:ThisPageIsUneditable')); |
142 |
} elsif (&is_frozen($page)) { |
} elsif (&is_frozen($page)) { |
143 |
&print_message($resource{cantchange}); |
&print_header($page, -noindex => 1, -expires => time+60); |
144 |
|
&print_message(&Resource('Error:ThisPageIsUneditable')); |
145 |
} else { |
} else { |
146 |
|
&print_header($page, -noindex => 1, -expires => time+60); |
147 |
&print_editform($database{$page}, &get_info($page, $info_LastModified), admin=>0); |
&print_editform($database{$page}, &get_info($page, $info_LastModified), admin=>0); |
148 |
} |
} |
149 |
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); |
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); |
151 |
my ($r, $c) = get_search_result ($form{mypage}); |
my ($r, $c) = get_search_result ($form{mypage}); |
152 |
my $rl = wiki::referer::list_html ($form{mypage}); |
my $rl = wiki::referer::list_html ($form{mypage}); |
153 |
if ($c) { |
if ($c) { |
154 |
print q{<h2 id="wikipage-see-also">See also</h2>}; |
print qq{<h2 id="wikipage-see-also">@{[&Resource('SeeAlso',escape=>1)]}</h2>}; |
155 |
print $r; |
print $r; |
156 |
} |
} |
157 |
if ($rl) { |
if ($rl) { |
158 |
print qq(<div id="wikipage-referer"><h2>参照元</h2>\n$rl</div>\n); |
print qq(<div id="wikipage-referer"><h2>@{[&Resource('Referers',escape=>1)]}</h2>\n$rl</div>\n); |
159 |
} |
} |
160 |
&print_footer($page); |
&print_footer($page); |
161 |
} |
} |
162 |
|
|
163 |
sub do_adminedit { |
sub do_adminedit { |
164 |
my ($page) = &unarmor_name(&armor_name($form{mypage})); |
my ($page) = &unarmor_name(&armor_name($form{mypage})); |
165 |
&print_header($page, -noindex => 1); |
&print_header($page, -noindex => 1, -expires => time+60); |
166 |
if (not &is_editable($page)) { |
if (not &is_editable($page)) { |
167 |
&print_message($resource{cantchange}); |
&print_message(&Resource('Error:ThisPageIsUneditable')); |
168 |
} else { |
} else { |
169 |
&print_message($resource{passwordneeded}); |
&print_message(&Resource('Error:PasswordIsNotSpecified')); |
170 |
&print_editform($database{$page}, &get_info($page, $info_LastModified), admin=>1); |
&print_editform($database{$page}, &get_info($page, $info_LastModified), admin=>1); |
171 |
} |
} |
172 |
&print_footer($page); |
&print_footer($page); |
173 |
} |
} |
174 |
|
|
|
sub do_adminchangepasswordform { |
|
|
&print_header($AdminChangePassword, -noindex => 1); |
|
|
&print_passwordform; |
|
|
&print_footer($AdminChangePassword); |
|
|
} |
|
|
|
|
175 |
sub do_adminchangepassword { |
sub do_adminchangepassword { |
176 |
if ($form{mynewpassword} ne $form{mynewpassword2}) { |
if ($form{mynewpassword} ne $form{mynewpassword2}) { |
177 |
&print_error($resource{passwordmismatcherror}); |
&print_error(&Resource('Error:PasswordMismatch')); |
178 |
} |
} |
179 |
my ($validpassword_crypt) = &get_info($AdminSpecialPage, $info_AdminPassword); |
my ($validpassword_crypt) = &get_info($PageName{AdminSpecialPage}, 'AdminPassword'); |
180 |
if ($validpassword_crypt) { |
if ($validpassword_crypt) { |
181 |
if (not &valid_password($form{myoldpassword})) { |
if (not &valid_password($form{myoldpassword})) { |
182 |
&send_mail_to_admin(<<"EOD", "AdminChangePassword"); |
&print_error(&Resource('Error:PasswordIsIncorrect')); |
|
myoldpassword=$form{myoldpassword} |
|
|
mynewpassword=$form{mynewpassword} |
|
|
mynewpassword2=$form{mynewpassword2} |
|
|
EOD |
|
|
&print_error($resource{passworderror}); |
|
183 |
} |
} |
184 |
} |
} |
185 |
my ($sec, $min, $hour, $day, $mon, $year, $weekday) = localtime(time); |
my ($sec, $min, $hour, $day, $mon, $year, $weekday) = localtime(time); |
187 |
my $salt1 = $token[(time | $$) % scalar(@token)]; |
my $salt1 = $token[(time | $$) % scalar(@token)]; |
188 |
my $salt2 = $token[($sec + $min*60 + $hour*60*60) % scalar(@token)]; |
my $salt2 = $token[($sec + $min*60 + $hour*60*60) % scalar(@token)]; |
189 |
my $crypted = crypt($form{mynewpassword}, "$salt1$salt2"); |
my $crypted = crypt($form{mynewpassword}, "$salt1$salt2"); |
190 |
&set_info($AdminSpecialPage, $info_AdminPassword, $crypted); |
&set_info($PageName{AdminSpecialPage}, 'AdminPassword', $crypted); |
191 |
|
|
192 |
&print_header($CompletedSuccessfully, -noindex => 1); |
&print_header('CompletedSuccessfully', -noindex => 1); |
193 |
&print_message($resource{passwordchanged}); |
&print_message(&Resource('Error:PasswordIsChanged')); |
194 |
&print_footer($CompletedSuccessfully); |
&print_footer('CompletedSuccessfully'); |
195 |
} |
} |
196 |
|
|
197 |
sub do_index { |
sub valid_password ($) { |
198 |
&print_header($IndexPage); |
my ($validpassword_crypt) = &get_info($PageName{AdminSpecialPage}, 'AdminPassword'); |
199 |
print qq(<ul>); |
return crypt (shift, $validpassword_crypt) eq $validpassword_crypt ? 1 : 0; |
|
foreach my $page (sort keys %database) { |
|
|
if (&is_editable($page)) { |
|
|
print qq(<li><a href="$url_cgi?@{[&encode($page)]}">@{[&escape($page)]}</a>@{[&escape(&get_subjectline($page))]}</li>); |
|
|
# print qq(<li>@{[&get_info($page, $info_IsFrozen)]}</li>); |
|
|
# print qq(<li>@{[0 + &is_frozen($page)]}</li>); |
|
|
} |
|
|
} |
|
|
print qq(</ul>); |
|
|
&print_footer($IndexPage); |
|
200 |
} |
} |
201 |
|
|
202 |
sub do_write { |
sub do_write { |
206 |
|
|
207 |
if (not &is_editable($form{mypage})) { |
if (not &is_editable($form{mypage})) { |
208 |
&print_header($form{mypage}, -noindex => 1); |
&print_header($form{mypage}, -noindex => 1); |
209 |
&print_message($resource{cantchange}); |
&print_message(&Resource('Error:ThisPageIsUneditable')); |
210 |
&print_footer($form{mypage}); |
&print_footer($form{mypage}); |
211 |
return; |
return; |
212 |
} |
} |
215 |
return; |
return; |
216 |
} |
} |
217 |
|
|
|
# Making diff |
|
|
{ |
|
|
&open_diff; |
|
|
my @msg1 = split(/\n/, $database{$form{mypage}}); |
|
|
my @msg2 = split(/\n/, $form{mymsg}); |
|
|
$diffbase{$form{mypage}} = &difftext(\@msg1, \@msg2); |
|
|
&close_diff; |
|
|
} |
|
|
|
|
218 |
if ($form{mymsg}) { |
if ($form{mymsg}) { |
219 |
$database{$form{mypage}} = $form{mymsg}; |
if ($form{mytouch} || !ref $database) { |
220 |
&send_mail_to_admin($form{mypage}, "Modify"); |
$database{$form{mypage}} = $form{mymsg}; |
221 |
if ($form{mytouch}) { |
} else { |
222 |
&set_info($form{mypage}, $info_LastModified, '' . localtime); |
$database->STORE ($form{mypage} => $form{mymsg}, -touch => 0); |
|
&update_recent_changes; |
|
223 |
} |
} |
224 |
&set_info($form{mypage}, $info_IsFrozen, 0 + $form{myfrozen}); |
&set_info($form{mypage}, $info_IsFrozen, 0 + $form{myfrozen}); |
225 |
my $fragment; |
my $fragment = ''; |
226 |
|
$fragment .= qq(;after_edit_cmd=@{[&encode($form{after_edit_cmd})]}) if $form{after_edit_cmd}; |
227 |
if ($form{__comment_anchor_index}) { |
if ($form{__comment_anchor_index}) { |
228 |
$fragment = qq(anchor-$form{__comment_anchor_index}); |
$fragment .= qq(#anchor-$form{__comment_anchor_index}); |
229 |
} elsif ($form{__wikiform_anchor_index}) { |
} elsif ($form{__wikiform_anchor_index}) { |
230 |
$fragment = qq(wikiform-$form{__wikiform_anchor_index}); |
$fragment .= qq(#wikiform-$form{__wikiform_anchor_index}); |
231 |
} |
} |
232 |
&print_header($CompletedSuccessfully, -noindex => 1, -goto => $url_cgi.'?mycmd=read;mypage='.&encode($form{mypage}).qq(;x-param=@{[time.[0..9]->[rand 10]]}).($fragment?'#'.$fragment:'')); |
&print_header('CompletedSuccessfully', -noindex => 1, -goto => $url_cgi.'?mycmd='.&encode($form{after_edit_cmd}||'read').';mypage='.&encode($form{mypage}).qq(;x-param=@{[time.[0..9]->[rand 10]]}$fragment)); |
233 |
&print_message($resource{saved}); |
&print_message(&Resource('Error:SavedSuccessfully')); |
234 |
&print_content("$resource{continuereading} @{[&armor_name($form{mypage})]}"); |
&print_content(&Resource('Error:ContinueReading')." @{[&armor_name($form{mypage})]}"); |
235 |
&print_footer($CompletedSuccessfully); |
&print_footer('CompletedSuccessfully'); |
236 |
} else { |
} else { |
|
&send_mail_to_admin($form{mypage}, "Delete"); |
|
237 |
delete $database{$form{mypage}}; |
delete $database{$form{mypage}}; |
238 |
delete $infobase{$form{mypage}}; |
delete $infobase{$form{mypage}}; |
|
if ($form{mytouch}) { |
|
|
&update_recent_changes; |
|
|
} |
|
239 |
&print_header($form{mypage}, -noindex => 1); |
&print_header($form{mypage}, -noindex => 1); |
240 |
&print_message($resource{deleted}); |
&print_message(&Resource('Error:PageIsDeletedSuccessfully')); |
241 |
&print_footer($form{mypage}); |
&print_footer($form{mypage}); |
242 |
} |
} |
243 |
} |
} |
244 |
|
|
|
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); |
|
|
} |
|
|
|
|
245 |
sub get_search_result ($;%) { |
sub get_search_result ($;%) { |
246 |
my $word = lc shift; |
my $word = lc shift; |
247 |
my %option = @_; |
my %option = @_; |
248 |
my @r; |
my @r; |
249 |
foreach my $page (keys %database) { |
foreach my $page (keys %database) { |
250 |
next if $page eq $RecentChanges || ($page eq $word && !$option{-match_myself}); |
next if !$option{-match_myself} && ($page eq $word); |
251 |
my $content = $database{$page}; |
my $content = lc $database{$page}; |
|
my $cf = 'SuikaWiki/0.9'; |
|
|
$cf = $1 if $content =~ s/^\#\?([^\x0A\x0D]+)//s; |
|
|
next if $cf =~ /obsoleted="yes"/; |
|
252 |
if (index (lc $page, $word) > -1) { |
if (index (lc $page, $word) > -1) { |
253 |
my $c = $content =~ s/\Q$word\E//gi; |
my $c = $content =~ s/\Q$word\E//g; |
254 |
push @r, [$page, $c+20]; |
push @r, [$page, $c+20]; |
255 |
} elsif (index ($word, lc $page) > -1) { |
} elsif (index ($word, lc $page) > -1) { |
256 |
my $c = $content =~ s/\Q$word\E//gi; |
my $c = $content =~ s/\Q$word\E//g; |
257 |
push @r, [$page, $c+10]; |
push @r, [$page, $c+10]; |
258 |
} elsif (my $c = $content =~ s/\Q$word\E//gi) { |
} elsif (my $c = $content =~ s/\Q$word\E//g) { |
259 |
push @r, [$page, $c]; |
push @r, [$page, $c]; |
260 |
} |
} |
261 |
} |
} |
262 |
my $em = sub { my $s = shift; $s =~ s#(\Q$word\E)#<em>$1</em>#gi; $s }; |
#my $em = sub { my $s = shift; $s =~ s#(\Q$word\E)#<em>$1</em>#gi; $s }; |
263 |
my $r = join "\n", map {qq(<li>[$_->[1]] <a href ="$url_cgi?@{[&encode($_->[0])]}" class="wiki">@{[&$em(&escape($_->[0]))]}</a> <span class="wikipage-summary">@{[&$em(&escape(&get_subjectline($_->[0])))]}</span></li>)} sort {$b->[1] <=> $a->[1] || $a->[0] cmp $b->[0]} @r; |
my $r = join "\n", map {qq(<li>[$_->[1]] <a href ="$url_cgi?@{[&encode($_->[0])]}" class="wiki">@{[&escape($_->[0])]}</a> <span class="wikipage-summary">@{[&escape(&get_subjectline($_->[0]))]}</span></li>)} sort {$b->[1] <=> $a->[1] || $a->[0] cmp $b->[0]} @r; |
264 |
$r = qq|<ul class="search-result">$r</ul>| if $r; |
$r = qq|<ul class="search-result">$r</ul>| if $r; |
|
get_message ($resource{notfound}) if @r == 0 && $option{-output_not_found}; |
|
265 |
wantarray? ($r, scalar @r): $r; |
wantarray? ($r, scalar @r): $r; |
266 |
} |
} |
267 |
|
|
|
sub do_create { |
|
|
&print_header($CreatePage); |
|
|
print <<"EOD"; |
|
|
<form action="$url_cgi" method="post"> |
|
|
<input type="hidden" name="mycmd" value="edit"> |
|
|
<strong>$resource{newpagename}</strong><br> |
|
|
<input type="text" name="mypage" value="" size="20"> |
|
|
<input type="submit" value="$resource{createbutton}"><br> |
|
|
</form> |
|
|
EOD |
|
|
&print_footer($CreatePage); |
|
|
} |
|
|
|
|
268 |
sub do_random_jump { |
sub do_random_jump { |
269 |
my @list = keys %database; |
my @list = keys %database; |
270 |
my $name = &encode ($list[rand @list]); |
my $name = &encode ($list[rand @list]); |
271 |
my ($scheme) = 'http'; |
my $scheme = 'http'; |
272 |
$scheme = $1 if $main::ENV{SERVER_PROTOCOL} =~ m#([A-Za-z0-9+.%-]+)#; |
$scheme = lc $1 if $main::ENV{SERVER_PROTOCOL} =~ m#([A-Za-z0-9+.%-]+)#; |
273 |
print "Location: $scheme://$main::ENV{SERVER_NAME}:$main::ENV{SERVER_PORT}$url_cgi?$name\n"; |
print "Location: $scheme://$main::ENV{SERVER_NAME}:$main::ENV{SERVER_PORT}$url_cgi?$name\n"; |
274 |
print "\n"; |
print "\n"; |
275 |
} |
} |
276 |
|
|
|
sub do_FrontPage { |
|
|
open(FILE, $file_FrontPage) or &print_error("($file_FrontPage)"); |
|
|
my $content = join('', <FILE>); |
|
|
&code_convert(\$content, $kanjicode); |
|
|
close(FILE); |
|
|
&print_header($FrontPage); |
|
|
&print_content($content); |
|
|
&print_footer($FrontPage); |
|
|
} |
|
|
|
|
277 |
sub print_error { |
sub print_error { |
278 |
my ($msg) = @_; |
my ($msg) = @_; |
279 |
&print_header($ErrorPage, -noindex => 1); |
&print_header($PageName{ErrorPage}, -noindex => 1); |
280 |
print qq(<p><strong class="error">$msg</strong></p>); |
print qq(<p><strong class="error">$msg</strong></p>); |
281 |
&print_footer($ErrorPage); |
&print_footer($PageName{ErrorPage}); |
282 |
exit(0); |
exit(0); |
283 |
} |
} |
284 |
|
|
285 |
sub print_header ($;%) { |
sub print_header ($;%) { |
286 |
my ($page, %option) = @_; |
my ($page, %option) = @_; |
287 |
my $bodyclass = "normal"; |
my @head; |
288 |
if (&is_frozen($page) and $form{mycmd} =~ /^(read|write)$/) { |
$option{body_class} = &is_frozen($page) ? 'frozen' : 'normal'; |
289 |
$bodyclass = "frozen"; |
$option{body_class} .= " wiki-page-obsoleted" if $option{-content_format} =~ /obsoleted="yes"/; |
|
} |
|
|
$bodyclass .= " wiki-page-obsoleted" if $option{-content_format} =~ /obsoleted="yes"/; |
|
290 |
if ($option{-goto}) { |
if ($option{-goto}) { |
291 |
if ($UA =~ m#Mozilla/[12]\.|Opera#) { |
if ($UA =~ m#Opera|MSIE 2\.#) { |
292 |
$option{-goto} =~ tr/;/&/; |
## WARNING: This code may output unsafe HTML document if |
293 |
|
## $option{-goto} is not clean. |
294 |
|
$option{-goto} =~ tr/;/&/ if $UA =~ m#Opera#; |
295 |
print qq{Refresh: 0; url=$option{-goto}\n}; |
print qq{Refresh: 0; url=$option{-goto}\n}; |
296 |
$option{-goto} = qq(<meta http-equiv="refresh" content="0; url=$option{-goto}">); |
push @head, qq(<meta http-equiv="refresh" content="0; url=$option{-goto}">); |
297 |
} else { |
} else { |
298 |
|
$option{-goto} =~ tr/;/&/ if $UA =~ m#Mozilla/[1-4]\.#; |
299 |
print qq{Refresh: 0; url="$option{-goto}"\n}; |
print qq{Refresh: 0; url="$option{-goto}"\n}; |
300 |
$option{-goto} = qq(<meta http-equiv="refresh" content="0; url="@{[&escape($option{-goto})]}"">); |
push @head, qq(<meta http-equiv="refresh" content="0; url="@{[&escape($option{-goto})]}"">); |
301 |
} |
} |
302 |
} |
} |
303 |
print qq{Last-Modified: $option{-last_modified}\n} if $option{-last_modified}; |
print qq{Last-Modified: @{[scalar gmtime $option{-last_modified}]}\n} if $option{-last_modified}; |
304 |
my $meta_ct = ''; |
if ($option{-expires}) { |
305 |
if ($UA =~ m#Mozilla/2#) { |
print qq{Expires: @{[scalar gmtime $option{-expires}]}\n}; |
|
$meta_ct = qq{text/html; charset=@{[&x_charset($charset)]}}; |
|
|
print qq{Content-Type: $meta_ct\n}; |
|
|
$meta_ct = qq{<meta http-equiv="content-type" content="$meta_ct">}; |
|
|
} else { |
|
|
print qq{Content-Type: text/html; charset=$charset\n}; |
|
306 |
} |
} |
307 |
my $cookedpage = &encode($page); |
if ($UA =~ m#Mozilla/2#) { |
308 |
my $escapedpage = &escape($page); |
my $ct = qq{text/html; charset=@{[&get_charset_name($kanjicode,compatible=>1)]}}; |
309 |
|
print qq{Content-Type: $ct\n}; |
310 |
|
push @head, qq{<meta http-equiv="content-type" content="$ct">}; |
311 |
|
} elsif ($UA =~ m#Infomosaic#) { |
312 |
|
print qq{Content-Type: text/html\n}; |
313 |
|
} else { |
314 |
|
print qq{Content-Type: text/html; charset=@{[&get_charset_name($kanjicode)]}\n}; |
315 |
|
} |
316 |
|
push @head, qq(<title>@{[&escape($page)]}</title>); |
317 |
|
if ($UA !~ m#Mozilla/[1-4]\.# || $UA =~ m#MSIE (?:[4-9]\.|\d\d)#) { |
318 |
|
push @head, qq(<link rel="stylesheet" type="text/css" href="@{[&escape($uri{wiki}.'?mycmd=TEXT_CSS;mypage='.&encode($PageName{DefaultStyleForHTML}).';x-lm='.&get_info($PageName{DefaultStyleForHTML}, $info_LastModified))]}"); |
319 |
|
} |
320 |
|
push @head, q(<meta name="ROBOTS" content="NOINDEX">) if $option{-noindex}; |
321 |
|
my ($Links, $links) = &make_navigate_links ($page); |
322 |
|
#print $Links; ## Link: fields |
323 |
|
$links = join "\n", (@head, $links); |
324 |
print <<"EOD"; |
print <<"EOD"; |
325 |
Content-Language: $lang |
Content-Language: $lang |
326 |
Content-Style-Type: text/css |
Content-Style-Type: text/css |
327 |
|
|
328 |
<!-- |
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
329 |
<!DOCTYPE html |
"http://www.w3.org/TR/html4/loose.dtd"> + RUBY --> |
330 |
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
<html lang="$lang" class="$option{body_class}"> |
331 |
"http://www.w3.org/TR/html4/loose.dtd"> + RUBY --> |
<head profile="http://suika.fam.cx/~wakaba/-temp/wiki/wiki?WikiHTMLMetaProfile"> |
332 |
<html lang="$lang"> |
$links |
|
<head> |
|
|
$meta_ct$option{-goto} |
|
|
<title>$escapedpage</title> |
|
|
<link rel="index" href="$url_cgi?$IndexPage"> |
|
|
<link rel="help" href="$url_cgi?WikiHelp"> |
|
|
<link rel="copyright" href="$url_cgi?$NAME_OF_WikiPageLicense"> |
|
|
<link rel="stylesheet" type="text/css" href="@{[&escape($url_stylesheet)]}"> |
|
|
@{[$option{-noindex} ? q(<meta name="ROBOTS" content="NOINDEX">) : '']} |
|
333 |
</head> |
</head> |
334 |
<body class="$bodyclass"> |
<body class="$option{body_class}"> |
335 |
EOD |
EOD |
336 |
&print_navigate_links ($page); |
&print_navigate_links ($page); |
337 |
print <<EOD; |
print <<EOD; |
338 |
<h1 class="header">@{[&escape($page)]}</h1> |
<h1 class="header">@{[&escape($page)]}</h1> |
339 |
EOD |
EOD |
340 |
} |
} |
341 |
|
|
342 |
sub x_charset ($) { |
sub get_charset_name ($;%) { |
343 |
my $charset = lc shift; |
my ($charset, %option) = (lc shift, @_); |
344 |
if ($charset eq 'euc-jp') { |
if ($charset =~ 'euc') { |
345 |
$charset = 'x-euc-jp'; |
$charset = $option{compatible} ? 'x-euc-jp' : 'euc-jp'; |
346 |
} elsif ($charset eq 'shift_jis') { |
} elsif ($charset =~ 'sjis' || $charset =~ 'shift') { |
347 |
$charset = 'x-sjis'; |
$charset = $option{compatible} ? 'x-sjis' : 'shift_jis'; |
348 |
|
} elsif ($charset =~ 'jis') { |
349 |
|
$charset = 'iso-2022-jp'; |
350 |
} |
} |
351 |
$charset; |
$charset; |
352 |
} |
} |
353 |
|
|
354 |
sub print_navigate_links (@) { |
sub print_navigate_links (@) { |
355 |
my ($page) = @_; |
my ($page) = @_; |
356 |
my $editable = 0; |
my $editable = (&is_editable($page) && !&is_frozen($page)) ? 1 : 0; |
357 |
my $admineditable = 0; |
my $cookedpage = &encode($page); |
|
if (&is_frozen($page) and $form{mycmd} =~ /^(read|write)$/) { |
|
|
$editable = 0; |
|
|
#$admineditable = 1; |
|
|
} elsif (&is_editable($page) and $form{mycmd} =~ /^(read|write)$/) { |
|
|
#$admineditable = 1; |
|
|
$editable = 1; |
|
|
} else { |
|
|
$editable = 0; |
|
|
} |
|
|
my $cookedpage = &encode($page); |
|
358 |
print <<EOH; |
print <<EOH; |
359 |
<div class="tools"> |
<div class="tools"> |
|
@{[ $admineditable |
|
|
? qq(<a title="$resource{admineditthispage}" href="$url_cgi?mycmd=adminedit;mypage=$cookedpage">$resource{admineditbutton}</a> | ) |
|
|
: qq() |
|
|
]} |
|
360 |
@{[ $editable |
@{[ $editable |
361 |
? #qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=$cookedpage" accesskey="E">$resource{editbutton} <kbd>E</kbd></a> | ) |
? qq(<a title="@{[&Resource('EditThisPageLong',escape=>1)]}" href="$url_cgi?mycmd=edit;mypage=$cookedpage" accesskey="E" class="wiki-cmd">@{[&Resource('EditThisPage',escape=>1)]}</a> | ) |
|
qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=$cookedpage" accesskey="E">編集</a> | ) |
|
362 |
: qq() |
: qq() |
363 |
]} |
]} |
364 |
<a href="$url_cgi?mycmd=read;mypage=$cookedpage;x-param=@{[time.[0..9]->[rand 10]]}">表示</a> | |
<a href="$url_cgi?mycmd=read;mypage=$cookedpage;x-param=@{[time.[0..9]->[rand 10]]}" class="wiki-cmd" title="@{[&Resource('ViewThisPageLong',escape=>1)]}">@{[&Resource('ViewThisPage',escape=>1)]}</a> | |
365 |
@{[ $admineditable |
<a href="$url_cgi?mycmd=map;mypage=$cookedpage" class="wiki-cmd" title="@{[&Resource('ShowMapOfThisPageLong',escape=>1)]}">@{[&Resource('ShowMapOfThisPage',escape=>1)]}</a> | |
366 |
? qq(<a href="$url_cgi?mycmd=diff;mypage=$cookedpage">$resource{diffbutton}</a> | ) |
<a href="$url_cgi?$PageName{CreatePage}" class="wiki" title="@{[&Resource('GoToCreatePageLong',escape=>1)]}">@{[&Resource('GoToCreatePage',escape=>1)]}</a> | |
367 |
: qq() |
<a href="$url_cgi?$PageName{IndexPage}" class="wiki" title="@{[&Resource('GoToIndexPageLong',escape=>1)]}">@{[&Resource('GoToIndexPage',escape=>1)]}</a> | |
368 |
]} |
<a href="$url_cgi?$PageName{FrontPage}" class="wiki" title="@{[&Resource('GoToHomePageLong',escape=>1)]}">@{[&Resource('GoToHomePage',escape=>1)]}</a> | |
369 |
<a href="$url_cgi?$CreatePage" class="wiki">新規</a> | |
<a href="$url_cgi?$PageName{SearchPage}" class="wiki" title="@{[&Resource('GoToSearchPageLong',escape=>1)]}">@{[&Resource('GoToSearchPage',escape=>1)]}</a> | |
370 |
<a href="$url_cgi?$IndexPage" class="wiki">$resource{indexbutton}</a> | |
<a href="$url_cgi?mycmd=RandomJump;x-param=@{[time.[0..9]->[rand 10]]}" class="wiki randomlink" title="@{[&Resource('GoSomewhereLong',escape=>1)]}">@{[&Resource('GoSomewhere',escape=>1)]}</a> | |
371 |
<a href="$url_cgi?$FrontPage" class="wiki">首頁</a> | |
<a href="$url_cgi?$PageName{RecentChanges}" class="wiki" title="@{[&Resource('GoToRecentChangesLong',escape=>1)]}">@{[&Resource('GoToRecentChanges',escape=>1)]}</a> |
|
<a href="$url_cgi?$SearchPage" class="wiki">$resource{searchbutton}</a> | |
|
|
<a href="$url_cgi?mycmd=RandomJump;x-param=@{[time.[0..9]->[rand 10]]}" class="wiki randomlink">どこか</a> | |
|
|
<a href="$url_cgi?$RecentChanges" class="wiki">最新</a> |
|
|
</div> |
|
|
EOH |
|
|
<<EOH; ## temp |
|
|
<a href="$url_cgi?$CreatePage" class="wiki">$resource{createbutton}</a> | |
|
|
<a href="$url_cgi?$IndexPage" class="wiki">$resource{indexbutton}</a> | |
|
|
<!-- <a href="$url_cgi?$RssPage" class="wiki">$resource{rssbutton}</a> | --> |
|
|
<a href="$url_cgi?$FrontPage" class="wiki">$FrontPage</a> | |
|
|
<a href="$url_cgi?$SearchPage" class="wiki">$resource{searchbutton}</a> | |
|
|
<a href="$url_cgi?mycmd=RandomJump;x-param=@{[time.[0..9]->[rand 10]]}" class="wiki randomlink">どこか</a> | |
|
|
<a href="$url_cgi?$RecentChanges" class="wiki">$resource{recentchangesbutton}</a> |
|
372 |
</div> |
</div> |
373 |
EOH |
EOH |
374 |
} |
} |
375 |
|
|
376 |
|
sub make_navigate_links ($) { |
377 |
|
my $page = shift; |
378 |
|
my @link; |
379 |
|
push @link, {rel=>'edit', href=>"$url_cgi?mycmd=edit;mypage=@{[&encode($page)]}", class=>"wiki-command", title=>&Resource('EditThisPageLink')} if &is_editable ($page) && !&is_frozen ($page); |
380 |
|
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); |
381 |
|
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')}; |
382 |
|
push @link, {rel=>'myself', href=>"$url_cgi?@{[&encode($page)]}", class=>'wiki', title=>&Resource('GoToMyselfLink')}; |
383 |
|
push @link, {rel=>'index', href=>"$url_cgi?$PageName{IndexPage}", class=>'wiki', title=>&Resource('GoToIndexPageLink')}; |
384 |
|
push @link, {rel=>'home', href=>"$url_cgi?$PageName{FrontPage}", class=>'wiki', title=>&Resource('GoToHomePageLink')}; |
385 |
|
push @link, {rel=>'News', href=>"$url_cgi?WikiNews", class=>'wiki', title=>&Resource('GoToWikiNewsLink')}; |
386 |
|
push @link, {rel=>'News', href=>"$url_cgi?$PageName{RecentChanges}", class=>"wiki", title=>&Resource('GoToRecentChangesLink')}; |
387 |
|
push @link, {rel=>'News', href=>"$url_cgi?$PageName{RssPage}", class=>"wiki", title=>&Resource('GoToRssPageLink'), type=>'application/xml'}; |
388 |
|
push @link, {rel=>'search', href=>"$url_cgi?$PageName{SearchPage}", class=>'wiki', title=>&Resource('GoToSearchPageLink')}; |
389 |
|
push @link, {rel=>'help', href=>"$url_cgi?WikiHelp", class=>'wiki', title=>&Resource('GoToWikiHelpLink')}; |
390 |
|
push @link, {rel=>'copyright', href=>"$url_cgi?WikiPageLicense", class=>'wiki', title=>&Resource('GoToWikiPageLicenseLink')}; |
391 |
|
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')}; |
392 |
|
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%3Fmycmd=edit;mypage='+encodeURIComponent(WikiName)%7D), class=>'wiki-cmd', title=>&Resource('JumpToEditLink')}; |
393 |
|
push @link, {rel=>'lucky', href=>"$url_cgi?mycmd=RandomJump;x-param=@{[time.[0..9]->[rand 10]]}", class=>'wiki randomlink', title=>&Resource('GoSomewhereLink')}; |
394 |
|
push @link, {rel=>'history', href=>$uri{cvs_wikipage}.do{my $s=$page;$s=~s/(.)/sprintf '%02X', ord $1/ges;$s}.'.txt', title=>&Resource('ViewHistoryOfThisPageLink'),hreflang=>'en'} if $uri{cvs_wikipage}; |
395 |
|
push @link, {rel=>'history', href=>"$url_cgi?mycmd=diff;mypage=@{[&encode($page)]}", title=>&Resource('ViewDiffOfThisPageLink'), class=>'wiki-command'} if $wiki::diff::UseDiff; |
396 |
|
push @link, {rel=>'contents', href=>"$url_cgi?mycmd=map;mypage=@{[&encode($page)]}", title=>&Resource('ShowMapOfThisPageLink'), class=>'wiki-command'}; |
397 |
|
my ($Links, $links) = ('', ''); |
398 |
|
for my $e (@link) { |
399 |
|
$links .= qq(<link); |
400 |
|
$Links .= qq(Link: <$e->{href}>); |
401 |
|
for my $attr (qw/rel rev href title class type hreflang charset/) { |
402 |
|
$links .= qq( $attr="@{[&escape($e->{$attr})]}") if $e->{$attr}; |
403 |
|
} |
404 |
|
for my $attr (qw/rel rev title/) { |
405 |
|
$Links .= qq(; $attr="@{[do{$e->{$attr} =~ s/([\\\"])/\\$1/g; $e->{$attr}}]}") if $e->{$attr}; |
406 |
|
} |
407 |
|
$links .= qq(>\n); |
408 |
|
$Links .= qq(\n); |
409 |
|
} |
410 |
|
wantarray ? ($Links, $links) : $Links; |
411 |
|
} |
412 |
|
|
413 |
sub print_footer { |
sub print_footer { |
414 |
my ($page, $lm) = @_; |
my ($page, $lm) = @_; |
415 |
my $epage = &encode ($page); |
my $epage = &encode ($page); |
|
$walrus_log = ($walrus_debugging) ? &text_to_html("----\n$walrus_log") : ''; # Walrus add (debug) |
|
|
# Walrus mod (1) start |
|
416 |
my $cvslog1 = q$Revision$; |
my $cvslog1 = q$Revision$; |
417 |
my $cvslog2 = q$Date$; |
my $cvslog2 = q$Date$; |
418 |
print_navigate_links ($page); |
print_navigate_links ($page); |
419 |
print <<"EOD"; |
print <<"EOD"; |
420 |
@{[ $lm ? qq(<div id="wikipage-last-modified">Last modified: $lm</div>) : '' ]} |
@{[ $lm ? qq(<div id="wikipage-last-modified">@{[&Resource('LastModified=',escape=>1)]}@{[&_rfc3339_date ($lm)]}</div>) : '' ]} |
421 |
<div class="footer"> |
<div class="footer"> |
422 |
<a href="http://www.hyuki.com/yukiwiki/" title="$version © 2000-2002 by Hiroshi Yuki">YukiWiki</a> <a href="http://digit.que.ne.jp/work/" title="$walversion © 2000-2002 by Makio Tsukamoto">WalWiki</a> |
<a href="http://www.hyuki.com/yukiwiki/" title="YukiWiki 2.0.beta1.2002-05-29 © 2000-2002 by Hiroshi Yuki">@{[&Resource('About:Name:YukiWiki',escape=>1)]}</a> <a href="http://digit.que.ne.jp/work/" title="WalWiki 2.0.beta1.wal.1 © 2000-2002 by Makio Tsukamoto">@{[&Resource('About:Name:WalWiki',escape=>1)]}</a> |
423 |
<a href="/gate/cvs/wakaba/wiki/" title="CVS Repository of this script ($cvslog2)">SuikaWiki $cvslog1</a> |
<a href="/gate/cvs/wakaba/wiki/" title="@{[&Resource('About:SuikaWiki:JumpToCVS',escape=>1)]} ($cvslog2)">@{[&Resource('About:Name:SuikaWiki',escape=>1)]} $cvslog1</a> |
|
<div class="navigation"> |
|
|
[<a href="/" title="このサーバーの首頁">/</a> |
|
|
<a href="/map" title="このサーバーの案内">地図</a> |
|
|
<a href="/search/" title="このサーバーの検索">検索</a>] |
|
|
</div> |
|
|
<div class="myuri"> |
|
|
<<a href="$url_cgi?$epage">$url_cgi?$epage</a>> |
|
424 |
</div> |
</div> |
|
</div> |
|
|
$walrus_log |
|
425 |
</body> |
</body> |
426 |
</html> |
</html> |
427 |
EOD |
EOD |
454 |
|
|
455 |
sub text_to_html { |
sub text_to_html { |
456 |
my ($txt, %option) = @_; |
my ($txt, %option) = @_; |
|
my (@txt) = split(/\n/, $txt); |
|
457 |
my @toc; |
my @toc; |
458 |
my @toc2 = @{$option{-toc}||[]}; |
my @toc2 = @{$option{-toc}||[]}; |
459 |
my $tocnum = 0; |
my $tocnum = 0; |
460 |
|
|
461 |
|
## Load constants |
462 |
|
my %const; |
463 |
|
if ($option{content_format} =~ /import="([^"]+)"/) { |
464 |
|
for (split /\s*,\s*/, $1) { |
465 |
|
my $wp = $database{$_}; |
466 |
|
if ($wp =~ m!^\#\?SuikaWikiConst/1.0!) { |
467 |
|
wiki::suikawikiconst::to_hash ($wp => \%const); |
468 |
|
} |
469 |
|
} |
470 |
|
} |
471 |
|
|
472 |
|
$txt =~ s{__&&([^&]+)&&__}{defined $const{$1}?$const{$1}:qq(__&&$1&&__)}ge; |
473 |
|
my (@txt) = split(/\n/, $txt); |
474 |
my (@saved, @result); |
my (@saved, @result); |
475 |
unshift(@saved, "</p>"); |
unshift(@saved, "</p>"); |
476 |
push(@result, "<p>"); |
push(@result, "<p>"); |
478 |
chomp; |
chomp; |
479 |
if (/^\*\*\*\*\*([^\x0D\x0A]*)/) { |
if (/^\*\*\*\*\*([^\x0D\x0A]*)/) { |
480 |
push(@toc, qq(----- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(----- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
481 |
push(@result, splice(@saved), qq(<h6 id="i$tocnum">) . &inline($1) . '</h6>'); |
push(@result, splice(@saved), qq(<h6 @{[&id_and_name("i$tocnum")]}>) . &inline($1, const => \%const) . '</h6>'); |
482 |
$tocnum++; |
$tocnum++; |
483 |
} elsif (/^\*\*\*\*([^\x0D\x0A]*)/) { |
} elsif (/^\*\*\*\*([^\x0D\x0A]*)/) { |
484 |
push(@toc, qq(---- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(---- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
485 |
push(@result, splice(@saved), qq(<h5 id="i$tocnum">) . &inline($1) . '</h5>'); |
push(@result, splice(@saved), qq(<h5 @{[&id_and_name("i$tocnum")]}>) . &inline($1, const => \%const) . '</h5>'); |
486 |
$tocnum++; |
$tocnum++; |
487 |
} elsif (/^\*\*\*([^\x0D\x0A]*)/) { |
} elsif (/^\*\*\*([^\x0D\x0A]*)/) { |
488 |
push(@toc, qq(--- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(--- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
489 |
push(@result, splice(@saved), qq(<h4 id="i$tocnum">) . &inline($1) . '</h4>'); |
push(@result, splice(@saved), qq(<h4 @{[&id_and_name("i$tocnum")]}>) . &inline($1, const => \%const) . '</h4>'); |
490 |
$tocnum++; |
$tocnum++; |
491 |
} elsif (/^\*\*([^\x0D\x0A]*)/) { |
} elsif (/^\*\*([^\x0D\x0A]*)/) { |
492 |
# if (/^\*\*(.*)/) { |
# if (/^\*\*(.*)/) { |
493 |
# Walrus mod (6) end |
# Walrus mod (6) end |
494 |
push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
495 |
push(@result, splice(@saved), qq(<h3><a name="i$tocnum"> </a>) . &inline($1) . '</h3>'); |
push(@result, splice(@saved), qq(<h3 @{[&id_and_name("i$tocnum")]}>) . &inline($1, const => \%const) . '</h3>'); |
496 |
$tocnum++; |
$tocnum++; |
497 |
} elsif (/^\*([^\x0D\x0A]*)/) { |
} elsif (/^\*([^\x0D\x0A]*)/) { |
498 |
push(@toc, qq(- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
499 |
push(@result, splice(@saved), qq(<h2><a name="i$tocnum"> </a>) . &inline($1) . '</h2>'); |
push(@result, splice(@saved), qq(<h2 @{[&id_and_name("i$tocnum")]}>) . &inline($1, const => \%const) . '</h2>'); |
500 |
$tocnum++; |
$tocnum++; |
501 |
} elsif (/^(={1,6})(.*)/) { |
} elsif (/^(={1,6})(.*)/) { |
502 |
&back_push('ol', length($1), \@saved, \@result); |
&back_push('ol', length($1), \@saved, \@result); |
503 |
push(@result, '<li>' . &inline($2) . '</li>'); |
push(@result, '<li>' . &inline($2, const => \%const) . '</li>'); |
504 |
} elsif (/^(-{1,6})(.*)/) { |
} elsif (/^(-{1,6})(.*)/) { |
505 |
&back_push('ul', length($1), \@saved, \@result); |
&back_push('ul', length($1), \@saved, \@result); |
506 |
my ($pf, $l) = ('', $2); |
my ($pf, $l) = ('', $2); |
508 |
my $num = 0+$1; |
my $num = 0+$1; |
509 |
$pf = qq(<a name="anchor-$num" id="anchor-$num" class="anchor">[$num]</a>); |
$pf = qq(<a name="anchor-$num" id="anchor-$num" class="anchor">[$num]</a>); |
510 |
} |
} |
511 |
push(@result, '<li>' . $pf . &inline ($l) . '</li>'); |
push(@result, '<li>' . $pf . &inline ($l, const => \%const) . '</li>'); |
512 |
} elsif (/^:([^:]+):(.*)/) { |
} elsif (/^:([^:]+):(.*)/) { |
513 |
&back_push('dl', 1, \@saved, \@result); |
&back_push('dl', 1, \@saved, \@result); |
514 |
push(@result, '<dt>' . &inline($1) . '</dt>', '<dd>' . &inline($2) . '</dd>'); |
push(@result, '<dt>' . &inline($1, const => \%const) . '</dt>', '<dd>' . &inline($2, const => \%const) . '</dd>'); |
515 |
} elsif (/^(?!>>\d)(>{1,5})(.*)/) { |
} elsif (/^(?!>>\d)(>{1,5})(.*)/) { |
516 |
&back_push('blockquote', length($1), \@saved, \@result); |
&back_push('blockquote', length($1), \@saved, \@result); |
517 |
push @result, "<p>"; |
push @result, "<p>"; |
518 |
push(@result, &inline($2)); |
push(@result, &inline($2, const => \%const)); |
519 |
unshift @saved, "</p>"; |
unshift @saved, "</p>"; |
520 |
} elsif (/^\s*$/) { |
} elsif (/^\s*$/) { |
521 |
push(@result, splice(@saved)); |
push(@result, splice(@saved)); |
523 |
unshift(@saved, "</p>"); |
unshift(@saved, "</p>"); |
524 |
} elsif (/^(\s+.*)$/) { |
} elsif (/^(\s+.*)$/) { |
525 |
&back_push('pre', 1, \@saved, \@result); |
&back_push('pre', 1, \@saved, \@result); |
526 |
#push(@result, &escape($1)); # Not &inline, but &escape |
push(@result, &inline($1, const => \%const)); |
527 |
push(@result, &inline($1)); |
} elsif (/^\,(.*?)[\x0D\x0A]*$/) { |
528 |
# } elsif (/^\,(.*)$/) { # Walrus del (BF) |
&back_push('table', 1, \@saved, \@result); |
|
} elsif (/^\,(.*?)[\x0D\x0A]*$/) { # Walrus add (BF) |
|
|
&back_push('table', 1, \@saved, \@result, ' border="1"'); |
|
529 |
####### |
####### |
530 |
# This part is taken from Mr. Ohzaki's Perl Memo and Makio Tsukamoto's WalWiki. |
# This part is taken from Mr. Ohzaki's Perl Memo and Makio Tsukamoto's WalWiki. |
531 |
# XXXXX |
# XXXXX |
539 |
$colspan[$i]++; |
$colspan[$i]++; |
540 |
} |
} |
541 |
$colspan[$i] = ($colspan[$i] > 1) ? sprintf(' colspan="%d"', $colspan[$i]) : ''; |
$colspan[$i] = ($colspan[$i] > 1) ? sprintf(' colspan="%d"', $colspan[$i]) : ''; |
542 |
$value[$i] = sprintf('<td%s%s>%s</td>', $align[$i], $colspan[$i], &inline($value[$i])); |
$value[$i] = sprintf('<td%s%s>%s</td>', $align[$i], $colspan[$i], &inline($value[$i], const => \%const)); |
543 |
} else { |
} else { |
544 |
$value[$i] = ''; |
$value[$i] = ''; |
545 |
} |
} |
556 |
} elsif (/^\[([0-9]+)\](.*)$/ && !$main::_EMBEDED) { |
} elsif (/^\[([0-9]+)\](.*)$/ && !$main::_EMBEDED) { |
557 |
my $num = 0+$1; |
my $num = 0+$1; |
558 |
push @result, qq(<a name="anchor-$num" id="anchor-$num" class="anchor">[$num]</a>); |
push @result, qq(<a name="anchor-$num" id="anchor-$num" class="anchor">[$num]</a>); |
559 |
push @result, &inline ($2); |
push @result, &inline ($2, const => \%const); |
560 |
} else { |
} else { |
561 |
push(@result, &inline($_)); |
push(@result, &inline($_, const => \%const)); |
562 |
} |
} |
563 |
} |
} |
564 |
push(@result, splice(@saved)); |
push(@result, splice(@saved)); |
599 |
} |
} |
600 |
} |
} |
601 |
|
|
602 |
sub inline { |
sub inline ($;%) { |
603 |
my ($line) = @_; |
my ($line, %option) = @_; |
604 |
$line = &escape($line); |
$line = &escape($line); |
605 |
$line =~ s{$embed_command{form}}{&make_custom_form ($1, $2, $3, $4)}ge; |
$line =~ s{$embed_command{form}}{&make_custom_form ($1, $2, $3, $4)}ge; |
606 |
$line =~ s{\[(INS|DEL|SUP|SUB|VAR|CODE|KBD|SAMP|DFN)(?:\(([A-Za-z0-9\x20-]+)\))?\[(.+?)\]\]}{<@{[lc $1]}@{[$2 ? qq( class="$2") : '']}>$3</@{[lc $1]}>}g; |
$line =~ s{\[(INS|DEL|SUP|SUB|VAR|CODE|KBD|SAMP|DFN)(?:\(([A-Za-z0-9\x20-]+)\))?\[(.+?)\]\]}{<@{[lc $1]}@{[$2 ? qq( class="$2") : '']}>$3</@{[lc $1]}>}g; |
609 |
$line =~ s:\[RUBYB\[([^]]+)\] \[([^]]+)\] \[([^]]+)\]\]:<span class="ruby"><ruby class="rb"><rb>$1</rb><rp>(</rp><rt>$2</rt><rp>)</rp></ruby><span class="rp"> (</span><span class="rt-below">$3</span><span class="rp">) </span></span>:g; |
$line =~ s:\[RUBYB\[([^]]+)\] \[([^]]+)\] \[([^]]+)\]\]:<span class="ruby"><ruby class="rb"><rb>$1</rb><rp>(</rp><rt>$2</rt><rp>)</rp></ruby><span class="rp"> (</span><span class="rt-below">$3</span><span class="rp">) </span></span>:g; |
610 |
$line =~ s:\[RUBY\[([^]]+)\] \[([^]]+)\]\]:<ruby><rb>$1</rb><rp>(</rp><rt>$2</rt><rp>)</rp></ruby>:g; |
$line =~ s:\[RUBY\[([^]]+)\] \[([^]]+)\]\]:<ruby><rb>$1</rb><rp>(</rp><rt>$2</rt><rp>)</rp></ruby>:g; |
611 |
$line =~ s:\[RUBYB\[([^]]+)\] \[([^]]+)\]\]:<span class="ruby"><span class="rb">$1</span><span class="rp"> (</span><span class="rt-below">$2</span><span class="rp">) </span></span>:g; |
$line =~ s:\[RUBYB\[([^]]+)\] \[([^]]+)\]\]:<span class="ruby"><span class="rb">$1</span><span class="rp"> (</span><span class="rt-below">$2</span><span class="rp">) </span></span>:g; |
|
$line =~ s%\[Q\[([^]]+)\](?: \[<([\x21-\x5A\x5E-\x7E]+)>\])?\]%「<q@{[$2?qq( cite="$2"):'']}>$1</q>」%g; |
|
612 |
$line =~ s|'''([^']+)'''|<strong>$1</strong>|g; |
$line =~ s|'''([^']+)'''|<strong>$1</strong>|g; |
613 |
$line =~ s|''([^']+)''|<em>$1</em>|g; |
$line =~ s|''([^']+)''|<em>$1</em>|g; |
614 |
$line =~ s{ |
$line =~ s{ |
615 |
((?:$bracket_name)) # [[likethis]], [[#comment]], [[Friend:remotelink]] |
(\[\[(\#\S+?)\]\]) |
616 |
|\[\[([^[]+?)]>>([0-9]+)] # [[WikiName]>>1] |
|\[\[([^[]+?)](?:>>([0-9]+))?] |
617 |
|>>([0-9]+) |
|>>([0-9]+) |
618 |
|<([A-Za-z0-9%]+:(?:(?!>).)+)> |
|<([A-Za-z0-9%]+:(?:(?!>).)+)> |
619 |
}{ |
}{ |
620 |
my ($l, $page,$anchor, $anum, $uri) = ($1, $3,$4, 0+$5, $6); |
my ($l, $page,$anchor, $anum, $uri) = ($1, $3,$4, 0+$5, $6); |
621 |
if ($l) { |
if ($l) { |
622 |
&make_link($l) |
&embedded_to_html($1); |
623 |
} elsif (defined $page) { |
} elsif (defined $page) { |
624 |
&make_wikilink ($page, anchor => 0+$anchor); |
&make_wikilink ($page, anchor => 0+$anchor); |
625 |
} elsif ($anum) { |
} elsif ($anum) { |
642 |
return qq(<a title="$subject" href="$url_cgi?@{[&encode($name)]}" class="wiki">$ename</a>); |
return qq(<a title="$subject" href="$url_cgi?@{[&encode($name)]}" class="wiki">$ename</a>); |
643 |
} |
} |
644 |
} else { |
} else { |
645 |
return qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=@{[&escape($name)]}" class="wiki not-exist">$ename<span class="mark">$editchar</span></a>); |
return qq(<a title="@{[&Resource('JumpAndEditWikiPage',escape=>1)]}" href="$url_cgi?@{[&escape($name)]}" class="wiki not-exist">$ename<span class="mark">@{[&Resource('JumpAndEditWikiPageMark',escape=>1)]}</span></a>); |
646 |
} |
} |
647 |
} |
} |
648 |
|
|
656 |
for ($site, $name) { |
for ($site, $name) { |
657 |
if (s/^"//) { s/"$//; s/\\(.)/$1/g } |
if (s/^"//) { s/"$//; s/\\(.)/$1/g } |
658 |
} |
} |
659 |
|
&init_InterWikiName () unless $interwiki{'[[]]'}; |
660 |
if ($interwiki{$site}) { |
if ($interwiki{$site}) { |
661 |
|
&load_formatter ('interwiki'); |
662 |
my $uri = &escape ($fmt{interwiki}->replace ($interwiki{$site} => {site => $site, name => $name})); |
my $uri = &escape ($fmt{interwiki}->replace ($interwiki{$site} => {site => $site, name => $name})); |
663 |
$site = &escape ($site); $name = &escape ($name); |
$site = &escape ($site); $name = &escape ($name); |
664 |
qq(<<a href="$uri" class="out-of-wiki interwiki" title="$name ($site); URI: <$uri>"><span class="interwiki-site">$site:</span><span class="interwiki-name">$name</span></a>>); |
qq(<<a href="$uri" class="out-of-wiki interwiki" title="$name ($site); URI: <$uri>"><span class="interwiki-site">$site:</span><span class="interwiki-name">$name</span></a>>); |
665 |
} else { |
} else { |
666 |
qq(<未登録の <a href="$url_cgi?InterWikiName" class="wiki">InterWikiName</a>: @{[&escape ($site)]}>); |
qq(<@{[&Resource('Error:UnknownInterWikiName=',escape=>1)]}@{[&escape ($site)]}>); |
667 |
} |
} |
668 |
} else { |
} else { |
669 |
qq(<不正な <a href="$url_cgi?InterWikiName" class="wiki">InterWikiName</a>: @{[&escape($uri)]}>); |
qq(<@{[&Resource('Error:InvalidInterWiki=',escape=>1)]}@{[&escape($uri)]}>); |
670 |
} |
} |
671 |
} elsif ($uri =~ /^urn:/) { ## URN |
} elsif ($uri =~ /^urn:/) { ## URN |
672 |
my $uri2 = &escape (URI->new ('/uri-res/N2L?'.&unescape ($uri), 'http')->canonical); |
my $uri2 = &escape (URI->new ('/uri-res/N2L?'.&unescape ($uri), 'http')->canonical); |
685 |
} |
} |
686 |
} |
} |
687 |
|
|
688 |
my $FormIndex = 0; |
{my $FormIndex = 0; |
689 |
sub make_custom_form ($$$) { |
sub make_custom_form ($$$$) { |
690 |
my ($wfname, $definition, $template, $option) = @_; |
my ($wfname, $definition, $template, $option) = @_; |
691 |
## $template and $option is currently not used in this procedure. |
## $template and $option is currently not used in this procedure. |
692 |
unless ($main::_EMBEDED) { |
unless ($main::_EMBEDED) { |
694 |
if (length $definition) { |
if (length $definition) { |
695 |
my $param = bless {}, 'SuikaWiki::Plugin'; |
my $param = bless {}, 'SuikaWiki::Plugin'; |
696 |
my $lastmodified = &get_info($form{mypage}, $info_LastModified); |
my $lastmodified = &get_info($form{mypage}, $info_LastModified); |
697 |
|
&load_formatter (qw/form_input form_option/); |
698 |
|
$definition = &unescape ($definition); |
699 |
$definition =~ s/\\(.)/$1/g; |
$definition =~ s/\\(.)/$1/g; |
|
$definition .= ' %submit;' if $definition !~ /%submit/; |
|
|
unless ($fmt{form_option}) { |
|
|
$fmt{form_option} = Message::Util::Formatter->new; |
|
|
for (@{$SuikaWiki::Plugin::List{wikiform_option}||[]}) { |
|
|
$_->load_formatter ($fmt{form_option}, type => 'wikiform_option'); |
|
|
} |
|
|
} |
|
700 |
$option = &unescape ($option); |
$option = &unescape ($option); |
701 |
$option =~ s/\\(.)/$1/g; |
$option =~ s/\\(.)/$1/g; |
702 |
$fmt{form_option}->replace ($option, $param); |
$fmt{form_option}->replace ($option, $param); |
703 |
|
$param->{output}->{form} = 1 unless defined $param->{output}->{form}; |
704 |
|
$definition .= ' %submit;' if $definition !~ /%submit/ && !$param->{output}->{nosubmit} && $param->{output}->{form}; |
705 |
|
my $target_page = $param->{output}->{page} || $form{mypage}; |
706 |
|
$param->{form_disabled} = 1 if $FixedPage{$target_page}; |
707 |
my $target_form = $param->{output}->{id}; |
my $target_form = $param->{output}->{id}; |
708 |
my $r = <<EOH; |
my $r = ''; |
709 |
|
$r = <<EOH if $param->{output}->{form}; |
710 |
<form method="post" action="$url_cgi" id="wikiform-$FormIndex" class="wikiform"> |
<form method="post" action="$url_cgi" id="wikiform-$FormIndex" class="wikiform"> |
711 |
<input type="hidden" name="mycmd" value="wikiform"> |
<input type="hidden" name="mycmd" value="@{[$param->{form_disabled}?'read':'wikiform']}"> |
712 |
<input type="hidden" name="mypage" value="@{[&escape($form{mypage})]}"> |
<input type="hidden" name="mypage" value="@{[&escape($target_page)]}"> |
713 |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
714 |
<input type="hidden" name="mytouch" value="on"> |
<input type="hidden" name="mytouch" value="on"> |
715 |
<input type="hidden" name="@{[$target_form? qq(wikiform_targetform" value="@{[&escape($target_form)]}) : qq(wikiform_index" value="$FormIndex)]}"> |
<input type="hidden" name="@{[$target_form? qq(wikiform_targetform" value="@{[&escape($target_form)]}) : qq(wikiform_index" value="$FormIndex)]}"> |
716 |
EOH |
EOH |
717 |
$r .= qq(<a name="wikiform-$FormIndex"></a>) if $UA =~ m#Mozilla/[12]\.#; |
$r .= qq(<a name="wikiform-$FormIndex"></a>) if $UA =~ m#Mozilla/[12]\.#; |
718 |
$r .= $fmt{form_input}->replace (&unescape ($definition), $param); |
$r .= $fmt{form_input}->replace ($definition, $param); |
719 |
$r .= <<EOH; |
$r .= "</form>\n" if $param->{output}->{form}; |
|
</form> |
|
|
EOH |
|
720 |
$r; |
$r; |
721 |
} else { ## No input-interface WikiForm |
} else { ## No input-interface WikiForm |
722 |
qq(<a id="wikiform-$FormIndex" name="wikiform-$FormIndex"><!-- #form --></a>); |
qq(<a id="wikiform-$FormIndex" name="wikiform-$FormIndex"><!-- #form --></a>); |
723 |
} |
} |
724 |
} else { |
} else { |
725 |
q(<ins class="wiki-error"><strong>Warning</strong>: form in embeded page is currently not supported.</ins>); |
qq(<ins class="wiki-error">@{[&Resource('Error:WikiForm:EmbedIsNotSupported',escape=>1)]}</ins>); |
|
} |
|
|
} |
|
|
|
|
|
## to be obsoleted |
|
|
sub make_link { |
|
|
my $chunk = shift; |
|
|
# Walrus add (3) start |
|
|
$chunk =~ s/^<(.*)>$/$1/; |
|
|
my $name = $chunk; |
|
|
$name = &unarmor_name($name); |
|
|
# Walrus add (3) end |
|
|
if ($chunk =~ /^$embedded_name$/) { |
|
|
return &embedded_to_html($chunk); |
|
|
} else { |
|
|
$chunk = &unarmor_name($chunk); |
|
|
$chunk = &unescape($chunk); # To treat '&' or '>' or '<' correctly. |
|
|
my $cookedchunk = &encode($chunk); |
|
|
if ($database{$chunk}) { |
|
|
my $subject = &escape(&get_subjectline($chunk, delimiter => '')); |
|
|
# return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$chunk</a>); # Walrus del (3) |
|
|
return qq(<a title="$subject" href="$url_cgi?$cookedchunk" class="wiki">@{[&escape($name)]}</a>); # Walrus add (3) |
|
|
} elsif ($page_command{$chunk}) { |
|
|
# return qq(<a title="$chunk" href="$url_cgi?$cookedchunk">$chunk</a>); # Walrus del (3) |
|
|
return qq(<a title="$chunk" href="$url_cgi?$cookedchunk" class="wiki">@{[&escape($name)]}</a>); # Walrus add (3) |
|
|
} else { |
|
|
return qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=$cookedchunk" class="wiki">@{[&escape($name)]}<span class="mark">$editchar</span></a>); |
|
|
} |
|
726 |
} |
} |
727 |
} |
}} |
728 |
|
|
729 |
sub print_message { |
sub print_message { |
730 |
my ($msg) = @_; |
my ($msg) = @_; |
731 |
print qq(<p><strong>$msg</strong></p>); |
print qq(<p><strong>@{[&escape($msg)]}</strong></p>); |
|
} |
|
|
|
|
|
sub get_message { |
|
|
my ($msg) = @_; |
|
|
qq(<p><strong>$msg</strong></p>); |
|
732 |
} |
} |
733 |
|
|
734 |
sub init_form { |
sub init_form { |
735 |
if (param()) { |
## TODO: Support multipart/form-data |
736 |
foreach my $var (param()) { |
my $query = ''; |
737 |
$form{$var} = param($var); |
if (uc $main::ENV{REQUEST_METHOD} eq 'POST') { |
738 |
} |
read STDIN, $query, $main::ENV{CONTENT_LENGTH}; |
739 |
} |
} |
740 |
$form{mypage} = &code_convert(\$form{mypage}, $kanjicode); |
$query .= ($query ? ';' : '') . $main::ENV{QUERY_STRING}; |
741 |
if ($main::ENV{QUERY_STRING} && $main::ENV{QUERY_STRING} !~ /[&;=]/) { |
if ($main::ENV{REQUEST_METHOD} ne 'POST' && $main::ENV{QUERY_STRING} && $main::ENV{QUERY_STRING} !~ /[&;=]/) { |
742 |
my $query = &decode($main::ENV{QUERY_STRING}); |
my $query = &decode($main::ENV{QUERY_STRING}); |
743 |
$query = &code_convert(\$query, $kanjicode); |
$query = &code_convert(\$query, $kanjicode); |
744 |
if ($page_command{$query}) { |
if ($page_command{$query}) { |
748 |
$form{mypage} = $query; |
$form{mypage} = $query; |
749 |
$form{mycmd} = $database{$form{mypage}} ? 'read' : 'edit'; |
$form{mycmd} = $database{$form{mypage}} ? 'read' : 'edit'; |
750 |
} |
} |
751 |
|
} else { |
752 |
|
for (split /[;&]/, $query) { |
753 |
|
if (my ($n, $v) = split /=/, $_, 2) { |
754 |
|
for ($n, $v) {tr/+/ /; s/%([0-9A-Fa-f][0-9A-Fa-f])/pack 'C', hex $1/ge}; |
755 |
|
$form{$n} = $v; |
756 |
|
} |
757 |
|
} |
758 |
|
unless (defined $form{mypage}) { |
759 |
|
$form{mypage} = $form{epage}; |
760 |
|
$form{mypage} =~ s/([0-9A-F]{2})/ord hex $1/g; |
761 |
|
} |
762 |
|
if ($page_command{$form{mypage}} && $form{mycmd} eq 'read') { |
763 |
|
$form{mypage} = &code_convert(\$form{mypage}, $kanjicode); |
764 |
|
$form{mycmd} = $page_command{$form{mypage}}; |
765 |
|
} |
766 |
} |
} |
767 |
$form{mypage} ||= 'HomePage'; |
$form{mypage} ||= 'HomePage'; |
768 |
$form{mycmd} ||= 'read'; |
$form{mycmd} ||= 'read'; |
788 |
$form{myname} = &code_convert(\$form{myname}, $kanjicode); |
$form{myname} = &code_convert(\$form{myname}, $kanjicode); |
789 |
} |
} |
790 |
|
|
791 |
sub update_recent_changes { |
{my %SubjectLine; |
|
my $update = "- @{[&get_now]} [[@{[&escape($form{mypage})]}]] @{[&get_subjectline($form{mypage})]}"; |
|
|
my @oldupdates = split(/\r?\n/, $database{$RecentChanges}); |
|
|
shift (@oldupdates); ## '#?' magic line |
|
|
my @updates; |
|
|
foreach (@oldupdates) { |
|
|
/^\- \d\d\d\d\-\d\d\-\d\d \([^)]+\) \d\d:\d\d \[\[(\S+?)\]\]/; |
|
|
my $name = $1; |
|
|
if ($name ne $form{mypage}) { |
|
|
push @updates, $_; |
|
|
} |
|
|
} |
|
|
if (&is_exist_page($form{mypage})) { |
|
|
unshift @updates, $update; |
|
|
} |
|
|
splice(@updates, $maxrecent + 1); |
|
|
$database{$RecentChanges} = "#?SuikaWiki/0.9\n" . join("\n", @updates); |
|
|
if ($file_touch) { |
|
|
open(FILE, "> $file_touch"); |
|
|
print FILE localtime() . "\n"; |
|
|
close(FILE); |
|
|
} |
|
|
} |
|
|
|
|
792 |
sub get_subjectline { |
sub get_subjectline { |
793 |
my ($page, %option) = @_; |
my ($page, %option) = @_; |
794 |
if (not &is_editable($page)) { |
unless (defined $SubjectLine{$page}) { |
795 |
return ""; |
if (not &is_editable($page)) { |
796 |
|
$SubjectLine{$page} = ""; |
797 |
|
} else { |
798 |
|
$SubjectLine{$page} = $database{$page}; |
799 |
|
$SubjectLine{$page} =~ s!^\#\?[^\x0A\x0D]+[\x0A\x0D]*!!s; |
800 |
|
$SubjectLine{$page} =~ s/\x0D?\x0A.*//s; |
801 |
|
} |
802 |
|
} |
803 |
|
if (length $SubjectLine{$page}) { |
804 |
|
$option{delimiter} = defined $option{delimiter} ? $option{delimiter} : &Resource('Title-Summary Delimiter'); |
805 |
|
$option{delimiter}.$SubjectLine{$page}.$option{tail}; |
806 |
} else { |
} else { |
807 |
# Delimiter check. |
''; |
|
my $delim = $subject_delimiter; |
|
|
if (defined($option{delimiter})) { |
|
|
$delim = $option{delimiter}; |
|
|
} |
|
|
|
|
|
# Get the subject of the page. |
|
|
my $subject = $database{$page}; |
|
|
$subject =~ s#^(?:\#\?)?SuikaWiki/0.9[^\x0D\x0A]*[\x0D\x0A]+##s; |
|
|
$subject =~ s/\r?\n.*//s; |
|
|
return "$delim$subject".$option{tail}; |
|
808 |
} |
} |
809 |
} |
}} |
|
|
|
|
sub send_mail_to_admin { |
|
|
my ($page, $mode) = @_; |
|
|
return unless $modifier_sendmail; |
|
|
my $message = <<"EOD"; |
|
|
To: $modifier_mail |
|
|
From: $modifier_mail |
|
|
Subject: [Wiki] |
|
|
MIME-Version: 1.0 |
|
|
Content-Type: text/plain; charset=ISO-2022-JP |
|
|
Content-Transfer-Encoding: 7bit |
|
|
|
|
|
-------- |
|
|
MODE = $mode |
|
|
REMOTE_ADDR = $ENV{REMOTE_ADDR} |
|
|
REMOTE_HOST = $ENV{REMOTE_HOST} |
|
|
-------- |
|
|
$page |
|
|
-------- |
|
|
$database{$page} |
|
|
-------- |
|
|
EOD |
|
|
&code_convert(\$message, 'jis'); |
|
|
open(MAIL, "| $modifier_sendmail"); |
|
|
print MAIL $message; |
|
|
close(MAIL); |
|
|
} |
|
810 |
|
|
811 |
sub open_db { |
sub open_db { |
812 |
if ($modifier_dbtype eq 'dbmopen') { |
if ($modifier_dbtype eq 'dbmopen') { |
813 |
dbmopen(%database, $dataname, 0666) or &print_error("(dbmopen) $dataname"); |
dbmopen(%database, $PathTo{WikiDataBase}, 0666) or &print_error("(dbmopen) $PathTo{WikiDataBase}"); |
814 |
dbmopen(%infobase, $infoname, 0666) or &print_error("(dbmopen) $infoname"); |
dbmopen(%infobase, $PathTo{WikiInfoBase}, 0666) or &print_error("(dbmopen) $PathTo{WikiInfoBase}"); |
815 |
} elsif ($modifier_dbtype eq 'AnyDBM_File') { |
} elsif ($modifier_dbtype eq 'AnyDBM_File') { |
816 |
tie(%database, "AnyDBM_File", $dataname, O_RDWR|O_CREAT, 0666) or &print_error("(tie AnyDBM_File) $dataname"); |
eval q{use AnyDBM_File}; |
817 |
tie(%infobase, "AnyDBM_File", $infoname, O_RDWR|O_CREAT, 0666) or &print_error("(tie AnyDBM_File) $infoname"); |
tie(%database, "AnyDBM_File", $PathTo{WikiDataBase}, O_RDWR|O_CREAT, 0666) or &print_error("(tie AnyDBM_File) $PathTo{WikiDataBase}"); |
818 |
} else { |
tie(%infobase, "AnyDBM_File", $PathTo{WikiInfoBase}, O_RDWR|O_CREAT, 0666) or &print_error("(tie AnyDBM_File) $PathTo{WikiInfoBase}"); |
819 |
tie(%database, "Yuki::YukiWikiDB", $dataname) or &print_error("(tie Yuki::YukiWikiDB) $dataname"); |
} elsif ($modifier_dbtype eq 'YukiWikiDB') { |
820 |
tie(%infobase, "Yuki::YukiWikiDB", $infoname) or &print_error("(tie Yuki::YukiWikiDB) $infoname"); |
eval q{use Yuki::YukiWikiDB}; |
821 |
|
tie(%database, "Yuki::YukiWikiDB", $PathTo{WikiDataBase}) or &print_error("(tie Yuki::YukiWikiDB) $PathTo{WikiDataBase}"); |
822 |
|
tie(%infobase, "Yuki::YukiWikiDB", $PathTo{WikiInfoBase}) or &print_error("(tie Yuki::YukiWikiDB) $PathTo{WikiInfoBase}"); |
823 |
|
} else { |
824 |
|
eval qq{use $modifier_dbtype}; |
825 |
|
$database = tie(%database, $modifier_dbtype => $PathTo{WikiDataBase}, -lock => 2, -backup => $wiki::diff::UseDiff) or &print_error("(tie $modifier_dbtype) $PathTo{WikiDataBase}"); |
826 |
|
tie(%infobase, $modifier_dbtype => $PathTo{WikiInfoBase}, -lock => 2) or &print_error("(tie $modifier_dbtype) $PathTo{WikiInfoBase}"); |
827 |
} |
} |
828 |
} |
} |
829 |
|
|
831 |
if ($modifier_dbtype eq 'dbmopen') { |
if ($modifier_dbtype eq 'dbmopen') { |
832 |
dbmclose(%database); |
dbmclose(%database); |
833 |
dbmclose(%infobase); |
dbmclose(%infobase); |
|
} elsif ($modifier_dbtype eq 'AnyDBM_File') { |
|
|
untie(%database); |
|
|
untie(%infobase); |
|
834 |
} else { |
} else { |
835 |
untie(%database); |
untie(%database); |
836 |
untie(%infobase); |
untie(%infobase); |
837 |
} |
} |
838 |
} |
} |
839 |
|
|
|
sub open_diff { |
|
|
if ($modifier_dbtype eq 'dbmopen') { |
|
|
dbmopen(%diffbase, $diffname, 0666) or &print_error("(dbmopen) $diffname"); |
|
|
} elsif ($modifier_dbtype eq 'AnyDBM_File') { |
|
|
tie(%diffbase, "AnyDBM_File", $diffname, O_RDWR|O_CREAT, 0666) or &print_error("(tie AnyDBM_File) $diffname"); |
|
|
} else { |
|
|
tie(%diffbase, "Yuki::YukiWikiDB", $diffname) or &print_error("(tie Yuki::YukiWikiDB) $diffname"); |
|
|
} |
|
|
} |
|
|
|
|
|
sub close_diff { |
|
|
if ($modifier_dbtype eq 'dbmopen') { |
|
|
dbmclose(%diffbase); |
|
|
} elsif ($modifier_dbtype eq 'AnyDBM_File') { |
|
|
untie(%diffbase); |
|
|
} else { |
|
|
untie(%diffbase); |
|
|
} |
|
|
} |
|
|
|
|
|
sub print_searchform { |
|
|
my ($word) = @_; |
|
|
print <<"EOD"; |
|
|
<form action="$url_cgi" method="get"> |
|
|
<input type="hidden" name="mycmd" value="read"> |
|
|
<input type="text" name="mypage" value="$word" size="20"> |
|
|
<input type="submit" value="$resource{searchbutton}"> |
|
|
</form> |
|
|
EOD |
|
|
} |
|
|
|
|
840 |
sub print_editform { |
sub print_editform { |
841 |
my ($mymsg, $lastmodified, %mode) = @_; |
my ($mymsg, $lastmodified, %mode) = @_; |
842 |
my $frozen = &is_frozen($form{mypage}); |
my $frozen = &is_frozen($form{mypage}); |
844 |
if ($form{mypreview}) { |
if ($form{mypreview}) { |
845 |
if ($form{mymsg}) { |
if ($form{mymsg}) { |
846 |
unless ($mode{conflict}) { |
unless ($mode{conflict}) { |
847 |
print qq(<h3>$resource{previewtitle}</h3>\n); |
print qq(<h3>@{[&Resource('Preview:Title',escape=>1)]}</h3>\n); |
848 |
print qq($resource{previewnotice}\n); |
print qq(<p>@{[&Resource('Preview:Notice',escape=>1)]}</p>\n); |
849 |
print qq(<div class="preview">\n); |
print qq(<div class="preview">\n); |
850 |
&print_content($form{mymsg}); |
&print_content($form{mymsg}); |
851 |
print qq(</div>\n); |
print qq(</div>\n); |
852 |
} |
} |
853 |
} else { |
} else { |
854 |
print qq($resource{previewempty}); |
print @{[&Resource('Preview:Empty',escape=>1)]}; |
855 |
} |
} |
856 |
$mymsg = &escape($form{mymsg}); |
$mymsg = &escape($form{mymsg}); |
857 |
} else { |
} else { |
858 |
$mymsg = &escape($mymsg || $database{NewPageTemplate}); |
$mymsg = &escape($mymsg || $database{NewPageTemplate}); |
859 |
} |
} |
860 |
|
my $magic = ''; |
861 |
|
$magic = $1 if $mymsg =~ m/^([^\x0A\x0D]+)/s; |
862 |
|
|
863 |
my $edit = $mode{admin} ? 'adminedit' : 'edit'; |
my $edit = $mode{admin} ? 'adminedit' : 'edit'; |
864 |
my $escapedmypage = &escape($form{mypage}); |
my $selected = 'read'; |
865 |
my $escapedmypassword = &escape($form{mypassword}); |
if ($form{after_edit_cmd}) { |
866 |
|
$selected = $form{after_edit_cmd}; |
867 |
|
} elsif ($magic =~ /Const|Config|CSS/) { |
868 |
|
$selected = 'edit'; |
869 |
|
} |
870 |
|
my $afteredit = <<EOH; |
871 |
|
<select name="after_edit_cmd"> |
872 |
|
<option value="read" label="@{[&Resource('Edit:SaveAndView',escape=>1)]}"@{[$selected eq 'read' ? ' selected="selected"':'']}>@{[&Resource('Edit:SaveAndView',escape=>1)]}</option> |
873 |
|
<option value="edit" label="@{[&Resource('Edit:SaveAndEdit',escape=>1)]}"@{[$selected eq 'edit' ? ' selected="selected"':'']}>@{[&Resource('Edit:SaveAndEdit',escape=>1)]}</option> |
874 |
|
</select> |
875 |
|
EOH |
876 |
|
|
877 |
print <<"EOD"; |
print <<"EOD"; |
878 |
<form action="$url_cgi" method="post"> |
<form action="$url_cgi" method="post"> |
879 |
<h2>$escapedmypageの編集</h2> |
<h2>@{[&Resource('Edit:Title',escape=>1)]}</h2> |
880 |
@{[ $mode{admin} ? qq($resource{frozenpassword} <input type="password" name="mypassword" value="$escapedmypassword" size="10"><br>) : "" ]} |
@{[ $mode{conflict} ? '' : qq(<input type="submit" name="mypreview_write" value="@{[&Resource('Edit:Save',escape=>1)]}"><kbd>S</kbd>) ]} |
881 |
|
@{[ $mode{admin} ? qq(<label>@{[&Resource('Edit:Password=',escape=>1)]}<input type="password" name="mypassword" value="" size="10"></label>) : "" ]} [@{[do {my $n = 0; |
882 |
|
$mymsg =~ s/(?:-+\s)?\[([0-9]+)\]/$n = $1 if $1 > $n; $&/mge; |
883 |
|
++$n}]}]<br> |
884 |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
885 |
<input type="hidden" name="mypage" value="$escapedmypage"> |
<input type="hidden" name="mypage" value="@{[&escape($form{mypage})]}"> |
886 |
<textarea cols="$cols" rows="$rows" name="mymsg" tabindex="1">$mymsg</textarea><br> |
<textarea cols="@{[&Resource('Edit:Form:Cols')+0||80]}" rows="@{[&Resource('Edit:Form:Rows')+0||20]}" name="mymsg" tabindex="1">$mymsg</textarea><br> |
887 |
@{[ |
@{[ |
888 |
$mode{admin} ? |
$mode{admin} ? |
889 |
qq( |
qq( |
890 |
<input type="radio" name="myfrozen" value="1" @{[$frozen ? qq(checked="checked") : ""]}>$resource{frozenbutton} |
<label><input type="radio" name="myfrozen" value="1" @{[$frozen ? qq(checked="checked") : ""]}>@{[&Resource('Edit:Freeze',escape=>1)]}</label> |
891 |
<input type="radio" name="myfrozen" value="0" @{[$frozen ? "" : qq(checked="checked")]}>$resource{notfrozenbutton}<br>) |
<label><input type="radio" name="myfrozen" value="0" @{[$frozen ? "" : qq(checked="checked")]}>@{[&Resource('Edit:DontFreeze',escape=>1)]}</label><br>) |
892 |
: "" |
: "" |
893 |
]} |
]} |
894 |
@{[ |
@{[ |
895 |
$mode{conflict} ? "" : |
$mode{conflict} ? "" : |
896 |
qq( |
qq( |
897 |
<input type="checkbox" name="mytouch" value="on" checked="checked">$resource{touch}<br> |
<label><input type="checkbox" name="mytouch" value="on" checked="checked">@{[&Resource('Edit:UpdateTimeStamp',escape=>1)]}</label><br> |
898 |
<input type="submit" name="mypreview_$edit" value="$resource{previewbutton}"> |
<input type="submit" name="mypreview_$edit" value="@{[&Resource('Edit:Preview',escape=>1)]}"> |
899 |
<input type="submit" name="mypreview_write" value="$resource{savebutton}" accesskey="S"><kbd>S</kbd> |
<label><input type="submit" name="mypreview_write" value="@{[&Resource('Edit:Save',escape=>1)]}" accesskey="S"><kbd>S</kbd></label> |
900 |
[@{[do {my $n = 0; |
$afteredit |
|
$mymsg =~ s/(?:-+\s)?\[([0-9]+)\]/$n = $1 if $1 > $n; $&/mge; |
|
|
++$n}]}]<br> |
|
901 |
) |
) |
902 |
]} |
]} |
903 |
</form> |
</form> |
904 |
EOD |
EOD |
905 |
unless ($mode{conflict}) { |
unless ($mode{conflict}) { |
906 |
# Show the format rule. |
## Show help text |
907 |
my $help = $database{'WikiEditHelp'}; |
my $help = $database{WikiEditHelp}; |
908 |
$help =~ s!^\#\?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.\x0D\x0A][^\x0D\x0A]*)?)[\x0D\x0A]+!!s; |
$help =~ s!^\#\?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.\x0D\x0A][^\x0D\x0A]*)?)[\x0D\x0A]+!!s; |
909 |
print &text_to_html ($help, toc => 0); |
print &text_to_html ($help, toc => 0); |
|
# open(FILE, $file_format) or &print_error("($file_format)"); |
|
|
# my $content = join('', <FILE>); |
|
|
# &code_convert(\$content, $kanjicode); |
|
|
# close(FILE); |
|
|
# print &text_to_html($content, toc=>0); |
|
910 |
} |
} |
911 |
} |
} |
912 |
|
|
|
sub print_passwordform { |
|
|
print <<"EOD"; |
|
|
<form action="$url_cgi" method="post"> |
|
|
<input type="hidden" name="mycmd" value="adminchangepassword"> |
|
|
$resource{oldpassword} <input type="password" name="myoldpassword" size="10"><br> |
|
|
$resource{newpassword} <input type="password" name="mynewpassword" size="10"><br> |
|
|
$resource{newpassword2} <input type="password" name="mynewpassword2" size="10"><br> |
|
|
<input type="submit" value="$resource{changepasswordbutton}"><br> |
|
|
</form> |
|
|
EOD |
|
|
} |
|
|
|
|
913 |
sub is_editable { |
sub is_editable { |
914 |
my ($page) = @_; |
my ($page) = @_; |
915 |
if ($fixedpage{$page} || $page =~ /\s/ || $page =~ /^\#/) { |
if ($FixedPage{$page} || $page =~ /\s/ || $page =~ /^\#/) { |
916 |
return 0; |
return 0; |
917 |
} else { |
} else { |
918 |
return 1; |
return 1; |
929 |
# WikiName -> WikiName |
# WikiName -> WikiName |
930 |
sub unarmor_name { |
sub unarmor_name { |
931 |
my ($name) = @_; |
my ($name) = @_; |
932 |
if ($name =~ /^$bracket_name$/) { |
if ($name =~ /^\[\[(\S+?)\]\]$/) { |
933 |
return $1; |
return $1; |
934 |
} else { |
} else { |
935 |
return $name; |
return $name; |
956 |
return $encoded; |
return $encoded; |
957 |
} |
} |
958 |
|
|
|
sub init_resource { |
|
|
open(FILE, $file_resource) or &print_error("(resource)"); |
|
|
while (<FILE>) { |
|
|
chomp; |
|
|
next if /^#/; |
|
|
my ($key, $value) = split(/=/, $_, 2); |
|
|
$resource{$key} = &code_convert(\$value, $kanjicode); |
|
|
} |
|
|
close(FILE); |
|
|
} |
|
|
|
|
959 |
sub conflict { |
sub conflict { |
960 |
my ($page, $rawmsg) = @_; |
my ($page, $rawmsg) = @_; |
961 |
if ($form{myLastModified} eq &get_info($page, $info_LastModified)) { |
if ($form{myLastModified} eq &get_info($page, $info_LastModified)) { |
962 |
return 0; |
return 0; |
963 |
} |
} |
|
open(FILE, $file_conflict) or &print_error("(conflict)"); |
|
|
my $content = join('', <FILE>); |
|
|
&code_convert(\$content, $kanjicode); |
|
|
close(FILE); |
|
964 |
&print_header($page, -noindex => 1); |
&print_header($page, -noindex => 1); |
965 |
&print_content($content); |
&print_content(&Resource('Error:Conflict')); |
966 |
&print_editform($rawmsg, $form{myLastModified}, frozen=>0, conflict=>1); |
&print_editform($rawmsg, $form{myLastModified}, frozen=>0, conflict=>1); |
967 |
&print_footer($page); |
&print_footer($page); |
968 |
return 1; |
return 1; |
969 |
} |
} |
970 |
|
|
971 |
sub get_now { |
sub get_now { |
972 |
my (@week) = qw(Sun Mon Tue Wed Thu Fri Sat); |
my ($sec, $min, $hour, $day, $mon, $year) = localtime(time); |
|
my (@week) = qw(日 月 火 水 木 金 土); |
|
|
my ($sec, $min, $hour, $day, $mon, $year, $weekday) = localtime(time); |
|
973 |
$year += 1900; |
$year += 1900; |
974 |
$mon++; |
$mon++; |
975 |
$mon = "0$mon" if $mon < 10; |
$mon = "0$mon" if $mon < 10; |
977 |
$hour = "0$hour" if $hour < 10; |
$hour = "0$hour" if $hour < 10; |
978 |
$min = "0$min" if $min < 10; |
$min = "0$min" if $min < 10; |
979 |
#$sec = "0$sec" if $sec < 10; |
#$sec = "0$sec" if $sec < 10; |
980 |
$weekday = $week[$weekday]; |
return "$year-$mon-$day $hour:$min"; |
|
return "$year-$mon-$day ($weekday) $hour:$min"; |
|
981 |
} |
} |
982 |
|
|
983 |
sub init_InterWikiName { |
sub init_InterWikiName { |
984 |
my @content = split /\n/, $database{$InterWikiName}; |
my @content = split /\n/, $database{InterWikiName}; |
985 |
for (@content) { |
for (@content) { |
986 |
if (/^([^#]\S*)\s+(\S[^\x0A\x0D]+)/) { |
if (/^([^#]\S*)\s+(\S[^\x0A\x0D]+)/) { |
987 |
$interwiki{$1} = $2; |
$interwiki{$1} = $2; |
988 |
} |
} |
989 |
} |
} |
990 |
require Message::Util::Formatter; |
$interwiki{'[[]]'} = 1; ## dummy |
|
$fmt{interwiki} = Message::Util::Formatter->new; |
|
|
$fmt{interwiki}->{encoded} = sub { |
|
|
my ($o, $p) = @_; |
|
|
if ($o->{except}) { |
|
|
$o->{except} =~ tr/\x00-\x20\x22\x23%\x2D<>^[\x5C]`{|}\x7F-\xFF//d; |
|
|
} |
|
|
my $s = &code_convert (\$p->{name}, $o->{charset} || 'iso-2022-7bit'); |
|
|
$s =~ s/([^$o->{except}A-Za-z0-9_-])/sprintf '%%%02X', unpack 'C', $1/ge; |
|
|
$s; |
|
|
}; |
|
|
$fmt{interwiki}->{ykwk} = sub { ## YukiWiki1 |
|
|
my ($o, $p) = @_; |
|
|
my $s = $p->{name}; |
|
|
$s = qq([[$s]]) if $s !~ /^[A-Z][a-z]+(?:[A-Z][a-z]+)+$/; |
|
|
&encode (&code_convert (\$p->{name}, $o->{charset} || 'shift_jis')); |
|
|
}; |
|
|
|
|
|
$fmt{form_input} = Message::Util::Formatter->new; |
|
|
for (@{$SuikaWiki::Plugin::List{wikiform_input}||[]}) { |
|
|
$_->load_formatter ($fmt{form_input}, type => 'wikiform_input'); |
|
|
} |
|
991 |
} |
} |
992 |
|
|
993 |
|
|
1018 |
# You are admin. |
# You are admin. |
1019 |
return 0; |
return 0; |
1020 |
} else { |
} else { |
1021 |
&print_error($resource{passworderror}); |
&print_error(&Resource('Error:PasswordIsIncorrect')); |
1022 |
return 1; |
return 1; |
1023 |
} |
} |
1024 |
} |
} |
1025 |
|
|
|
sub valid_password { |
|
|
my ($givenpassword) = @_; |
|
|
my ($validpassword_crypt) = &get_info($AdminSpecialPage, $info_AdminPassword); |
|
|
if (crypt($givenpassword, $validpassword_crypt) eq $validpassword_crypt) { |
|
|
return 1; |
|
|
} else { |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
1026 |
sub is_frozen { |
sub is_frozen { |
1027 |
my ($page) = @_; |
my ($page) = @_; |
1028 |
if (&get_info($page, $info_IsFrozen)) { |
if (&get_info($page, $info_IsFrozen)) { |
1037 |
my $default_name; ## this code does not strict. |
my $default_name; ## this code does not strict. |
1038 |
$default_name = $1 if $content =~ /default-name="([^"]+)"/; |
$default_name = $1 if $content =~ /default-name="([^"]+)"/; |
1039 |
my $datestr = '[WEAK['.&get_now.']]'; |
my $datestr = '[WEAK['.&get_now.']]'; |
1040 |
my $namestr = $form{myname} || $default_name || $DEFAULT_embed_comment_name; |
my $namestr = $form{myname} || $default_name || &Resource('WikiForm:WikiComment:DefaultName'); |
1041 |
($namestr = '', $datestr = '') if $form{myname} eq 'nodate'; |
($namestr = '', $datestr = '') if $form{myname} eq 'nodate'; |
1042 |
if ($namestr =~ /^(?:>>)?[0-9]/) { |
if ($namestr =~ /^(?:>>)?[0-9]/) { |
1043 |
$namestr = qq( ''$namestr'': ); |
$namestr = qq( ''$namestr'': ); |
1046 |
} |
} |
1047 |
my $anchor = &get_new_anchor_index ($content); |
my $anchor = &get_new_anchor_index ($content); |
1048 |
my $i = 1; my $o = 0; |
my $i = 1; my $o = 0; |
1049 |
$content =~ s{(\Q$embed_comment\E|\Q$embed_rcomment\E)}{ |
$content =~ s{(\[\[\#r?comment\]\])}{ |
1050 |
my $embed = $1; |
my $embed = $1; |
1051 |
if ($i == $form{comment_index}) { |
if ($i == $form{comment_index}) { |
1052 |
if ($embed eq $embed_comment) { |
if ($embed ne '[[#rcomment]]') { |
1053 |
$embed = "- [$anchor] $datestr$namestr$form{mymsg}\n$embed"; $o = 1; |
$embed = "- [$anchor] $datestr$namestr$form{mymsg}\n$embed"; $o = 1; |
1054 |
} else { |
} else { |
1055 |
$embed .= "\n- [$anchor] $datestr$namestr$form{mymsg}"; $o = 1; |
$embed .= "\n- [$anchor] $datestr$namestr$form{mymsg}"; $o = 1; |
1083 |
my $CommentIndex = 0; |
my $CommentIndex = 0; |
1084 |
sub embedded_to_html { |
sub embedded_to_html { |
1085 |
my ($embedded) = @_; |
my ($embedded) = @_; |
1086 |
if ($embedded eq $embed_comment or $embedded eq $embed_rcomment) { |
if ($embedded eq '[[#comment]]' or $embedded eq '[[#rcomment]]') { |
1087 |
unless ($main::_EMBEDED) { |
unless ($main::_EMBEDED) { |
1088 |
my $lastmodified = &get_info($form{mypage}, $info_LastModified); |
my $lastmodified = &get_info($form{mypage}, $info_LastModified); |
1089 |
return <<"EOD"; |
return <<"EOD"; |
1093 |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
1094 |
<input type="hidden" name="mytouch" value="on"> |
<input type="hidden" name="mytouch" value="on"> |
1095 |
<input type="hidden" name="comment_index" value="$CommentIndex"> |
<input type="hidden" name="comment_index" value="$CommentIndex"> |
1096 |
$embed_comment_Name_Prompt |
@{[&Resource('WikiForm:WikiComment:Name=',escape=>1)]} |
1097 |
<input type="text" name="myname" value="" size="10" class="comment-name"> |
<input type="text" name="myname" value="" size="10" class="comment-name"> |
1098 |
<input type="text" name="mymsg" value="" size="60" class="comment-msg"> |
<input type="text" name="mymsg" value="" size="60" class="comment-msg"> |
1099 |
<input type="submit" value="$resource{commentbutton}" class="comment-submit"> |
<input type="submit" value="@{[&Resource('WikiForm:Add',escape=>1)]}" title="@{[&Resource('WikiForm:AddLong',escape=>1)]}" class="comment-submit"> |
1100 |
</p></form> |
</p></form> |
1101 |
EOD |
EOD |
1102 |
} else { |
} else { |
1104 |
<del><form action="$url_cgi" method="get"> |
<del><form action="$url_cgi" method="get"> |
1105 |
<input type="hidden" name="mycmd" value="read"> |
<input type="hidden" name="mycmd" value="read"> |
1106 |
<input type="hidden" name="mypage" value="$form{mypage}"> |
<input type="hidden" name="mypage" value="$form{mypage}"> |
1107 |
$embed_comment_Name_Prompt |
@{[&Resource('WikiForm:WikiComment:Name=',escape=>1)]} |
1108 |
<input type="text" name="myname" value="" size="10" disabled="disabled"> |
<input type="text" name="myname" value="" size="10" disabled="disabled"> |
1109 |
<input type="text" name="mymsg" value="" size="60" disabled="disabled"> |
<input type="text" name="mymsg" value="" size="60" disabled="disabled"> |
|
<input type="submit" value="$resource{commentbutton}" disabled="disabled"> |
|
1110 |
</form></del> |
</form></del> |
1111 |
EOD |
EOD |
1112 |
} |
} |
1113 |
} elsif ($embedded =~ /$embed_command{searched}/) { |
} elsif ($embedded =~ /$embed_command{searched}/) { |
1114 |
return get_search_result ($1, -match_myself => 1); |
return get_search_result ($1, -match_myself => 1); |
|
# Walrus add (5) start |
|
|
} elsif ($embedded =~ /$embed_interwiki/ and my $remoteurl = $interwiki{$2}) { |
|
|
$_ = &make_interwiki_box($1, $2); |
|
|
return ($_) ? $_ : $embedded; |
|
|
# Walrus add (5) end |
|
1115 |
} elsif ($embedded =~ /^\[\[\#embed:(.+)\]\]$/) { |
} elsif ($embedded =~ /^\[\[\#embed:(.+)\]\]$/) { |
1116 |
my ($name, $r) = ($1, ''); |
my ($name, $r) = ($1, ''); |
1117 |
if ($main::_EMBEDED != 1) { |
if ($main::_EMBEDED != 1) { |
1124 |
} elsif (length $content) { |
} elsif (length $content) { |
1125 |
$r = "<pre>@{[&escape ($content)]}</pre>"; |
$r = "<pre>@{[&escape ($content)]}</pre>"; |
1126 |
} else { |
} else { |
1127 |
$r = &text_to_html ("[INS[\n埋め込まれている [[$name]] はまだ書かれていません。\n]INS]\n", content_format => 'SuikaWiki/0.9'); |
$r = &text_to_html ("[INS[\n[[$name]]: @{[&Resource('Embed:PageNotFound')]}\n]INS]\n", content_format => 'SuikaWiki/0.9'); |
1128 |
} |
} |
1129 |
} else { ## nested #EMBED |
} else { ## nested #EMBED |
1130 |
$r = &text_to_html ("[INS[\n[[$name]] の埋め込みは (入り組んでいるので) 解決されませんでした。\n]INS]\n", content_format => 'SuikaWiki/0.9'); |
$r = &text_to_html ("[INS[\n[[$name]]: @{[&Resource('Embed:Nested',escape=>1)]}\n]INS]\n", content_format => 'SuikaWiki/0.9'); |
1131 |
} |
} |
1132 |
return qq(<blockquote title="@{[&escape($name)]}" class="wiki-embed">$r<div class="cite-note">『<cite><a href="$url_cgi?@{[&encode($name)]}" class="wiki">@{[&escape($name)]}</a></cite>』</div></blockquote>); |
return qq(<blockquote title="@{[&escape($name)]}" class="wiki-embed">$r<div class="cite-note">『<cite><a href="$url_cgi?@{[&encode($name)]}" class="wiki">@{[&escape($name)]}</a></cite>』</div></blockquote>); |
1133 |
} elsif ($embedded =~ /^\[\[\#randomlink:(.+)\]\]$/) { |
} elsif ($embedded =~ /^\[\[\#randomlink:(.+)\]\]$/) { |
1137 |
} |
} |
1138 |
} |
} |
1139 |
|
|
1140 |
sub do_wikiform { |
sub load_formatter (@) { |
1141 |
my $content = $database{$form{mypage}}; |
for my $t (@_) { |
|
my $anchor = &get_new_anchor_index ($content); |
|
|
for my $t (qw/form_template form_option/) { |
|
1142 |
unless ($fmt{$t}) { |
unless ($fmt{$t}) { |
1143 |
|
require Message::Util::Formatter; |
1144 |
$fmt{$t} = Message::Util::Formatter->new; |
$fmt{$t} = Message::Util::Formatter->new; |
1145 |
for (@{$SuikaWiki::Plugin::List{'wiki'.$t}||[]}) { |
for (@{$SuikaWiki::Plugin::List{'wiki'.$t}||[]}) { |
1146 |
$_->load_formatter ($fmt{$t}, type => 'wiki'.$t); |
$_->load_formatter ($fmt{$t}, type => 'wiki'.$t); |
1147 |
} |
} |
1148 |
} |
} |
1149 |
} |
} |
1150 |
|
} |
1151 |
|
|
1152 |
|
sub do_wikiform { |
1153 |
|
my $content = $database{$form{mypage}}; |
1154 |
|
my $anchor = &get_new_anchor_index ($content); |
1155 |
|
&load_formatter (qw/form_template form_option/); |
1156 |
my $write = 0; |
my $write = 0; |
1157 |
my $i = 1; |
my $i = 1; |
1158 |
$content =~ s{$embed_command{form}}{ |
$content =~ s{$embed_command{form}}{ |
1168 |
$param->{anchor_index} = $anchor; |
$param->{anchor_index} = $anchor; |
1169 |
$param->{argv} = \%form; |
$param->{argv} = \%form; |
1170 |
$param->{default_name} = $1 if $content =~ /default-name="([^"]+)"/; |
$param->{default_name} = $1 if $content =~ /default-name="([^"]+)"/; |
1171 |
$param->{default_name} ||= $DEFAULT_embed_comment_name; |
$param->{default_name} ||= &Resource('WikiForm:WikiComment:DefaultName'); |
1172 |
$fmt{form_option}->replace ($option, $param); |
$fmt{form_option}->replace ($option, $param); |
1173 |
my $t = 1; |
my $t = 1; |
1174 |
for (@{$param->{require}||[]}) { |
for (@{$param->{require}||[]}) { |
1175 |
(undef $t, last) unless length $param->{argv}->{'wikiform__'.$_}; |
(undef $t, last) unless length $param->{argv}->{'wikiform__'.$_}; |
1176 |
} |
} |
1177 |
$t = $fmt{form_template}->replace ($template, $param) if $t; |
$t = $fmt{form_template}->replace ($template, $param) if $t; |
1178 |
if (length $t) { |
if (length $t) { |
1206 |
} |
} |
1207 |
} |
} |
1208 |
|
|
|
|
|
|
# Walrus add (5) start |
|
|
sub do_interwiki_box { |
|
|
my $remoteurl = $interwiki{$form{'myintername'}}; |
|
|
if ($remoteurl) { |
|
|
$remoteurl =~ s/\b(euc|sjis|ykwk|asis|isbn)\(\$1\)/&interwiki_convert($1, $form{'mylocalname'})/e; |
|
|
print "Location: $remoteurl\n\n"; |
|
|
exit(1); |
|
|
} else { |
|
|
&do_read; |
|
|
} |
|
|
} |
|
|
# Walrus add (5) end |
|
|
|
|
|
# Walrus add (5) start |
|
|
sub make_interwiki_box { |
|
|
my ($localname, $intername) = @_; |
|
|
my %ignoretype = ( |
|
|
'box' => 'text', |
|
|
'text' => 'text', |
|
|
'pass' => 'password', |
|
|
'password' => 'password' |
|
|
); |
|
|
my $converted = ($ignoretype{$localname}) ? <<EOD : undef; |
|
|
<form action="$url_cgi" method="post"> |
|
|
<input type="hidden" name="mycmd" value="interwikibox"> |
|
|
<input type="hidden" name="mypage" value="$form{mypage}"> |
|
|
<input type="hidden" name="myintername" value="$intername"> |
|
|
$intername: |
|
|
<input type="$ignoretype{$localname}" name="mylocalname" value="" size="10"> |
|
|
<input type="submit" value="Submit"> |
|
|
</form> |
|
|
EOD |
|
|
} |
|
|
# Walrus add (5) end |
|
|
|
|
1209 |
sub code_convert { |
sub code_convert { |
1210 |
|
require Jcode; |
1211 |
my ($contentref, $code) = (shift, shift || $kanjicode); |
my ($contentref, $code) = (shift, shift || $kanjicode); |
1212 |
$code = 'jis' if $code =~ /iso/; |
$code = 'jis' if $code =~ /iso/; |
1213 |
$code = 'euc' if $code =~ /euc/; |
$code = 'euc' if $code =~ /euc/; |
1214 |
$code = 'sjis' if $code =~ /shift/; |
$code = 'sjis' if $code =~ /shift/; |
1215 |
$code = 'utf8' if $code =~ /utf/; |
$code = 'utf8' if $code =~ /utf/; |
1216 |
&Jcode::convert($contentref, $code); # for Jcode.pm |
$$contentref = Jcode->new ($contentref)->tr ("\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA\xA1\xF5\xA1\xA4\xA1\xA5\xA1\xA7\xA1\xA8\xA1\xA9\xA1\xAA\xA1\xAE\xA1\xB0\xA1\xB2\xA1\xBF\xA1\xC3\xA1\xCA\xA1\xCB\xA1\xCE\xA1\xCF\xA1\xD0\xA1\xD1\xA1\xDC\xA1\xF0\xA1\xF3\xA1\xF4\xA1\xF6\xA1\xF7\xA1\xE1\xA2\xAF\xA2\xB0\xA2\xB2\xA2\xB1\xA1\xE4\xA1\xE3\xA1\xC0\xA1\xA1" => q(0-9A-Za-z&,.:;?!`^_/|()[]{}+$%#*@='"~-><\ ))->$code; |
|
# &jcode::convert($contentref, $code); # for jcode.pl |
|
|
&jcode::tr ($contentref, "\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA\xA1\xF5\xA1\xA4\xA1\xA5\xA1\xA7\xA1\xA8\xA1\xA9\xA1\xAA\xA1\xAE\xA1\xB0\xA1\xB2\xA1\xBF\xA1\xC3\xA1\xCA\xA1\xCB\xA1\xCE\xA1\xCF\xA1\xD0\xA1\xD1\xA1\xDC\xA1\xF0\xA1\xF3\xA1\xF4\xA1\xF6\xA1\xF7\xA1\xE1\xA2\xAF\xA2\xB0\xA2\xB2\xA2\xB1\xA1\xE4\xA1\xE3\xA1\xC0\xA1\xA1" => q(0-9A-Za-z&,.:;?!`^_/|()[]{}+$%#*@='"~-><\ )) if $code eq 'euc'; |
|
1217 |
return $$contentref; |
return $$contentref; |
1218 |
} |
} |
1219 |
|
|
|
sub test_convert { |
|
|
my $txt = &text_to_html(<<"EOD", toc=>1); |
|
|
*HEADER1 |
|
|
**HEADER1-1 |
|
|
-ITEM1 |
|
|
-ITEM2 |
|
|
-ITEM3 |
|
|
PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1 |
|
|
PAR1PAR1PAR1PAR1PAR1PAR1''BOLD''PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1 |
|
|
PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1 |
|
|
|
|
|
PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2 |
|
|
PAR2PAR2PAR2PAR2PAR2PAR2'''ITALIC'''PAR2PAR2PAR2PAR2PAR2PAR2PAR2 |
|
|
PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2 |
|
|
**HEADER1-2 |
|
|
:TERM1:DESCRIPTION1 AND ''BOLD'' |
|
|
PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1 |
|
|
PAR1PAR1PAR1PAR1PAR1PAR1''BOLD''PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1 |
|
|
PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1 |
|
|
:TERM2:DESCRIPTION2 |
|
|
:TERM3:DESCRIPTION3 |
|
|
---- |
|
|
*HEADER2 |
|
|
**HEADER2-1 |
|
|
http://www.hyuki.com/ |
|
|
**HEADER2-2 |
|
|
|
|
|
[[YukiWiki2]] |
|
|
|
|
|
PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1 |
|
|
PAR1PAR1PAR1PAR1PAR1PAR1'''''BOLD ITALIC'''''PAR1PAR1PAR1PAR1PAR1 |
|
|
PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1 |
|
|
>PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2 |
|
|
>PAR2PAR2PAR2PAR2PAR2PAR2'''ITALIC'''PAR2PAR2PAR2PAR2PAR2PAR2PAR2 |
|
|
>PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2 |
|
|
|
|
|
LEVEL0LEVEL0LEVEL0LEVEL0LEVEL0LEVEL0LEVEL0 |
|
|
|
|
|
>LEVEL1 |
|
|
>LEVEL1 |
|
|
>LEVEL1 |
|
|
>>LEVEL2 |
|
|
>>LEVEL2 |
|
|
>>LEVEL2 |
|
|
>>>LEVEL3 |
|
|
-HELLO-1 |
|
|
--HELLO-2 |
|
|
(HELLO-2, HELLO-2, HELLO-2) |
|
|
---HELLO-3 |
|
|
(HELLO-3, HELLO-3, HELLO-3) |
|
|
--HELLO-2 |
|
|
---HELLO-3 |
|
|
--HELLO-2 |
|
|
---HELLO-3 |
|
|
>>>LEVEL3 |
|
|
>>>LEVEL3 |
|
|
>>>LEVEL3 |
|
|
>>>LEVEL3 |
|
|
EOD |
|
|
print $txt; |
|
|
exit; |
|
|
} |
|
|
|
|
1220 |
sub do_diff { |
sub do_diff { |
|
if (not &is_editable($form{mypage})) { |
|
|
&do_read; |
|
|
return; |
|
|
} |
|
|
&open_diff; |
|
1221 |
my $title = $form{mypage}; |
my $title = $form{mypage}; |
1222 |
&print_header($title, -noindex => 1); |
&print_header($title, -noindex => 1); |
1223 |
$_ = &escape($diffbase{$form{mypage}}); |
print qq(<h2>@{[&Resource('Diff:Title',escape=>1)]}</h2>); |
1224 |
&close_diff; |
print qq(<p>@{[&Resource('Diff:Notice',escape=>1)]}</p>); |
|
print qq(<h3>$resource{difftitle}</h3>); |
|
|
print qq($resource{diffnotice}); |
|
1225 |
print qq(<pre class="diff">); |
print qq(<pre class="diff">); |
1226 |
foreach (split(/\n/, $_)) { |
for (split(/\n/, &escape ($database->traverse_diff ($form{mypage})))) { |
1227 |
if (/^\+(.*)/) { |
if (/^\+(.*)/) { |
1228 |
print qq(<b class="added">$1</b>\n); |
print qq(<ins class="added">$1</ins>\n); |
1229 |
} elsif (/^\-(.*)/) { |
} elsif (/^\-(.*)/) { |
1230 |
print qq(<s class="deleted">$1</s>\n); |
print qq(<del class="deleted">$1</del>\n); |
1231 |
} elsif (/^\=(.*)/) { |
} elsif (/^\=(.*)/) { |
1232 |
print qq(<span class="same">$1</span>\n); |
print qq(<span class="same">$1</span>\n); |
1233 |
} else { |
} else { |
1235 |
} |
} |
1236 |
} |
} |
1237 |
print qq(</pre>); |
print qq(</pre>); |
|
print qq(<hr>); |
|
1238 |
&print_footer($title); |
&print_footer($title); |
1239 |
} |
} |
1240 |
|
|
1241 |
sub do_rss { |
sub do_rss { |
1242 |
|
eval q{use Yuki::RSS}; |
1243 |
my $rss = new Yuki::RSS( |
my $rss = new Yuki::RSS( |
1244 |
version => '1.0', |
version => '1.0', |
1245 |
encoding => $charset, |
encoding => &get_charset_name ($kanjicode), |
1246 |
|
); |
1247 |
|
my $scheme = 'http'; |
1248 |
|
$scheme = lc $1 if $main::ENV{SERVER_PROTOCOL} =~ m#([A-Za-z0-9+.%-]+)#; |
1249 |
|
my $myuri = "$scheme://$main::ENV{SERVER_NAME}:$main::ENV{SERVER_PORT}$url_cgi"; |
1250 |
|
$rss->stylesheet ( |
1251 |
|
href => $myuri . "?mycmd=TEXT_CSS;mypage=WikiStyle:RSS", |
1252 |
|
type => 'text/css', |
1253 |
); |
); |
1254 |
$rss->channel( |
$rss->channel( |
1255 |
title => $modifier_rss_title, |
title => &Resource ('RSS:WikiTitle'), |
1256 |
link => $modifier_rss_link, |
link => $myuri, |
1257 |
description => $modifier_rss_description, |
description => &Resource ('RSS:WikiDescription'), |
1258 |
|
'dc:language' => $lang, |
1259 |
); |
); |
1260 |
my $recentchanges = $database{$RecentChanges}; |
my $recentchanges = $database{RecentChanges}; |
1261 |
my $count = 0; |
my $count = 0; |
1262 |
foreach (split(/\n/, $recentchanges)) { |
foreach (split(/\n/, $recentchanges)) { |
1263 |
last if ($count >= 15); |
last if ($count >= 15); |
1264 |
/^\- \d\d\d\d\-\d\d\-\d\d \([^)]+\) \d\d:\d\d:\d\d (\S+)/; # date format. |
if (/\[\[([^]]+)\]\]/) { |
1265 |
my $title = &unarmor_name($1); |
my $title = $1; |
1266 |
my $escaped_title = &escape($title); |
$rss->add_item ( |
1267 |
my $link = $modifier_rss_link . '?' . &encode($title); |
title => &escape($title), |
1268 |
my $description = $escaped_title . &escape(&get_subjectline($title)); |
link => $myuri . '?' . &encode($title), |
1269 |
$rss->add_item( |
description => &escape(&get_subjectline($title,delimiter=>'')), |
1270 |
title => $escaped_title, |
'dc:date' => &get_info ($title, $info_LastModified), |
1271 |
link => $link, |
); |
1272 |
description => $description, |
$count++; |
1273 |
); |
} |
|
$count++; |
|
1274 |
} |
} |
1275 |
# print RSS information (as XML). |
# print RSS information (as XML). |
1276 |
print <<"EOD" |
print <<"EOD" |
1277 |
Content-type: text/xml |
Content-type: application/xml; charset=@{[&get_charset_name ($kanjicode)]} |
1278 |
|
|
1279 |
@{[$rss->as_string]} |
@{[$rss->as_string]} |
1280 |
EOD |
EOD |
1281 |
} |
} |
1282 |
|
|
1283 |
|
sub _rfc3339_date ($) { |
1284 |
|
my @time = gmtime (shift); |
1285 |
|
sprintf '%04d-%02d-%02dT%02d:%02d:%02d+00:00', $time[5]+1900,$time[4]+1,@time[3,2,1,0]; |
1286 |
|
} |
1287 |
|
|
1288 |
sub is_exist_page { |
sub is_exist_page { |
1289 |
my ($name) = @_; |
my ($name) = @_; |
1290 |
if ($use_exists) { |
if ($use_exists) { |
1297 |
sub __get_database ($) { $database{ $_[0] } } |
sub __get_database ($) { $database{ $_[0] } } |
1298 |
sub __set_database ($$) { $database{ $_[0] } = $_[1] } |
sub __set_database ($$) { $database{ $_[0] } = $_[1] } |
1299 |
|
|
1300 |
|
sub do_map { |
1301 |
|
my $page = $form{mypage}; |
1302 |
|
&print_header ($page); |
1303 |
|
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); |
1304 |
|
wiki::useragent::add ($ENV{HTTP_USER_AGENT}); |
1305 |
|
my ($r, $c) = get_search_result ($form{mypage}); |
1306 |
|
my $rl = wiki::referer::list_html ($form{mypage}); |
1307 |
|
print "<h2>@{[&Resource('Map:Title',escape=>1)]}</h2>\n<p>@{[&Resource('Map:Description',escape=>1)]}</p>\n"; |
1308 |
|
my %option = (level => 0+&Resource('Map:Depth'), weight_list => {}, not_exist => {}, |
1309 |
|
map_from_here => &Resource('Map:FromHere'), |
1310 |
|
map_from_here_description => &Resource('Map:FromHereLong')); |
1311 |
|
&wiki::map::make_list ($page, %option); |
1312 |
|
print &wiki::map::list_to_html ($page, $option{weight_list}, %option); |
1313 |
|
if ($c) { |
1314 |
|
print qq{<h2 id="wikipage-see-also">@{[&Resource('SeeAlso',escape=>1)]}</h2>}; |
1315 |
|
print $r; |
1316 |
|
} |
1317 |
|
if ($rl) { |
1318 |
|
print qq(<div id="wikipage-referer"><h2>@{[&Resource('Referers',escape=>1)]}</h2>\n$rl</div>\n); |
1319 |
|
} |
1320 |
|
&print_footer ($page); |
1321 |
|
} |
1322 |
|
|
1323 |
|
my %_Resource; |
1324 |
|
sub Resource ($;%) { |
1325 |
|
my ($s, %o) = @_; |
1326 |
|
unless (defined $_Resource{$s}) { |
1327 |
|
$_Resource{$_[0]} = &wiki::resource::get ($s, $_Resource{__option}); |
1328 |
|
} |
1329 |
|
$o{escape} ? &escape ($_Resource{$s}) : $_Resource{$s}; |
1330 |
|
} |
1331 |
|
|
1332 |
package wiki::referer; |
package wiki::referer; |
1333 |
sub add ($$) { |
sub add ($$) { |
1334 |
my $page = shift; |
my $page = shift; |
1394 |
} |
} |
1395 |
my $euri = main::escape ($uri); |
my $euri = main::escape ($uri); |
1396 |
if ($title) { |
if ($title) { |
1397 |
$r .= qq(<li>[$list{$uri}] <a href="$euri" title="URI: <$euri>">@{[main::escape ($title)]}</a></li>\n); |
$r .= qq(<li>[$list{$uri}] <a href="$euri" title="URI: <$euri>">@{[main::escape ($title)]}</a></li>\n); |
1398 |
} else { |
} else { |
1399 |
$r .= qq(<li>[$list{$uri}] <<a href="$euri">$euri</a>></li>\n); |
$r .= qq(<li>[$list{$uri}] <<a href="$euri">$euri</a>></li>\n); |
1400 |
} |
} |
1410 |
} |
} |
1411 |
|
|
1412 |
package wiki::useragent; |
package wiki::useragent; |
1413 |
|
our $UseLog; |
1414 |
|
|
1415 |
sub add ($) { |
sub add ($) { |
1416 |
my $s = shift; |
my $s = shift; |
1417 |
return unless length $s; |
return unless length $s; |
1418 |
$s =~ s/([\x00-\x08\x0A-\x1F\x25\x7F-\xFF])/sprintf '%%%02X', unpack 'C', $1/g; |
return unless $UseLog; |
1419 |
|
$s =~ s/([\x00-\x08\x0A-\x1F\x25\x7F-\xFF])/sprintf '%%%02X', unpack 'C', $1/ge; |
1420 |
my %ua; |
my %ua; |
1421 |
for (split /\n/, &main::__get_database('WikiUserAgentList')) { |
for (split /\n/, &main::__get_database($main::PageName{UserAgentList})) { |
1422 |
if (/^-\[(\d+)\] (.+)$/) { |
if (/^-\[(\d+)\] (.+)$/) { |
1423 |
my ($t, $n) = ($1, $2); |
my ($t, $n) = ($1, $2); |
1424 |
$n =~ tr/\x0A\x0D//d; |
$n =~ tr/\x0A\x0D//d; |
1430 |
for (sort {$ua{$a} <=> $ua{$b}} keys %ua) { |
for (sort {$ua{$a} <=> $ua{$b}} keys %ua) { |
1431 |
$s .= sprintf qq(-[%d] %s\n), $ua{$_}, $_; |
$s .= sprintf qq(-[%d] %s\n), $ua{$_}, $_; |
1432 |
} |
} |
1433 |
&main::__set_database ('WikiUserAgentList' => $s); |
$main::database->STORE ($main::PageName{UserAgentList} => $s, -touch => 0); |
1434 |
|
} |
1435 |
|
|
1436 |
|
package wiki::suikawikiconst; |
1437 |
|
|
1438 |
|
sub to_hash ($;$) { |
1439 |
|
my $page = shift; |
1440 |
|
my $h = shift || {}; |
1441 |
|
my $val; |
1442 |
|
for my $line (split /\n/, $page) { |
1443 |
|
$line =~ tr/\x0A\x0D//d; |
1444 |
|
if ($val && $line =~ s/^\s+//) { |
1445 |
|
$h->{$val} .= length $h->{$val} ? "\n" . $line : $line; |
1446 |
|
} elsif ($line =~ /^(.+):/) { |
1447 |
|
$val = $1; $h->{$val} = ''; |
1448 |
|
} |
1449 |
|
} |
1450 |
|
$h; |
1451 |
} |
} |
1452 |
|
|
1453 |
package SuikaWiki::Plugin; |
package SuikaWiki::Plugin; |
1454 |
|
our $plugin_directory; # defined in top of this file. |
1455 |
our %List; |
our %List; |
1456 |
|
|
1457 |
sub escape ($$) { main::escape ($_[1]) } |
sub escape ($$) { main::escape ($_[1]) } |
1459 |
sub encode ($$) { main::encode ($_[1]) } |
sub encode ($$) { main::encode ($_[1]) } |
1460 |
sub decode ($$) { main::decode ($_[1]) } |
sub decode ($$) { main::decode ($_[1]) } |
1461 |
sub __get_datetime ($) { main::get_now () } |
sub __get_datetime ($) { main::get_now () } |
1462 |
|
sub resource ($$;%) { shift; &main::Resource (@_) } |
1463 |
|
sub uri ($$) { $main::uri{$_[1]} } |
1464 |
|
|
1465 |
sub regist ($@) { |
sub regist ($@) { |
1466 |
my $pack = shift; |
my $pack = shift; |
1469 |
} |
} |
1470 |
} |
} |
1471 |
|
|
1472 |
use SuikaWiki::Plugin::WikiFormBasic; |
sub import_plugins () { |
1473 |
|
opendir PDIR, $plugin_directory; |
1474 |
|
my @plugin = grep {s/\.pm$//} readdir (PDIR); |
1475 |
|
closedir PDIR; |
1476 |
|
for (@plugin) { |
1477 |
|
eval qq{ use SuikaWiki::Plugin::$_ } unless /[^A-Za-z0-9_]/; |
1478 |
|
push @{$List{_all}}, qq(SuikaWiki::Plugin::$_); |
1479 |
|
} |
1480 |
|
} |
1481 |
|
|
1482 |
|
&import_plugins (); |
1483 |
|
|
1484 |
|
package wiki::conneg; |
1485 |
|
|
1486 |
|
## BUG: this parser isn't strict. |
1487 |
|
sub get_accept_lang (;$) { |
1488 |
|
my $alang = shift || $main::ENV{HTTP_ACCEPT_LANGUAGE}; |
1489 |
|
my %alang = (ja => 0.0002, en => 0.0001); |
1490 |
|
my $i = 0.1; |
1491 |
|
for (split /\s*,\s*/, $alang) { |
1492 |
|
tr/\x09\x0A\x0D\x20//d; |
1493 |
|
if (/((?:(?!;q=).)+)(?:;q="?([0-9.]+)"?)?/) { |
1494 |
|
my $l = lc $1; $l =~ tr/\x22\x5C//d; |
1495 |
|
$alang{$l} = (defined $2 ? $2 : 1.000)*1000; |
1496 |
|
$alang{$l} += $i unless $alang{$l} == 0; |
1497 |
|
$i -= 0.001; |
1498 |
|
} |
1499 |
|
} |
1500 |
|
\%alang; |
1501 |
|
} |
1502 |
|
|
1503 |
|
package wiki::resource; |
1504 |
|
|
1505 |
|
sub get ($;\%) { |
1506 |
|
my ($resname, $option) = @_; |
1507 |
|
$option->{accept_language} ||= &wiki::conneg::get_accept_lang (); |
1508 |
|
$option->{resource} ||= {}; |
1509 |
|
my $v; |
1510 |
|
for my $lang (sort {$option->{accept_language}->{$b} <=> $option->{accept_language}->{$a}} grep {$option->{accept_language}->{$_}!=0} keys %{$option->{accept_language}}) { |
1511 |
|
while (length $lang) { |
1512 |
|
unless ($option->{accept_language}->{defined $option->{accept_language}->{$lang} ? $lang : '*'} == 0) { |
1513 |
|
$option->{resource}->{$lang} ||= &wiki::suikawikiconst::to_hash (&main::__get_database('WikiResource:'.$lang)); |
1514 |
|
$v = $option->{resource}->{$lang}->{$resname}; |
1515 |
|
last if defined $v; |
1516 |
|
} |
1517 |
|
$lang =~ s/[^+-]*$//; $lang =~ s/[+-]$//; |
1518 |
|
} |
1519 |
|
last if defined $v; |
1520 |
|
} |
1521 |
|
defined $v ? $v : $resname; |
1522 |
|
} |
1523 |
|
|
1524 |
|
package wiki::map; |
1525 |
|
|
1526 |
|
sub make_list ($;%) { |
1527 |
|
my ($page, %option) = @_; |
1528 |
|
$option{level} ||= 3; |
1529 |
|
my %weight; |
1530 |
|
my $content = &main::__get_database ($page); |
1531 |
|
$content =~ s{^\#\?([^\x0A\x0D]+)}{ |
1532 |
|
if ($1 =~ /import="([^"]+)"/) { |
1533 |
|
for (split /\s*,\s*/, $1) { |
1534 |
|
$weight{$_} += 2; |
1535 |
|
} |
1536 |
|
} |
1537 |
|
$&; |
1538 |
|
}ges; |
1539 |
|
## Bug: this code does not support content type. |
1540 |
|
$content =~ s{\[\[((?!\#)[^]]+)\](?:>>\d+)?\]}{ |
1541 |
|
$weight{$1}++; $&; |
1542 |
|
}ge; |
1543 |
|
delete $weight{$page}; ## Delete myself |
1544 |
|
for my $page (keys %weight) { |
1545 |
|
my $w = ($content =~ s/\Q$page\E/$&/g); |
1546 |
|
$weight{$page} += $w + $weight{$page}; ## Weight of [[name]] is x2. |
1547 |
|
($weight{$page} *= 0.1, $option{not_exist}->{$page} = 1) unless &main::is_exist_page ($page); |
1548 |
|
} |
1549 |
|
$option{weight_list}->{$page} = \%weight; |
1550 |
|
if (--$option{level}) { |
1551 |
|
for my $page (keys %weight) { |
1552 |
|
&make_list ($page, %option) unless $option{weight_list}->{$page}; |
1553 |
|
} |
1554 |
|
} |
1555 |
|
$option{weight_list}; |
1556 |
|
} |
1557 |
|
|
1558 |
|
sub list_to_html ($$;%) { |
1559 |
|
my ($Page, $wlist, %option) = @_; |
1560 |
|
my $r = ''; |
1561 |
|
$option{outputed}->{$Page} = 1; |
1562 |
|
for my $page (sort {$wlist->{$Page}->{$b} <=> $wlist->{$Page}->{$a}} keys %{$wlist->{$Page}}) { |
1563 |
|
$r .= qq(<li><span class="weight">[@{[0+$wlist->{$Page}->{$page}]}]</span> <a href="$main::url_cgi?@{[&main::encode($page)]}" class="wiki@{[$option{not_exist}->{$page}?' not-exist':'']}">@{[&main::escape ($page).($option{not_exist}->{$page}?qq(<span class="mark">@{[&main::Resource('JumpAndEditWikiPageMark',escape=>1)]}</span>):'')]}</a> <a href="$main::url_cgi?mycmd=map;mypage=@{[&main::encode($page)]}" class="wiki-cmd map-from-here" title="@{[&main::escape($option{map_from_here_description})]}">@{[&main::escape($option{map_from_here})]}</a> <span class="summary">@{[&main::escape(&main::get_subjectline($page))]}</span>); |
1564 |
|
unless ($option{outputed}->{$page}) { |
1565 |
|
$r .= &list_to_html ($page, $wlist, %option); |
1566 |
|
} |
1567 |
|
$r .= "</li>\n"; |
1568 |
|
} |
1569 |
|
$r ? qq(<ul class="map">$r</ul>) : ''; |
1570 |
|
} |
1571 |
|
|
1572 |
|
package main; |
1573 |
|
&main; |
1574 |
|
exit 0; |
1575 |
|
|
1576 |
1; |
1; |
1577 |
__END__ |
__END__ |
1578 |
=head1 NAME |
=head1 NAME |
1579 |
|
|
1580 |
wiki.cgi - This is YukiWiki, yet another Wiki clone. |
wiki.cgi --- SuikaWiki: Yet yet another Wiki engine |
|
|
|
|
=head1 DESCRIPTION |
|
|
|
|
|
YukiWiki is yet another Wiki clone. |
|
1581 |
|
|
1582 |
YukiWiki can treat Japanese WikiNames (enclosed with [[ and ]]). |
=head1 AUTHORS |
|
YukiWiki provides 'InterWiki' feature, RDF Site Summary (RSS), |
|
|
and some embedded commands (such as [[#comment]] to add comments). |
|
1583 |
|
|
1584 |
Read F<readme_en.txt> (English) or F<readme_ja.txt> (Japanese) in more detail. |
Hiroshi Yuki <hyuki@hyuki.com> <http://www.hyuki.com/yukiwiki/> |
1585 |
|
|
1586 |
=head1 AUTHOR |
Makio Tsukamoto <http://digit.que.ne.jp/> |
1587 |
|
|
1588 |
Hiroshi Yuki <hyuki@hyuki.com> http://www.hyuki.com/yukiwiki/ |
Wakaba <w@suika.fam.cx> |
1589 |
|
|
1590 |
=head1 LICENSE |
=head1 LICENSE |
1591 |
|
|
1592 |
Copyright (C) 2000-2002 by Hiroshi Yuki. |
Copyright (C) 2000-2003 AUTHORS |
1593 |
|
|
1594 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
1595 |
modify it under the same terms as Perl itself. |
modify it under the same terms as Perl itself. |