| 220 |
my $content = $database{$form{mypage}}; |
my $content = $database{$form{mypage}}; |
| 221 |
if ($content =~ m#^\s*/\*\s*W3C-CSS#) { |
if ($content =~ m#^\s*/\*\s*W3C-CSS#) { |
| 222 |
my $lm = &get_info($form{mypage}, $info_LastModified); |
my $lm = &get_info($form{mypage}, $info_LastModified); |
| 223 |
|
print scalar make_navigate_links ($form{mypage}); |
| 224 |
print "Content-Type: text/css; charset=$charset\n"; |
print "Content-Type: text/css; charset=$charset\n"; |
| 225 |
print "Last-Modified: $lm\n"; |
print "Last-Modified: $lm\n"; |
| 226 |
print "\n"; |
print "\n"; |
| 235 |
|
|
| 236 |
sub id_and_name ($) { |
sub id_and_name ($) { |
| 237 |
my $name = shift; |
my $name = shift; |
| 238 |
if ($UA =~ m#Mozilla/[12]\.#) { |
if ($UA =~ m#Mozilla/[12]\.|Microsoft Internet Explorer#) { |
| 239 |
qq{id="$name"><a name="$name"></a}; |
qq{id="$name"><a name="$name"></a}; |
| 240 |
} else { |
} else { |
| 241 |
qq{id="$name"}; |
qq{id="$name"}; |
| 358 |
&update_recent_changes; |
&update_recent_changes; |
| 359 |
} |
} |
| 360 |
&set_info($form{mypage}, $info_IsFrozen, 0 + $form{myfrozen}); |
&set_info($form{mypage}, $info_IsFrozen, 0 + $form{myfrozen}); |
| 361 |
my $fragment; |
my $fragment = ''; |
| 362 |
|
$fragment .= qq(;after_edit_cmd=@{[&encode($form{after_edit_cmd})]}) if $form{after_edit_cmd}; |
| 363 |
if ($form{__comment_anchor_index}) { |
if ($form{__comment_anchor_index}) { |
| 364 |
$fragment = qq(anchor-$form{__comment_anchor_index}); |
$fragment .= qq(#anchor-$form{__comment_anchor_index}); |
| 365 |
} elsif ($form{__wikiform_anchor_index}) { |
} elsif ($form{__wikiform_anchor_index}) { |
| 366 |
$fragment = qq(wikiform-$form{__wikiform_anchor_index}); |
$fragment .= qq(#wikiform-$form{__wikiform_anchor_index}); |
| 367 |
} |
} |
| 368 |
&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)); |
| 369 |
&print_message($resource{saved}); |
&print_message($resource{saved}); |
| 370 |
&print_content("$resource{continuereading} @{[&armor_name($form{mypage})]}"); |
&print_content("$resource{continuereading} @{[&armor_name($form{mypage})]}"); |
| 371 |
&print_footer($CompletedSuccessfully); |
&print_footer($CompletedSuccessfully); |
| 471 |
} |
} |
| 472 |
$bodyclass .= " wiki-page-obsoleted" if $option{-content_format} =~ /obsoleted="yes"/; |
$bodyclass .= " wiki-page-obsoleted" if $option{-content_format} =~ /obsoleted="yes"/; |
| 473 |
if ($option{-goto}) { |
if ($option{-goto}) { |
| 474 |
if ($UA =~ m#Mozilla/[12]\.|Opera#) { |
if ($UA =~ m#Opera|MSIE 2\.#) { |
| 475 |
$option{-goto} =~ tr/;/&/; |
$option{-goto} =~ tr/;/&/ if $UA =~ m#Opera#; |
| 476 |
print qq{Refresh: 0; url=$option{-goto}\n}; |
print qq{Refresh: 0; url=$option{-goto}\n}; |
| 477 |
$option{-goto} = qq(<meta http-equiv="refresh" content="0; url=$option{-goto}">); |
$option{-goto} = qq(<meta http-equiv="refresh" content="0; url=$option{-goto}">); |
| 478 |
} else { |
} else { |
| 479 |
|
$option{-goto} =~ tr/;/&/ if $UA =~ m#Mozilla/[1-4]\.#; |
| 480 |
print qq{Refresh: 0; url="$option{-goto}"\n}; |
print qq{Refresh: 0; url="$option{-goto}"\n}; |
| 481 |
$option{-goto} = qq(<meta http-equiv="refresh" content="0; url="@{[&escape($option{-goto})]}"">); |
$option{-goto} = qq(<meta http-equiv="refresh" content="0; url="@{[&escape($option{-goto})]}"">); |
| 482 |
} |
} |
| 487 |
$meta_ct = qq{text/html; charset=@{[&x_charset($charset)]}}; |
$meta_ct = qq{text/html; charset=@{[&x_charset($charset)]}}; |
| 488 |
print qq{Content-Type: $meta_ct\n}; |
print qq{Content-Type: $meta_ct\n}; |
| 489 |
$meta_ct = qq{<meta http-equiv="content-type" content="$meta_ct">}; |
$meta_ct = qq{<meta http-equiv="content-type" content="$meta_ct">}; |
| 490 |
|
} elsif ($UA =~ m#Infomosaic#) { |
| 491 |
|
print qq{Content-Type: text/html\n}; |
| 492 |
} else { |
} else { |
| 493 |
print qq{Content-Type: text/html; charset=$charset\n}; |
print qq{Content-Type: text/html; charset=$charset\n}; |
| 494 |
} |
} |
| 495 |
my $cookedpage = &encode($page); |
my $cookedpage = &encode($page); |
| 496 |
my $escapedpage = &escape($page); |
my $escapedpage = &escape($page); |
| 497 |
|
my ($Links, $links) = &make_navigate_links ($page); |
| 498 |
|
print $Links; |
| 499 |
print <<"EOD"; |
print <<"EOD"; |
| 500 |
Content-Language: $lang |
Content-Language: $lang |
| 501 |
Content-Style-Type: text/css |
Content-Style-Type: text/css |
| 505 |
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| 506 |
"http://www.w3.org/TR/html4/loose.dtd"> + RUBY --> |
"http://www.w3.org/TR/html4/loose.dtd"> + RUBY --> |
| 507 |
<html lang="$lang"> |
<html lang="$lang"> |
| 508 |
<head> |
<head profile="http://suika.fam.cx/~wakaba/-temp/wiki/wiki?WikiHTMLMetaProfile"> |
| 509 |
$meta_ct$option{-goto} |
$meta_ct$option{-goto} |
| 510 |
<title>$escapedpage</title> |
<title>$escapedpage</title> |
| 511 |
<link rel="index" href="$url_cgi?$IndexPage"> |
@{[($UA !~ m#Mozilla/[1-4]\.# || $UA =~ m#MSIE (?:[4-9]\.|\d\d)#) ? qq(<link rel="stylesheet" type="text/css" href="@{[&escape($url_stylesheet)]}">) : '']} |
|
<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)]}"> |
|
| 512 |
@{[$option{-noindex} ? q(<meta name="ROBOTS" content="NOINDEX">) : '']} |
@{[$option{-noindex} ? q(<meta name="ROBOTS" content="NOINDEX">) : '']} |
| 513 |
|
$links |
| 514 |
</head> |
</head> |
| 515 |
<body class="$bodyclass"> |
<body class="$bodyclass"> |
| 516 |
EOD |
EOD |
| 568 |
<a href="$url_cgi?$RecentChanges" class="wiki">最新</a> |
<a href="$url_cgi?$RecentChanges" class="wiki">最新</a> |
| 569 |
</div> |
</div> |
| 570 |
EOH |
EOH |
| 571 |
<<EOH; ## temp |
} |
| 572 |
<a href="$url_cgi?$CreatePage" class="wiki">$resource{createbutton}</a> | |
|
| 573 |
<a href="$url_cgi?$IndexPage" class="wiki">$resource{indexbutton}</a> | |
sub make_navigate_links ($) { |
| 574 |
<!-- <a href="$url_cgi?$RssPage" class="wiki">$resource{rssbutton}</a> | --> |
my $page = shift; |
| 575 |
<a href="$url_cgi?$FrontPage" class="wiki">$FrontPage</a> | |
my @link; |
| 576 |
<a href="$url_cgi?$SearchPage" class="wiki">$resource{searchbutton}</a> | |
push @link, {rel=>'edit', href=>"$url_cgi?mycmd=edit;mypage=@{[&encode($page)]}", class=>"wiki-command", title=>$resource{editbutton}} if &is_editable ($page) && !&is_frozen ($page); |
| 577 |
<a href="$url_cgi?mycmd=RandomJump;x-param=@{[time.[0..9]->[rand 10]]}" class="wiki randomlink">どこか</a> | |
push @link, {rel=>'edit', href=>"$url_cgi?mycmd=adminedit;mypage=@{[&encode($page)]}", class=>"wiki-command", title=>$resource{admineditbutton}} if &is_editable ($page) || &is_frozen ($page); |
| 578 |
<a href="$url_cgi?$RecentChanges" class="wiki">$resource{recentchangesbutton}</a> |
push @link, {rel=>'view', href=>"$url_cgi?mycmd=read;mypage=@{[&encode($page)]};x-p=@{[time.[0..9]->[rand 10]]}", class=>'wiki-command', title=>'View latest version of this page'}; |
| 579 |
</div> |
push @link, {rel=>'myself', href=>"$url_cgi?@{[&encode($page)]}", class=>'wiki'}; |
| 580 |
EOH |
push @link, {rel=>'index', href=>"$url_cgi?$IndexPage", class=>'wiki', title=>$resource{indexbutton}}; |
| 581 |
|
push @link, {rel=>'home', href=>"$url_cgi?$FrontPage", class=>'wiki', title=>$FrontPage}; |
| 582 |
|
push @link, {rel=>'News', href=>"$url_cgi?WikiNews", class=>'wiki', title=>'News on this wiki'}; |
| 583 |
|
push @link, {rel=>'News', href=>"$url_cgi?$RecentChanges", class=>"wiki", title=>$resource{recentchangesbutton}}; |
| 584 |
|
push @link, {rel=>'News', href=>"$url_cgi?$RssPage", class=>"wiki", title=>$resource{rssbutton}, type=>'application/xml'}; |
| 585 |
|
push @link, {rel=>'search', href=>"$url_cgi?$SearchPage", class=>'wiki', title=>$resource{searchbutton}}; |
| 586 |
|
push @link, {rel=>'help', href=>"$url_cgi?WikiHelp", class=>'wiki'}; |
| 587 |
|
push @link, {rel=>'copyright', href=>"$url_cgi?WikiPageLicense", class=>'wiki'}; |
| 588 |
|
my ($Links, $links) = ('', ''); |
| 589 |
|
for my $e (@link) { |
| 590 |
|
$links .= qq(<link); |
| 591 |
|
$Links .= qq(Link: <$e->{href}>); |
| 592 |
|
for my $attr (qw/rel rev href title class type hreflang charset/) { |
| 593 |
|
$links .= qq( $attr="@{[&escape($e->{$attr})]}") if $e->{$attr}; |
| 594 |
|
} |
| 595 |
|
for my $attr (qw/rel rev title/) { |
| 596 |
|
$Links .= qq(; $attr="@{[do{$e->{$attr} =~ s/([\\\"])/\\$1/g; $e->{$attr}}]}") if $e->{$attr}; |
| 597 |
|
} |
| 598 |
|
$links .= qq(>\n); |
| 599 |
|
$Links .= qq(\n); |
| 600 |
|
} |
| 601 |
|
wantarray ? ($Links, $links) : $Links; |
| 602 |
} |
} |
| 603 |
|
|
| 604 |
sub print_footer { |
sub print_footer { |
| 667 |
chomp; |
chomp; |
| 668 |
if (/^\*\*\*\*\*([^\x0D\x0A]*)/) { |
if (/^\*\*\*\*\*([^\x0D\x0A]*)/) { |
| 669 |
push(@toc, qq(----- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(----- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
| 670 |
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) . '</h6>'); |
| 671 |
$tocnum++; |
$tocnum++; |
| 672 |
} elsif (/^\*\*\*\*([^\x0D\x0A]*)/) { |
} elsif (/^\*\*\*\*([^\x0D\x0A]*)/) { |
| 673 |
push(@toc, qq(---- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(---- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
| 674 |
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) . '</h5>'); |
| 675 |
$tocnum++; |
$tocnum++; |
| 676 |
} elsif (/^\*\*\*([^\x0D\x0A]*)/) { |
} elsif (/^\*\*\*([^\x0D\x0A]*)/) { |
| 677 |
push(@toc, qq(--- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(--- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
| 678 |
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) . '</h4>'); |
| 679 |
$tocnum++; |
$tocnum++; |
| 680 |
} elsif (/^\*\*([^\x0D\x0A]*)/) { |
} elsif (/^\*\*([^\x0D\x0A]*)/) { |
| 681 |
# if (/^\*\*(.*)/) { |
# if (/^\*\*(.*)/) { |
| 682 |
# Walrus mod (6) end |
# Walrus mod (6) end |
| 683 |
push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
| 684 |
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) . '</h3>'); |
| 685 |
$tocnum++; |
$tocnum++; |
| 686 |
} elsif (/^\*([^\x0D\x0A]*)/) { |
} elsif (/^\*([^\x0D\x0A]*)/) { |
| 687 |
push(@toc, qq(- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
push(@toc, qq(- <a href="#i$tocnum">@{[&escape($1)||$tocnum]}</a>\n)); |
| 688 |
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) . '</h2>'); |
| 689 |
$tocnum++; |
$tocnum++; |
| 690 |
} elsif (/^(={1,6})(.*)/) { |
} elsif (/^(={1,6})(.*)/) { |
| 691 |
&back_push('ol', length($1), \@saved, \@result); |
&back_push('ol', length($1), \@saved, \@result); |
| 1142 |
} else { |
} else { |
| 1143 |
$mymsg = &escape($mymsg || $database{NewPageTemplate}); |
$mymsg = &escape($mymsg || $database{NewPageTemplate}); |
| 1144 |
} |
} |
| 1145 |
|
my $magic = ''; |
| 1146 |
|
$magic = $1 if $mymsg =~ m/^([^\x0A\x0D]+)/s; |
| 1147 |
|
|
| 1148 |
my $edit = $mode{admin} ? 'adminedit' : 'edit'; |
my $edit = $mode{admin} ? 'adminedit' : 'edit'; |
| 1149 |
my $escapedmypage = &escape($form{mypage}); |
my $escapedmypage = &escape($form{mypage}); |
| 1150 |
my $escapedmypassword = &escape($form{mypassword}); |
my $escapedmypassword = &escape($form{mypassword}); |
| 1151 |
|
my $selected = 'read'; |
| 1152 |
|
if ($form{after_edit_cmd}) { |
| 1153 |
|
$selected = $form{after_edit_cmd}; |
| 1154 |
|
} elsif ($magic =~ /Config/ || $magic =~ /CSS/) { |
| 1155 |
|
$selected = 'edit'; |
| 1156 |
|
} |
| 1157 |
|
my $afteredit = <<EOH; |
| 1158 |
|
<select name="after_edit_cmd"> |
| 1159 |
|
<option value="read" label="View changed page"@{[$selected eq 'read' ? ' selected="selected"':'']}>read</option> |
| 1160 |
|
<option value="edit" label="Edit changed page"@{[$selected eq 'edit' ? ' selected="selected"':'']}>edit</option> |
| 1161 |
|
</select> |
| 1162 |
|
EOH |
| 1163 |
|
|
| 1164 |
print <<"EOD"; |
print <<"EOD"; |
| 1165 |
<form action="$url_cgi" method="post"> |
<form action="$url_cgi" method="post"> |
| 1166 |
<h2>$escapedmypageの編集</h2> |
<h2>$escapedmypageの編集</h2> |
| 1167 |
@{[ $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{savebutton}"><kbd>S</kbd>) ]} |
| 1168 |
|
@{[ $mode{admin} ? qq($resource{frozenpassword} <input type="password" name="mypassword" value="$escapedmypassword" size="10">) : "" ]} [@{[do {my $n = 0; |
| 1169 |
|
$mymsg =~ s/(?:-+\s)?\[([0-9]+)\]/$n = $1 if $1 > $n; $&/mge; |
| 1170 |
|
++$n}]}]<br> |
| 1171 |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
<input type="hidden" name="myLastModified" value="$lastmodified"> |
| 1172 |
<input type="hidden" name="mypage" value="$escapedmypage"> |
<input type="hidden" name="mypage" value="$escapedmypage"> |
| 1173 |
<textarea cols="$cols" rows="$rows" name="mymsg" tabindex="1">$mymsg</textarea><br> |
<textarea cols="$cols" rows="$rows" name="mymsg" tabindex="1">$mymsg</textarea><br> |
| 1184 |
<input type="checkbox" name="mytouch" value="on" checked="checked">$resource{touch}<br> |
<input type="checkbox" name="mytouch" value="on" checked="checked">$resource{touch}<br> |
| 1185 |
<input type="submit" name="mypreview_$edit" value="$resource{previewbutton}"> |
<input type="submit" name="mypreview_$edit" value="$resource{previewbutton}"> |
| 1186 |
<input type="submit" name="mypreview_write" value="$resource{savebutton}" accesskey="S"><kbd>S</kbd> |
<input type="submit" name="mypreview_write" value="$resource{savebutton}" accesskey="S"><kbd>S</kbd> |
| 1187 |
[@{[do {my $n = 0; |
$afteredit |
| 1188 |
$mymsg =~ s/(?:-+\s)?\[([0-9]+)\]/$n = $1 if $1 > $n; $&/mge; |
<br> |
|
++$n}]}]<br> |
|
| 1189 |
) |
) |
| 1190 |
]} |
]} |
| 1191 |
</form> |
</form> |
| 1264 |
sub init_resource { |
sub init_resource { |
| 1265 |
open(FILE, $file_resource) or &print_error("(resource)"); |
open(FILE, $file_resource) or &print_error("(resource)"); |
| 1266 |
while (<FILE>) { |
while (<FILE>) { |
| 1267 |
chomp; |
s/[\x0A\x0D]+$//g; |
| 1268 |
next if /^#/; |
next if /^#/; |
| 1269 |
my ($key, $value) = split(/=/, $_, 2); |
my ($key, $value) = split(/=/, $_, 2); |
| 1270 |
$resource{$key} = &code_convert(\$value, $kanjicode); |
$resource{$key} = &code_convert(\$value, $kanjicode); |
| 1526 |
$fmt{form_option}->replace ($option, $param); |
$fmt{form_option}->replace ($option, $param); |
| 1527 |
my $t = 1; |
my $t = 1; |
| 1528 |
for (@{$param->{require}||[]}) { |
for (@{$param->{require}||[]}) { |
| 1529 |
(undef $t, last) unless length $param->{argv}->{'wikiform__'.$_}; |
(undef $t, last) unless length $param->{argv}->{'wikiform__'.$_}; |
| 1530 |
} |
} |
| 1531 |
$t = $fmt{form_template}->replace ($template, $param) if $t; |
$t = $fmt{form_template}->replace ($template, $param) if $t; |
| 1532 |
if (length $t) { |
if (length $t) { |
| 1727 |
$count++; |
$count++; |
| 1728 |
} |
} |
| 1729 |
# print RSS information (as XML). |
# print RSS information (as XML). |
| 1730 |
|
print scalar &make_navigate_links ('RssPage'); |
| 1731 |
print <<"EOD" |
print <<"EOD" |
| 1732 |
Content-type: text/xml |
Content-type: application/xml |
| 1733 |
|
|
| 1734 |
@{[$rss->as_string]} |
@{[$rss->as_string]} |
| 1735 |
EOD |
EOD |
| 1818 |
} |
} |
| 1819 |
my $euri = main::escape ($uri); |
my $euri = main::escape ($uri); |
| 1820 |
if ($title) { |
if ($title) { |
| 1821 |
$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); |
| 1822 |
} else { |
} else { |
| 1823 |
$r .= qq(<li>[$list{$uri}] <<a href="$euri">$euri</a>></li>\n); |
$r .= qq(<li>[$list{$uri}] <<a href="$euri">$euri</a>></li>\n); |
| 1824 |
} |
} |