/[pub]/suikawiki/script/wiki.cgi
Suika

Diff of /suikawiki/script/wiki.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by wakaba, Sun Mar 24 00:51:52 2002 UTC revision 1.19 by wakaba, Sun Jun 2 06:28:30 2002 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl  #!/usr/bin/perl
2  use lib "../lib";  #!perl
3  use CGI::Carp 'fatalsToBrowser';  #
4  use Algorithm::Diff qw(traverse_sequences);  # wiki.cgi - This is YukiWiki, yet another Wiki clone.
5  # use strict;  #
6  #  # Copyright (C) 2000-2002 by Hiroshi Yuki.
7  # yukiwiki.cgi - Yet another WikiWikiWeb clone.  # <hyuki@hyuki.com>
8  #  # http://www.hyuki.com/yukiwiki/
9  # Copyright (C) 2000,2001 by Hiroshi Yuki.  #
10  # <hyuki@hyuki.com>  # This program is free software; you can redistribute it and/or
11  # http://www.hyuki.com/yukiwiki/  # modify it under the same terms as Perl itself.
12  #  #
13  # This program is free software; you can redistribute it and/or modify  ##############################
14  # it under the terms of the GNU General Public License as published by  #
15  # the Free Software Foundation; either version 2 of the License, or  # walwiki.cgi based on yukiwiki.cgi - Yet another WikiWikiWeb clone.
16  # (at your option) any later version.  #
17  #  # WalWiki�θ��С������ϡ�YukiWiki 2.0.beta1��١����ˤ��Ƥ��ޤ���
18  # This program is distributed in the hope that it will be useful,  #
19  # but WITHOUT ANY WARRANTY; without even the implied warranty of  # * ��������
20  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  #
21  # GNU General Public License for more details.  # 2.0.beta1.wal.1 on 2002/05/19,22:32:19
22  #  # (1) Footer���ѹ�
23  # $Id$  # (2) WikiName�γ�ĥ : PerlCE����ޡ�PPMInstall�ϴޤޤʤ�
24  ##############################  # (3) ��̾��󥯡�[��̾ URL]�ˤ��б���
25  my $version = "1.6.6";  # (4) ISBN�򥢥ޥ���.jp��Asociate�ץ�������󥯤��Ѵ���
26  ##############################  # (5) [[#box:InterWikiName]]��InterWiki�ʥƥ����ȥܥå�������
27  # ñ�ȥƥ��ȤΤȤ��ˤ� 1 �ˤ��롣  # (6) HTML�⡼���б���
28  my $testing = 0;  #
29  ##############################  # ��2.0.alpha0.wal.3�ǤޤǤν������⡢�ʲ����ѹ�������ޤ���
30  # �����饤�֥��  # ���ʲ���YukiWiki2�˼������줿���ᡢ�ȼ������ɤϤʤ��ʤ�ޤ�����
31  my $jcodelib = 'jcode.pl';  #   - ����饤��β����Ѵ�
32  ##############################  #   - YukiWikiDB�б�
33  # ��¸��ɽ���δ���������  #   - �ơ��֥�
34  my $kanjicode = 'euc';     # 'sjis' 'euc'  #   - DB��Ϣ�⥸�塼��use��eval��
35  my $charset = 'euc-jisx0213';  # 'Shift_JIS' 'EUC-JP'  #   - BracketName�ˤ�륭������֥饱�åȤ��ӽ�
36  ##############################  # ��ISBN�ֹ�ؤ��б���WalWiki2.0��ꡢInterWiki�ؤ�Add-On�ˤʤ�ޤ�����
37  # dbmopen���Ȥ���ʤ�1���Ȥ��ʤ��ʤ�0  #   [[ISBN http://www.amazon.co.jp/exec/obidos/ASIN/isbn($1)/walrdigi-22]]�Τ褦����Ͽ��
38  my $dbmopen = 0;  #
39  ##############################  #=======================================
40  # �ǡ����١���̾��.pag, .dir, .db�ʤɤ����ס�  
41  # $dbmopen = 1�ΤȤ��ϥǡ����١���̾��  # Walrus add (debug) start
42  # $dbmopen = 0�ΤȤ��ϥǥ��쥯�ȥ�̾�ˤʤ롣  my $walrus_log;
43  my $dbname = './wikidata';  my $walrus_debugging = 0;
44  my $diffdbname = './wikidiff';  # Walrus add (debug) end
45  ##############################  
46  # �����Ԥλ�̾�ʼ�ͳ���ѹ����Ƥ���������  # Libraries.
47  my $modifier = 'suika';  use strict;
48  ##############################  use lib qw(./WalWiki/lib);
49  # �����Ԥ�Web�ڡ����ʼ�ͳ���ѹ����Ƥ���������  use CGI qw(:standard);
50  my $modifierlink = 'http://suika.fam.cx/';  use CGI::Carp qw(fatalsToBrowser);
51  ##############################  use Yuki::RSS;
52  # ���Υڡ�����URL  use Yuki::DiffText qw(difftext);
53  my $thisurl = 'wiki';  use Yuki::YukiWikiDB;
54  ##############################  use AnyDBM_File;
55  # ���ϥڡ���̾  require 'jcode.pl';
56  my $toppage = 'HomePage';  # use Jcode;
57  ##############################  use Fcntl;
58  # �ǽ������ڡ���̾  my $version = '2.0.beta1.2002-05-29';
59  my $whatsnew = 'RecentChanges';  my $walversion;
60  ##############################  ##############################
61  # �ǽ������˷Ǻܤ���ڡ�����  #
62  my $maxnew = 50;  # You MUST modify following '$modifier_...' variables.
63  ##############################  #
64  # ��������ե�����̾�ʥ��顼�ǡ�  my $modifier_mail = 'w@suika.fam.cx';   # Your mail address, like 'walrus@digit.que.ne.jp'.
65  my $iconfile = '';  my $modifier_url  = 'http://suika.fam.cx/~wakaba/';     # Your web page, like 'http://digit.que.ne.jp/work/'.
66  ##############################  my $modifier_name = '��';       # Your name, like 'Makio Tsukamoto'.
67  # ��������ե�����̾�ʥ�Υ����ǡ�  # my $modifier_dbtype = 'AnyDBM_File';  # Fast, not available on some server, page size limited.
68  # my $iconfile = '';  # my $modifier_dbtype = 'dbmopen';      # Fast, not available on some server, page size limited.
69  ##############################  my $modifier_dbtype = 'YukiWikiDB';     # Slow, available on all environment.
70  # �ڡ������ѹ������Ȥ���touch����ե������''�ʤ鲿�⤷�ʤ���  # my $modifier_sendmail = '/usr/sbin/sendmail -t -n'; # Your sendmail.
71  my $touchfile = 'touch.txt';  my $modifier_sendmail = ''; # If you don't need mail notification.
72  ##############################  my $modifier_dir_data = './wikidata'; # Your data directory.
73  # �ץ�ӥ塼�Ѥ��طʿ�  my $modifier_rss_title = "WalWiki $walversion";
74  my $preview_color = '#FFCCCC';  my $modifier_rss_link = 'http://suika.fam.cx/~wakaba/-temp/wiki2/wiki'; # Blank is not allowed.
75  ##############################  my $modifier_rss_description = 'This is WalWiki, yet another Wiki clone based on YukiWiki';
76  # ���ڡ����Υ�������  ##############################
77  my $style = <<'EOD';  #
78  pre, dl, ul, ol, p, blockquote { line-height:120%; }  # You MAY modify following variables.
79  a { text-decoration: none; }  #
80  a:link { color: #0000FF; background-color: #FFFFFF; }  my $file_touch = "$modifier_dir_data/touched.txt";
81  a:visited { color: #9900CC; background-color: #FFFFFF; }  my $file_resource = "$modifier_dir_data/resource.txt";
82  a:hover { text-decoration: underline; }  my $file_FrontPage = "$modifier_dir_data/frontpage.txt";
83  EOD  my $file_conflict = "$modifier_dir_data/conflict.txt";
84  ##############################  my $file_format = "$modifier_dir_data/format.txt";
85  # �ƥ�����������ʬ���礭��  my $url_cgi = 'wiki';
86  my $cols = 80;  my $url_stylesheet = 'wiki-style.css';
87  my $rows = 20;  my $icontag = '<img src="/icons/folder" alt="*" width="40" height="40" />';
88  ##############################  my $maxrecent = 50;
89  my %form = ();  my $cols = 80;
90  my %database = ();  my $rows = 20;
91  my %diffbase = ();  ##############################
92  my $diff_text = '';  #
93  my @diff_added = ();  # You MAY, but do NOT NEED modify following variables.
94  my @diff_deleted = ();  #
95  my $msgrefA;  my $dataname = "$modifier_dir_data/wiki";
96  my $msgrefB;  my $infoname = "$modifier_dir_data/info";
97  ##############################  my $diffname = "$modifier_dir_data/diff";
98  # �Խ��Բĥڡ���̾����  my $editchar = '?';
99  my @uneditable = ( $whatsnew );  my $subject_delimiter = ' - ';
100  ##############################  my $use_autoimg = 1; # automatically convert image URL into <img> tag.
101  # ����Ѥ�����ɽ��  my $use_exists = 0; # If you can use 'exists' method for your DB.
102  # YukiWiki�Υ�󥯤�2���ढ�롣  ##############################
103  #  my $InterWikiName = 'InterWikiName';
104  # (1) WikiName (RecentChanges�Ȥ�FrontPage�Τ褦�ʤ��)  my $RecentChanges = 'RecentChanges';
105  # (2) BracketName ([[����]]�Ȥ�[[�ȥ�֥륷�塼��]]�Τ褦�ʤ��)  my $AdminChangePassword = 'AdminChangePassword';
106  #  my $CompletedSuccessfully = 'CompletedSuccessfully';
107  # �����ե�JIS��2�Х����ܤˤ� ']' ���褦��Τǡ�  my $FrontPage = 'HomePage';
108  # ʸ��']'��1��¿���Ȥ�褦�ˤ��Ƥ��롣  my $IndexPage = 'IndexPage';
109  #  my $SearchPage = 'SearchPage';
110  my $WikiName = '([A-Z][a-z]+([A-Z][a-z]+)+)';  my $CreatePage = 'CreatePage';
111  my $BracketName = '\[\[([^>\x09]+?\]?)\]\]';  my $ErrorPage = 'ErrorPage';
112    my $RssPage = 'RssPage';
113  # ����������ʬ�Υ���  my $AdminSpecialPage = 'Admin Special Page'; # must include spaces.
114  my $IconTag = ''; #<<"EOD";  ##############################
115  #<a href="http://www.hyuki.com/yukiwiki/"><img src="$iconfile"  # my $wiki_name = '\b([A-Z][a-z]+([A-Z][a-z]+)+)\b';        # Walrus del (2)
116  # border="0" width="80" height="80" alt="[YukiWiki]" /></a>  my $wiki_name   = '\b([A-Z][a-z]+([A-Z][a-z]*)+)\b';        # Walrus add (2)
117  #EOD  my $bracket_name = '\[\[(\S+?)\]\]';
118    my $embedded_name = '\[\[(#\S+?)\]\]';
119  require "$jcodelib";  my $interwiki_definition = '\[\[(\S+?)\ (\S+?)\]\]';
120    my $interwiki_name = '([^:]+):([^:].*)';
121  &init_form($kanjicode);  ##############################
122    my $embed_comment = '[[#comment]]';
123  if ($testing) {  my $embed_rcomment = '[[#rcomment]]';
124      %form = (  my $embed_interwiki = '^\[\[#(box|text|password):(\S+)\]\]$';    # Walrus add (5)
125          # 'mycmd' => 'write',  ##############################
126          'mycmd' => 'read',  my $info_LastModified = 'LastModified';
127          #'mycmd' => 'search',  my $info_IsFrozen = 'IsFrozen';
128          #'mycmd' => 'edit',  my $info_AdminPassword = 'AdminPassword';
129          'mymsg' => <<"EOD",  ##############################
130  �Ϥ���ޤ��ơ�  my $kanjicode = 'euc';
131  ���줫�餤�������񤭹��ߤޤ��͡�  my $charset = 'EUC-JP';
132  LinkPage�⸫�Ƥ���������  my $lang = 'ja';
133  TestPage�Ϥɤ��Ǥ��礦����  my %fixedpage = (
134  �ɤ������������      $IndexPage => 1,
135  http://www.hyuki.com/      $CreatePage => 1,
136  [[����]]      $ErrorPage => 1,
137  EOD      $RssPage => 1,
138          'mypage' => '<����>',      $RecentChanges => 1,
139          'myword' => '��',      $SearchPage => 1,
140          # '3C8C8B8FE98D5F3E' => '',      $AdminChangePassword => 1,
141          # 'TestPage' => '',      $CompletedSuccessfully => 1,
142      );      #$FrontPage => 1,
143  }  );
144  &main;  my %form;
145  exit(0);  my %database;
146    my %infobase;
147  # �ᥤ��  my %diffbase;
148  sub main {  my %resource;
149      &normalize_form;  my %interwiki;
150      if ($dbmopen) {  ##############################
151          if (!dbmopen(%database, $dbname, 0666)) {  my %page_command = (
152              &print_error("(dbmopen) $dbname �����ޤ���");      $IndexPage => 'index',
153          }      $SearchPage => 'searchform',
154      } else {      $CreatePage => 'create',
155          if (!tie(%database, "YukiWikiDB", $dbname)) {      $RssPage => 'rss',
156              &print_error("(tie error)");      $AdminChangePassword => 'adminchangepasswordform',
157          }      #$FrontPage => 'FrontPage',
158      }  );
159    my %command_do = (
160      # myspecial�б�      read => \&do_read,
161      foreach (keys %form) {      edit => \&do_edit,
162          if (/^myspecial_(.*)/) {      adminedit => \&do_adminedit,
163              $form{mycmd} = $1;      adminchangepasswordform => \&do_adminchangepasswordform,
164              last;      adminchangepassword => \&do_adminchangepassword,
165          }      write => \&do_write,
166      }      index => \&do_index,
167        searchform => \&do_searchform,
168      if ($form{mycmd} eq 'read') {      search => \&do_search,
169          &do_read;      create => \&do_create,
170      } elsif ($form{mycmd} eq 'preview') {      createresult => \&do_createresult,
171          &do_preview;      FrontPage => \&do_FrontPage,
172      } elsif ($form{mycmd} eq 'write') {      comment => \&do_comment,
173          &do_write;      rss => \&do_rss,
174      } elsif ($form{mycmd} eq 'edit') {      diff => \&do_diff,
175          &do_edit;      interwikibox => \&do_interwiki_box, # Walrus add (5)
176      } elsif ($form{mycmd} eq 'reedit') {  );
177          &do_reedit;  ##############################
178      } elsif ($form{mycmd} eq 'search') {  my @ignore_html_page = ('FrontPage');        # Walrus add (6)
179          &do_search;  my @ignore_html_tags = ('a', 'br', 'img');   # Walrus add (6)
180      } elsif ($form{mycmd} eq 'list') {  my $walversion = '2.0.beta1.wal.1';          # Walrus add (1)
181          &do_list;  ##############################
182      } elsif ($form{mycmd} eq 'diff') {  # &test_convert;
183          &do_diff;  &main;
184      } else {  exit(0);
185          $form{mypage} = $toppage;  ##############################
186          &do_read;  
187      }  sub main {
188      if ($dbmopen) {      &init_resource;
189          dbmclose(%database);      &open_db;
190      } else {      &init_form;
191          untie(%database);      &init_InterWikiName;
192      }      if ($command_do{$form{mycmd}}) {
193  }          &{$command_do{$form{mycmd}}};
194        } else {
195  # �ڡ�����ɽ��          &do_FrontPage;
196  sub do_read {      }
197      my $page_name = $form{mypage};      &close_db;
198      my $percent_name = &encode_percent($page_name);  }
199      &print_header($page_name);  
200      print qq|<h1>$IconTag<a href="$thisurl?mycmd=search;myword=$percent_name">$page_name</a></h1>\n|;  sub do_read {
201      &print_toolbar($page_name);      &print_header($form{mypage});
202      print &convert_html(&get_page($page_name));      &print_content($database{$form{mypage}});
203      &print_footer;      &print_footer($form{mypage});
204  }  }
205    
206  # �ڡ������Խ�  sub do_edit {
207  sub do_edit {      my ($page) = &unarmor_name(&armor_name($form{mypage}));
208      if (not &is_editable($form{mypage})) {      &print_header($page);
209          # �Խ��Բĥڡ�����ɽ���Τ�      if (not &is_editable($page)) {
210          &do_read;          &print_message($resource{cantchange});
211          return;      } elsif (&is_frozen($page)) {
212      }          &print_message($resource{cantchange});
213      &editpage(&get_page($form{mypage}));      } else {
214  }          &print_editform($database{$page}, &get_info($page, $info_LastModified), admin=>0);
215        }
216  # �ڡ����κ��Խ�      &print_footer($page);
217  sub do_reedit {  }
218      if (not &is_editable($form{mypage})) {  
219          # �Խ��Բĥڡ�����ɽ���Τ�  sub do_adminedit {
220          &do_read;      my ($page) = &unarmor_name(&armor_name($form{mypage}));
221      } else {      &print_header($page);
222          &editpage($form{mymsg});      if (not &is_editable($page)) {
223      }          &print_message($resource{cantchange});
224  }      } else {
225            &print_message($resource{passwordneeded});
226  sub editpage {          &print_editform($database{$page}, &get_info($page, $info_LastModified), admin=>1);
227      my $page_msg = shift;      }
228      my $page_name = $form{mypage};      &print_footer($page);
229      my $digest = &calc_message_digest($page_msg);  }
230      &print_header($page_name);  
231      print qq|<h1>$IconTag${page_name}���Խ�</h1>\n|;  sub do_adminchangepasswordform {
232      &print_toolbar($page_name);      &print_header($AdminChangePassword);
233      $page_msg = &escape($page_msg);      &print_passwordform;
234      print <<"EOD";      &print_footer($AdminChangePassword);
235  <form action="$thisurl" method="post">  }
236  <!--<input type="hidden" name="mycmd" value="preview">-->  
237  <input type="hidden" name="mypage" value="$page_name">  sub do_adminchangepassword {
238  <input type="hidden" name="mydigest" value="$digest">      if ($form{mynewpassword} ne $form{mynewpassword2}) {
239  <textarea cols="$cols" rows="$rows" name="mymsg" wrap="virtual">$page_msg</textarea><br>          &print_error($resource{passwordmismatcherror});
240  <input type="submit" name="myspecial_preview" value="��ǧ">      }
241  <input type="submit" name="myspecial_write" value="��ǧ�����ѹ�">      my ($validpassword_crypt) = &get_info($AdminSpecialPage, $info_AdminPassword);
242  </form>      if ($validpassword_crypt) {
243  <hr>          if (not &valid_password($form{myoldpassword})) {
244  <h3>�ƥ����������Υ롼��</h3>              &send_mail_to_admin(<<"EOD", "AdminChangePassword");
245    myoldpassword=$form{myoldpassword}
246  <p>�̾�����Ϥ���ʸ�������Τޤ޽��Ϥ���ޤ�����  mynewpassword=$form{mynewpassword}
247  �ʲ��Υ롼��˽��äƥƥ�����������Ԥ����Ȥ��Ǥ��ޤ���</p>  mynewpassword2=$form{mynewpassword2}
248    EOD
249  <ul>              &print_error($resource{passworderror});
250  <li>          }
251  ���Ԥ�����ζ��ڤ�Ȥʤ�ޤ���      }
252        my ($sec, $min, $hour, $day, $mon, $year, $weekday) = localtime(time);
253  <li>      my (@token) = ('0'..'9', 'A'..'Z', 'a'..'z');
254  HTML�Υ����Ͻ񤱤ޤ���      my $salt1 = $token[(time | $$) % scalar(@token)];
255        my $salt2 = $token[($sec + $min*60 + $hour*60*60) % scalar(@token)];
256  <li>      my $crypted = crypt($form{mynewpassword}, "$salt1$salt2");
257  ''��Ĵ''�Τ褦�˥��󥰥륯��������ĤǤϤ���ȡ���Ĵ�ˤʤ�ޤ���      &set_info($AdminSpecialPage, $info_AdminPassword, $crypted);
258    
259  <li>      &print_header($CompletedSuccessfully);
260  '''���˶�Ĵ'''�Τ褦�˥��󥰥륯�����Ȼ��ĤǤϤ���ȡ����˶�Ĵ�ˤʤ�ޤ���      &print_message($resource{passwordchanged});
261        &print_footer($CompletedSuccessfully);
262  <li>  }
263  ----�Τ褦�˥ޥ��ʥ�4�Ĥ�����ȡ���ʿ���ˤʤ�ޤ���  
264    sub do_index {
265  <li>      &print_header($IndexPage);
266  *���Ƭ�˽񤯤��縫�Ф��ˤʤ�ޤ���      print qq(<ul>);
267        foreach my $page (sort keys %database) {
268  <li>          if (&is_editable($page)) {
269  **���Ƭ�˽񤯤Ⱦ����Ф��ˤʤ�ޤ���              print qq(<li><a href="$url_cgi?@{[&encode($page)]}">$page</a>@{[&escape(&get_subjectline($page))]}</li>);
270                # print qq(<li>@{[&get_info($page, $info_IsFrozen)]}</li>);
271  <li>              # print qq(<li>@{[0 + &is_frozen($page)]}</li>);
272  -���Ƭ�˽񤯤Ȳվ�񤭤ˤʤ�ޤ���- -- --- ��3��٥뤬����ޤ���          }
273        }
274  <li>      print qq(</ul>);
275  :���Ƭ�˽񤯤��Ѹ�Ȳ���ʸ�����ޤ���      &print_footer($IndexPage);
276    }
277  <pre>  
278      :�Ѹ�1:���������񤤤�����ʸ1  sub do_write {
279      :�Ѹ�2:���������񤤤�����ʸ2      if (&frozen_reject()) {
280      :�Ѹ�3:���������񤤤�����ʸ3          return;
281  </pre>      }
282    
283  <li>      if (not &is_editable($form{mypage})) {
284  http://www.hyuki.com/ �Τ褦��URL�ϼ�ưŪ�˥�󥯤ˤʤ�ޤ���          &print_header($form{mypage});
285            &print_message($resource{cantchange});
286  <li>          &print_footer($form{mypage});
287  YukiWiki�Τ褦����ʸ����ʸ���򺮤�����ʸ�����񤯤ȡ�          return;
288  YukiWiki�Υڡ���̾�ˤʤ�ޤ���      }
289    
290  <li>      if (&conflict($form{mypage}, $form{mymsg})) {
291  [[����]]�Τ褦����Ť��礫�ä�[[ ]]�Ǥ����ä�ʸ�����񤯤ȡ�          return;
292  YukiWiki�Υڡ���̾�ˤʤ�ޤ���      }
293  �礫�ä�����ˤϥ��ڡ�����ޤ�ƤϤ����ޤ���  
294  ���ܸ��Ȥ��ޤ���      # Making diff
295        {
296  <li>          &open_diff;
297  ��Ƭ�����ڡ����ǻϤޤäƤ���ȡ�          my @msg1 = split(/\n/, $database{$form{mypage}});
298  ��������������Ѥ߰����ޤ���          my @msg2 = split(/\n/, $form{mymsg});
299  �ץ�������񤭹���Ȥ��˻Ȥ��������Ǥ���          $diffbase{$form{mypage}} = &difftext(\@msg1, \@msg2);
300            &close_diff;
301  <li>      }
302  &gt; ���Ƭ�˽񤯤ȡ�  
303  ����ʸ���񤱤ޤ���      if ($form{mymsg}) {
304  &gt; �ο���¿���ȥ���ǥ�Ȥ������ʤ�ޤ���3��٥�ޤǡˡ�          $database{$form{mypage}} = $form{mymsg};
305            &send_mail_to_admin($form{mypage}, "Modify");
306  </ul>          if ($form{mytouch}) {
307  EOD              &set_info($form{mypage}, $info_LastModified, '' . localtime);
308      &print_footer;              &update_recent_changes;
309  }          }
310            &set_info($form{mypage}, $info_IsFrozen, 0 + $form{myfrozen});
311  # �ڡ����θ���          &print_header($CompletedSuccessfully);
312  sub do_search {          &print_message($resource{saved});
313      if ($form{myword}) {          &print_content("$resource{continuereading} @{[&armor_name($form{mypage})]}");
314          &print_header('�������');          &print_footer($CompletedSuccessfully);
315          print qq|<h1>$IconTag$form{myword}�θ������</h1>\n|;      } else {
316          &print_toolbar();          &send_mail_to_admin($form{mypage}, "Delete");
317          print qq|<ul>\n|;          delete $database{$form{mypage}};
318          my $count = 0;          delete $infobase{$form{mypage}};
319          foreach my $page_name (sort keys %database) {    # sort����Τ�̵�Ť���          if ($form{mytouch}) {
320              if ($database{$page_name} =~ /\Q$form{'myword'}\E/) {              &update_recent_changes;
321                  my $encoded = &encode_percent($page_name);          }
322                  print qq|<li><a href="$thisurl?mycmd=read;mypage=$encoded">$page_name</a>\n|;          &print_header($form{mypage});
323                  $count++;          &print_message($resource{deleted});
324              }          &print_footer($form{mypage});
325          }      }
326          print qq|</ul>\n|;  }
327          if ($count > 0) {  
328              print qq|<p><strong>$form{myword}</strong>��ޤ�ڡ����ϡ���˼���<strong>$count</strong> �ڡ����Ǥ���</p>\n|;  sub do_searchform {
329          } else {      &print_header($SearchPage);
330              print qq|<p><strong>$form{myword}</strong>��ޤ�ڡ����ϸ��Ĥ���ޤ���</p>\n|;      &print_searchform("");
331          }      &print_footer($SearchPage);
332      } else {  }
333          &print_header('ñ�측��');  
334          print qq|<h1>$IconTagñ�측��</h1>\n|;  sub do_search {
335          &print_toolbar();      my $word = &escape($form{mymsg});
336      }      &print_header($SearchPage);
337      print <<"EOD";      &print_searchform($word);
338  <p>      my $counter = 0;
339  <form action="$thisurl" method="post">      foreach my $page (sort keys %database) {
340  <input type="hidden" name="mycmd" value="search">          next if $page =~ /^$RecentChanges$/;
341  <input type="text" name="myword" size="20" value="$form{myword}">          if ($database{$page} =~ /\Q$form{mymsg}\E/ or $page =~ /\Q$form{mymsg}\E/) {
342  <input type="submit" value="ñ�측��">              if ($counter == 0) {
343  </form>                  print qq|<ul>|;
344  </p>              }
345  EOD              print qq(<li><a href ="$url_cgi?@{[&encode($page)]}">$page</a>@{[&escape(&get_subjectline($page))]}</li>);
346      &print_footer;              $counter++;
347  }          }
348        }
349  # �ڡ����ΰ���      if ($counter == 0) {
350  sub do_list {          &print_message($resource{notfound});
351      &print_header('�ڡ�������');      } else {
352      print qq|<h1>$IconTag �ڡ�������</h1>\n|;          print qq|</ul>|;
353      &print_toolbar();      }
354      print qq|<ul>\n|;      &print_footer($SearchPage);
355      foreach my $page_name (sort keys %database) {    # sort����Τ�̵�Ť���  }
356          my $encoded = &encode_percent($page_name);  
357          print qq|<li><a href="$thisurl?mycmd=read;mypage=$encoded">$page_name</a>\n|  sub do_create {
358      }      &print_header($CreatePage);
359      print qq|</ul>\n|;      print <<"EOD";
360      &print_footer;  <form action="$url_cgi" method="post">
361  }      <input type="hidden" name="mycmd" value="edit">
362        <strong>$resource{newpagename}</strong><br>
363  # �ץ�ӥ塼      <input type="text" name="mypage" value="" size="20">
364  sub do_preview {      <input type="submit" value="$resource{createbutton}"><br>
365      my $page_name = $form{mypage};  </form>
366      my $escapedmsg = &escape($form{mymsg});  EOD
367      &print_header($page_name);      &print_footer($CreatePage);
368      print qq|<h1>$IconTag${page_name}�Υץ�ӥ塼</h1>\n|;  }
369      &print_toolbar($page_name);  
370      # local $percent_name = &encode_percent($page_name);  sub do_FrontPage {
371      print qq|<p>�ʲ��Υץ�ӥ塼���ǧ���ơ��褱��Хڡ��������Υܥ���ǹ������Ƥ���������</p>\n|;      open(FILE, $file_FrontPage) or &print_error("($file_FrontPage)");
372      if ($form{mymsg}) {      my $content = join('', <FILE>);
373          print qq|<table width="100%" bgcolor="$preview_color" ><tr><td>\n|;      &code_convert(\$content, $kanjicode);
374          # print &convert_html($escapedmsg);      close(FILE);
375          print &convert_html($form{mymsg});      &print_header($FrontPage);
376          print qq|</td></tr></table>\n|;      &print_content($content);
377      } else {      &print_footer($FrontPage);
378          print qq|<p>�ʥڡ��������Ƥ϶��Ǥ�����������Ȥ��Υڡ�����<strong>���</strong>����ޤ�����</p>\n|;  }
379      }  
380      &print_preview_buttons($page_name, $escapedmsg, $form{mydigest});  sub print_error {
381      &print_footer;      my ($msg) = @_;
382  }      &print_header($ErrorPage);
383        print qq(<p><strong class="error">$msg</strong></p>);
384  sub print_preview_buttons {      &print_footer($ErrorPage);
385      my ($page_name, $escapedmsg, $digest) = @_;      exit(0);
386      print <<"EOD";  }
387      <form action="$thisurl" method="post">  
388      <textarea cols="$cols" rows="$rows" name="mymsg" wrap="virtual">$escapedmsg</textarea>  sub print_header {
389      <br />      my ($page) = @_;
390      <input type="hidden" name="mypage" value="$page_name">      my $bodyclass = "normal";
391      <input type="hidden" name="mydigest" value="$digest">      my $editable = 0;
392      <input type="submit" name="myspecial_preview" value="���٥ץ�ӥ塼">      my $admineditable = 0;
393      <input type="submit" name="myspecial_write" value="�ڡ����ι���">      if (&is_frozen($page) and $form{mycmd} =~ /^(read|write)$/) {
394      </form>          $editable = 0;
395  EOD          $admineditable = 1;
396  }          $bodyclass = "frozen";
397        } elsif (&is_editable($page) and $form{mycmd} =~ /^(read|write)$/) {
398  # �񤭹���          $admineditable = 1;
399  sub do_write {          $editable = 1;
400      if (not &is_editable($form{mypage})) {      } else {
401          # �Խ��Բĥڡ�����ɽ���Τ�          $editable = 0;
402          &do_read;      }
403          return;      my $cookedpage = &encode($page);
404      }      print <<"EOD";
405    Content-type: text/html; charset=$charset
406      my $page_name = $form{mypage};  Content-Language: $lang
407    Content-Style-Type: text/css
408      # digest��Ȥäơ������ξ��ͥ����å�  
409      my $original_digest = &calc_message_digest(&get_page($page_name));  <!DOCTYPE html
410      if ($form{mydigest} ne $original_digest) {      PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
411          &print_header($page_name);      "http://www.w3.org/TR/html4/loose.dtd">
412          print qq|<h1>$IconTag${page_name}�ǡڹ����ξ��ۤ͡������ޤ���</h1>\n|;  <html lang="$lang">
413          print <<"EOD";  <head>
414  <p>���ʤ������Υڡ������Խ����Ƥ���֤ˡ�      <title>$page @{[&escape(&get_subjectline($page))]}</title>
415  ¾�οͤ�Ʊ���ڡ����򹹿����Ƥ��ޤä��褦�Ǥ���      <link rel="index" href="$url_cgi?$IndexPage">
416  </p><p>      <link rev="made" href="mailto:$modifier_mail">
417  �ʲ��ˡ����ʤ����Խ������ƥ����Ȥ�����ޤ��Τǡ�      <link rel="stylesheet" type="text/css" href="$url_stylesheet">
418  ���ʤ����Խ����Ƥ������ʤ��褦�ˡ�  </head>
419  ���ޤ��������Ģ�ʤɤ˥��ԡ����ڡ����Ȥ��Ƥ���������  <body class="$bodyclass">
420  </p><p>  <div class="tools">
421  ���ԡ����ڡ����Ȥ��Ѥ�Ǥ��顢      @{[ $admineditable
422  �ǿ������Ƥ򸫤ƺ����Խ���ľ���Ƥ���������          ? qq(<a title="$resource{admineditthispage}" href="$url_cgi?mycmd=adminedit;mypage=$cookedpage">$resource{admineditbutton}</a> | )
423  �ǿ������Ƥ�          : qq()
424  <a target="_blank" href="$thisurl?mycmd=read;mypage=$form{mypage}">$form{mypage}</a>      ]}
425  �Ǹ��뤳�Ȥ��Ǥ��ޤ���      @{[ $editable
426  </p>          ? qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=$cookedpage">$resource{editbutton}</a> | )
427  EOD          : qq()
428          # &print_toolbar($page_name);      ]}
429          &print_preview_buttons($page_name, &escape($form{mymsg}), $form{mydigest});      @{[ $admineditable
430          &print_footer;          ? qq(<a href="$url_cgi?mycmd=diff;mypage=$cookedpage">$resource{diffbutton}</a> | )
431          return;          : qq()
432      }      ]}
433        <a href="$url_cgi?$CreatePage">$resource{createbutton}</a> |
434      # diff����      <a href="$url_cgi?$IndexPage">$resource{indexbutton}</a> |
435      {      <a href="$url_cgi?$RssPage">$resource{rssbutton}</a> |
436          &opendiff;      <a href="$url_cgi?$FrontPage">$FrontPage</a> |
437          my @msg1 = split(/\n/, &get_page($page_name));      <a href="$url_cgi?$SearchPage">$resource{searchbutton}</a> |
438          my @msg2 = split(/\n/, $form{mymsg});      <a href="$url_cgi?$RecentChanges">$resource{recentchangesbutton}</a>
439          $msgrefA = \@msg1;  </div>
440          $msgrefB = \@msg2;  <h1 class="header"><a
441          &diff_check;      title="$resource{searchthispage}"
442          $diffbase{$form{mypage}} = $diff_text;      href="$url_cgi?mycmd=search;mymsg=$cookedpage">$page</a>@{[&escape(&get_subjectline($page))]}</h1>
443          $diff_text = '';  EOD
444          &closediff;  }
445      }  
446    sub print_footer {
447      &print_header($page_name);      my ($page) = @_;
448      &set_page($page_name, $form{mymsg});      $walrus_log = ($walrus_debugging) ? &text_to_html("----\n$walrus_log") : '';    # Walrus add (debug)
449      if ($form{mymsg}) {      # Walrus mod (1) start
450          print qq|<h1>$IconTag${page_name}�򹹿����ޤ���</h1>\n|;  my $cvslog = '$Revision$ $Date$';
451          &print_toolbar($page_name);      print <<"EOD";
452          print &convert_html(&get_page($page_name));  <div class="footer">
453      } else {  <p>
454          print qq|<h1>$IconTag${page_name}�������ޤ���</h1>\n|;  <a href="http://digit.que.ne.jp/work/">WalWiki</a> $walversion &copy; 2000-2002 by <a href="http://digit.que.ne.jp/">Makio Tsukamoto</a>.<br />
455          &print_toolbar($page_name);  based on <a href="http://www.hyuki.com/yukiwiki/">YukiWiki</a> $version &copy; 2000-2002 by <a href="http://www.hyuki.com/">Hiroshi Yuki</a>.<br />
456          print qq|<p>${page_name}�������ޤ�����</p>\n|;  <a href="/gate/cvs/wakaba/wiki/" title="CVS Repository">
457      }  $cvslog
458      &print_footer;  </a>
459      # �������줿�Τǥ��å����Ƥ�����  </p>
460      if ($touchfile) {  <div class="navigation">
461          open(FILE, "> $touchfile");  [<a href="/" title="���Υ����С��μ���">/</a>
462          print FILE "\n";  <a href="/map" title="���Υ����С��ΰ���">�Ͽ�</a>
463          close(FILE);  <a href="/search/" title="���Υ����С��θ���">����</a>]
464      }  </div>
465  }  </div>
466    $walrus_log
467  # �ڡ������ѹ���  </body>
468  sub do_diff {  </html>
469      if (not &is_editable($form{mypage})) {  EOD
470          # �Խ��Բĥڡ�����ɽ���Τ�  #       print <<"EOD";
471          &do_read;  #   <hr>
472          return;  #   <address class="footer">
473      }  #       <a href="http://www.hyuki.com/yukiwiki/">YukiWiki</a> $version
474      &opendiff;  #       &copy; 2000-2002 by <a href="http://www.hyuki.com/">Hiroshi Yuki</a>.<br />
475      &print_header($form{mypage} . '���ѹ���');  #       Modified by <a href="$modifier_url">$modifier_name</a>.
476      print qq|<h1>$IconTag <a href="$thisurl?mycmd=read&mypage=$form{mypage}">$form{mypage}</a>���ѹ���</h1>\n|;  #   </address>
477      &print_toolbar();  #   <p class="footer">
478      $_ = &escape($diffbase{$form{mypage}});  #       <a href="http://www.hyuki.com/yukiwiki/">$icontag</a>
479      print <<"EOD";  #   </p>
480  <ul>  #   </body>
481  <li>�ɲä��줿�Ԥ�<ins>�Ŀ�</ins>�Ǥ���  #   </html>
482  <li>������줿�Ԥ�<del>�ֿ�</del>�Ǥ���  #   EOD
483  <li><a href="$thisurl?mycmd=read;mypage=$form{mypage}">$form{mypage}</a>�عԤ���      # Walrus mod (1) end
484  </ul>  }
485  <hr />  
486  EOD  sub escape {
487      print qq|<pre>\n|;      my $s = shift;
488      foreach (split(/\n/, $_)) {      $s =~ s|\r\n|\n|g;
489          if (/^\+(.*)/) {      $s =~ s|\&|&amp;|g;
490              print qq|<ins>$1</ins>\n|;      $s =~ s|<|&lt;|g;
491          } elsif (/^\-(.*)/) {      $s =~ s|>|&gt;|g;
492              print qq|<del>$1</del>\n|;      $s =~ s|"|&quot;|g;
493          } elsif (/^\=(.*)/) {      return $s;
494              print qq|$1\n|;  }
495          } else {  
496              print qq|??? $_\n|;  sub unescape {
497          }      my $s = shift;
498      }      # $s =~ s|\n|\r\n|g;
499      print qq|</pre>\n|;      $s =~ s|\&amp;|\&|g;
500      &print_footer;      $s =~ s|\&lt;|\<|g;
501      &closediff;      $s =~ s|\&gt;|\>|g;
502  }      $s =~ s|\&quot;|\"|g;
503        return $s;
504  sub opendiff {  }
505      if ($dbmopen) {  
506          if (!dbmopen(%diffbase, $diffdbname, 0666)) {  sub print_content {
507              &print_error("(dbmopen) $diffdbname �����ޤ���");      my ($rawcontent) = @_;
508          }      print &text_to_html($rawcontent, toc=>1);
509      } else {  }
510          if (!tie(%diffbase, "YukiWikiDB", $diffdbname)) {  
511              &print_error("(tie error)");  sub text_to_html {
512          }      my ($txt, %option) = @_;
513      }      my (@txt) = split(/\n/, $txt);
514  }      my (@toc);
515        my $tocnum = 0;
516  sub closediff {      my (@saved, @result);
517      if ($dbmopen) {      unshift(@saved, "</p>");
518          dbmclose(%diffbase);      push(@result, "<p>");
519      } else {      foreach (@txt) {
520          untie(%diffbase);          chomp;
521      }          # Walrus mod (6) start
522  }          #if ($saved[0] eq '</html>') {
523            #    if (/<\/html>/i) { splice(@saved); }
524  # �ե����फ��ξ����Ϣ������ %form �������          #    else { push (@result, &html_to_ignored_html($_)); }
525  # &init_form('euc');          #} elsif (/^<html>/i and &is_ignore_html($form{mypage})) {
526  sub init_form {          #    push(@result, splice(@saved));
527      my ($charcode) = @_;          #    push(@saved, '</html>');
528      my $query;          #} els
529      if ($ENV{REQUEST_METHOD} =~ /^post$/i) {          if (/^\*\*\*\*\*(.*)/) {
530          read(STDIN, $query, $ENV{CONTENT_LENGTH});              push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
531      } else {              push(@result, splice(@saved), qq(<h6 id="i$tocnum">) . &inline($1) . '</h6>');
532          $query = $ENV{QUERY_STRING};              $tocnum++;
533      }          } elsif (/^\*\*\*\*(.*)/) {
534      my @assocarray = split(/[&;]/, $query);              push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
535      foreach my $assoc (@assocarray) {              push(@result, splice(@saved), qq(<h5 id="i$tocnum">) . &inline($1) . '</h5>');
536          my ($property, $value) = split(/=/, $assoc);              $tocnum++;
537          $value =~ tr/+/ /;          } elsif (/^\*\*\*(.*)/) {
538          $value =~ s/%([A-Fa-f0-9][A-Fa-f0-9])/pack("C", hex($1))/eg;              push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
539          &jcode::convert(\$value, $charcode);              push(@result, splice(@saved), qq(<h4 id="i$tocnum">) . &inline($1) . '</h4>');
540          $form{$property} = $value;              $tocnum++;
541      }          } elsif (/^\*\*(.*)/) {
542  }          # if (/^\*\*(.*)/) {
543            # Walrus mod (6) end
544  # ���顼�ڡ�������Ϥ���              push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
545  sub print_error {              push(@result, splice(@saved), qq(<h3><a name="i$tocnum"> </a>) . &inline($1) . '</h3>');
546      my ($msg) = @_;              $tocnum++;
547      &print_header('Error');          } elsif (/^\*(.*)/) {
548      print "<h1>$IconTag$msg</h1></body></html>";              push(@toc, qq(- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
549      exit(0);              push(@result, splice(@saved), qq(<h2><a name="i$tocnum"> </a>) . &inline($1) . '</h2>');
550  }              $tocnum++;
551            #} elsif (/^----/) {
552  sub escape {          #    push(@result, splice(@saved), '<hr>');
553      my ($line) = shift;          } elsif (/^(={1,5})(.*)/) {
554      $line =~ s|<|&lt;|g;              &back_push('ol', length($1), \@saved, \@result);
555      $line =~ s|>|&gt;|g;              push(@result, '<li>' . &inline($2) . '</li>');
556      $line =~ s|"|&quot;|g;          } elsif (/^(-{1,5})(.*)/) {
557      # $line =~ s|\&|&amp;|g;              &back_push('ul', length($1), \@saved, \@result);
558      return $line;              push(@result, '<li>' . &inline($2) . '</li>');
559  }          } elsif (/^:([^:]+):(.*)/) {
560                &back_push('dl', 1, \@saved, \@result);
561  sub inline {              push(@result, '<dt>' . &inline($1) . '</dt>', '<dd>' . &inline($2) . '</dd>');
562      my ($line) = shift;          } elsif (/^(>{1,5})(.*)/) {
563      $line = &escape($line);              &back_push('blockquote', length($1), \@saved, \@result);
564      $line =~ s|'''([^']+?)'''|<strong>$1</strong>|g;              push(@result, &inline($2));
565      $line =~ s|''([^']+?)''|<em>$1</em>|g;                    } elsif (/^\s*$/) {
566      $line =~ s!              push(@result, splice(@saved));
567         (              unshift(@saved, "</p>");
568           (?:&lt;(?:mailto|http|https|ftp|urn):[\x21-\x7E]*)&gt;              push(@result, "<p>");
569         #| (?:$WikiName)                         # LocalLinkLikeThis          } elsif (/^(\s+.*)$/) {
570         | (?:$BracketName)                      # [[���ܸ���]]              &back_push('pre', 1, \@saved, \@result);
571         )              #push(@result, &escape($1)); # Not &inline, but &escape
572              !              push(@result, &inline($1)); # Not &inline, but &escape
573                  &make_link($1)  #       } elsif (/^\,(.*)$/) {             # Walrus del (BF)
574              !gex;          } elsif (/^\,(.*?)[\x0D\x0A]*$/) { # Walrus add (BF)
575      return $line;              &back_push('table', 1, \@saved, \@result, ' border="1"');
576  }              #######
577                # This part is taken from Mr. Ohzaki's Perl Memo and Makio Tsukamoto's WalWiki.
578  # �ڡ����Υ����ȥ뤫��ڡ��������Ƥ�����              # XXXXX
579  sub get_page {              my $tmp = "$1,";
580      my $page_name = shift;              my @value = map {/^"(.*)"$/ ? scalar($_ = $1, s/""/"/g, $_) : $_} ($tmp =~ /("[^"]*(?:""[^"]*)*"|[^,]*),/g);
581      return $database{$page_name};              my @align = map {(s/^\s+//) ? ((s/\s+$//) ? ' align="center"' : ' align="right"') : ''} @value;
582  }              my @colspan = map {($_ eq '==') ? 0 : 1} @value;
583                for (my $i = 0; $i < @value; $i++) {
584  # �ڡ��������Ƥ�Ϳ����                  if ($colspan[$i]) {
585  # &set_page($title, $txt)                      while ($i + $colspan[$i] < @value and $value[$i + $colspan[$i]] eq '==') {
586  sub set_page {                          $colspan[$i]++;
587      # �ڡ����򹹿�����                      }
588      my $title = $_[0];                      $colspan[$i] = ($colspan[$i] > 1) ? sprintf(' colspan="%d"', $colspan[$i]) : '';
589      $database{$title} = $_[1];                      $value[$i] = sprintf('<td%s%s>%s</td>', $align[$i], $colspan[$i], &inline($value[$i]));
590      # ���ڡ����ʤ�������                  } else {
591      unless ($database{$title}) {                      $value[$i] = '';
592          delete $database{$title};                  }
593      }              }
594      # RecentChanges�򹹿�����              push(@result, join('', '<tr>', @value, '</tr>'));
595      my $delim = ' - ';              # XXXXX
596      my @pages = split(/\n/, $database{$whatsnew});              #######
597      my $datestr = &get_current_datestr;          } else {
598      unshift(@pages, qq|-$datestr$delim$title|);              push(@result, &inline($_));
599      # Ʊ��ڡ����ι����Ϻǿ��Τ�ΤΤߤˤ���          }
600      # ¸�ߤ��ʤ��ڡ����ϥ����åפ��롣      }
601      my %count;      push(@result, splice(@saved));
602      my @newpages;  
603      foreach my $line (@pages) {      if ($option{toc}) {
604          my ($prefix, $title) = split(/$delim/, $line);          # Convert @toc (table of contents) to HTML.
605          $count{$title}++;          # This part is taken from Makio Tsukamoto's WalWiki.
606          if ($count{$title} == 1 and exists($database{$title})) {          my (@tocsaved, @tocresult);
607              push(@newpages, qq|$prefix - $title|);          foreach (@toc) {
608          }              if (/^(-{1,3})(.*)/) {
609      }                  &back_push('ul', length($1), \@tocsaved, \@tocresult);
610      # �����������˹���                  push(@tocresult, '<li>' . $2 . '</li>');
611      $database{$whatsnew} = join("\n", splice(@newpages, 0, $maxnew));              }
612  }          }
613            push(@tocresult, splice(@tocsaved));
614  # �ڡ����Υإå������          return join("\n", @tocresult, @result);
615  sub print_header {      } else {
616      my $title = shift;          return join("\n", @result);
617      print <<"EOD";      }
618  Content-type: text/html  }
619    
620  <html><head>  sub back_push {
621  <title>$title</title>      my ($tag, $level, $savedref, $resultref, $attr) = @_;
622  <style type="text/css">      while (@$savedref > $level) {
623  $style          push(@$resultref, shift(@$savedref));
624  </style>      }
625  </head>      if ($savedref->[0] ne "</$tag>") {
626  <body>          push(@$resultref, splice(@$savedref));
627  EOD      }
628  }      while (@$savedref < $level) {
629            unshift(@$savedref, "</$tag>");
630  # �ġ���С������          push(@$resultref, "<$tag$attr>");
631  sub print_toolbar {      }
632      my $page_name = shift;  }
633      my $percent_name = &encode_percent($page_name);  
634      my $editlink = '';  sub inline {
635      if ($page_name ne '' and &is_editable($page_name)) {      my ($line) = @_;
636          $editlink = <<"EOD";      $line = &escape($line);
637  <a href="$thisurl?mycmd=edit;mypage=$percent_name">�Խ�</a> |      $line =~ s|'''([^']+?)'''|<strong>$1</strong>|g;
638  <a href="$thisurl?mycmd=diff;mypage=$percent_name">��ʬ</a> |      $line =~ s|''([^']+?)''|<em>$1</em>|g;
639  EOD      $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
640      }      $line =~ s!
641      print <<"EOD";        (
642  <p>          (?:&lt;(?:mailto|http|https|ftp|urn):[\x21-\x7E]*)&gt;
643   [        |
644  <a href="$thisurl?mycmd=read;mypage=$toppage">�ȥå�</a> |          ($bracket_name) # [[likethis]], [[#comment]], [[Friend:remotelink]]
645  <a href="$thisurl?mycmd=list">����</a> |        |
646  $editlink          ($interwiki_definition) # [[Friend http://somewhere/?q=sjis($1)]]
647  <a href="$thisurl?mycmd=search">ñ�측��</a> |        #|
648  <a href="$thisurl?mycmd=read;mypage=$whatsnew">�ǽ�����</a>        #  ($wiki_name)
649   ]        )
650  </p>              !
651  EOD                  &make_link($1)
652  }              !gex;
653        return $line;
654  # �ڡ����Υեå������  }
655  sub print_footer {  
656      print <<"EOD";  sub make_link {
657  <address>      my $chunk = shift;
658  <a href="http://www.hyuki.com/yukiwiki/">YukiWiki</a> 1.6.6 Copyright (C) 2000,2001 by <a href="http://www.hyuki.com/">Hiroshi Yuki.</a>      # Walrus add (3) start
659  + <a href="$modifierlink">$modifier</a> ${version}.      my $name  = $chunk;
660  [<a href="/" title="���Υ����С��μ���">/</a>      $name =~ s/^&lt;(.*)&gt;$/$1/;
661  <a href="/map" title="���Υ����С��ΰ���">�Ͽ�</a>      if ($chunk =~ /^\[\[([^ ]+?) ([^ ]+?)\]\]$/ and $form{mypage} ne $InterWikiName) {
662  <a href="/search/" title="���Υ����С��θ���">����</a>]          ($name, $chunk) = ($1, $2);
663  </address>      } elsif ($chunk =~ /^mailto:(.*)$/) {
664  </body></html>          $name = $1;
665  EOD      }
666  }      if ($use_autoimg and $name =~ /^(http|https|ftp|):.+\.(png|gif|jpe?g)/) {
667            $name = qq(<img src="$name">) ;
668  # URL��ڡ�����̾�������󥯤���      }
669  sub make_link {      $name = &unarmor_name($name);
670      my $name = shift;      # Walrus add (3) end
671      $name =~ s/^&lt;(.*)&gt;$/$1/;      if ($chunk =~ /^(http|https|ftp):/) {
672      $name =~ s/^\[\[(.*)\]\]$/$1/;          # Walrus mod (3) start
673      if ($name =~ /^(http|https|ftp).*?(\.png|\.jpeg|\.jpg)?$/) {  #       if ($use_autoimg and $chunk =~ /\.(gif|png|jpeg|jpg)$/) {
674          if ($2) {  #           return qq(<a href="$chunk"><img src="$chunk"></a>);
675              return qq|<a href="$name"><img border="0" src="$name" /></a>|;  #       } else {
676          } else {  #           return qq(<a href="$chunk">$chunk</a>);
677              return qq|&lt;<a href="$name">$name</a>&gt;|;  #       }
678          }          return qq(<a href="$chunk">$name</a>);
679      } elsif ($name =~ /^mailto:(.*)/) {          # Walrus mod (3) end
680          my $address = $1;      } elsif ($chunk =~ m#^urn:[0-9A-Za-z_:;/.-]+#) {
681          return qq|&lt;<a href="$name">$address</a>&gt;|;          return qq|&lt;<a href="/uri-res/N2L?${name}">$name</a>&gt;|;
682      } elsif ($name =~ /^urn:[0-9A-Za-z_:-]+/) {      } elsif ($chunk =~ /^mailto:(.*)/) {
683          return qq|&lt;<a href="/uri-res/N2L?${name}">$name</a>&gt;|;  #       return qq(<a href="$chunk">$2</a>);                 # Walrus del (3)
684      } else {          return qq(&lt;<a href="$chunk">$name</a>&gt;);              # Walrus add (3)
685        my $name2 = $name; $name2 =~ tr/\x20/-/;      } elsif ($chunk =~ /^$interwiki_definition$/) {
686        if ($database{$name2}) {  #       return qq(<span class="InterWiki">$chunk</span>);   # Walrus del (3)
687          my $percent_name = &encode_percent($name2);          return qq(<span class="InterWiki">$name</span>);    # Walrus add (3)
688          return qq|<a href="$thisurl?mycmd=read;mypage=$percent_name" class="wiki">$name</a>|;      } elsif ($chunk =~ /^$embedded_name$/) {
689        } elsif ($database{'[['.$name2.']]'}) {          return &embedded_to_html($chunk);
690          my $percent_name = &encode_percent('[['.$name2.']]');      } else {
691          return qq|<a href="$thisurl?mycmd=read;mypage=$percent_name" class="wiki">$name</a>|;          $chunk = &unarmor_name($chunk);
692        } else {          $chunk = &unescape($chunk); # To treat '&' or '>' or '<' correctly.
693          my $percent_name = &encode_percent($name2);          my $cookedchunk = &encode($chunk);
694          return qq|<a href="$thisurl?mycmd=edit;mypage=$percent_name" class="wiki newpage">$name?</a>|;          if ($chunk =~ /^$interwiki_name$/) {
695        }              my ($intername, $localname) = ($1, $2);
696      }              my $remoteurl = $interwiki{$intername};
697  }              if ($remoteurl) {
698    #               $remoteurl =~ s/\b(euc|sjis|ykwk|asis)\(\$1\)/&interwiki_convert($1, $localname)/e;      # Walrus del (4)
699  # %xx �η����˥��󥳡��ɤ���                  $remoteurl =~ s/\b(euc|sjis|ykwk|asis|isbn)\(\$1\)/&interwiki_convert($1, $localname)/e; # Walrus add (4)
700  # ����ϡ�  #               return qq(<a href="$remoteurl">$chunk</a>); # Walrus del (3)
701  # http://www.hyuki.com/yukiwiki/yukiwiki.cgi?mycmd=read&mypage=%3C%8C%8B%8F%E9%8D_%3E                  return qq(<a href="$remoteurl">$name</a>);  # Walrus add (3)
702  # �Ȥ��������Τ���˻Ȥ��롣              } else {
703  # '<����>' �� '%3C%8C%8B%8F%E9%8D_%3E'  #               return $chunk;                              # Walrus del (3)
704  sub encode_percent {                  return $name;                               # Walrus add (3)
705      my $name = shift;              }
706      my $encoded = '';          } elsif ($database{$chunk}) {
707      foreach my $ch (split(//, $name)) {              my $subject = &escape(&get_subjectline($chunk, delimiter => ''));
708          if ($ch =~ /[A-Za-z0-9_]/) {  #           return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$chunk</a>);  # Walrus del (3)
709              $encoded .= $ch;              return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$name</a>);   # Walrus add (3)
710          } else {          } elsif ($page_command{$chunk}) {
711              $encoded .= '%' . sprintf("%02X", ord($ch));  #           return qq(<a title="$chunk" href="$url_cgi?$cookedchunk">$chunk</a>);    # Walrus del (3)
712          }              return qq(<a title="$chunk" href="$url_cgi?$cookedchunk">$name</a>);     # Walrus add (3)
713      }          } else {
714      return $encoded;  #           return qq($chunk<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit&amp;mypage=$cookedchunk">$editchar</a>); # Walrus del (3)
715  }              return qq($name<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit&amp;mypage=$cookedchunk">$editchar</a>);  # Walrus add (3)
716            }
717  # �ƥ��������Τ�HTML���Ѵ�����      }
718  sub convert_html {  }
719      my ($txt) = shift;  
720      my (@txt) = split(/\n/, $txt);  # Walrus add (6) start
721      foreach (@txt) {  sub is_ignore_html {
722          chomp;      my ($pagename) = @_;
723          if (/^\*\*(.*)/) {      foreach (@ignore_html_page) {
724              push(@result, splice(@saved), '<h3>' . &inline($1) . '</h3>');          return 1 if ($pagename eq $_);
725          } elsif (/^\*(.*)/) {      }
726              push(@result, splice(@saved), '<h2>' . &inline($1) . '</h2>');      return 0;
727          } elsif (/^----/) {  }
728              push(@result, splice(@saved), '<hr>');  # Walrus add (6) end
729          } elsif (/^(-{1,3})(.*)/) {  
730              &back_push('ul', length($1));  # Walrus add (6) start
731              push(@result, '<li>' . &inline($2) . '</li>');  sub html_to_ignored_html {
732          } elsif (/^:([^:]+):(.*)/) {      my $str = shift(@_);
733              &back_push('dl', 1);      my $text_regex        = q{[^<]*};
734              push(@result, '<dt>' . &inline($1) . '</dt>', '<dd>' . &inline($2) . '</dd>');      my $tag_regex_        = q{[^"'<>]*(?:"[^"]*"[^"'<>]*|'[^']*'[^"'<>]*)*(?:>|(?=<)|$(?!\n))}; #'}}}}
735          } elsif (/^(>{1,3})(.*)/) {      my $comment_tag_regex = '<!(?:--[^-]*-(?:[^-]+-)*?-(?:[^>-]*(?:-[^>-]+)*?)??)*(?:>|$(?!\n)|--.*$)';
736              &back_push('blockquote', length($1));      my $tag_regex         = qq{$comment_tag_regex|<$tag_regex_};
737              push(@result, &inline($2));      my $ignored           = join('|', @ignore_html_tags);
738          } elsif (/^\s*$/) {      my $result = '';
739              push(@result, splice(@saved));      while ($str =~ /($text_regex)($tag_regex)?/gso) {
740              unshift(@saved, "</p>");        last if $1 eq '' and $2 eq '';
741              push(@result, "<p>");        $result .= $1;
742          } elsif (/^(\s+.*)$/) {        my $tag_tmp = $2;
743              &back_push('pre', 1);        $result .= ($tag_tmp =~ /^<\/?($ignored)(?![0-9A-Za-z])/i) ? $tag_tmp : &escape($tag_tmp);
744              push(@result, &escape($1)); # Not &inline, but &escape        if ($tag_tmp =~ /^<(XMP|PLAINTEXT|SCRIPT)(?![0-9A-Za-z])/i) {
745          } else {          $str =~ /(.*?)(?:<\/$1(?![0-9A-Za-z])$tag_regex_|$)/gsi;
746              push(@result, &inline($_));          $result .= &escape($1);
747          }        }
748      }      }
749      push(@result, splice(@saved));      return $result;
750      return join("\n", @result);  }
751  }  # Walrus add (6) end
752    
753  # &back_push($tag, $count)  sub print_message {
754  # $tag�Υ�����$level��٥�ޤǵͤ�롣      my ($msg) = @_;
755  sub back_push {      print qq(<p><strong>$msg</strong></p>);
756      my ($tag, $level) = @_;  }
757      while (@saved > $level) {  
758          push(@result, shift(@saved));  sub init_form {
759      }      if (param()) {
760      if ($saved[0] ne "</$tag>") {          foreach my $var (param()) {
761          push(@result, splice(@saved));              $form{$var} = param($var);
762      }          }
763      while (@saved < $level) {      } else {
764          unshift(@saved, "</$tag>");          $ENV{QUERY_STRING} = $FrontPage;
765          push(@result, "<$tag>");      }
766      }  
767  }      my $query = &decode($ENV{QUERY_STRING});
768        if ($page_command{$query}) {
769  # �Խ���ǽ�ڡ�������          $form{mycmd} = $page_command{$query};
770  sub is_editable {          $form{mypage} = $query;
771      my ($pagename) = @_;      } elsif ($query =~ /^($wiki_name)$/) {
772      foreach (@uneditable) {          $form{mycmd} = 'read';
773          if ($pagename eq $_) {          $form{mypage} = $1;
774              return 0;      } elsif ($database{$query}) {
775          }          $form{mycmd} = 'read';
776      }          $form{mypage} = $query;
777      if (&is_valid_name($pagename)) {      }
778          return 1;  
779      }      # mypreview_edit        -> do_edit, with preview.
780      return 0;      # mypreview_adminedit   -> do_adminedit, with preview.
781  }      # mypreview_write       -> do_write, without preview.
782        foreach (keys %form) {
783  # Valid��̾������          if (/^mypreview_(.*)$/) {
784  sub is_valid_name {              $form{mycmd} = $1;
785      my ($pagename) = @_;              $form{mypreview} = 1;
786      if ($pagename =~ /^$WikiName$/) {          }
787          return 1;      }
788      } elsif ($pagename =~ /^$BracketName$/) {  
789          return 1;      #
790      } else {      # $form{mycmd} is frozen here.
791          return 0;      #
792      }  
793  }      $form{mymsg} = &code_convert(\$form{mymsg}, $kanjicode);
794        $form{myname} = &code_convert(\$form{myname}, $kanjicode);
795  # ���߻����ʸ���������  }
796  sub get_current_datestr {  
797      my (@wdays) = ( "��", "��", "��", "��", "��", "��", "��" );  sub update_recent_changes {
798      my ($sec, $min, $hour, $mday, $mon, $year, $wday) = localtime(time);      my $update = "- @{[&get_now]} @{[&armor_name($form{mypage})]} @{[&get_subjectline($form{mypage})]}";
799      return sprintf("%4d-%02d-%02d (%s) %02d:%02d:%02d",      my @oldupdates = split(/\r?\n/, $database{$RecentChanges});
800          $year + 1900, $mon + 1, $mday, $wdays[$wday], $hour, $min, $sec);      my @updates;
801  }      foreach (@oldupdates) {
802            /^\- \d\d\d\d\-\d\d\-\d\d \(...\) \d\d:\d\d:\d\d (\S+)/;    # date format.
803  # URL?SomePage�䡢          my $name = &unarmor_name($1);
804  # URL?[[����]]�η������ä���硢(not yet)          if (&is_exist_page($name) and ($name ne $form{mypage})) {
805  # ����Ū��mycmd��read�ˤ���$form�����Ƥ����ꤹ�롣              push(@updates, $_);
806  sub normalize_form {          }
807      foreach my $key (keys %form) {      }
808          if ($key =~ /^$WikiName$/) {      if (&is_exist_page($form{mypage})) {
809              $form{mycmd} = 'read';          unshift(@updates, $update);
810              $form{mypage} = $1;      }
811              last;      splice(@updates, $maxrecent + 1);
812          } elsif ($key =~ /^$BracketName$/) {      $database{$RecentChanges} = join("\n", @updates);
813              $form{mycmd} = 'read';      if ($file_touch) {
814              $form{mypage} = $1;          open(FILE, "> $file_touch");
815              last;          print FILE localtime() . "\n";
816          }          close(FILE);
817      }      }
818  }  }
819    
820  # �Ѵ��ƥ��Ȥ�Ԥʤ��Ȥ��Υ���ץ�  sub get_subjectline {
821  sub print_sample {      my ($page, %option) = @_;
822      my $txt = &convert_html(<<"EOD");      if (not &is_editable($page)) {
823  *�縫�Ф�1          return "";
824  **�����Ф�1-1      } else {
825  -����1          # Delimiter check.
826  -����2          my $delim = $subject_delimiter;
827  -����3          if (defined($option{delimiter})) {
828  ����1����1����1����1����1����1����1����1����1����1����1����1              $delim = $option{delimiter};
829  ����1����1����1����1����1����''��Ĵ''1����1����1����1����1����1          }
830  ����1����1����1����1����1����1����1����1����1����1����1����1  
831            # Get the subject of the page.
832  ����2����2����2����2����2����2����2����2����2����2����2����2          my $subject = $database{$page};
833  ����2����2����2����2����2����2����2����2����2����2����2����2          $subject =~ s/\r?\n.*//s;
834  ����2����2����2����2����2����2����2����2����2����2����2����2          return "$delim$subject";
835  **�����Ф�1-2      }
836  :�Ѹ�1:���������񤤤�����ʸ1��''��Ĵñ��''  }
837  ����1����1����1����1����1����1����1����1����1����1����1����1  
838  ����1����1����1����1����1����1����1����1����1����1����1����1  sub send_mail_to_admin {
839  ����1����1����1����1����1����1����1����1����1����1����1����1      my ($page, $mode) = @_;
840  :�Ѹ�2:���������񤤤�����ʸ2      return unless $modifier_sendmail;
841  :�Ѹ�3:���������񤤤�����ʸ3      my $message = <<"EOD";
842  ----  To: $modifier_mail
843  *�縫�Ф�2  From: $modifier_mail
844  **�����Ф�2-1  Subject: [Wiki]
845  &lt;http://suika.fam.cx/&gt;  MIME-Version: 1.0
846  **�����Ф�2-2  Content-Type: text/plain; charset=ISO-2022-JP
847    Content-Transfer-Encoding: 7bit
848  [[����]]  
849    --------
850  ����1����1����1����1����1����1����1����1����1����1����1����1  MODE = $mode
851  ����1����1����1����'''��Ĵ'''1����1����1����1����1����1����1����1  REMOTE_ADDR = $ENV{REMOTE_ADDR}
852  ����1����1����1����'''''������Ĵ'''''1����1����1����1����1����1����1����1����1  REMOTE_HOST = $ENV{REMOTE_HOST}
853  >����2����2����2����2����2����2����2����2����2����2����2����2  --------
854  >����2����2����2����2����2����2����2����2����2����2����2����2  $page
855  >����2����2����2����2����2����2����2����2����2����2����2����2  --------
856    $database{$page}
857  ��٥�0��٥�0��٥�0��٥�0��٥�0��٥�0  --------
858    EOD
859  >��٥�1      &code_convert(\$message, 'jis');
860  >��٥�1      open(MAIL, "| $modifier_sendmail");
861  >��٥�1      print MAIL $message;
862  >>��٥�2      close(MAIL);
863  >>��٥�2  }
864  >>��٥�2  
865  >>>��٥�3  sub open_db {
866  -�Ϥ�1      if ($modifier_dbtype eq 'dbmopen') {
867  --�Ϥ�2          dbmopen(%database, $dataname, 0666) or &print_error("(dbmopen) $dataname");
868  ��������2          dbmopen(%infobase, $infoname, 0666) or &print_error("(dbmopen) $infoname");
869  ---�Ϥ�3      } elsif ($modifier_dbtype eq 'AnyDBM_File') {
870  --�Ϥ�2          tie(%database, "AnyDBM_File", $dataname, O_RDWR|O_CREAT, 0666) or &print_error("(tie AnyDBM_File) $dataname");
871  ---�Ϥ�3          tie(%infobase, "AnyDBM_File", $infoname, O_RDWR|O_CREAT, 0666) or &print_error("(tie AnyDBM_File) $infoname");
872  --�Ϥ�2      } else {
873  ---�Ϥ�3          tie(%database, "Yuki::YukiWikiDB", $dataname) or &print_error("(tie Yuki::YukiWikiDB) $dataname");
874  >>>��٥�3          tie(%infobase, "Yuki::YukiWikiDB", $infoname) or &print_error("(tie Yuki::YukiWikiDB) $infoname");
875  >>>��٥�3      }
876  >>>��٥�3  }
877  EOD  
878      print $txt;  sub close_db {
879      exit;      if ($modifier_dbtype eq 'dbmopen') {
880  }          dbmclose(%database);
881            dbmclose(%infobase);
882  sub diff_check {      } elsif ($modifier_dbtype eq 'AnyDBM_File') {
883      traverse_sequences(          untie(%database);
884              $msgrefA, $msgrefB,          untie(%infobase);
885              {      } else {
886                  MATCH => \&df_match,          untie(%database);
887                  DISCARD_A => \&df_delete,          untie(%infobase);
888                  DISCARD_B => \&df_add,      }
889              }  }
890      );  
891      &diff_flush;  sub open_diff {
892  }      if ($modifier_dbtype eq 'dbmopen') {
893            dbmopen(%diffbase, $diffname, 0666) or &print_error("(dbmopen) $diffname");
894  sub diff_flush {      } elsif ($modifier_dbtype eq 'AnyDBM_File') {
895      $diff_text .= join('', map { "-$_\n" } splice(@diff_deleted));          tie(%diffbase, "AnyDBM_File", $diffname, O_RDWR|O_CREAT, 0666) or &print_error("(tie AnyDBM_File) $diffname");
896      $diff_text .= join('', map { "+$_\n" } splice(@diff_added));      } else {
897  }          tie(%diffbase, "Yuki::YukiWikiDB", $diffname) or &print_error("(tie Yuki::YukiWikiDB) $diffname");
898        }
899  sub df_match {  }
900      my ($a, $b) = @_;  
901      &diff_flush;  sub close_diff {
902      $diff_text .= "=$msgrefA->[$a]\n";      if ($modifier_dbtype eq 'dbmopen') {
903  }          dbmclose(%diffbase);
904        } elsif ($modifier_dbtype eq 'AnyDBM_File') {
905  sub df_delete {          untie(%diffbase);
906      my ($a, $b) = @_;      } else {
907      push(@diff_deleted, $msgrefA->[$a]);          untie(%diffbase);
908  }      }
909    }
910  sub df_add {  
911      my ($a, $b) = @_;  sub print_searchform {
912      push(@diff_added, $msgrefB->[$b]);      my ($word) = @_;
913  }      print <<"EOD";
914    <form action="$url_cgi" method="get">
915  sub calc_message_digest {   # You have to use MD5...      <input type="hidden" name="mycmd" value="search">
916      my $text = shift;      <input type="text" name="mymsg" value="$word" size="20">
917      my @text = split(//, $text);      <input type="submit" value="$resource{searchbutton}">
918      my $len = length($text);  </form>
919      my $checksum = 0;  EOD
920      foreach (@text) {  }
921          $checksum += ord($_);  
922          $checksum = ($checksum * 2) % 65536 + (($checksum & 32768) ? 1 : 0); # 16bit rotate  sub print_editform {
923      }      my ($mymsg, $lastmodified, %mode) = @_;
924      return "$len:$checksum";      my $frozen = &is_frozen($form{mypage});
925  }  
926        if ($form{mypreview}) {
927  # Definition of YukiWikiDB          if ($form{mymsg}) {
928  package YukiWikiDB;              unless ($mode{conflict}) {
929                    print qq(<h3>$resource{previewtitle}</h3>\n);
930  my $debug = 1;                  print qq($resource{previewnotice}\n);
931                    print qq(<div class="preview">\n);
932  # Constructor                  &print_content($form{mymsg});
933  sub new {                  print qq(</div>\n);
934      return shift->TIEHASH(@_);              }
935  }          } else {
936                print qq($resource{previewempty});
937  # tying          }
938  sub TIEHASH {          $mymsg = &escape($form{mymsg});
939      my ($class, $dbname) = @_;      } else {
940      my $self = {          $mymsg = &escape($mymsg);
941          dir => $dbname,      }
942          keys => [],  
943      };      my $edit = $mode{admin} ? 'adminedit' : 'edit';
944      if (not -d $self->{dir}) {  
945          if (!mkdir($self->{dir}, 0777)) {      print <<"EOD";
946              print "mkdir(" . $self->{dir} . ") fail\n" if ($debug);  <form action="$url_cgi" method="post">
947              return undef;      @{[ $mode{admin} ? qq($resource{frozenpassword} <input type="password" name="mypassword" value="$form{mypassword}" size="10"><br>) : "" ]}
948          }      <input type="hidden" name="myLastModified" value="$lastmodified">
949      }      <input type="hidden" name="mypage" value="$form{mypage}">
950      return bless($self, $class);      <textarea cols="$cols" rows="$rows" name="mymsg" wrap="off">$mymsg</textarea><br>
951  }  @{[
952        $mode{admin} ?
953  # Store      qq(
954  sub STORE {      <input type="radio" name="myfrozen" value="1" @{[$frozen ? qq(checked="checked") : ""]}>$resource{frozenbutton}
955      my ($self, $key, $val) = @_;      <input type="radio" name="myfrozen" value="0" @{[$frozen ? "" : qq(checked="checked")]}>$resource{notfrozenbutton}<br>)
956      my $file = &make_filename($self, $key);      : ""
957      if (open(FILE,"> $file")) {  ]}
958          binmode(FILE);  @{[
959          print FILE $val;      $mode{conflict} ? "" :
960          close(FILE);      qq(
961          return $self->{$key} = $val;          <input type="checkbox" name="mytouch" value="on" checked="checked">$resource{touch}<br>
962      } else {          <input type="submit" name="mypreview_$edit" value="$resource{previewbutton}">
963          print "$file create error.";          <input type="submit" name="mypreview_write" value="$resource{savebutton}"><br>
964      }      )
965  }  ]}
966    </form>
967  # Fetch  EOD
968  sub FETCH {      unless ($mode{conflict}) {
969      my ($self, $key) = @_;          # Show the format rule.
970      my $file = &make_filename($self, $key);          open(FILE, $file_format) or &print_error("($file_format)");
971      if (open(FILE, $file)) {          my $content = join('', <FILE>);
972          local $/;          &code_convert(\$content, $kanjicode);
973          $self->{$key} = <FILE>;          close(FILE);
974          close(FILE);          print &text_to_html($content, toc=>0);
975      }      }
976      return $self->{$key};  }
977  }  
978    sub print_passwordform {
979  # Exists          print <<"EOD";
980  sub EXISTS {  <form action="$url_cgi" method="post">
981      my ($self, $key) = @_;      <input type="hidden" name="mycmd" value="adminchangepassword">
982      my $file = &make_filename($self, $key);      $resource{oldpassword} <input type="password" name="myoldpassword" size="10"><br>
983      return -e($file);      $resource{newpassword} <input type="password" name="mynewpassword" size="10"><br>
984  }      $resource{newpassword2} <input type="password" name="mynewpassword2" size="10"><br>
985        <input type="submit" value="$resource{changepasswordbutton}"><br>
986  # Delete  </form>
987  sub DELETE {  EOD
988      my ($self, $key) = @_;  }
989      my $file = &make_filename($self, $key);  
990      unlink $file;  sub is_editable {
991      return delete $self->{$key};      my ($page) = @_;
992  }      if (&is_bracket_name($page)) {
993            return 0;
994  sub FIRSTKEY {      } elsif ($fixedpage{$page}) {
995      my ($self) = @_;          return 0;
996      opendir(DIR, $self->{dir}) or die $self->{dir};      } elsif ($page =~ /\s/) {
997      @{$self->{keys}} = grep /\.txt$/, readdir(DIR);          return 0;
998      foreach my $name (@{$self->{keys}}) {      } elsif ($page =~ /^\#/) {
999          $name =~ s/\.txt$//;          return 0;
1000          $name =~ s/[0-9A-F][0-9A-F]/pack("C", hex($&))/eg;      } elsif ($page =~ /^$interwiki_name$/) {
1001      }          return 0;
1002      return shift @{$self->{keys}};      } else {
1003  }          return 1;
1004        }
1005  sub NEXTKEY {  }
1006      my ($self) = @_;  
1007      return shift @{$self->{keys}};  # armor_name:
1008  }  #   WikiName -> WikiName
1009    #   not_wiki_name -> [[not_wiki_name]]
1010  sub make_filename {  sub armor_name {
1011      my ($self, $key) = @_;      my ($name) = @_;
1012      my $enkey = '';      if ($name =~ /^$wiki_name$/) {
1013      foreach my $ch (split(//, $key)) {          return $name;
1014          $enkey .= sprintf("%02X", ord($ch));      } else {
1015      }          return "[[$name]]";
1016      return $self->{dir} . "/$enkey.txt";      }
1017  }  }
1018  __END__  
1019    # unarmor_name:
1020  =head1 NAME  #   [[bracket_name]] -> bracket_name
1021    #   WikiName -> WikiName
1022  YukiWiki - ��ͳ�˥ڡ������ɲá�������Խ��Ǥ���Web�ڡ�������CGI  sub unarmor_name {
1023        my ($name) = @_;
1024      Copyright (C) 2000,2001 by Hiroshi Yuki.      if ($name =~ /^$bracket_name$/) {
1025      ���� <hyuki@hyuki.com>          return $1;
1026      http://www.hyuki.com/      } else {
1027      http://www.hyuki.com/yukiwiki/          return $name;
1028        }
1029  =head1 SYNOPSIS  }
1030    
1031      http://www.hyuki.com/yukiwiki/yukiwiki.cgi  sub is_bracket_name {
1032        my ($name) = @_;
1033  =head1 DESCRIPTION      if ($name =~ /^$bracket_name$/) {
1034            return 1;
1035  YukiWiki�ʷ�륦�������ˤϻ��üԤ���ͳ�˥ڡ������ɲá�������Խ��Ǥ���      } else {
1036  �Ի׵Ĥ�Web�ڡ���������CGI�Ǥ���          return 0;
1037  Web��ư���Ǽ��ĤȤ���äȻ��Ƥ��ޤ�����      }
1038  Web�Ǽ��Ĥ�ñ�˥�å��������ɲä�������ʤΤ��Ф��ơ�  }
1039  YukiWiki�ϡ�Web�ڡ������Τ�ͳ���ѹ����뤳�Ȥ��Ǥ��ޤ���  
1040    sub decode {
1041  YukiWiki�ϡ�Cunningham & Cunningham��WikiWikiWeb��      my ($s) = @_;
1042  ���ͤ򻲹ͤˤ����ȼ��˺���ޤ�����      $s =~ tr/+/ /;
1043        $s =~ s/%([A-Fa-f0-9][A-Fa-f0-9])/pack("C", hex($1))/eg;
1044  YukiWiki��Perl�ǽ񤫤줿CGI������ץȤȤ��Ƽ¸�����Ƥ��ޤ��Τǡ�      return $s;
1045  Perl��ư���Web�����Фʤ�����Ū�ưפ����֤Ǥ��ޤ���  }
1046    
1047  ���Ȥ�dbmopen���Ȥ���Ķ��ʤ�����֤Ǥ��ޤ�(Version 1.5.0�ʹߤʤ�dbmopen���Ȥ��ʤ��Ƥ����֤Ǥ��ޤ�)��  sub encode {
1048        my ($s) = @_;
1049        my $encoded = '';
1050  YukiWiki�ϥե꡼���եȤǤ���      foreach my $ch (split(//, $s)) {
1051  ����ͳ�ˤ��Ȥ�����������          if ($ch =~ /[A-Za-z0-9_]/) {
1052                $encoded .= $ch;
1053  =head1 ������ˡ          } else {
1054                $encoded .= '%' . sprintf("%02X", ord($ch));
1055  =head2 ����          }
1056        }
1057  YukiWiki�κǿ��Ǥϡ�      return $encoded;
1058  http://www.hyuki.com/yukiwiki/  }
1059  ��������Ǥ��ޤ���  
1060    sub init_resource {
1061  =head2 �ե��������      open(FILE, $file_resource) or &print_error("(resource)");
1062        while (<FILE>) {
1063      readme.txt      �ɥ������          chomp;
1064      yukiwiki.cgi    YukiWiki����          next if /^#/;
1065      yukiwiki.gif    �����ʥ��顼�ǡ�          my ($key, $value) = split(/=/, $_, 2);
1066      yukimono.gif    �����ʥ�Υ����ǡ�          $resource{$key} = &code_convert(\$value, $kanjicode);
1067      jcode.pl        ���������ɥ饤�֥��      }
1068        close(FILE);
1069  =head2 ���󥹥ȡ���  }
1070    
1071  =over 4  sub conflict {
1072        my ($page, $rawmsg) = @_;
1073  =item 1.      if ($form{myLastModified} eq &get_info($page, $info_LastModified)) {
1074            return 0;
1075  ���������֤�򤯡�      }
1076        open(FILE, $file_conflict) or &print_error("(conflict)");
1077  =item 2.      my $content = join('', <FILE>);
1078        &code_convert(\$content, $kanjicode);
1079  yukiwiki.cgi�ΤϤ�������ˤ���������ǧ���ޤ���      close(FILE);
1080  �̾�ϲ��⤷�ʤ��Ƥ褤����      &print_header($page);
1081  �Ϥ����$touchfile��''�ˤ��������褤�Ǥ��礦��      &print_content($content);
1082        &print_editform($rawmsg, $form{myLastModified}, frozen=>0, conflict=>1);
1083  =item 3.      &print_footer($page);
1084        return 1;
1085  yukiwiki.cgi��jcode.pl��Ʊ���Ȥ��������֤��ޤ���  }
1086    
1087  =item 4.  sub get_now {
1088        my (@week) = qw(Sun Mon Tue Wed Thu Fri Sat);
1089  ������0��yukiwiki.db�Ȥ����ե���������֤��ޤ���      my ($sec, $min, $hour, $day, $mon, $year, $weekday) = localtime(time);
1090  ��Perl�����ƥ�ˤ�äƤ�yukiwiki.pag, yukiwiki.dir��      $year += 1900;
1091        $mon++;
1092  =item 5.      $mon = "0$mon" if $mon < 10;
1093        $day = "0$day" if $day < 10;
1094  yukiwiki.cgi�˥֥饦�����饢���������ޤ���      $hour = "0$hour" if $hour < 10;
1095        $min = "0$min" if $min < 10;
1096  =back      $sec = "0$sec" if $sec < 10;
1097        $weekday = $week[$weekday];
1098  =head2 �ѡ��ߥå����      return "$year-$mon-$day ($weekday) $hour:$min:$sec";
1099    }
1100          �ե�����        �ѡ��ߥå����      ž���⡼��  
1101          yukiwiki.cgi    755                 ASCII  # [[YukiWiki http://www.hyuki.com/yukiwiki/wiki.cgi?euc($1)]]
1102          yukiwiki.gif    644                 BINARY  sub init_InterWikiName {
1103          yukimono.gif    644                 BINARY      my $content = $database{$InterWikiName};
1104          jcode.pl        644                 ASCII      while ($content =~ /\[\[(\S+) +(\S+)\]\]/g) {
1105            my ($name, $url) = ($1, $2);
1106      $dbmopen = 1; �ˤ������:          $interwiki{$name} = $url;
1107          yukiwiki.db     666                 BINARY      }
1108          (yukiwiki.pag, yukiwiki.dir�ξ��⤢���  }
1109    
1110      $dbmopen = 0; �ˤ������: (�����ȥǥ��쥯�ȥ��777�ˤ��Ƥ���)  sub interwiki_convert {
1111          .               777                 (ž�����ʤ�)      my ($type, $localname) = @_;
1112        if ($type eq 'sjis' or $type eq 'euc') {
1113  =head1 �ǡ����ΥХå����å���ˡ          &code_convert(\$localname, $type);
1114            return &encode($localname);
1115  $dbmopen = 1;�ξ��ϡ�      } elsif ($type eq 'ykwk') {
1116  �ǡ����Ϥ��٤�yukiwiki.db(.dir, .pag)�����롣          # for YukiWiki1
1117  �����Хå����åפ���Ф褤��          if ($localname =~ /^$wiki_name$/) {
1118                return $localname;
1119  $dbmopen = 0;�ξ��ϡ�          } else {
1120  yukiwiki�Ȥ����ǥ��쥯�ȥ꤬�Ǥ���Τǡ�              &code_convert(\$localname, 'sjis');
1121  ����ʲ���Хå����åפ���Ф褤��              return &encode("[[" . $localname . "]]");
1122            }
1123  =head1 �������ڡ����κ����      } elsif ($type eq 'asis') {
1124            return $localname;
1125  =over 4      # Walrus add (4) start
1126        } elsif ($type eq 'isbn') {
1127  =item 1.          $localname = join('', ($localname =~ /[0-9x]/g)) if ($localname =~ /^(\d-?){9}[\dx]$/);
1128            return $localname;
1129  �ޤ���Ŭ���ʥڡ������㤨��FrontPage�ˤ����ӡ�      # Walrus add (4) end
1130  �ڡ����β��ˤ�����Խ��ץ�󥯤򤿤ɤ�ޤ���      } else {
1131            return $localname;
1132  =item 2.      }
1133    }
1134  ����ȥƥ��������Ϥ��Ǥ�����֤ˤʤ�Τǡ�  
1135  ������NewPage�Τ褦��ñ��  sub get_info {
1136  ����ʸ����ʸ�����ߤ��Ƥ����ʸ�����      my ($page, $key) = @_;
1137  ��񤤤ơ���¸�פ��ޤ���      my %info = map { split(/=/, $_, 2) } split(/\n/, $infobase{$page});
1138        return $info{$key};
1139  =item 3.  }
1140    
1141  ��¸����ȡ�FrontPage�Υڡ������񤭴���ꡢ  sub set_info {
1142  ���ʤ����񤤤�NewPage�Ȥ���ʸ����θ���� ? �Ȥ�����󥯤�ɽ������ޤ���      my ($page, $key, $value) = @_;
1143  ���� ? �Ϥ��Υڡ������ޤ�¸�ߤ��ʤ����Ȥ򼨤����Ǥ���      my %info = map { split(/=/, $_, 2) } split(/\n/, $infobase{$page});
1144        $info{$key} = $value;
1145  =item 4.      my $s = '';
1146        for (keys %info) {
1147  ���� ? �򥯥�å�����ȿ������ڡ���NewPage���Ǥ��ޤ��Τǡ�          $s .= "$_=$info{$_}\n";
1148  ���ʤ��ι�����ʸ�Ϥ򤽤ο������ڡ����˽񤤤���¸���ޤ���      }
1149        $infobase{$page} = $s;
1150  =item 5.  }
1151    
1152  NewPage�ڡ������Ǥ����FrontPage�� ? �Ͼä��ơ���󥯤Ȥʤ�ޤ���  sub frozen_reject {
1153        my ($isfrozen) = &get_info($form{mypage}, $info_IsFrozen);
1154  =back      my ($willbefrozen) = $form{myfrozen};
1155        if (not $isfrozen and not $willbefrozen) {
1156  =head1 �ƥ����������Υ롼��          # You need no check.
1157            return 0;
1158  =over 4      } elsif (valid_password($form{mypassword})) {
1159            # You are admin.
1160  =item *          return 0;
1161        } else {
1162  Ϣ³����ʣ���Ԥϥե��뤵���ɽ������ޤ���          &print_error($resource{passworderror});
1163            return 1;
1164  =item *      }
1165    }
1166  ���Ԥ�����C<< <p> >>�ζ��ڤ�Ȥʤ�ޤ���  
1167    sub valid_password {
1168  =item *      my ($givenpassword) = @_;
1169        my ($validpassword_crypt) = &get_info($AdminSpecialPage, $info_AdminPassword);
1170  HTML�Υ����Ͻ񤱤ޤ���      if (crypt($givenpassword, $validpassword_crypt) eq $validpassword_crypt) {
1171            return 1;
1172  =item *      } else {
1173            return 0;
1174  B<''�ܡ����''>�Τ褦�˥��󥰥륯��������ĤǤϤ���ȡ�      }
1175  �ܡ����C<< <b> >>�ˤʤ�ޤ���  }
1176    
1177  =item *  sub is_frozen {
1178        my ($page) = @_;
1179  B<'''������å�'''>�Τ褦�˥��󥰥륯�����Ȼ��ĤǤϤ���ȡ�      if (&get_info($page, $info_IsFrozen)) {
1180  ������å�C<< <i> >>�ˤʤ�ޤ���          return 1;
1181        } else {
1182  =item *          return 0;
1183        }
1184  B<---->�Τ褦�˥ޥ��ʥ�4�Ĥ�����ȡ�  }
1185  ��ʿ��C<< <hr> >>�ˤʤ�ޤ���  
1186    sub do_comment {
1187  =item *      my ($content) = $database{$form{mypage}};
1188        my $datestr = &get_now;
1189  �Ԥ�B<*>�ǤϤ����ȡ�      my $namestr = $form{myname} ? " ''[[$form{myname}]]'' : " : " ";
1190  �縫�Ф�C<< <h2> >>�ˤʤ�ޤ���      if ($content =~ s/(\Q$embed_comment\E)/- $datestr$namestr$form{mymsg}\n$1/) {
1191            ;
1192  =item *      } else {
1193            $content =~ s/(\Q$embed_rcomment\E)/$1\n- $datestr$namestr$form{mymsg}/;
1194  �Ԥ�B<**>�ǤϤ����ȡ�      }
1195  �����Ф�C<< <h3> >>�ˤʤ�ޤ���      if ($form{mymsg}) {
1196            $form{mymsg} = $content;
1197  =item *          $form{mytouch} = 'on';
1198            &do_write;
1199  �Ԥ�ޥ��ʥ�-�ǤϤ����ȡ�      } else {
1200  �վ��C<< <ul> >>�ˤʤ�ޤ���          $form{mycmd} = 'read';
1201  �ޥ��ʥ��ο���������ȥ�٥뤬������ޤ���3��٥�ޤǡ�          &do_read;
1202        }
1203      -����1  }
1204      --����1-1  
1205      --����1-2  sub embedded_to_html {
1206      -����2      my ($embedded) = @_;
1207      -����3      if ($embedded eq $embed_comment or $embedded eq $embed_rcomment) {
1208      --����3-1          my $lastmodified = &get_info($form{mypage}, $info_LastModified);
1209      ---����3-1-1          return <<"EOD";
1210      ---����3-1-2  <form action="$url_cgi" method="post">
1211      --����3-2      <input type="hidden" name="mycmd" value="comment">
1212        <input type="hidden" name="mypage" value="$form{mypage}">
1213  =item *      <input type="hidden" name="myLastModified" value="$lastmodified">
1214        <input type="hidden" name="mytouch" value="on">
1215  �������Ȥ��ȡ�      $resource{yourname}
1216  �Ѹ�Ȳ���ʸ�Υꥹ��C<< <dl> >>���񤱤ޤ���      <input type="text" name="myname" value="" size="10">
1217        <input type="text" name="mymsg" value="" size="40">
1218      :�Ѹ�1:���������񤤤�����ʸ1      <input type="submit" value="$resource{commentbutton}">
1219      :�Ѹ�2:���������񤤤�����ʸ2  </form>
1220      :�Ѹ�3:���������񤤤�����ʸ3  EOD
1221        # Walrus add (5) start
1222  =item *      } elsif ($embedded =~ /$embed_interwiki/ and my $remoteurl = $interwiki{$2}) {
1223            $_ = &make_interwiki_box($1, $2);
1224  ���          return ($_) ? $_ : $embedded;
1225        # Walrus add (5) end
1226  =over 4      } else {
1227            return $embedded;
1228  =item *      }
1229    }
1230  LinkToSomePage��FrontPage�Τ褦�ˡ�  
1231  ��ñ��κǽ�ΰ�ʸ������ʸ���ˤ�����Τ�  # Walrus add (5) start
1232  ��İʾ�Ϣ³������Τ�YukiWiki�Υڡ���̾�Ȥʤꡢ  sub do_interwiki_box {
1233  ���줬ʸ����˴ޤޤ��ȥ�󥯤ˤʤ�ޤ���      my $remoteurl = $interwiki{$form{'myintername'}};
1234        if ($remoteurl) {
1235  =item *          $remoteurl =~ s/\b(euc|sjis|ykwk|asis|isbn)\(\$1\)/&interwiki_convert($1, $form{'mylocalname'})/e;
1236            print "Location: $remoteurl\n\n";
1237  http://www.hyuki.com/ �Τ褦��URL�ϼ�ưŪ�˥�󥯤ˤʤ�ޤ���          exit(1);
1238        } else {
1239  =item *          &do_read;
1240        }
1241  ��Ť��礫�ä�[[ ]]�Ǥ����ä�ʸ����⡢  }
1242  YukiWiki�Υڡ���̾�ˤʤ�ޤ���  # Walrus add (5) end
1243  �礫�ä�����ˤϥ��ڡ�����ޤ�ƤϤ����ޤ���  
1244  ���ܸ��Ȥ��ޤ���  # Walrus add (5) start
1245    sub make_interwiki_box {
1246  =back      my ($localname, $intername) = @_;
1247        my %ignoretype = (
1248  =item *          'box'      => 'text',
1249            'text'     => 'text',
1250  ��Ƭ�����ڡ����䥿�֤ǻϤޤäƤ���ȡ�          'pass'     => 'password',
1251  ����������Ѥߤ�����C<< <pre> >>�Ȥ��ư����ޤ���          'password' => 'password'
1252  �ץ�������ɽ���ʤɤ˻Ȥ��������Ǥ���      );
1253        my $converted = ($ignoretype{$localname}) ? <<EOD : undef;
1254    <form action="$url_cgi" method="post">
1255  =item *      <input type="hidden" name="mycmd" value="interwikibox">
1256        <input type="hidden" name="mypage" value="$form{mypage}">
1257  �Ԥ� > �ǤϤ����ȡ�      <input type="hidden" name="myintername" value="$intername">
1258  ����ʸC<< <blockquote> >>���񤱤ޤ���      $intername:
1259  >�ο���¿���ȥ���ǥ�Ȥ������ʤ�ޤ���3��٥�ޤǡˡ�      <input type="$ignoretype{$localname}" name="mylocalname" value="" size="10">
1260        <input type="submit" value="Submit">
1261      >ʸ��  </form>
1262      >ʸ��  EOD
1263      >>����ʤ����  }
1264      >ʸ��  # Walrus add (5) end
1265    
1266  =back  sub code_convert {
1267        my ($contentref, $kanjicode) = @_;
1268  =head1 ��������  #   &Jcode::convert($contentref, $kanjicode);       # for Jcode.pm
1269        &jcode::convert($contentref, $kanjicode);       # for jcode.pl
1270  =over 4      return $$contentref;
1271    }
1272  =item *  
1273    sub test_convert {
1274  2001ǯ10��20����Version 1.6.6��      my $txt = &text_to_html(<<"EOD", toc=>1);
1275    *HEADER1
1276  �����ξ����к���  **HEADER1-1
1277  ���ڡ����δ�ñ�ʥ����å�������äƤ�����  -ITEM1
1278  �������˥����å��������Ӥ��롣  -ITEM2
1279  �����Ľ��digest�Ȥ���ʸ����򸡺������ʬ���롣  -ITEM3
1280  �����MD5�ʤɤǤ����Ȥ�ä����������Τ�����ɡ�  PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1
1281    PAR1PAR1PAR1PAR1PAR1PAR1''BOLD''PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1
1282  ���ͻ���ɽ��������å������ʤɤϡֶ˰��פ���Υڡ����򻲹ͤˤ�����  PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1
1283    
1284  =item *  PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2
1285    PAR2PAR2PAR2PAR2PAR2PAR2'''ITALIC'''PAR2PAR2PAR2PAR2PAR2PAR2PAR2
1286  2001ǯ10��17����Version 1.6.5��  PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2
1287    **HEADER1-2
1288  �ץ�ӥ塼���̤ǡ������ܥ���򲡤����Ȥ������������  :TERM1:DESCRIPTION1 AND ''BOLD''
1289  ��å����������Ƥ�input���Ǥ�type="hidden"��Ȥä�������Τ���롣  PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1
1290  ����ˡ�textarea���Ǥ�Ȥ���  PAR1PAR1PAR1PAR1PAR1PAR1''BOLD''PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1
1291  �ƥץ�ӥ塼�Ѥ�myspecial_��Ƴ�����Ǥ⤭�줤���к��ǤϤʤ���  PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1
1292    :TERM2:DESCRIPTION2
1293  =item *  :TERM3:DESCRIPTION3
1294    ----
1295  2001ǯ8��30����Version 1.6.4��  *HEADER2
1296    **HEADER2-1
1297  URL�ǥ����쥯�Ȥ˥ڡ���̾����ꤷ�Ƥ⡢  http://www.hyuki.com/
1298  $WikiName��$BracketName�ʳ��Υڡ�������ʤ��褦�ˤ�����  **HEADER2-2
1299  (is_valid_name��is_editable����)��  
1300    [[YukiWiki2]]
1301  =item *  
1302    PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1
1303  2001ǯ8��30����Version 1.6.3��  PAR1PAR1PAR1PAR1PAR1PAR1'''''BOLD ITALIC'''''PAR1PAR1PAR1PAR1PAR1
1304    PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1PAR1
1305  RecentChanges���Խ������Խ��ԲĤȤ�����  >PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2
1306  �Խ��Բĥڡ�����@uneditable�˥ڡ���̾������롣  >PAR2PAR2PAR2PAR2PAR2PAR2'''ITALIC'''PAR2PAR2PAR2PAR2PAR2PAR2PAR2
1307    >PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2PAR2
1308  =item *  
1309    LEVEL0LEVEL0LEVEL0LEVEL0LEVEL0LEVEL0LEVEL0
1310  2001ǯ2��25����Version 1.6.1, 1.6.2��  
1311    >LEVEL1
1312  ��ʬ��ǽ�ΥХ�������  >LEVEL1
1313  do_preview��'>'�������ʤ��Х�����  >LEVEL1
1314  �ʥ桼������λ�Ŧ�ˡ�  >>LEVEL2
1315    >>LEVEL2
1316  =item *  >>LEVEL2
1317    >>>LEVEL3
1318  2001ǯ2��22����Version 1.6.0��  -HELLO-1
1319  ��ʬ��ǽ�����������  --HELLO-2
1320    (HELLO-2, HELLO-2, HELLO-2)
1321  =item *  ---HELLO-3
1322    (HELLO-3, HELLO-3, HELLO-3)
1323  2001ǯ2��19����Version 1.5.4��  --HELLO-2
1324  �����ե�����ؤΥ�󥯤ϲ����ˤ��Ƥߤ���  ---HELLO-3
1325    --HELLO-2
1326  =item *  ---HELLO-3
1327    >>>LEVEL3
1328  2001ǯ2��19����Version 1.5.3��  >>>LEVEL3
1329  RecentChanges����˺�������ڡ���������Τ��᤿��  >>>LEVEL3
1330  use strict;�ǰ��ä�������ʬ�򾯤�����(�����ǤϤʤ�)��  >>>LEVEL3
1331    EOD
1332  =item *      print $txt;
1333        exit;
1334  2001ǯ2��16����Version 1.5.2��  }
1335  textarea��ɽ������ӥץ�ӥ塼�������� < �� > �� &lt; �� &gt; ���Ѵ�����  
1336  (do_preview, editpage, print_preview_buttons)��  sub do_diff {
1337        if (not &is_editable($form{mypage})) {
1338  =item *          &do_read;
1339            return;
1340  2000ǯ12��27����Version 1.5.1��      }
1341  �ץ�ӥ塼���̤�����������      &open_diff;
1342        my $title = $form{mypage};
1343  =item *      &print_header($title);
1344        $_ = &escape($diffbase{$form{mypage}});
1345  2000ǯ12��22����Version 1.5.0��      &close_diff;
1346  ����Ū�ˤ����֤��ľ������      print qq(<h3>$resource{difftitle}</h3>);
1347  ���������Ӻ�������褦�ˤ���(do_list)��      print qq($resource{diffnotice});
1348  �񤭹������˳�ǧ���̤�Ф��褦�ˤ���(do_preview)��      print qq(<pre class="diff">);
1349  �ƥ����Ȥν������Խ����̤����줿(do_edit, do_reedit)��      foreach (split(/\n/, $_)) {
1350  WhatsNew��RecentChanges��TopPage��FrontPage���ѹ�������          if (/^\+(.*)/) {
1351                print qq(<b class="added">$1</b>\n);
1352  =item *          } elsif (/^\-(.*)/) {
1353                print qq(<s class="deleted">$1</s>\n);
1354  2000ǯ12��20����Version 1.1.0��          } elsif (/^\=(.*)/) {
1355  tie�����Ѥ��ơ�dbmopen���Ȥ��ʤ����Ǥ�ư���褦�˽�����              print qq(<span class="same">$1</span>\n);
1356  ���ѼԤ�1�ͤǤ���ֶ˰��פ��󤫤�          } else {
1357  ���äƤ��������������ɤ򸵤ˤ��Ƥ��ޤ���              print qq|??? $_\n|;
1358            }
1359  =item *      }
1360        print qq(</pre>);
1361  2000ǯ9��5����Version 1.0.2��      print qq(<hr>);
1362   <body color=...> �� <body bgcolor=...>      &print_footer($title);
1363  ���ѼԤ���λ�Ŧ�ˤ�롣���ա�  }
1364    
1365  =item *  sub do_rss {
1366        my $rss = new Yuki::RSS(
1367  2000ǯ8��6����Version 1.0.1�������          version => '1.0',
1368  C MAGAZINE�ʥ��եȥХ󥯥ѥ֥�å��󥰡�          encoding => $charset,
1369  2000ǯ10���Ϣ�ܵ������������ǡ�      );
1370  [[ ]] �κǸ夬��˾�פΤ褦�˥��ե�JIS��      $rss->channel(
1371  0x5D�ˤʤ���β����Ԥʤä���          title => $modifier_rss_title,
1372            link  => $modifier_rss_link,
1373  =item *          description => $modifier_rss_description,
1374        );
1375  2000ǯ8��5����Version 1.0.0�������      my $recentchanges = $database{$RecentChanges};
1376        my $count = 0;
1377  =item *      foreach (split(/\n/, $recentchanges)) {
1378            last if ($count >= 15);
1379  2000ǯ7��23����Version 0.82�������          /^\- \d\d\d\d\-\d\d\-\d\d \(...\) \d\d:\d\d:\d\d (\S+)/;    # date format.
1380  �Խ����Υ�󥯥ߥ���          my $title = &unarmor_name($1);
1381  <textarea>��°���ѹ���          my $escaped_title = &escape($title);
1382            my $link = $modifier_rss_link . '?' . &encode($title);
1383  =item *          my $description = $escaped_title . &escape(&get_subjectline($title));
1384            $rss->add_item(
1385  2000ǯ7��22����Version 0.81�������              title => $escaped_title,
1386  �������Ȥ߹��ࡣ              link  => $link,
1387                description => $description,
1388  =item *          );
1389            $count++;
1390  2000ǯ7��21����Version 0.80�������      }
1391  POD��CGI��˽񤭹��ࡣ      # print RSS information (as XML).
1392        print <<"EOD"
1393  =item *  Content-type: text/xml
1394    
1395  2000ǯ7��19����Version 0.70�������  @{[$rss->as_string]}
1396  '''������å�'''�䡢--��---��>>��>>>�ʤɤ������  EOD
1397    }
1398  =item *  
1399    sub is_exist_page {
1400  2000ǯ7��18����Version 0.60�������      my ($name) = @_;
1401  *����*��''����''���ѹ�      if ($use_exists) {
1402            return exists($database{$name});
1403  =item *      } else {
1404            return $database{$name};
1405  2000ǯ7��17����Version 0.50�������      }
1406    }
1407  =item *  
1408    1;
1409  2000ǯ7��17��������ˤ��������ɲä��롣  __END__
1410    =head1 NAME
1411  =item *  
1412    wiki.cgi - This is YukiWiki, yet another Wiki clone.
1413  2000ǯ7��16�������������ɲá�  
1414    =head1 DESCRIPTION
1415  =item *  
1416    YukiWiki is yet another Wiki clone.
1417  2000ǯ7��15����������  
1418    YukiWiki can treat Japanese WikiNames (enclosed with [[ and ]]).
1419  =back  YukiWiki provides 'InterWiki' feature, RDF Site Summary (RSS),
1420    and some embedded commands (such as [[#comment]] to add comments).
1421  =head1 TODO  
1422    Read F<readme_en.txt> (English) or F<readme_ja.txt> (Japanese) in more detail.
1423      - �ƥ�����ɽ���⡼��  
1424      - Charset��������  =head1 AUTHOR
1425      - textarea����Ĥ������б�  
1426      - ��˥塼�αѸ�ɽ���յ�  Hiroshi Yuki <hyuki@hyuki.com> http://www.hyuki.com/yukiwiki/
1427      - �ץ�ӥ塼�Υܥ���ǡ�mymsg��input��value������Ƥ��뤬�����Ԥ򤽤Τޤ�value�ˤ���ƤϤ����ʤ��ΤǤϤʤ�����  
1428      - �ֺ��Խ��פε�ǽ�ϥ֥饦���� back �ǽ�ʬ�ǤϤʤ������ץ�ӥ塼�Ϥ�äȥ���ץ�ˡ�  =head1 LICENSE
1429      - �ڡ��������ȥ��Wikiname�ˤ������ˤ�����褦�ˤ��롣  
1430      - InterWiki���ε�ǽ��URL�򱣤��Ĥġ���󥯤�ĥ���  Copyright (C) 2000-2002 by Hiroshi Yuki.
1431    
1432  =head1 ���  This program is free software; you can redistribute it and/or
1433    modify it under the same terms as Perl itself.
1434      Copyright (C) 2000 by Hiroshi Yuki.  
1435      ���� <hyuki@hyuki.com>  =cut
     http://www.hyuki.com/  
     http://www.hyuki.com/yukiwiki/  
   
 ���䡢�ո����Х����� hyuki@hyuki.com �˥᡼�뤷�Ƥ���������  
   
 =head1 ���۾��  
   
 YukiWiki�ϡ�  
 GNU General Public License�ˤƸ������ޤ���  
   
 YukiWiki�ϥե꡼���եȤǤ���  
 ����ͳ�ˤ��Ȥ�����������  
 ��ʬ���ߤ�YukiWiki������褦�˥���ץ�ˤ��Ƥ���ޤ���  
   
 =head1 �ռ�  
   
 �ܲȤ�WikiWiki���ä�Cunningham & Cunningham, Inc.��  
 ���դ��ޤ���  
   
 YukiWiki��ڤ���ǻȤäƤ�������  
 �ͥåȾ�������˴��դ��ޤ���  
   
 YukiWiki�Υ�����ǥ����󤷤Ƥ������ä��������व��  
 http://city.hokkai.or.jp/~reina/  
 �˴��դ��ޤ���  
   
 tie��Ȥä��Ǥθ��ˤʤ륳���ɤ����äƤ������ä�  
 �ֶ˰��פ���˴��դ��ޤ���  
   
 =head1 ���ȥ��  
   
 =over 4  
   
 =item *  
   
 YukiWiki�ۡ���ڡ���  
 http://www.hyuki.com/yukiwiki/  
   
 =item *  
   
 �ܲȤ�WikiWiki  
 http://c2.com/cgi/wiki?WikiWikiWeb  
   
 =item *  
   
 �ܲȤ�WikiWiki�κ��(Cunningham & Cunningham, Inc.)  
 http://c2.com/  
   
 =item *  
   
 YukiWiki�Υ����ǥ�����򤷤Ƥ������ä��������व��Υڡ���  
 http://city.hokkai.or.jp/~reina/  
   
 =back  
   
 =cut  

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.19

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24  
Google Analytics is used in this page; Cookies are used. 忍者AdMax is used in this page; Cookies are used. Privacy policy.