| 1 |
#!/usr/bin/perl |
#!/usr/bin/perl |
|
#!perl |
|
| 2 |
# |
# |
| 3 |
# wiki.cgi - This is YukiWiki, yet another Wiki clone. |
# wiki.cgi - This is YukiWiki, yet another Wiki clone. |
| 4 |
# |
# |
| 9 |
# This program is free software; you can redistribute it and/or |
# This program is free software; you can redistribute it and/or |
| 10 |
# modify it under the same terms as Perl itself. |
# modify it under the same terms as Perl itself. |
| 11 |
# |
# |
|
############################## |
|
|
# |
|
| 12 |
# walwiki.cgi based on yukiwiki.cgi - Yet another WikiWikiWeb clone. |
# walwiki.cgi based on yukiwiki.cgi - Yet another WikiWikiWeb clone. |
|
# |
|
|
# WalWikiの現バージョンは、YukiWiki 2.0.beta1をベースにしています。 |
|
|
# |
|
|
# * 更新内容 |
|
|
# |
|
|
# 2.0.beta1.wal.1 on 2002/05/19,22:32:19 |
|
|
# (1) Footerの変更 |
|
|
# (2) WikiNameの拡張 : PerlCEも包含、PPMInstallは含まない |
|
|
# (3) 別名リンク([別名 URL])に対応。 |
|
|
# (4) ISBNをアマゾン.jpのAsociateプログラムリンクに変換。 |
|
|
# (5) [[#box:InterWikiName]]でInterWikiなテキストボックス生成 |
|
|
# (6) HTMLモード対応。 |
|
|
# |
|
|
# 旧2.0.alpha0.wal.3版までの修正の内、以下に変更があります。 |
|
|
# ・以下はYukiWiki2に実装されたため、独自コードはなくなりました。 |
|
|
# - インラインの画像変換 |
|
|
# - YukiWikiDB対応 |
|
|
# - テーブル |
|
|
# - DB関連モジュールuseのeval化 |
|
|
# - BracketNameによるキーからブラケットを排除 |
|
|
# ・ISBN番号への対応はWalWiki2.0より、InterWikiへのAdd-Onになりました。 |
|
|
# [[ISBN http://www.amazon.co.jp/exec/obidos/ASIN/isbn($1)/walrdigi-22]]のように登録。 |
|
|
# |
|
|
#======================================= |
|
| 13 |
|
|
| 14 |
# Walrus add (debug) start |
# Walrus add (debug) start |
| 15 |
my $walrus_log; |
my $walrus_log; |
| 26 |
use Yuki::YukiWikiDB; |
use Yuki::YukiWikiDB; |
| 27 |
use AnyDBM_File; |
use AnyDBM_File; |
| 28 |
require 'jcode.pl'; |
require 'jcode.pl'; |
| 29 |
# use Jcode; |
require Jcode; |
| 30 |
use Fcntl; |
use Fcntl; |
| 31 |
my $version = '2.0.beta1.2002-05-29'; |
my $version = '2.0.beta1.2002-05-29'; |
| 32 |
my $walversion; |
my $walversion; |
| 86 |
my $NAME_OF_WikiPageLicense = 'WikiPageLicense'; |
my $NAME_OF_WikiPageLicense = 'WikiPageLicense'; |
| 87 |
my $AdminSpecialPage = 'Admin Special Page'; # must include spaces. |
my $AdminSpecialPage = 'Admin Special Page'; # must include spaces. |
| 88 |
############################## |
############################## |
|
# my $wiki_name = '\b([A-Z][a-z]+([A-Z][a-z]+)+)\b'; # Walrus del (2) |
|
|
my $wiki_name = '\b([A-Z][a-z]+([A-Z][a-z]*)+)\b'; # Walrus add (2) |
|
| 89 |
my $bracket_name = '\[\[(\S+?)\]\]'; |
my $bracket_name = '\[\[(\S+?)\]\]'; |
| 90 |
my $embedded_name = '\[\[(#\S+?)\]\]'; |
my $embedded_name = '\[\[(#\S+?)\]\]'; |
| 91 |
my $interwiki_definition = '\[\[(\S+?)\ (\S+?)\]\]'; |
my %fmt; ## formatter objects |
|
my $interwiki_name = 'i:([^:]+):([^:].*)'; |
|
| 92 |
############################## |
############################## |
| 93 |
my $embed_comment = '[[#comment]]'; |
my $embed_comment = '[[#comment]]'; |
| 94 |
my $embed_rcomment = '[[#rcomment]]'; |
my $embed_rcomment = '[[#rcomment]]'; |
| 97 |
my $embed_interwiki = '^\[\[#(box|text|password):(\S+)\]\]$'; # Walrus add (5) |
my $embed_interwiki = '^\[\[#(box|text|password):(\S+)\]\]$'; # Walrus add (5) |
| 98 |
my %embed_command = ( |
my %embed_command = ( |
| 99 |
searched => '^\[\[#searched:([^\]]+)\]\]$', |
searched => '^\[\[#searched:([^\]]+)\]\]$', |
| 100 |
|
form => qw/\[\[\#form(?:\(([A-Za-z0-9-]+)\))?:'((?:[^'\\]|\\.)*)':'((?:[^'\\]|\\.)*)'(?::'((?:[^'\\]|\\.)*)')?\]\]/, |
| 101 |
); |
); |
| 102 |
############################## |
############################## |
| 103 |
my $info_LastModified = 'LastModified'; |
my $info_LastModified = 'LastModified'; |
| 117 |
$AdminChangePassword => 1, |
$AdminChangePassword => 1, |
| 118 |
$CompletedSuccessfully => 1, |
$CompletedSuccessfully => 1, |
| 119 |
#$FrontPage => 1, |
#$FrontPage => 1, |
| 120 |
|
WikiUserAgentList => 1, |
| 121 |
); |
); |
| 122 |
my %form; |
my %form; |
| 123 |
my %database; |
my %database; |
| 153 |
rss => \&do_rss, |
rss => \&do_rss, |
| 154 |
diff => \&do_diff, |
diff => \&do_diff, |
| 155 |
interwikibox => \&do_interwiki_box, # Walrus add (5) |
interwikibox => \&do_interwiki_box, # Walrus add (5) |
| 156 |
|
wikiform => \&do_wikiform, |
| 157 |
); |
); |
| 158 |
############################## |
############################## |
|
my @ignore_html_page = ('FrontPage'); # Walrus add (6) |
|
|
my @ignore_html_tags = ('a', 'br', 'img'); # Walrus add (6) |
|
| 159 |
my $walversion = '2.0.beta1.wal.1'; # Walrus add (1) |
my $walversion = '2.0.beta1.wal.1'; # Walrus add (1) |
| 160 |
############################## |
############################## |
| 161 |
# &test_convert; |
# &test_convert; |
| 162 |
|
my $UA = ''; ## User agent name |
| 163 |
&main; |
&main; |
| 164 |
exit(0); |
exit(0); |
| 165 |
############################## |
############################## |
| 166 |
|
|
| 167 |
sub main { |
sub main { |
| 168 |
|
$UA = $main::ENV{HTTP_USER_AGENT}; |
| 169 |
&init_resource; |
&init_resource; |
| 170 |
&open_db; |
&open_db; |
| 171 |
&init_form; |
&init_form; |
| 182 |
my $content = $database{$form{mypage}}; |
my $content = $database{$form{mypage}}; |
| 183 |
my $lm = &get_info($form{mypage}, $info_LastModified); |
my $lm = &get_info($form{mypage}, $info_LastModified); |
| 184 |
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); |
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); |
| 185 |
|
wiki::useragent::add ($ENV{HTTP_USER_AGENT}); |
| 186 |
my ($r, $c) = get_search_result ($form{mypage}); |
my ($r, $c) = get_search_result ($form{mypage}); |
| 187 |
my $rl = wiki::referer::list_html ($form{mypage}); |
my $rl = wiki::referer::list_html ($form{mypage}); |
| 188 |
my @toc; |
my @toc; |
| 193 |
## - 'SuikaWiki/0.9' CRLF |
## - 'SuikaWiki/0.9' CRLF |
| 194 |
## - 'H2H/' ("0.9" / "1.0" / "1.1") CRLF |
## - 'H2H/' ("0.9" / "1.0" / "1.1") CRLF |
| 195 |
## - "/*" WSP* 'W3C-CSS/' ("1.0" / "2.0") "*/" CRLF |
## - "/*" WSP* 'W3C-CSS/' ("1.0" / "2.0") "*/" CRLF |
| 196 |
$cf = $1 if $content =~ s#^(?:/\*\s*|[\#<]\?)?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.][^\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; |
| 197 |
if ($cf =~ m!^(?:\#\?)?SuikaWiki/0.9(?:$|\s)!) { |
if ($cf =~ m!^(?:\#\?)?SuikaWiki/0.9(?:$|\s)!) { |
| 198 |
&print_header ($form{mypage}, -last_modified => $lm, |
&print_header ($form{mypage}, -last_modified => $lm, |
| 199 |
-content_format => $cf, -noindex => $cf =~ /obsoleted="yes"/); |
-content_format => $cf, -noindex => $cf =~ /obsoleted="yes"/); |
| 200 |
&print_content ($content, content_format => $cf, last_modified => $lm, |
&print_content ($content, content_format => $cf, last_modified => $lm, |
| 201 |
-toc => \@toc); |
-toc => \@toc); |
| 202 |
print &text_to_html (q([[#comment]])); |
print &text_to_html (q([[#comment]])) if $cf !~ /obsoleted="yes"/ && !$fixedpage{$form{mypage}}; |
| 203 |
} else { |
} else { |
| 204 |
&print_header($form{mypage}, -last_modified => $lm); |
&print_header($form{mypage}, -last_modified => $lm); |
| 205 |
print "<pre>@{[&escape($content)]}</pre>"; |
print "<pre>@{[&escape($content)]}</pre>"; |
| 206 |
} |
} |
| 207 |
if ($c) { |
if ($c) { |
| 208 |
print q{<h2 id="wikipage-see-also">See also</h2>}; |
print qq{<h2 @{[&id_and_name('wikipage-see-also')]}>See also</h2>}; |
| 209 |
print $r; |
print $r; |
| 210 |
} |
} |
| 211 |
if ($rl) { |
if ($rl) { |
| 212 |
print qq(<div id="wikipage-referer"><h2>参照元</h2>\n$rl</div>\n); |
print qq(<div @{[&id_and_name('wikipage-referer')]}><h2>参照元</h2>\n$rl</div>\n); |
| 213 |
} |
} |
| 214 |
&print_footer($form{mypage}, $lm); |
&print_footer($form{mypage}, $lm); |
| 215 |
} |
} |
| 230 |
} |
} |
| 231 |
} |
} |
| 232 |
|
|
| 233 |
|
sub id_and_name ($) { |
| 234 |
|
my $name = shift; |
| 235 |
|
if ($UA =~ m#Mozilla/[12]\.#) { |
| 236 |
|
qq{id="$name"><a name="$name"></a}; |
| 237 |
|
} else { |
| 238 |
|
qq{id="$name"}; |
| 239 |
|
} |
| 240 |
|
} |
| 241 |
|
|
| 242 |
sub do_edit { |
sub do_edit { |
| 243 |
my ($page) = &unarmor_name(&armor_name($form{mypage})); |
my ($page) = &unarmor_name(&armor_name($form{mypage})); |
| 244 |
&print_header($page, -noindex => 1); |
&print_header($page, -noindex => 1); |
| 249 |
} else { |
} else { |
| 250 |
&print_editform($database{$page}, &get_info($page, $info_LastModified), admin=>0); |
&print_editform($database{$page}, &get_info($page, $info_LastModified), admin=>0); |
| 251 |
} |
} |
| 252 |
|
wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER}); |
| 253 |
|
wiki::useragent::add ($ENV{HTTP_USER_AGENT}); |
| 254 |
|
my ($r, $c) = get_search_result ($form{mypage}); |
| 255 |
|
my $rl = wiki::referer::list_html ($form{mypage}); |
| 256 |
|
if ($c) { |
| 257 |
|
print q{<h2 id="wikipage-see-also">See also</h2>}; |
| 258 |
|
print $r; |
| 259 |
|
} |
| 260 |
|
if ($rl) { |
| 261 |
|
print qq(<div id="wikipage-referer"><h2>参照元</h2>\n$rl</div>\n); |
| 262 |
|
} |
| 263 |
&print_footer($page); |
&print_footer($page); |
| 264 |
} |
} |
| 265 |
|
|
| 355 |
&update_recent_changes; |
&update_recent_changes; |
| 356 |
} |
} |
| 357 |
&set_info($form{mypage}, $info_IsFrozen, 0 + $form{myfrozen}); |
&set_info($form{mypage}, $info_IsFrozen, 0 + $form{myfrozen}); |
| 358 |
&print_header($CompletedSuccessfully, -noindex => 1, -goto => $url_cgi.'?'.&encode($form{mypage}).($form{__comment_anchor_index}?"#anchor-$form{__comment_anchor_index}":'')); |
my $fragment; |
| 359 |
|
if ($form{__comment_anchor_index}) { |
| 360 |
|
$fragment = qq(anchor-$form{__comment_anchor_index}); |
| 361 |
|
} elsif ($form{__wikiform_anchor_index}) { |
| 362 |
|
$fragment = qq(wikiform-$form{__wikiform_anchor_index}); |
| 363 |
|
} |
| 364 |
|
&print_header($CompletedSuccessfully, -noindex => 1, -goto => $url_cgi.'?mycmd=read;mypage='.&encode($form{mypage}).qq(;x-param=@{[time.[0..9]->[rand 10]]}).($fragment?'#'.$fragment:'')); |
| 365 |
&print_message($resource{saved}); |
&print_message($resource{saved}); |
| 366 |
&print_content("$resource{continuereading} @{[&armor_name($form{mypage})]}"); |
&print_content("$resource{continuereading} @{[&armor_name($form{mypage})]}"); |
| 367 |
&print_footer($CompletedSuccessfully); |
&print_footer($CompletedSuccessfully); |
| 388 |
my $word = $form{mymsg}; |
my $word = $form{mymsg}; |
| 389 |
&print_header($SearchPage); |
&print_header($SearchPage); |
| 390 |
&print_searchform(&escape($word)); |
&print_searchform(&escape($word)); |
| 391 |
print scalar get_search_result ($word, -output_not_found => 1); |
print scalar get_search_result ($word, -output_not_found => 1, -match_myself => 1); |
| 392 |
&print_footer($SearchPage); |
&print_footer($SearchPage); |
| 393 |
} |
} |
| 394 |
|
|
| 395 |
sub get_search_result ($;%) { |
sub get_search_result ($;%) { |
| 396 |
my $word = shift; |
my $word = lc shift; |
| 397 |
my %option = @_; |
my %option = @_; |
| 398 |
my $counter = 0; |
my @r; |
| 399 |
my $r = ''; |
foreach my $page (keys %database) { |
| 400 |
foreach my $page (sort keys %database) { |
next if $page eq $RecentChanges || ($page eq $word && !$option{-match_myself}); |
|
next if $page eq $RecentChanges; |
|
| 401 |
my $content = $database{$page}; |
my $content = $database{$page}; |
| 402 |
$content =~ s/^\#\?[^\x0A\x0D]+//s; |
my $cf = 'SuikaWiki/0.9'; |
| 403 |
if ( index ($content, $word) > 0 |
$cf = $1 if $content =~ s/^\#\?([^\x0A\x0D]+)//s; |
| 404 |
|| index ($page, $word) > 0 |
next if $cf =~ /obsoleted="yes"/; |
| 405 |
|| index ($word, $page) > 0 |
if (index (lc $page, $word) > -1) { |
| 406 |
) { |
my $c = $content =~ s/\Q$word\E//gi; |
| 407 |
$r .= qq(<li><a href ="$url_cgi?@{[&encode($page)]}" class="wiki">@{[&escape($page)]}</a> <span class="wikipage-summary">@{[&escape(&get_subjectline($page))]}</span></li>); |
push @r, [$page, $c+20]; |
| 408 |
$counter++; |
} elsif (index ($word, lc $page) > -1) { |
| 409 |
|
my $c = $content =~ s/\Q$word\E//gi; |
| 410 |
|
push @r, [$page, $c+10]; |
| 411 |
|
} elsif (my $c = $content =~ s/\Q$word\E//gi) { |
| 412 |
|
push @r, [$page, $c]; |
| 413 |
} |
} |
| 414 |
} |
} |
| 415 |
$r = qq|<ul>$r</ul>| if $r; |
my $em = sub { my $s = shift; $s =~ s#(\Q$word\E)#<em>$1</em>#gi; $s }; |
| 416 |
get_message ($resource{notfound}) |
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; |
| 417 |
if $counter == 0 && $option{-output_not_found}; |
$r = qq|<ul class="search-result">$r</ul>| if $r; |
| 418 |
wantarray? ($r, $counter): $r; |
get_message ($resource{notfound}) if @r == 0 && $option{-output_not_found}; |
| 419 |
|
wantarray? ($r, scalar @r): $r; |
| 420 |
} |
} |
| 421 |
|
|
| 422 |
sub do_create { |
sub do_create { |
| 466 |
$bodyclass = "frozen"; |
$bodyclass = "frozen"; |
| 467 |
} |
} |
| 468 |
$bodyclass .= " wiki-page-obsoleted" if $option{-content_format} =~ /obsoleted="yes"/; |
$bodyclass .= " wiki-page-obsoleted" if $option{-content_format} =~ /obsoleted="yes"/; |
| 469 |
print qq{Refresh: 0; url="$option{-goto}"\n} if $option{-goto}; |
if ($option{-goto}) { |
| 470 |
|
if ($UA =~ m#Mozilla/[12]\.|Opera#) { |
| 471 |
|
$option{-goto} =~ tr/;/&/; |
| 472 |
|
print qq{Refresh: 0; url=$option{-goto}\n}; |
| 473 |
|
$option{-goto} = qq(<meta http-equiv="refresh" content="0; url=$option{-goto}">); |
| 474 |
|
} else { |
| 475 |
|
print qq{Refresh: 0; url="$option{-goto}"\n}; |
| 476 |
|
$option{-goto} = qq(<meta http-equiv="refresh" content="0; url="@{[&escape($option{-goto})]}"">); |
| 477 |
|
} |
| 478 |
|
} |
| 479 |
print qq{Last-Modified: $option{-last_modified}\n} if $option{-last_modified}; |
print qq{Last-Modified: $option{-last_modified}\n} if $option{-last_modified}; |
| 480 |
|
my $meta_ct = ''; |
| 481 |
|
if ($UA =~ m#Mozilla/2#) { |
| 482 |
|
$meta_ct = qq{text/html; charset=@{[&x_charset($charset)]}}; |
| 483 |
|
print qq{Content-Type: $meta_ct\n}; |
| 484 |
|
$meta_ct = qq{<meta http-equiv="content-type" content="$meta_ct">}; |
| 485 |
|
} else { |
| 486 |
|
print qq{Content-Type: text/html; charset=$charset\n}; |
| 487 |
|
} |
| 488 |
my $cookedpage = &encode($page); |
my $cookedpage = &encode($page); |
| 489 |
my $escapedpage = &escape($page); |
my $escapedpage = &escape($page); |
| 490 |
print <<"EOD"; |
print <<"EOD"; |
|
Content-type: text/html; charset=$charset |
|
| 491 |
Content-Language: $lang |
Content-Language: $lang |
| 492 |
Content-Style-Type: text/css |
Content-Style-Type: text/css |
| 493 |
|
|
| 497 |
"http://www.w3.org/TR/html4/loose.dtd"> + RUBY --> |
"http://www.w3.org/TR/html4/loose.dtd"> + RUBY --> |
| 498 |
<html lang="$lang"> |
<html lang="$lang"> |
| 499 |
<head> |
<head> |
| 500 |
|
$meta_ct$option{-goto} |
| 501 |
<title>$escapedpage</title> |
<title>$escapedpage</title> |
| 502 |
<link rel="index" href="$url_cgi?$IndexPage"> |
<link rel="index" href="$url_cgi?$IndexPage"> |
| 503 |
|
<link rel="help" href="$url_cgi?WikiHelp"> |
| 504 |
<link rel="copyright" href="$url_cgi?$NAME_OF_WikiPageLicense"> |
<link rel="copyright" href="$url_cgi?$NAME_OF_WikiPageLicense"> |
|
<link rev="made" href="mailto:@{[&escape($modifier_mail)]}"> |
|
| 505 |
<link rel="stylesheet" type="text/css" href="@{[&escape($url_stylesheet)]}"> |
<link rel="stylesheet" type="text/css" href="@{[&escape($url_stylesheet)]}"> |
| 506 |
@{[$option{-noindex} ? q(<meta name="ROBOTS" content="NOINDEX">) : '']} |
@{[$option{-noindex} ? q(<meta name="ROBOTS" content="NOINDEX">) : '']} |
| 507 |
</head> |
</head> |
| 513 |
EOD |
EOD |
| 514 |
} |
} |
| 515 |
|
|
| 516 |
|
sub x_charset ($) { |
| 517 |
|
my $charset = lc shift; |
| 518 |
|
if ($charset eq 'euc-jp') { |
| 519 |
|
$charset = 'x-euc-jp'; |
| 520 |
|
} elsif ($charset eq 'shift_jis') { |
| 521 |
|
$charset = 'x-sjis'; |
| 522 |
|
} |
| 523 |
|
$charset; |
| 524 |
|
} |
| 525 |
|
|
| 526 |
sub print_navigate_links (@) { |
sub print_navigate_links (@) { |
| 527 |
my ($page) = @_; |
my ($page) = @_; |
| 528 |
my $editable = 0; |
my $editable = 0; |
| 548 |
qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=$cookedpage" accesskey="E">編集</a> | ) |
qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=$cookedpage" accesskey="E">編集</a> | ) |
| 549 |
: qq() |
: qq() |
| 550 |
]} |
]} |
| 551 |
|
<a href="$url_cgi?mycmd=read;mypage=$cookedpage;x-param=@{[time.[0..9]->[rand 10]]}">表示</a> | |
| 552 |
@{[ $admineditable |
@{[ $admineditable |
| 553 |
? qq(<a href="$url_cgi?mycmd=diff;mypage=$cookedpage">$resource{diffbutton}</a> | ) |
? qq(<a href="$url_cgi?mycmd=diff;mypage=$cookedpage">$resource{diffbutton}</a> | ) |
| 554 |
: qq() |
: qq() |
| 575 |
|
|
| 576 |
sub print_footer { |
sub print_footer { |
| 577 |
my ($page, $lm) = @_; |
my ($page, $lm) = @_; |
| 578 |
|
my $epage = &encode ($page); |
| 579 |
$walrus_log = ($walrus_debugging) ? &text_to_html("----\n$walrus_log") : ''; # Walrus add (debug) |
$walrus_log = ($walrus_debugging) ? &text_to_html("----\n$walrus_log") : ''; # Walrus add (debug) |
| 580 |
# Walrus mod (1) start |
# Walrus mod (1) start |
| 581 |
my $cvslog1 = q$Revision$; |
my $cvslog1 = q$Revision$; |
| 591 |
<a href="/map" title="このサーバーの案内">地図</a> |
<a href="/map" title="このサーバーの案内">地図</a> |
| 592 |
<a href="/search/" title="このサーバーの検索">検索</a>] |
<a href="/search/" title="このサーバーの検索">検索</a>] |
| 593 |
</div> |
</div> |
| 594 |
|
<div class="myuri"> |
| 595 |
|
<<a href="$url_cgi?$epage">$url_cgi?$epage</a>> |
| 596 |
|
</div> |
| 597 |
</div> |
</div> |
| 598 |
$walrus_log |
$walrus_log |
| 599 |
</body> |
</body> |
| 600 |
</html> |
</html> |
| 601 |
EOD |
EOD |
|
# print <<"EOD"; |
|
|
# <hr> |
|
|
# <address class="footer"> |
|
|
# <a href="http://www.hyuki.com/yukiwiki/">YukiWiki</a> $version |
|
|
# © 2000-2002 by <a href="http://www.hyuki.com/">Hiroshi Yuki</a>.<br /> |
|
|
# Modified by <a href="$modifier_url">$modifier_name</a>. |
|
|
# </address> |
|
|
# <p class="footer"> |
|
|
# <a href="http://www.hyuki.com/yukiwiki/">$icontag</a> |
|
|
# </p> |
|
|
# </body> |
|
|
# </html> |
|
|
# EOD |
|
|
# Walrus mod (1) end |
|
| 602 |
} |
} |
| 603 |
|
|
| 604 |
sub escape { |
sub escape { |
| 673 |
} elsif (/^:([^:]+):(.*)/) { |
} elsif (/^:([^:]+):(.*)/) { |
| 674 |
&back_push('dl', 1, \@saved, \@result); |
&back_push('dl', 1, \@saved, \@result); |
| 675 |
push(@result, '<dt>' . &inline($1) . '</dt>', '<dd>' . &inline($2) . '</dd>'); |
push(@result, '<dt>' . &inline($1) . '</dt>', '<dd>' . &inline($2) . '</dd>'); |
| 676 |
} elsif (/^(>{1,5})(.*)/) { |
} elsif (/^(?!>>\d)(>{1,5})(.*)/) { |
| 677 |
&back_push('blockquote', length($1), \@saved, \@result); |
&back_push('blockquote', length($1), \@saved, \@result); |
| 678 |
|
push @result, "<p>"; |
| 679 |
push(@result, &inline($2)); |
push(@result, &inline($2)); |
| 680 |
|
unshift @saved, "</p>"; |
| 681 |
} elsif (/^\s*$/) { |
} elsif (/^\s*$/) { |
| 682 |
push(@result, splice(@saved)); |
push(@result, splice(@saved)); |
|
unshift(@saved, "</p>"); |
|
| 683 |
push(@result, "<p>"); |
push(@result, "<p>"); |
| 684 |
|
unshift(@saved, "</p>"); |
| 685 |
} elsif (/^(\s+.*)$/) { |
} elsif (/^(\s+.*)$/) { |
| 686 |
&back_push('pre', 1, \@saved, \@result); |
&back_push('pre', 1, \@saved, \@result); |
| 687 |
#push(@result, &escape($1)); # Not &inline, but &escape |
#push(@result, &escape($1)); # Not &inline, but &escape |
| 741 |
$toc = join("\n", @tocresult); |
$toc = join("\n", @tocresult); |
| 742 |
$toc = $toc ? qq(<div id="wikipage-toc">$toc</div>) : ''; |
$toc = $toc ? qq(<div id="wikipage-toc">$toc</div>) : ''; |
| 743 |
} |
} |
| 744 |
return $toc . join("\n", @result); |
$toc .= join("\n", @result); |
| 745 |
|
$toc =~ s#<p>\n</p>##g; |
| 746 |
|
$toc =~ s#[\x0D\x0A]+</#</#g; |
| 747 |
|
$toc =~ s#<pre>\n#<pre>#g; |
| 748 |
|
$toc; |
| 749 |
} |
} |
| 750 |
|
|
| 751 |
sub back_push { |
sub back_push { |
| 765 |
sub inline { |
sub inline { |
| 766 |
my ($line) = @_; |
my ($line) = @_; |
| 767 |
$line = &escape($line); |
$line = &escape($line); |
| 768 |
$line =~ s:\[(INS|DEL|SUP|SUB)\[(.+?)\]\]:<@{[lc $1]}>$2</@{[lc $1]}>:g; |
$line =~ s{$embed_command{form}}{&make_custom_form ($1, $2, $3, $4)}ge; |
| 769 |
$line =~ s:\[ABBR\[(.+?)\] \[(.+?)\]\]:<acronym title="$2">$1</acronym>: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; |
| 770 |
$line =~ s:\[RUBY\[(.+?)\] \[(.+?)\]\]:<ruby><rb>$1</rb><rp>(</rp><rt>$2</rt><rp>)</rp></ruby>:g; |
$line =~ s:\[(WEAK)\[(.+?)\]\]:<span class="@{[lc $1]}">$2</span>:g; |
| 771 |
$line =~ s%\[Q\[(.+?)\](?: \[<([\x21-\x5A\x5E-\x7E]+)>\])?\]%「<q@{[$2?qq( cite="$2"):'']}>$1</q>」%g; |
$line =~ s:\[ABBR\[([^]]+)\] \[([^]]+)\]\]:<acronym title="$2">$1</acronym>:g; |
| 772 |
$line =~ s|'''([^']+?)'''|<strong>$1</strong>|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; |
| 773 |
$line =~ s|''([^']+?)''|<em>$1</em>|g; |
$line =~ s:\[RUBY\[([^]]+)\] \[([^]]+)\]\]:<ruby><rb>$1</rb><rp>(</rp><rt>$2</rt><rp>)</rp></ruby>:g; |
| 774 |
$line =~ s|(\d\d\d\d-\d\d-\d\d \(\w\w\w\) \d\d:\d\d:\d\d)|<span class="date">$1</span>|g; # Date |
$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; |
| 775 |
$line =~ s! |
$line =~ s%\[Q\[([^]]+)\](?: \[<([\x21-\x5A\x5E-\x7E]+)>\])?\]%「<q@{[$2?qq( cite="$2"):'']}>$1</q>」%g; |
| 776 |
( |
$line =~ s|'''([^']+)'''|<strong>$1</strong>|g; |
| 777 |
(?:<(?:mailto|http|https|ftp|urn|news):[\x21-\x7E]*)> |
$line =~ s|''([^']+)''|<em>$1</em>|g; |
| 778 |
| |
$line =~ s{ |
| 779 |
(?:$bracket_name)) # [[likethis]], [[#comment]], [[Friend:remotelink]] |
((?:$bracket_name)) # [[likethis]], [[#comment]], [[Friend:remotelink]] |
| 780 |
|\[\[([^[]+?)]>>([0-9]+)] |
|\[\[([^[]+?)]>>([0-9]+)] # [[WikiName]>>1] |
| 781 |
|>>([0-9]+) |
|>>([0-9]+) |
| 782 |
! |
|<([A-Za-z0-9%]+:(?:(?!>).)+)> |
| 783 |
my ($l, $page,$anchor, $anum) = ($1, $3,$4, 0+$5); |
}{ |
| 784 |
|
my ($l, $page,$anchor, $anum, $uri) = ($1, $3,$4, 0+$5, $6); |
| 785 |
if ($l) { |
if ($l) { |
| 786 |
&make_link($l) |
&make_link($l) |
| 787 |
} elsif (defined $page) { |
} elsif (defined $page) { |
| 788 |
&make_wikilink ($page, anchor => 0+$anchor); |
&make_wikilink ($page, anchor => 0+$anchor); |
| 789 |
} elsif ($anum) { |
} elsif ($anum) { |
| 790 |
qq(<a href="#anchor-$anum" class="wiki-anchor">>>$anum</a>); |
qq(<a href="#anchor-$anum" class="wiki-anchor">>>$anum</a>); |
| 791 |
|
} elsif ($uri) { |
| 792 |
|
&make_urilink ($uri); |
| 793 |
} |
} |
| 794 |
!gex; |
}gex; |
| 795 |
return $line; |
return $line; |
| 796 |
} |
} |
| 797 |
|
|
| 810 |
} |
} |
| 811 |
} |
} |
| 812 |
|
|
| 813 |
|
sub make_urilink ($;%) { |
| 814 |
|
require URI; |
| 815 |
|
my $uri = shift; |
| 816 |
|
if ($uri =~ s/^IW://) { ## InterWiki (not URI) |
| 817 |
|
$uri = &unescape ($uri); |
| 818 |
|
if ($uri =~ /^([^\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+|"(?:\\.|[^"\\])+"):([^\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+|"(?:\\.|[^"\\])+")$/) { |
| 819 |
|
my ($site, $name) = ($1, $2); |
| 820 |
|
for ($site, $name) { |
| 821 |
|
if (s/^"//) { s/"$//; s/\\(.)/$1/g } |
| 822 |
|
} |
| 823 |
|
if ($interwiki{$site}) { |
| 824 |
|
my $uri = &escape ($fmt{interwiki}->replace ($interwiki{$site} => {site => $site, name => $name})); |
| 825 |
|
$site = &escape ($site); $name = &escape ($name); |
| 826 |
|
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>>); |
| 827 |
|
} else { |
| 828 |
|
qq(<未登録の <a href="$url_cgi?InterWikiName" class="wiki">InterWikiName</a>: @{[&escape ($site)]}>); |
| 829 |
|
} |
| 830 |
|
} else { |
| 831 |
|
qq(<不正な <a href="$url_cgi?InterWikiName" class="wiki">InterWikiName</a>: @{[&escape($uri)]}>); |
| 832 |
|
} |
| 833 |
|
} elsif ($uri =~ /^urn:/) { ## URN |
| 834 |
|
my $uri2 = &escape (URI->new ('/uri-res/N2L?'.&unescape ($uri), 'http')->canonical); |
| 835 |
|
qq(<<a href="$uri2" title="URI: <$uri> (via <$uri2>)" class="out-of-wiki urn">$uri</a>>); |
| 836 |
|
} elsif ($uri =~ s/^MAIL://) { ## mail address (not URI) |
| 837 |
|
my $uri2 = &escape (URI->new ('mailto:'.&unescape ($uri))->canonical); |
| 838 |
|
qq(<<a href="$uri2" class="out-of-wiki mail">$uri</a>>); |
| 839 |
|
} elsif ($uri =~ s/^IMG(?:\([^)]+\))?://) { ## image (not URI itself) |
| 840 |
|
my $uri2 = &escape (URI->new (&unescape ($uri))->canonical); |
| 841 |
|
qq(<img src="$uri2" alt="" title="URI: <$uri2>" class="out-of-wiki">); |
| 842 |
|
} else { ## misc. URI |
| 843 |
|
CGI::Carp::warningsToBrowser (0); |
| 844 |
|
my $uri2 = &escape (URI->new (&unescape ($uri))->canonical); |
| 845 |
|
CGI::Carp::warningsToBrowser (1); |
| 846 |
|
qq(<<a href="$uri2" title="URI: <$uri2>" class="out-of-wiki">$uri</a>>); |
| 847 |
|
} |
| 848 |
|
} |
| 849 |
|
|
| 850 |
|
my $FormIndex = 0; |
| 851 |
|
sub make_custom_form ($$$) { |
| 852 |
|
my ($wfname, $definition, $template, $option) = @_; |
| 853 |
|
## $template and $option is currently not used in this procedure. |
| 854 |
|
unless ($main::_EMBEDED) { |
| 855 |
|
$FormIndex++; |
| 856 |
|
if (length $definition) { |
| 857 |
|
my $param = bless {}, 'SuikaWiki::Plugin'; |
| 858 |
|
my $lastmodified = &get_info($form{mypage}, $info_LastModified); |
| 859 |
|
$definition =~ s/\\(.)/$1/g; |
| 860 |
|
$definition .= ' %submit;' if $definition !~ /%submit/; |
| 861 |
|
unless ($fmt{form_option}) { |
| 862 |
|
$fmt{form_option} = Message::Util::Formatter->new; |
| 863 |
|
for (@{$SuikaWiki::Plugin::List{wikiform_option}||[]}) { |
| 864 |
|
$_->load_formatter ($fmt{form_option}, type => 'wikiform_option'); |
| 865 |
|
} |
| 866 |
|
} |
| 867 |
|
$option = &unescape ($option); |
| 868 |
|
$option =~ s/\\(.)/$1/g; |
| 869 |
|
$fmt{form_option}->replace ($option, $param); |
| 870 |
|
my $target_form = $param->{output}->{id}; |
| 871 |
|
my $r = <<EOH; |
| 872 |
|
<form method="post" action="$url_cgi" id="wikiform-$FormIndex" class="wikiform"> |
| 873 |
|
<input type="hidden" name="mycmd" value="wikiform"> |
| 874 |
|
<input type="hidden" name="mypage" value="@{[&escape($form{mypage})]}"> |
| 875 |
|
<input type="hidden" name="myLastModified" value="$lastmodified"> |
| 876 |
|
<input type="hidden" name="mytouch" value="on"> |
| 877 |
|
<input type="hidden" name="@{[$target_form? qq(wikiform_targetform" value="@{[&escape($target_form)]}) : qq(wikiform_index" value="$FormIndex)]}"> |
| 878 |
|
EOH |
| 879 |
|
$r .= qq(<a name="wikiform-$FormIndex"></a>) if $UA =~ m#Mozilla/[12]\.#; |
| 880 |
|
$r .= $fmt{form_input}->replace (&unescape ($definition), $param); |
| 881 |
|
$r .= <<EOH; |
| 882 |
|
</form> |
| 883 |
|
EOH |
| 884 |
|
$r; |
| 885 |
|
} else { ## No input-interface WikiForm |
| 886 |
|
qq(<a id="wikiform-$FormIndex" name="wikiform-$FormIndex"><!-- #form --></a>); |
| 887 |
|
} |
| 888 |
|
} else { |
| 889 |
|
q(<ins class="wiki-error"><strong>Warning</strong>: form in embeded page is currently not supported.</ins>); |
| 890 |
|
} |
| 891 |
|
} |
| 892 |
|
|
| 893 |
|
## to be obsoleted |
| 894 |
sub make_link { |
sub make_link { |
| 895 |
my $chunk = shift; |
my $chunk = shift; |
| 896 |
# Walrus add (3) start |
# Walrus add (3) start |
| 897 |
$chunk =~ s/^<(.*)>$/$1/; |
$chunk =~ s/^<(.*)>$/$1/; |
| 898 |
my $name = $chunk; |
my $name = $chunk; |
|
if ($chunk =~ /^\[\[([^ ]+?) ([^ ]+?)\]\]$/ and $form{mypage} ne $InterWikiName) { |
|
|
($name, $chunk) = ($1, $2); |
|
|
} elsif ($chunk =~ /^mailto:(.*)$/) { |
|
|
$name = $1; |
|
|
} |
|
|
if ($use_autoimg and $name =~ /^(http|https|ftp):.+\.(png|gif|jpe?g)/) { |
|
|
$name = qq(<img src="$name">) ; |
|
|
} |
|
| 899 |
$name = &unarmor_name($name); |
$name = &unarmor_name($name); |
| 900 |
# Walrus add (3) end |
# Walrus add (3) end |
| 901 |
if ($chunk =~ /^(http|https|ftp|news):/) { |
if ($chunk =~ /^$embedded_name$/) { |
|
# Walrus mod (3) start |
|
|
# if ($use_autoimg and $chunk =~ /\.(gif|png|jpeg|jpg)$/) { |
|
|
# return qq(<a href="$chunk"><img src="$chunk"></a>); |
|
|
# } else { |
|
|
# return qq(<a href="$chunk">$chunk</a>); |
|
|
# } |
|
|
return qq(<<a href="$chunk">$name</a>>); |
|
|
# Walrus mod (3) end |
|
|
} elsif ($chunk =~ m#^urn:[0-9A-Za-z_:;/.-]+#) { |
|
|
return qq|<<a href="/uri-res/N2L?${name}">$name</a>>|; |
|
|
} elsif ($chunk =~ /^mailto:(.*)/) { |
|
|
# return qq(<a href="$chunk">$2</a>); # Walrus del (3) |
|
|
return qq(<<a href="$chunk">$name</a>>); # Walrus add (3) |
|
|
} elsif ($chunk =~ /^$interwiki_definition$/) { |
|
|
# return qq(<span class="InterWiki">$chunk</span>); # Walrus del (3) |
|
|
return qq(<span class="InterWiki">$name</span>); # Walrus add (3) |
|
|
} elsif ($chunk =~ /^$embedded_name$/) { |
|
| 902 |
return &embedded_to_html($chunk); |
return &embedded_to_html($chunk); |
| 903 |
} else { |
} else { |
| 904 |
$chunk = &unarmor_name($chunk); |
$chunk = &unarmor_name($chunk); |
| 905 |
$chunk = &unescape($chunk); # To treat '&' or '>' or '<' correctly. |
$chunk = &unescape($chunk); # To treat '&' or '>' or '<' correctly. |
| 906 |
my $cookedchunk = &encode($chunk); |
my $cookedchunk = &encode($chunk); |
| 907 |
if ($chunk =~ /^$interwiki_name$/) { |
if ($database{$chunk}) { |
|
my ($intername, $localname) = ($1, $2); |
|
|
my $remoteurl = $interwiki{$intername}; |
|
|
if ($remoteurl) { |
|
|
# $remoteurl =~ s/\b(euc|sjis|ykwk|asis)\(\$1\)/&interwiki_convert($1, $localname)/e; # Walrus del (4) |
|
|
$remoteurl =~ s/\b(euc|sjis|ykwk|asis|isbn)\(\$1\)/&interwiki_convert($1, $localname)/e; # Walrus add (4) |
|
|
# return qq(<a href="$remoteurl">$chunk</a>); # Walrus del (3) |
|
|
return qq(<a href="$remoteurl">@{[&escape($name)]}</a>); # Walrus add (3) |
|
|
} else { |
|
|
# return $chunk; # Walrus del (3) |
|
|
return &escape($name); # Walrus add (3) |
|
|
} |
|
|
} elsif ($database{$chunk}) { |
|
| 908 |
my $subject = &escape(&get_subjectline($chunk, delimiter => '')); |
my $subject = &escape(&get_subjectline($chunk, delimiter => '')); |
| 909 |
# return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$chunk</a>); # Walrus del (3) |
# return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$chunk</a>); # Walrus del (3) |
| 910 |
return qq(<a title="$subject" href="$url_cgi?$cookedchunk" class="wiki">@{[&escape($name)]}</a>); # Walrus add (3) |
return qq(<a title="$subject" href="$url_cgi?$cookedchunk" class="wiki">@{[&escape($name)]}</a>); # Walrus add (3) |
| 931 |
if (param()) { |
if (param()) { |
| 932 |
foreach my $var (param()) { |
foreach my $var (param()) { |
| 933 |
$form{$var} = param($var); |
$form{$var} = param($var); |
| 934 |
} |
} |
|
} else { |
|
|
$ENV{QUERY_STRING} = $FrontPage; |
|
| 935 |
} |
} |
| 936 |
|
$form{mypage} = &code_convert(\$form{mypage}, $kanjicode); |
| 937 |
my $query = &decode($ENV{QUERY_STRING}); |
if ($main::ENV{QUERY_STRING} && $main::ENV{QUERY_STRING} !~ /[&;=]/) { |
| 938 |
if ($page_command{$query}) { |
my $query = &decode($main::ENV{QUERY_STRING}); |
| 939 |
|
$query = &code_convert(\$query, $kanjicode); |
| 940 |
|
if ($page_command{$query}) { |
| 941 |
$form{mycmd} = $page_command{$query}; |
$form{mycmd} = $page_command{$query}; |
| 942 |
$form{mypage} = $query; |
$form{mypage} = $query; |
| 943 |
} elsif ($query =~ /^($wiki_name)$/) { |
} else { |
|
$form{mycmd} = 'read'; |
|
|
$form{mypage} = $1; |
|
|
} elsif ($database{$query}) { |
|
|
$form{mycmd} = 'read'; |
|
| 944 |
$form{mypage} = $query; |
$form{mypage} = $query; |
| 945 |
|
$form{mycmd} = $database{$form{mypage}} ? 'read' : 'edit'; |
| 946 |
|
} |
| 947 |
} |
} |
| 948 |
|
$form{mypage} ||= 'HomePage'; |
| 949 |
|
$form{mycmd} ||= 'read'; |
| 950 |
|
|
| 951 |
# mypreview_edit -> do_edit, with preview. |
# mypreview_edit -> do_edit, with preview. |
| 952 |
# mypreview_adminedit -> do_adminedit, with preview. |
# mypreview_adminedit -> do_adminedit, with preview. |
| 958 |
} |
} |
| 959 |
} |
} |
| 960 |
|
|
| 961 |
# |
# |
| 962 |
# $form{mycmd} is frozen here. |
# $form{mycmd} is frozen here. |
| 963 |
# |
# |
| 964 |
|
|
| 965 |
|
for (grep /^wikiform__/, keys %form) { |
| 966 |
|
$form{$_} = &code_convert (\$form{$_}, $kanjicode); |
| 967 |
|
} |
| 968 |
$form{mymsg} = &code_convert(\$form{mymsg}, $kanjicode); |
$form{mymsg} = &code_convert(\$form{mymsg}, $kanjicode); |
| 969 |
$form{myname} = &code_convert(\$form{myname}, $kanjicode); |
$form{myname} = &code_convert(\$form{myname}, $kanjicode); |
| 970 |
} |
} |
| 972 |
sub update_recent_changes { |
sub update_recent_changes { |
| 973 |
my $update = "- @{[&get_now]} [[@{[&escape($form{mypage})]}]] @{[&get_subjectline($form{mypage})]}"; |
my $update = "- @{[&get_now]} [[@{[&escape($form{mypage})]}]] @{[&get_subjectline($form{mypage})]}"; |
| 974 |
my @oldupdates = split(/\r?\n/, $database{$RecentChanges}); |
my @oldupdates = split(/\r?\n/, $database{$RecentChanges}); |
| 975 |
|
shift (@oldupdates); ## '#?' magic line |
| 976 |
my @updates; |
my @updates; |
| 977 |
foreach (@oldupdates) { |
foreach (@oldupdates) { |
| 978 |
/^\- \d\d\d\d\-\d\d\-\d\d \([^)]+\) \d\d:\d\d \[\[(\S+?)\]\]/; |
/^\- \d\d\d\d\-\d\d\-\d\d \([^)]+\) \d\d:\d\d \[\[(\S+?)\]\]/; |
| 985 |
unshift @updates, $update; |
unshift @updates, $update; |
| 986 |
} |
} |
| 987 |
splice(@updates, $maxrecent + 1); |
splice(@updates, $maxrecent + 1); |
| 988 |
$database{$RecentChanges} = join("\n", @updates); |
$database{$RecentChanges} = "#?SuikaWiki/0.9\n" . join("\n", @updates); |
| 989 |
if ($file_touch) { |
if ($file_touch) { |
| 990 |
open(FILE, "> $file_touch"); |
open(FILE, "> $file_touch"); |
| 991 |
print FILE localtime() . "\n"; |
print FILE localtime() . "\n"; |
| 1089 |
my ($word) = @_; |
my ($word) = @_; |
| 1090 |
print <<"EOD"; |
print <<"EOD"; |
| 1091 |
<form action="$url_cgi" method="get"> |
<form action="$url_cgi" method="get"> |
| 1092 |
<input type="hidden" name="mycmd" value="search"> |
<input type="hidden" name="mycmd" value="read"> |
| 1093 |
<input type="text" name="mymsg" value="$word" size="20"> |
<input type="text" name="mypage" value="$word" size="20"> |
| 1094 |
<input type="submit" value="$resource{searchbutton}"> |
<input type="submit" value="$resource{searchbutton}"> |
| 1095 |
</form> |
</form> |
| 1096 |
EOD |
EOD |
| 1123 |
|
|
| 1124 |
print <<"EOD"; |
print <<"EOD"; |
| 1125 |
<form action="$url_cgi" method="post"> |
<form action="$url_cgi" method="post"> |
| 1126 |
|
<h2>$escapedmypageの編集</h2> |
| 1127 |
@{[ $mode{admin} ? qq($resource{frozenpassword} <input type="password" name="mypassword" value="$escapedmypassword" size="10"><br>) : "" ]} |
@{[ $mode{admin} ? qq($resource{frozenpassword} <input type="password" name="mypassword" value="$escapedmypassword" size="10"><br>) : "" ]} |
| 1128 |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
| 1129 |
<input type="hidden" name="mypage" value="$escapedmypage"> |
<input type="hidden" name="mypage" value="$escapedmypage"> |
| 1140 |
qq( |
qq( |
| 1141 |
<input type="checkbox" name="mytouch" value="on" checked="checked">$resource{touch}<br> |
<input type="checkbox" name="mytouch" value="on" checked="checked">$resource{touch}<br> |
| 1142 |
<input type="submit" name="mypreview_$edit" value="$resource{previewbutton}"> |
<input type="submit" name="mypreview_$edit" value="$resource{previewbutton}"> |
| 1143 |
<input type="submit" name="mypreview_write" value="$resource{savebutton}" accesskey="S"><kbd>S</kbd><br> |
<input type="submit" name="mypreview_write" value="$resource{savebutton}" accesskey="S"><kbd>S</kbd> |
| 1144 |
|
[@{[do {my $n = 0; |
| 1145 |
|
$mymsg =~ s/(?:-+\s)?\[([0-9]+)\]/$n = $1 if $1 > $n; $&/mge; |
| 1146 |
|
++$n}]}]<br> |
| 1147 |
) |
) |
| 1148 |
]} |
]} |
| 1149 |
</form> |
</form> |
| 1150 |
EOD |
EOD |
| 1151 |
unless ($mode{conflict}) { |
unless ($mode{conflict}) { |
| 1152 |
# Show the format rule. |
# Show the format rule. |
| 1153 |
open(FILE, $file_format) or &print_error("($file_format)"); |
my $help = $database{'WikiEditHelp'}; |
| 1154 |
my $content = join('', <FILE>); |
$help =~ s!^\#\?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.\x0D\x0A][^\x0D\x0A]*)?)[\x0D\x0A]+!!s; |
| 1155 |
&code_convert(\$content, $kanjicode); |
print &text_to_html ($help, toc => 0); |
| 1156 |
close(FILE); |
# open(FILE, $file_format) or &print_error("($file_format)"); |
| 1157 |
print &text_to_html($content, toc=>0); |
# my $content = join('', <FILE>); |
| 1158 |
|
# &code_convert(\$content, $kanjicode); |
| 1159 |
|
# close(FILE); |
| 1160 |
|
# print &text_to_html($content, toc=>0); |
| 1161 |
} |
} |
| 1162 |
} |
} |
| 1163 |
|
|
| 1175 |
|
|
| 1176 |
sub is_editable { |
sub is_editable { |
| 1177 |
my ($page) = @_; |
my ($page) = @_; |
| 1178 |
if (&is_bracket_name($page)) { |
if ($fixedpage{$page} || $page =~ /\s/ || $page =~ /^\#/) { |
|
return 0; |
|
|
} elsif ($fixedpage{$page}) { |
|
|
return 0; |
|
|
} elsif ($page =~ /\s/) { |
|
|
return 0; |
|
|
} elsif ($page =~ /^\#/) { |
|
|
return 0; |
|
|
} elsif ($page =~ /^$interwiki_name$/) { |
|
| 1179 |
return 0; |
return 0; |
| 1180 |
} else { |
} else { |
| 1181 |
return 1; |
return 1; |
| 1185 |
# armor_name: |
# armor_name: |
| 1186 |
# WikiName -> WikiName |
# WikiName -> WikiName |
| 1187 |
# not_wiki_name -> [[not_wiki_name]] |
# not_wiki_name -> [[not_wiki_name]] |
| 1188 |
sub armor_name { |
sub armor_name { qq([[$_[0]]]) } |
|
my ($name) = @_; |
|
|
#if ($name =~ /^$wiki_name$/) { |
|
|
# return $name; |
|
|
#} else { |
|
|
return "[[$name]]"; |
|
|
#} |
|
|
} |
|
| 1189 |
|
|
| 1190 |
# unarmor_name: |
# unarmor_name: |
| 1191 |
# [[bracket_name]] -> bracket_name |
# [[bracket_name]] -> bracket_name |
| 1199 |
} |
} |
| 1200 |
} |
} |
| 1201 |
|
|
|
sub is_bracket_name { |
|
|
my ($name) = @_; |
|
|
if ($name =~ /^$bracket_name$/) { |
|
|
return 1; |
|
|
} else { |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
| 1202 |
sub decode { |
sub decode { |
| 1203 |
my ($s) = @_; |
my ($s) = @_; |
| 1204 |
$s =~ tr/+/ /; |
$s =~ tr/+/ /; |
| 1261 |
return "$year-$mon-$day ($weekday) $hour:$min"; |
return "$year-$mon-$day ($weekday) $hour:$min"; |
| 1262 |
} |
} |
| 1263 |
|
|
|
# [[YukiWiki http://www.hyuki.com/yukiwiki/wiki.cgi?euc($1)]] |
|
| 1264 |
sub init_InterWikiName { |
sub init_InterWikiName { |
| 1265 |
my $content = $database{$InterWikiName}; |
my @content = split /\n/, $database{$InterWikiName}; |
| 1266 |
while ($content =~ /\[\[(\S+) +(\S+)\]\]/g) { |
for (@content) { |
| 1267 |
my ($name, $url) = ($1, $2); |
if (/^([^#]\S*)\s+(\S[^\x0A\x0D]+)/) { |
| 1268 |
$interwiki{$name} = $url; |
$interwiki{$1} = $2; |
| 1269 |
} |
} |
| 1270 |
|
} |
| 1271 |
|
require Message::Util::Formatter; |
| 1272 |
|
$fmt{interwiki} = Message::Util::Formatter->new; |
| 1273 |
|
$fmt{interwiki}->{encoded} = sub { |
| 1274 |
|
my ($o, $p) = @_; |
| 1275 |
|
if ($o->{except}) { |
| 1276 |
|
$o->{except} =~ tr/\x00-\x20\x22\x23%\x2D<>^[\x5C]`{|}\x7F-\xFF//d; |
| 1277 |
|
} |
| 1278 |
|
my $s = &code_convert (\$p->{name}, $o->{charset} || 'iso-2022-7bit'); |
| 1279 |
|
$s =~ s/([^$o->{except}A-Za-z0-9_-])/sprintf '%%%02X', unpack 'C', $1/ge; |
| 1280 |
|
$s; |
| 1281 |
|
}; |
| 1282 |
|
$fmt{interwiki}->{ykwk} = sub { ## YukiWiki1 |
| 1283 |
|
my ($o, $p) = @_; |
| 1284 |
|
my $s = $p->{name}; |
| 1285 |
|
$s = qq([[$s]]) if $s !~ /^[A-Z][a-z]+(?:[A-Z][a-z]+)+$/; |
| 1286 |
|
&encode (&code_convert (\$p->{name}, $o->{charset} || 'shift_jis')); |
| 1287 |
|
}; |
| 1288 |
|
|
| 1289 |
|
$fmt{form_input} = Message::Util::Formatter->new; |
| 1290 |
|
for (@{$SuikaWiki::Plugin::List{wikiform_input}||[]}) { |
| 1291 |
|
$_->load_formatter ($fmt{form_input}, type => 'wikiform_input'); |
| 1292 |
|
} |
| 1293 |
} |
} |
| 1294 |
|
|
|
sub interwiki_convert { |
|
|
my ($type, $localname) = @_; |
|
|
if ($type eq 'sjis' or $type eq 'euc') { |
|
|
&code_convert(\$localname, $type); |
|
|
return &encode($localname); |
|
|
} elsif ($type eq 'ykwk') { |
|
|
# for YukiWiki1 |
|
|
if ($localname =~ /^$wiki_name$/) { |
|
|
return $localname; |
|
|
} else { |
|
|
&code_convert(\$localname, 'sjis'); |
|
|
return &encode("[[" . $localname . "]]"); |
|
|
} |
|
|
} elsif ($type eq 'asis') { |
|
|
return $localname; |
|
|
# Walrus add (4) start |
|
|
} elsif ($type eq 'isbn') { |
|
|
$localname = join('', ($localname =~ /[0-9x]/g)) if ($localname =~ /^(\d-?){9}[\dx]$/); |
|
|
return $localname; |
|
|
# Walrus add (4) end |
|
|
} else { |
|
|
return $localname; |
|
|
} |
|
|
} |
|
| 1295 |
|
|
| 1296 |
sub get_info { |
sub get_info { |
| 1297 |
my ($page, $key) = @_; |
my ($page, $key) = @_; |
| 1346 |
|
|
| 1347 |
sub do_comment { |
sub do_comment { |
| 1348 |
my ($content) = $database{$form{mypage}}; |
my ($content) = $database{$form{mypage}}; |
| 1349 |
my $datestr = &get_now; |
my $default_name; ## this code does not strict. |
| 1350 |
my $namestr = $form{myname} || $DEFAULT_embed_comment_name; |
$default_name = $1 if $content =~ /default-name="([^"]+)"/; |
| 1351 |
|
my $datestr = '[WEAK['.&get_now.']]'; |
| 1352 |
|
my $namestr = $form{myname} || $default_name || $DEFAULT_embed_comment_name; |
| 1353 |
|
($namestr = '', $datestr = '') if $form{myname} eq 'nodate'; |
| 1354 |
if ($namestr =~ /^(?:>>)?[0-9]/) { |
if ($namestr =~ /^(?:>>)?[0-9]/) { |
| 1355 |
$namestr = qq( ''$namestr'': ); |
$namestr = qq( ''$namestr'': ); |
| 1356 |
} else { |
} elsif (length $namestr) { |
| 1357 |
$namestr = qq( ''[[$namestr]]'': ); |
$namestr = qq( ''[[$namestr]]'': ); |
| 1358 |
} |
} |
| 1359 |
my $anchor = 0; |
my $anchor = &get_new_anchor_index ($content); |
|
$content =~ s/(?:-+\s)?\[([0-9]+)\]/$anchor = $1 if $1 > $anchor; $&/mge; |
|
|
$anchor++; |
|
| 1360 |
my $i = 1; my $o = 0; |
my $i = 1; my $o = 0; |
| 1361 |
$content =~ s{(\Q$embed_comment\E|\Q$embed_rcomment\E)}{ |
$content =~ s{(\Q$embed_comment\E|\Q$embed_rcomment\E)}{ |
| 1362 |
my $embed = $1; |
my $embed = $1; |
| 1370 |
$i++; $embed; |
$i++; $embed; |
| 1371 |
}ge; |
}ge; |
| 1372 |
unless ($o) { |
unless ($o) { |
| 1373 |
|
$content = "#?SuikaWiki/0.9\n\n" unless $content; |
| 1374 |
|
$content .= "\n" unless $content =~ /\n$/s; |
| 1375 |
$content .= "- [$anchor] $datestr$namestr$form{mymsg}\n"; |
$content .= "- [$anchor] $datestr$namestr$form{mymsg}\n"; |
| 1376 |
} |
} |
| 1377 |
$form{__comment_anchor_index} = $anchor; |
$form{__comment_anchor_index} = $anchor; |
| 1378 |
if ($form{mymsg}) { |
if ($form{mymsg} || $form{myname}) { |
| 1379 |
$form{mymsg} = $content; |
$form{mymsg} = $content; |
| 1380 |
$form{mytouch} = 'on'; |
$form{mytouch} = 'on'; |
| 1381 |
&do_write; |
&do_write; |
| 1385 |
} |
} |
| 1386 |
} |
} |
| 1387 |
|
|
| 1388 |
|
sub get_new_anchor_index ($) { |
| 1389 |
|
my $content = shift; |
| 1390 |
|
my $anchor = 0; |
| 1391 |
|
$content =~ s/^(?:[-=]+\s*)?\[([0-9]+)\]/$anchor = $1 if $1 > $anchor; $&/mge; |
| 1392 |
|
$anchor + 1; |
| 1393 |
|
} |
| 1394 |
|
|
| 1395 |
my $CommentIndex = 0; |
my $CommentIndex = 0; |
| 1396 |
sub embedded_to_html { |
sub embedded_to_html { |
| 1397 |
my ($embedded) = @_; |
my ($embedded) = @_; |
| 1399 |
unless ($main::_EMBEDED) { |
unless ($main::_EMBEDED) { |
| 1400 |
my $lastmodified = &get_info($form{mypage}, $info_LastModified); |
my $lastmodified = &get_info($form{mypage}, $info_LastModified); |
| 1401 |
return <<"EOD"; |
return <<"EOD"; |
| 1402 |
<form action="$url_cgi" method="post" id="x-comment-@{[++$CommentIndex]}"> |
<form action="$url_cgi" method="post" id="x-comment-@{[++$CommentIndex]}" class="comment"><p> |
| 1403 |
<input type="hidden" name="mycmd" value="comment"> |
<input type="hidden" name="mycmd" value="comment"> |
| 1404 |
<input type="hidden" name="mypage" value="$form{mypage}"> |
<input type="hidden" name="mypage" value="$form{mypage}"> |
| 1405 |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
| 1406 |
<input type="hidden" name="mytouch" value="on"> |
<input type="hidden" name="mytouch" value="on"> |
| 1407 |
<input type="hidden" name="comment_index" value="$CommentIndex"> |
<input type="hidden" name="comment_index" value="$CommentIndex"> |
| 1408 |
$embed_comment_Name_Prompt |
$embed_comment_Name_Prompt |
| 1409 |
<input type="text" name="myname" value="" size="10"> |
<input type="text" name="myname" value="" size="10" class="comment-name"> |
| 1410 |
<input type="text" name="mymsg" value="" size="60"> |
<input type="text" name="mymsg" value="" size="60" class="comment-msg"> |
| 1411 |
<input type="submit" value="$resource{commentbutton}"> |
<input type="submit" value="$resource{commentbutton}" class="comment-submit"> |
| 1412 |
</form> |
</p></form> |
| 1413 |
EOD |
EOD |
| 1414 |
} else { |
} else { |
| 1415 |
return <<"EOD"; |
return <<"EOD"; |
| 1424 |
EOD |
EOD |
| 1425 |
} |
} |
| 1426 |
} elsif ($embedded =~ /$embed_command{searched}/) { |
} elsif ($embedded =~ /$embed_command{searched}/) { |
| 1427 |
return get_search_result ($1); |
return get_search_result ($1, -match_myself => 1); |
| 1428 |
# Walrus add (5) start |
# Walrus add (5) start |
| 1429 |
} elsif ($embedded =~ /$embed_interwiki/ and my $remoteurl = $interwiki{$2}) { |
} elsif ($embedded =~ /$embed_interwiki/ and my $remoteurl = $interwiki{$2}) { |
| 1430 |
$_ = &make_interwiki_box($1, $2); |
$_ = &make_interwiki_box($1, $2); |
| 1442 |
} elsif (length $content) { |
} elsif (length $content) { |
| 1443 |
$r = "<pre>@{[&escape ($content)]}</pre>"; |
$r = "<pre>@{[&escape ($content)]}</pre>"; |
| 1444 |
} else { |
} else { |
| 1445 |
$r = &text_to_html ("[[$name]]", content_format => 'SuikaWiki/0.9'); |
$r = &text_to_html ("[INS[\n埋め込まれている [[$name]] はまだ書かれていません。\n]INS]\n", content_format => 'SuikaWiki/0.9'); |
| 1446 |
} |
} |
| 1447 |
} else { ## nested #EMBED |
} else { ## nested #EMBED |
| 1448 |
$r = &text_to_html ("[INS[\n[[$name]] の埋め込みは (入り組んでいるので) 解決されませんでした。\n]INS]\n", content_format => 'SuikaWiki/0.9'); |
$r = &text_to_html ("[INS[\n[[$name]] の埋め込みは (入り組んでいるので) 解決されませんでした。\n]INS]\n", content_format => 'SuikaWiki/0.9'); |
| 1449 |
} |
} |
| 1450 |
return qq(<blockquote title="@{[&escape($name)]}">$r</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>); |
| 1451 |
} elsif ($embedded =~ /^\[\[\#randomlink:(.+)\]\]$/) { |
} elsif ($embedded =~ /^\[\[\#randomlink:(.+)\]\]$/) { |
| 1452 |
return qq(<a href="$url_cgi?mycmd=RandomJump;x-param=@{[time.[0..9]->[rand 10]]}" class="wiki randomlink">$1</a>); |
return qq(<a href="$url_cgi?mycmd=RandomJump;x-param=@{[time.[0..9]->[rand 10]]}" class="wiki randomlink">$1</a>); |
| 1453 |
} else { |
} else { |
| 1455 |
} |
} |
| 1456 |
} |
} |
| 1457 |
|
|
| 1458 |
|
sub do_wikiform { |
| 1459 |
|
my $content = $database{$form{mypage}}; |
| 1460 |
|
my $anchor = &get_new_anchor_index ($content); |
| 1461 |
|
for my $t (qw/form_template form_option/) { |
| 1462 |
|
unless ($fmt{$t}) { |
| 1463 |
|
$fmt{$t} = Message::Util::Formatter->new; |
| 1464 |
|
for (@{$SuikaWiki::Plugin::List{'wiki'.$t}||[]}) { |
| 1465 |
|
$_->load_formatter ($fmt{$t}, type => 'wiki'.$t); |
| 1466 |
|
} |
| 1467 |
|
} |
| 1468 |
|
} |
| 1469 |
|
my $write = 0; |
| 1470 |
|
my $i = 1; |
| 1471 |
|
$content =~ s{$embed_command{form}}{ |
| 1472 |
|
my ($embed, $wfname, $template, $option) = ($&, $1, $3, $4); |
| 1473 |
|
if (($wfname && $wfname eq $form{wikiform_targetform}) |
| 1474 |
|
|| $i == $form{wikiform_index}) { |
| 1475 |
|
$template =~ s/\\(.)/$1/g; |
| 1476 |
|
$option =~ s/\\(.)/$1/g; |
| 1477 |
|
my $param = bless {}, 'SuikaWiki::Plugin'; |
| 1478 |
|
$param->{page} = $form{mypage}; |
| 1479 |
|
$param->{form_index} = $i; |
| 1480 |
|
$param->{form_name} = $wfname; |
| 1481 |
|
$param->{anchor_index} = $anchor; |
| 1482 |
|
$param->{argv} = \%form; |
| 1483 |
|
$param->{default_name} = $1 if $content =~ /default-name="([^"]+)"/; |
| 1484 |
|
$param->{default_name} ||= $DEFAULT_embed_comment_name; |
| 1485 |
|
$fmt{form_option}->replace ($option, $param); |
| 1486 |
|
my $t = 1; |
| 1487 |
|
for (@{$param->{require}||[]}) { |
| 1488 |
|
(undef $t, last) unless length $param->{argv}->{'wikiform__'.$_}; |
| 1489 |
|
} |
| 1490 |
|
$t = $fmt{form_template}->replace ($template, $param) if $t; |
| 1491 |
|
if (length $t) { |
| 1492 |
|
if ($param->{output}->{reverse}) { |
| 1493 |
|
$embed .= "\n" . $t; |
| 1494 |
|
} else { |
| 1495 |
|
$embed = $t . "\n" . $embed; |
| 1496 |
|
} |
| 1497 |
|
$write = 1; |
| 1498 |
|
$form{__comment_anchor_index} = $anchor |
| 1499 |
|
if $param->{anchor_index_}; ## $anchor is used! |
| 1500 |
|
} |
| 1501 |
|
$form{__wikiform_anchor_index} = $i; |
| 1502 |
|
undef $form{wikiform_targetform}; ## make sure never to match |
| 1503 |
|
undef $form{wikiform_index}; ## with WikiForm in rest of page |
| 1504 |
|
} |
| 1505 |
|
$i++; $embed; |
| 1506 |
|
}ge; |
| 1507 |
|
unless ($write) { |
| 1508 |
|
#$content = "#?SuikaWiki/0.9\n\n" unless $content; |
| 1509 |
|
#$content .= "\n" unless $content =~ /\n$/s; |
| 1510 |
|
# |
| 1511 |
|
} |
| 1512 |
|
if ($write) { |
| 1513 |
|
$form{mymsg} = $content; |
| 1514 |
|
$form{mytouch} = 'on'; |
| 1515 |
|
&do_write; |
| 1516 |
|
} else { |
| 1517 |
|
$form{mycmd} = 'read'; |
| 1518 |
|
&do_read; |
| 1519 |
|
} |
| 1520 |
|
} |
| 1521 |
|
|
| 1522 |
|
|
| 1523 |
# Walrus add (5) start |
# Walrus add (5) start |
| 1524 |
sub do_interwiki_box { |
sub do_interwiki_box { |
| 1525 |
my $remoteurl = $interwiki{$form{'myintername'}}; |
my $remoteurl = $interwiki{$form{'myintername'}}; |
| 1557 |
|
|
| 1558 |
sub code_convert { |
sub code_convert { |
| 1559 |
my ($contentref, $code) = (shift, shift || $kanjicode); |
my ($contentref, $code) = (shift, shift || $kanjicode); |
| 1560 |
# &Jcode::convert($contentref, $code); # for Jcode.pm |
$code = 'jis' if $code =~ /iso/; |
| 1561 |
&jcode::convert($contentref, $code); # for jcode.pl |
$code = 'euc' if $code =~ /euc/; |
| 1562 |
|
$code = 'sjis' if $code =~ /shift/; |
| 1563 |
|
$code = 'utf8' if $code =~ /utf/; |
| 1564 |
|
&Jcode::convert($contentref, $code); # for Jcode.pm |
| 1565 |
|
# &jcode::convert($contentref, $code); # for jcode.pl |
| 1566 |
|
&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'; |
| 1567 |
return $$contentref; |
return $$contentref; |
| 1568 |
} |
} |
| 1569 |
|
|
| 1703 |
} |
} |
| 1704 |
|
|
| 1705 |
sub __get_database ($) { $database{ $_[0] } } |
sub __get_database ($) { $database{ $_[0] } } |
| 1706 |
|
sub __set_database ($$) { $database{ $_[0] } = $_[1] } |
| 1707 |
|
|
| 1708 |
package wiki::referer; |
package wiki::referer; |
| 1709 |
sub add ($$) { |
sub add ($$) { |
| 1785 |
main::code_convert (\$s); |
main::code_convert (\$s); |
| 1786 |
} |
} |
| 1787 |
|
|
| 1788 |
|
package wiki::useragent; |
| 1789 |
|
|
| 1790 |
|
sub add ($) { |
| 1791 |
|
my $s = shift; |
| 1792 |
|
return unless length $s; |
| 1793 |
|
$s =~ s/([\x00-\x08\x0A-\x1F\x25\x7F-\xFF])/sprintf '%%%02X', unpack 'C', $1/g; |
| 1794 |
|
my %ua; |
| 1795 |
|
for (split /\n/, &main::__get_database('WikiUserAgentList')) { |
| 1796 |
|
if (/^-\[(\d+)\] (.+)$/) { |
| 1797 |
|
my ($t, $n) = ($1, $2); |
| 1798 |
|
$n =~ tr/\x0A\x0D//d; |
| 1799 |
|
$ua{$n} = $t; |
| 1800 |
|
} |
| 1801 |
|
} |
| 1802 |
|
$ua{$s}++; |
| 1803 |
|
my $s = qq(#?SuikaWiki/0.9\n); |
| 1804 |
|
for (sort {$ua{$a} <=> $ua{$b}} keys %ua) { |
| 1805 |
|
$s .= sprintf qq(-[%d] %s\n), $ua{$_}, $_; |
| 1806 |
|
} |
| 1807 |
|
&main::__set_database ('WikiUserAgentList' => $s); |
| 1808 |
|
} |
| 1809 |
|
|
| 1810 |
|
package SuikaWiki::Plugin; |
| 1811 |
|
our %List; |
| 1812 |
|
|
| 1813 |
|
sub escape ($$) { main::escape ($_[1]) } |
| 1814 |
|
sub unescape ($$) { main::unescape ($_[1]) } |
| 1815 |
|
sub encode ($$) { main::encode ($_[1]) } |
| 1816 |
|
sub decode ($$) { main::decode ($_[1]) } |
| 1817 |
|
sub __get_datetime ($) { main::get_now () } |
| 1818 |
|
|
| 1819 |
|
sub regist ($@) { |
| 1820 |
|
my $pack = shift; |
| 1821 |
|
for (@_) { |
| 1822 |
|
push @{$List{$_}}, $pack; |
| 1823 |
|
} |
| 1824 |
|
} |
| 1825 |
|
|
| 1826 |
|
use SuikaWiki::Plugin::WikiFormBasic; |
| 1827 |
|
|
| 1828 |
1; |
1; |
| 1829 |
__END__ |
__END__ |
| 1830 |
=head1 NAME |
=head1 NAME |