/[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.48 by w, Fri Jan 3 08:25:31 2003 UTC revision 1.49 by w, Sat Jan 4 03:32:55 2003 UTC
# Line 12  our $VERSION = do{my @r=(q$Revision$=~/\ Line 12  our $VERSION = do{my @r=(q$Revision$=~/\
12  require 'wikidata/suikawiki-config.ph';  require 'wikidata/suikawiki-config.ph';
13  use Fcntl;  use Fcntl;
14  ##############################  ##############################
15  my %fmt;        ## formatter objects  our %fmt;       ## formatter objects
16  my %embed_command = (  my %embed_command = (
17          searched        => '^\[\[#searched:([^\]]+)\]\]$',          searched        => '^\[\[#searched:([^\]]+)\]\]$',
18          form    => qr/\[\[\#form(?:\(([A-Za-z0-9-]+)\))?:'((?:[^'\\]|\\.)*)':'((?:[^'\\]|\\.)*)'(?::'((?:[^'\\]|\\.)*)')?\]\]/,          form    => qr/\[\[\#form(?:\(([A-Za-z0-9-]+)\))?:'((?:[^'\\]|\\.)*)':'((?:[^'\\]|\\.)*)'(?::'((?:[^'\\]|\\.)*)')?\]\]/,
# Line 39  my %command_do = ( Line 39  my %command_do = (
39      comment => \&do_comment,      comment => \&do_comment,
40      RandomJump  => \&do_random_jump,      RandomJump  => \&do_random_jump,
41      rss => \&do_rss,      rss => \&do_rss,
42      diff => \&do_diff,      diff => \&do_view,
43      wikiform    => \&do_wikiform,      wikiform    => \&do_wikiform,
44      map => \&do_view,      map => \&do_view,
45  );  );
# Line 65  sub do_read { Line 65  sub do_read {
65    wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER});    wiki::referer::add ($form{mypage}, $ENV{HTTP_REFERER});
66    wiki::useragent::add ($ENV{HTTP_USER_AGENT});    wiki::useragent::add ($ENV{HTTP_USER_AGENT});
67    my @toc;    my @toc;
68      my $cf = 'SuikaWiki/0.9';      my ($magic, $content) = &SuikaWiki::Plugin::magic_and_content (undef, $content);
69      ## Should be support at least:      $magic ||= '#?SuikaWiki/0.9';
70      ## - 'SuikaWiki/0.9' CRLF      if ($magic =~ m!^\#\?SuikaWiki/0.9!) {
     ## - 'H2H/' ("0.9" / "1.0" / "1.1") CRLF  
     ## - "/*" WSP* 'W3C-CSS/' ("1.0" / "2.0") "*/" CRLF  
     $cf = $1 if $content =~ s#^(?:/\*\s*|[\#<]\?)?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.\x0D\x0A][^\x0D\x0A]*)?)[\x0D\x0A]+##s;  
     if ($cf =~ m!^(?:\#\?)?SuikaWiki/0.9(?:$|\s)!) {  
71        my $expires = time;        my $expires = time;
72        if ($cf =~ /interactive="yes"/) {        if ($magic =~ /interactive="yes"/) {
73          $lm = $expires;          $lm = $expires;
74        } else {        } else {
75          $expires += 120;          $expires += 120;
76        }        }
77        &print_header ($form{mypage}, -last_modified => $lm, -expires => $expires,        &print_header ($form{mypage}, -last_modified => $lm, -expires => $expires,
78          -content_format => $cf, -noindex => ($cf =~ /obsoleted="yes"/ ? 1 : 0));          -content_format => $magic, -noindex => ($magic =~ /obsoleted="yes"/ ? 1 : 0));
       &print_content ($content, content_format => $cf, last_modified => $lm,  
         -toc => \@toc);  
       print &text_to_html (q([[#comment]])) if $cf !~ /obsoleted="yes"/ && !$database->meta (IsFrozen => $form{mypage});  
79      } else {      } else {
80        &print_header($form{mypage}, -expires => time + 120, -last_modified => $lm);        &print_header($form{mypage}, -expires => time + 120, -content_format => $magic, -last_modified => $lm);
       print "<pre>@{[&escape($content)]}</pre>";  
81      }      }
82      &load_formatter ('view');      &load_formatter ('view');
83      print $fmt{view}->replace ($ViewDefinition{read} => bless {param => \%form, page => $form{mypage}, toc => \@toc, formatter => $fmt{view}, &_compatible_options ()}, 'SuikaWiki::Plugin');      print $fmt{view}->replace ($ViewDefinition{read} => bless {param => \%form, page => $form{mypage}, toc => \@toc, formatter => $fmt{view}, &_compatible_options ()}, 'SuikaWiki::Plugin');
     &print_footer ($form{mypage}, $lm);  
84  }  }
85    
86  sub do_output_css {  sub do_output_css {
# Line 106  sub do_output_css { Line 97  sub do_output_css {
97    } else {    } else {
98      print "Status: 406 Unsupported Media Type\n";      print "Status: 406 Unsupported Media Type\n";
99      &print_header('WikiPageIsNotCSS', -noindex => 1);      &print_header('WikiPageIsNotCSS', -noindex => 1);
100      &print_content($database{WikiPageIsNotCSS});      &load_formatter ('view');
101      &print_footer('WikiPageIsNotCSS');      print $fmt{view}->replace ($ViewDefinition{read} => bless {param => \%form, page => 'WikiPageIsNotCSS', toc => [], formatter => $fmt{view}, &_compatible_options ()}, 'SuikaWiki::Plugin');
102    }    }
103  }  }
104    
# Line 132  sub do_view { Line 123  sub do_view {
123        $view = 'view'        $view = 'view'
124      }      }
125      print $fmt{view}->replace ($ViewDefinition{$view} => bless {param => \%form, page => $form{mypage}, toc => [], formatter => $fmt{view}, &_compatible_options ()}, 'SuikaWiki::Plugin');      print $fmt{view}->replace ($ViewDefinition{$view} => bless {param => \%form, page => $form{mypage}, toc => [], formatter => $fmt{view}, &_compatible_options ()}, 'SuikaWiki::Plugin');
     &print_footer($form{mypage});  
126  }  }
127    
128  sub do_adminchangepassword {  sub do_adminchangepassword {
# Line 154  sub do_adminchangepassword { Line 144  sub do_adminchangepassword {
144    
145      &print_header('CompletedSuccessfully', -noindex => 1);      &print_header('CompletedSuccessfully', -noindex => 1);
146      &print_message(&Resource('Error:PasswordIsChanged'));      &print_message(&Resource('Error:PasswordIsChanged'));
     &print_footer('CompletedSuccessfully');  
147  }  }
148    
149  sub valid_password ($) {  sub valid_password ($) {
# Line 170  sub do_write { Line 159  sub do_write {
159      if (not &is_editable($form{mypage})) {      if (not &is_editable($form{mypage})) {
160          &print_header($form{mypage}, -noindex => 1);          &print_header($form{mypage}, -noindex => 1);
161          &print_message(&Resource('Error:ThisPageIsUneditable'));          &print_message(&Resource('Error:ThisPageIsUneditable'));
         &print_footer($form{mypage});  
162          return;          return;
163      }      }
164    
165      ## Check confliction      ## Check confliction
166      if ($form{myLastModified} ne $database->mtime ($page)) {      if ($form{myLastModified} ne $database->mtime ($form{mypage})) {
167        &print_header($page, -noindex => 1);        &print_header($form{mypage}, -noindex => 1);
168        &load_formatter ('view');        &load_formatter ('view');
169        print $fmt{view}->replace ($ViewDefinition{-conflict} => bless {param => \%form, page => $form{mypage}, toc => [], formatter => $fmt{view}, &_compatible_options ()}, 'SuikaWiki::Plugin');        print $fmt{view}->replace ($ViewDefinition{-conflict} => bless {param => \%form, page => $form{mypage}, toc => [], formatter => $fmt{view}, &_compatible_options ()}, 'SuikaWiki::Plugin');
       &print_footer($page);  
170        return;        return;
171      }      }
172    
# Line 197  sub do_write { Line 184  sub do_write {
184          } elsif ($form{__wikiform_anchor_index}) {          } elsif ($form{__wikiform_anchor_index}) {
185              $fragment .= qq(#wikiform-$form{__wikiform_anchor_index});              $fragment .= qq(#wikiform-$form{__wikiform_anchor_index});
186          }          }
187          &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));          &print_header($form{mypage}, -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));
188          &print_message(&Resource('Error:SavedSuccessfully'));          &load_formatter ('view');
189          &print_content(&Resource('Error:ContinueReading')." @{[&armor_name($form{mypage})]}");          print $fmt{view}->replace ($ViewDefinition{-wrote} => bless {param => \%form, page => $form{mypage}, formatter => $fmt{view}, &_compatible_options ()}, 'SuikaWiki::Plugin');
         &print_footer('CompletedSuccessfully');  
190      } else {      } else {
191          delete $database{$form{mypage}};          delete $database{$form{mypage}};
192          &print_header($form{mypage}, -noindex => 1);          &print_header($form{mypage}, -noindex => 1);
193          &print_message(&Resource('Error:PageIsDeletedSuccessfully'));          &load_formatter ('view');
194          &print_footer($form{mypage});          print $fmt{view}->replace ($ViewDefinition{-deleted} => bless {param => \%form, page => $form{mypage}, formatter => $fmt{view}, &_compatible_options ()}, 'SuikaWiki::Plugin');
195      }      }
196  }  }
197    
# Line 249  sub print_error { Line 235  sub print_error {
235      my ($msg) = @_;      my ($msg) = @_;
236      &print_header($PageName{ErrorPage}, -noindex => 1);      &print_header($PageName{ErrorPage}, -noindex => 1);
237      print qq(<p><strong class="error">$msg</strong></p>);      print qq(<p><strong class="error">$msg</strong></p>);
     &print_footer($PageName{ErrorPage});  
238      exit(0);      exit(0);
239  }  }
240    
# Line 303  Content-Style-Type: text/css Line 288  Content-Style-Type: text/css
288  <head profile="http://suika.fam.cx/~wakaba/-temp/wiki/wiki?WikiHTMLMetaProfile">  <head profile="http://suika.fam.cx/~wakaba/-temp/wiki/wiki?WikiHTMLMetaProfile">
289  $links  $links
290  </head>  </head>
 <body class="$option{body_class}">  
 EOD  
     &print_navigate_links ($page);  
     print <<EOD;  
 <h1 class="header">@{[&escape($page)]}</h1>  
291  EOD  EOD
292  }  }
293    
# Line 323  sub get_charset_name ($;%) { Line 303  sub get_charset_name ($;%) {
303      $charset;      $charset;
304  }  }
305    
306  sub print_navigate_links (@) {  sub _navigate_links (@) {
307    my ($page) = @_;    my ($page) = @_;
308    my $editable = (&is_editable($page) && !&is_frozen($page)) ? 1 : 0;    my $editable = (&is_editable($page) && !&is_frozen($page)) ? 1 : 0;
309    my $cookedpage = &encode($page);    my $cookedpage = &encode($page);
310    print <<EOH;    <<EOH;
 <div class="tools">  
311      @{[ $editable      @{[ $editable
312          ? qq(<a title="@{[&Resource('EditThisPageLong',escape=>1)]}" href="$url_cgi?mycmd=edit;mypage=$cookedpage" accesskey="E" class="wiki-cmd">@{[&Resource('EditThisPage',escape=>1)]}</a> | )          ? qq(<a title="@{[&Resource('EditThisPageLong',escape=>1)]}" href="$url_cgi?mycmd=edit;mypage=$cookedpage" accesskey="E" class="wiki-cmd">@{[&Resource('EditThisPage',escape=>1)]}</a> | )
313          : qq()          : qq()
# Line 341  sub print_navigate_links (@) { Line 320  sub print_navigate_links (@) {
320      <a href="$url_cgi?$PageName{SearchPage}" class="wiki" title="@{[&Resource('GoToSearchPageLong',escape=>1)]}">@{[&Resource('GoToSearchPage',escape=>1)]}</a> |      <a href="$url_cgi?$PageName{SearchPage}" class="wiki" title="@{[&Resource('GoToSearchPageLong',escape=>1)]}">@{[&Resource('GoToSearchPage',escape=>1)]}</a> |
321      <a href="$url_cgi?mycmd=RandomJump;x-param=@{[time.[0..9]->[rand 10]]}" class="wiki randomlink" title="@{[&Resource('GoSomewhereLong',escape=>1)]}">@{[&Resource('GoSomewhere',escape=>1)]}</a> |      <a href="$url_cgi?mycmd=RandomJump;x-param=@{[time.[0..9]->[rand 10]]}" class="wiki randomlink" title="@{[&Resource('GoSomewhereLong',escape=>1)]}">@{[&Resource('GoSomewhere',escape=>1)]}</a> |
322      <a href="$url_cgi?$PageName{RecentChanges}" class="wiki" title="@{[&Resource('GoToRecentChangesLong',escape=>1)]}">@{[&Resource('GoToRecentChanges',escape=>1)]}</a>      <a href="$url_cgi?$PageName{RecentChanges}" class="wiki" title="@{[&Resource('GoToRecentChangesLong',escape=>1)]}">@{[&Resource('GoToRecentChanges',escape=>1)]}</a>
 </div>  
323  EOH  EOH
324  }  }
325    
# Line 382  sub make_navigate_links ($) { Line 360  sub make_navigate_links ($) {
360      wantarray ? ($Links, $links) : $Links;      wantarray ? ($Links, $links) : $Links;
361  }  }
362    
 sub print_footer {  
     my ($page, $lm) = @_;  
     my $epage = &encode ($page);  
   my $cvslog1 = q$Revision$;  
   my $cvslog2 = q$Date$;  
   print_navigate_links ($page);  
   print <<"EOD";  
 @{[ $lm ? qq(<div id="wikipage-last-modified">@{[&Resource('LastModified=',escape=>1)]}@{[&_rfc3339_date ($lm)]}</div>) : '' ]}  
 <div class="footer">  
 <a href="http://www.hyuki.com/yukiwiki/" title="YukiWiki 2.0.beta1.2002-05-29 &copy; 2000-2002 by Hiroshi Yuki">@{[&Resource('About:Name:YukiWiki',escape=>1)]}</a> <a href="http://digit.que.ne.jp/work/" title="WalWiki 2.0.beta1.wal.1 &copy; 2000-2002 by Makio Tsukamoto">@{[&Resource('About:Name:WalWiki',escape=>1)]}</a>  
 <a href="/gate/cvs/wakaba/wiki/" title="@{[&Resource('About:SuikaWiki:JumpToCVS',escape=>1)]} ($cvslog2)">@{[&Resource('About:Name:SuikaWiki',escape=>1)]} $cvslog1</a>  
 </div>  
 </body>  
 </html>  
 EOD  
 }  
   
363  sub escape {  sub escape {
364      my $s = shift;      my $s = shift;
365      $s =~ s|\x0D\x0A|\x0A|g;      $s =~ s|\x0D\x0A|\x0A|g;
# Line 419  sub unescape { Line 380  sub unescape {
380      return $s;      return $s;
381  }  }
382    
383  sub print_content ($;$) {  sub convert_format ($$$;%) {
384      my ($rawcontent, %option) = @_;    my ($content, $d => $t, %option) = @_;
385      print &text_to_html($rawcontent, toc=>1, %option);    &load_formatter ('format');
386      my $f = $fmt{format}->{$d.'_to_'.$t};
387      if (ref $f) {
388        $option{content} = $content;
389        &$f ({}, bless (\%option, 'SuikaWiki::Plugin'));
390      } elsif ($t =~ /HTML|xml/) {
391        length $content ? '<pre>'.&escape($content).'</pre>' : '';
392      } else {
393        $content;
394      }
395  }  }
396    
397  sub text_to_html {  sub text_to_html {
398      my ($txt, %option) = @_;      my ($txt, %option) = @_;
399      my $toc = $option{-toc} || [];      my $toc = $option{-toc} || (ref $option{toc} ? $option{toc} : []);
400      my $tocnum = 0;      my $tocnum = 0;
401            
402      ## Load constants      ## Load constants
# Line 590  sub inline ($;%) { Line 560  sub inline ($;%) {
560  sub make_wikilink ($%) {  sub make_wikilink ($%) {
561    my ($ename, %option) = @_;    my ($ename, %option) = @_;
562    my $name = &unescape ($ename);    my $name = &unescape ($ename);
563      $option{latest} = $option{latest} ? qq(mycmd=read;x-param=@{[time.[0..9]->[rand 10]]};mypage=) : '';
564    if ($database{$name}) {    if ($database{$name}) {
565      my $subject = &escape (&get_subjectline ($name, delimiter => ''));      my $subject = &escape (&get_subjectline ($name, delimiter => ''));
566      if ($option{anchor}) {      if ($option{anchor}) {
567        return qq(<a title="$subject" href="$url_cgi?@{[&encode($name)]}#anchor-$option{anchor}" class="wiki">$ename&gt;&gt;$option{anchor}</a>);        return qq(<a title="$subject" href="$uri{wiki}?$option{latest}@{[&encode($name)]}#anchor-$option{anchor}" class="wiki">$ename&gt;&gt;$option{anchor}</a>);
568      } else {      } else {
569        return qq(<a title="$subject" href="$url_cgi?@{[&encode($name)]}" class="wiki">$ename</a>);        return qq(<a title="$subject" href="$uri{wiki}?$option{latest}@{[&encode($name)]}" class="wiki">$ename</a>);
570      }      }
571    } else {    } else {
572      return qq(<a title="@{[&Resource('JumpAndEditWikiPage',escape=>1)]}" href="$url_cgi?@{[&escape($name)]}" class="wiki not-exist">$ename<span class="mark">@{[&Resource('JumpAndEditWikiPageMark',escape=>1)]}</span></a>);      return qq(<a title="@{[&Resource('JumpAndEditWikiPage',escape=>1)]}" href="$uri{wiki}?$option{latest}@{[&escape($name)]}" class="wiki not-exist">$ename<span class="mark">@{[&Resource('JumpAndEditWikiPageMark',escape=>1)]}</span></a>);
573    }    }
574  }  }
575    
# Line 834  EOH Line 805  EOH
805  ]}  ]}
806  </form>  </form>
807  EOD  EOD
     unless ($option{conflict}) {  
         ## Show help text  
         my $help = $database{WikiEditHelp};  
         $help =~ s!^\#\?([A-Z][A-Za-z0-9-]+/[0-9.]+(?:[^0-9.\x0D\x0A][^\x0D\x0A]*)?)[\x0D\x0A]+!!s;  
         $f .= &text_to_html ($help, toc => 0);  
     }  
808      $f;      $f;
809  }  }
810    
# Line 848  sub is_editable { Line 813  sub is_editable {
813      $page =~ /[\x00-\x1F\x7F]/ ? 0 : 1;      $page =~ /[\x00-\x1F\x7F]/ ? 0 : 1;
814  }  }
815    
 # armor_name:  
 #   WikiName -> WikiName  
 #   not_wiki_name -> [[not_wiki_name]]  
 sub armor_name { qq([[$_[0]]]) }  
   
 # unarmor_name:  
 #   [[bracket_name]] -> bracket_name  
 #   WikiName -> WikiName  
 sub unarmor_name {  
     my ($name) = @_;  
     if ($name =~ /^\[\[(\S+?)\]\]$/) {  
         return $1;  
     } else {  
         return $name;  
     }  
 }  
   
816  sub decode {  sub decode {
817      my ($s) = @_;      my ($s) = @_;
818      $s =~ tr/+/ /;      $s =~ tr/+/ /;
# Line 873  sub decode { Line 821  sub decode {
821  }  }
822    
823  sub encode {  sub encode {
824      my ($s) = @_;    my $s = shift;
825      my $encoded = '';    $s =~ s/([^0-9A-Za-z_-])/sprintf '%%%02X', ord $1/g;
826      foreach my $ch (split(//, $s)) {    $s;
         if ($ch =~ /[A-Za-z0-9_]/) {  
             $encoded .= $ch;  
         } else {  
             $encoded .= '%' . sprintf("%02X", ord($ch));  
         }  
     }  
     return $encoded;  
827  }  }
828    
829  sub get_now {  sub get_now {
# Line 926  sub is_frozen ($) { $database->meta (IsF Line 867  sub is_frozen ($) { $database->meta (IsF
867    
868  sub do_comment {  sub do_comment {
869      my ($content) = $database{$form{mypage}};      my ($content) = $database{$form{mypage}};
870      my $default_name;   ## this code does not strict.      my $default_name;   ## this code is not strict.
871      $default_name = $1 if $content =~ /default-name="([^"]+)"/;      $default_name = $1 if $content =~ /default-name="([^"]+)"/;
872      my $datestr = '[WEAK['.&get_now.']]';      my $datestr = '[WEAK['.&get_now.']]';
873      my $namestr = $form{myname} || $default_name || &Resource('WikiForm:WikiComment:DefaultName');      my $namestr = $form{myname} || $default_name || &Resource('WikiForm:WikiComment:DefaultName');
# Line 1101  sub do_wikiform { Line 1042  sub do_wikiform {
1042  sub code_convert {  sub code_convert {
1043    require Jcode;    require Jcode;
1044      my ($contentref, $code) = (shift, shift || $kanjicode);      my ($contentref, $code) = (shift, shift || $kanjicode);
1045      $code = 'jis' if $code =~ /iso/;      if    ($code =~ /euc/) { $code = 'euc' }
1046      $code = 'euc' if $code =~ /euc/;      elsif ($code =~ /iso/) { $code = 'jis' }
1047      $code = 'sjis' if $code =~ /shift/;      elsif ($code =~ /shi/) { $code = 'sjis' }
1048      $code = 'utf8' if $code =~ /utf/;      elsif ($code =~ /utf/) { $code = 'utf8' }
1049      $$contentref = Jcode->new ($contentref)->tr ("\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA\xA1\xF5\xA1\xA4\xA1\xA5\xA1\xA7\xA1\xA8\xA1\xA9\xA1\xAA\xA1\xAE\xA1\xB0\xA1\xB2\xA1\xBF\xA1\xC3\xA1\xCA\xA1\xCB\xA1\xCE\xA1\xCF\xA1\xD0\xA1\xD1\xA1\xDC\xA1\xF0\xA1\xF3\xA1\xF4\xA1\xF6\xA1\xF7\xA1\xE1\xA2\xAF\xA2\xB0\xA2\xB2\xA2\xB1\xA1\xE4\xA1\xE3\xA1\xC0\xA1\xA1" => q(0-9A-Za-z&,.:;?!`^_/|()[]{}+$%#*@='"~-><\ ))->$code;      $$contentref = Jcode->new ($contentref)->tr ("\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA\xA1\xF5\xA1\xA4\xA1\xA5\xA1\xA7\xA1\xA8\xA1\xA9\xA1\xAA\xA1\xAE\xA1\xB0\xA1\xB2\xA1\xBF\xA1\xC3\xA1\xCA\xA1\xCB\xA1\xCE\xA1\xCF\xA1\xD0\xA1\xD1\xA1\xDC\xA1\xF0\xA1\xF3\xA1\xF4\xA1\xF6\xA1\xF7\xA1\xE1\xA2\xAF\xA2\xB0\xA2\xB2\xA2\xB1\xA1\xE4\xA1\xE3\xA1\xC0\xA1\xA1" => q(0-9A-Za-z&,.:;?!`^_/|()[]{}+$%#*@='"~-><\ ))->$code;
1050      return $$contentref;      return $$contentref;
1051  }  }
1052    
 sub do_diff {  
     my $title = $form{mypage};  
     &print_header($title, -noindex => 1);  
     print qq(<h2>@{[&Resource('Diff:Title',escape=>1)]}</h2>);  
     print qq(<p>@{[&Resource('Diff:Notice',escape=>1)]}</p>);  
     print qq(<pre class="diff">);  
     for (split(/\n/, &escape ($database->traverse_diff ($form{mypage})))) {  
         if (/^\+(.*)/) {  
             print qq(<ins class="added">$1</ins>\n);  
         } elsif (/^\-(.*)/) {  
             print qq(<del class="deleted">$1</del>\n);  
         } elsif (/^\=(.*)/) {  
             print qq(<span class="same">$1</span>\n);  
         } else {  
             print qq|??? $_\n|;  
         }  
     }  
     print qq(</pre>);  
     &print_footer($title);  
 }  
   
1053  sub do_rss {  sub do_rss {
1054      eval q{use Yuki::RSS};      eval q{use Yuki::RSS};
1055      my $rss = new Yuki::RSS(      my $rss = new Yuki::RSS(
# Line 1177  sub _rfc3339_date ($) { Line 1097  sub _rfc3339_date ($) {
1097    sprintf '%04d-%02d-%02dT%02d:%02d:%02d+00:00', $time[5]+1900,$time[4]+1,@time[3,2,1,0];    sprintf '%04d-%02d-%02dT%02d:%02d:%02d+00:00', $time[5]+1900,$time[4]+1,@time[3,2,1,0];
1098  }  }
1099    
1100  sub is_exist_page {  sub is_exist_page { $use_exists ? exists ($database{$_[0]}) : $database{$_[0]} }
     my ($name) = @_;  
     if ($use_exists) {  
         return exists($database{$name});  
     } else {  
         return $database{$name};  
     }  
 }  
   
1101  sub __get_database ($) { $database{ $_[0] } }  sub __get_database ($) { $database{ $_[0] } }
1102    
1103  my %_Resource;  my %_Resource;
# Line 1227  sub set ($%) { Line 1139  sub set ($%) {
1139  sub get_dont_record () {  sub get_dont_record () {
1140    map {s/\$/\\\$/g; s/\@/\\\@/g; $_}    map {s/\$/\\\$/g; s/\@/\\\@/g; $_}
1141    grep !/^#/,    grep !/^#/,
1142    split /[\x0D\x0A]+/, &main::__get_database ('RefererDontRecord');    split /[\x0D\x0A]+/, $main::database{RefererDontRecord};
1143  }  }
1144  sub get_site_name () {  sub get_site_name () {
1145    my @lines = grep /[^#]/, split /[\x0D\x0A]+/, &main::__get_database('RefererSiteName');    my @lines = grep /[^#]/, split /[\x0D\x0A]+/, $main::database{RefererSiteName};
1146    my @item;    my @item;
1147    for (@lines) {    for (@lines) {
1148      next if /^#/;      next if /^#/;
# Line 1321  sub meta (@) {undef} Line 1233  sub meta (@) {undef}
1233  sub Yuki::YukiWikiDB2::meta (@) {undef}  sub Yuki::YukiWikiDB2::meta (@) {undef}
1234    
1235  package SuikaWiki::Plugin;  package SuikaWiki::Plugin;
1236    our $plugin_directory;  # defined in top of this file.    our $plugin_directory;
1237    our %List;    our %List;
1238    our %Index;    our %Index;
1239    
# Line 1333  sub __get_datetime ($) { main::get_now ( Line 1245  sub __get_datetime ($) { main::get_now (
1245  sub resource ($$;%) { shift; &main::Resource (@_) }  sub resource ($$;%) { shift; &main::Resource (@_) }
1246  sub uri ($$) { $main::uri{$_[1]} }  sub uri ($$) { $main::uri{$_[1]} }
1247  sub new_index ($$) { ++$Index{$_[1]} }  sub new_index ($$) { ++$Index{$_[1]} }
1248    sub magic_and_content ($$) {
1249      my $page = $_[1];
1250      $page =~ s!^((?:\#\?|/\*|<\?)[^\x02\x0A\x0D]+)[\x02\x0A\x0D]+!!s;
1251      ($1, $page);
1252    }
1253    sub formatter ($$) {
1254      &main::load_formatter ($_[1]);
1255      $main::fmt{$_[1]};
1256    }
1257    
1258  sub regist ($@) {  sub regist ($@) {
1259      my $pack = shift;      my $pack = shift;
# Line 1382  sub get ($;\%) { Line 1303  sub get ($;\%) {
1303    for my $lang (sort {$option->{accept_language}->{$b} <=> $option->{accept_language}->{$a}} grep {$option->{accept_language}->{$_}!=0} keys %{$option->{accept_language}}) {    for my $lang (sort {$option->{accept_language}->{$b} <=> $option->{accept_language}->{$a}} grep {$option->{accept_language}->{$_}!=0} keys %{$option->{accept_language}}) {
1304      while (length $lang) {      while (length $lang) {
1305        unless ($option->{accept_language}->{defined $option->{accept_language}->{$lang} ? $lang : '*'} == 0) {        unless ($option->{accept_language}->{defined $option->{accept_language}->{$lang} ? $lang : '*'} == 0) {
1306          $option->{resource}->{$lang} ||= &wiki::suikawikiconst::to_hash (&main::__get_database('WikiResource:'.$lang));          $option->{resource}->{$lang} ||= &wiki::suikawikiconst::to_hash ($main::database{'WikiResource:'.$lang});
1307          $v = $option->{resource}->{$lang}->{$resname};          $v = $option->{resource}->{$lang}->{$resname};
1308          last if defined $v;          last if defined $v;
1309        }        }
# Line 1403  __END__ Line 1324  __END__
1324    
1325  wiki.cgi --- SuikaWiki: Yet yet another Wiki engine  wiki.cgi --- SuikaWiki: Yet yet another Wiki engine
1326    
1327    =head1 SEE ALSO
1328    
1329    <IW:SuikaWiki:SuikaWiki>
1330    
1331  =head1 AUTHORS  =head1 AUTHORS
1332    
1333  Hiroshi Yuki <hyuki@hyuki.com> <http://www.hyuki.com/yukiwiki/>  Hiroshi Yuki <hyuki@hyuki.com> <http://www.hyuki.com/yukiwiki/>

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24