/[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.23 by wakaba, Sun Aug 18 04:14:35 2002 UTC revision 1.24 by wakaba, Fri Aug 30 04:31:11 2002 UTC
# Line 274  sub do_index { Line 274  sub do_index {
274      print qq(<ul>);      print qq(<ul>);
275      foreach my $page (sort keys %database) {      foreach my $page (sort keys %database) {
276          if (&is_editable($page)) {          if (&is_editable($page)) {
277              print qq(<li><a href="$url_cgi?@{[&encode($page)]}">$page</a>@{[&escape(&get_subjectline($page))]}</li>);              print qq(<li><a href="$url_cgi?@{[&encode($page)]}">@{[&escape($page)]}</a>@{[&escape(&get_subjectline($page))]}</li>);
278              # print qq(<li>@{[&get_info($page, $info_IsFrozen)]}</li>);              # print qq(<li>@{[&get_info($page, $info_IsFrozen)]}</li>);
279              # print qq(<li>@{[0 + &is_frozen($page)]}</li>);              # print qq(<li>@{[0 + &is_frozen($page)]}</li>);
280          }          }
# Line 343  sub do_search { Line 343  sub do_search {
343      my $word = $form{mymsg};      my $word = $form{mymsg};
344      &print_header($SearchPage);      &print_header($SearchPage);
345      &print_searchform(&escape($word));      &print_searchform(&escape($word));
346      print get_search_result ($word, -output_not_found => 1);      print scalar get_search_result ($word, -output_not_found => 1);
     print "foo";  
347      &print_footer($SearchPage);      &print_footer($SearchPage);
348  }  }
349    
# Line 359  sub get_search_result ($;%) { Line 358  sub get_search_result ($;%) {
358          || index ($page, $word) > 0          || index ($page, $word) > 0
359          || index ($word, $page) > 0          || index ($word, $page) > 0
360         ) {         ) {
361        $r .= qq(<li><a href ="$url_cgi?@{[&escape(&encode($page))]}">@{[&escape($page)]}</a>@{[&escape(&get_subjectline($page))]}</li>);        $r .= qq(<li><a href ="$url_cgi?@{[&encode($page)]}">@{[&escape($page)]}</a>@{[&escape(&get_subjectline($page))]}</li>);
362        $counter++;        $counter++;
363      }      }
364    }    }
# Line 410  sub print_header { Line 409  sub print_header {
409        print qq{Refresh: 0; url="$option{-goto}"\n};        print qq{Refresh: 0; url="$option{-goto}"\n};
410      }      }
411      my $cookedpage = &encode($page);      my $cookedpage = &encode($page);
412        my $escapedpage = &escape($page);
413      print <<"EOD";      print <<"EOD";
414  Content-type: text/html; charset=$charset  Content-type: text/html; charset=$charset
415  Content-Language: $lang  Content-Language: $lang
# Line 420  Content-Style-Type: text/css Line 420  Content-Style-Type: text/css
420      "http://www.w3.org/TR/html4/loose.dtd">      "http://www.w3.org/TR/html4/loose.dtd">
421  <html lang="$lang">  <html lang="$lang">
422  <head>  <head>
423      <title>@{[&escape($page.' '.&get_subjectline($page))]}</title>      <title>$escapedpage @{[&escape(&get_subjectline($page))]}</title>
424      <link rel="index" href="$url_cgi?$IndexPage">      <link rel="index" href="$url_cgi?$IndexPage">
425      <link rev="made" href="mailto:$modifier_mail">      <link rev="made" href="mailto:@{[&escape($modifier_mail)]}">
426      <link rel="stylesheet" type="text/css" href="$url_stylesheet">      <link rel="stylesheet" type="text/css" href="@{[&escape($url_stylesheet)]}">
427  </head>  </head>
428  <body class="$bodyclass">  <body class="$bodyclass">
429  EOD  EOD
# Line 549  sub text_to_html { Line 549  sub text_to_html {
549      push(@result, "<p>");      push(@result, "<p>");
550      foreach (@txt) {      foreach (@txt) {
551          chomp;          chomp;
         # Walrus mod (6) start  
         #if ($saved[0] eq '</html>') {  
         #    if (/<\/html>/i) { splice(@saved); }  
         #    else { push (@result, &html_to_ignored_html($_)); }  
         #} elsif (/^<html>/i and &is_ignore_html($form{mypage})) {  
         #    push(@result, splice(@saved));  
         #    push(@saved, '</html>');  
         #} els  
552          if (/^\*\*\*\*\*(.*)/) {          if (/^\*\*\*\*\*(.*)/) {
553              push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));              push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
554              push(@result, splice(@saved), qq(<h6 id="i$tocnum">) . &inline($1) . '</h6>');              push(@result, splice(@saved), qq(<h6 id="i$tocnum">) . &inline($1) . '</h6>');
# Line 729  sub make_link { Line 721  sub make_link {
721  #               $remoteurl =~ s/\b(euc|sjis|ykwk|asis)\(\$1\)/&interwiki_convert($1, $localname)/e;      # Walrus del (4)  #               $remoteurl =~ s/\b(euc|sjis|ykwk|asis)\(\$1\)/&interwiki_convert($1, $localname)/e;      # Walrus del (4)
722                  $remoteurl =~ s/\b(euc|sjis|ykwk|asis|isbn)\(\$1\)/&interwiki_convert($1, $localname)/e; # Walrus add (4)                  $remoteurl =~ s/\b(euc|sjis|ykwk|asis|isbn)\(\$1\)/&interwiki_convert($1, $localname)/e; # Walrus add (4)
723  #               return qq(<a href="$remoteurl">$chunk</a>); # Walrus del (3)  #               return qq(<a href="$remoteurl">$chunk</a>); # Walrus del (3)
724                  return qq(<a href="$remoteurl">$name</a>);  # Walrus add (3)                  return qq(<a href="$remoteurl">@{[&escape($name)]}</a>);  # Walrus add (3)
725              } else {              } else {
726  #               return $chunk;                              # Walrus del (3)  #               return $chunk;                              # Walrus del (3)
727                  return $name;                               # Walrus add (3)                  return &escape($name);                               # Walrus add (3)
728              }              }
729          } elsif ($database{$chunk}) {          } elsif ($database{$chunk}) {
730              my $subject = &escape(&get_subjectline($chunk, delimiter => ''));              my $subject = &escape(&get_subjectline($chunk, delimiter => ''));
731  #           return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$chunk</a>);  # Walrus del (3)  #           return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$chunk</a>);  # Walrus del (3)
732              return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$name</a>);   # Walrus add (3)              return qq(<a title="$subject" href="$url_cgi?$cookedchunk">@{[&escape($name)]}</a>);   # Walrus add (3)
733          } elsif ($page_command{$chunk}) {          } elsif ($page_command{$chunk}) {
734  #           return qq(<a title="$chunk" href="$url_cgi?$cookedchunk">$chunk</a>);    # Walrus del (3)  #           return qq(<a title="$chunk" href="$url_cgi?$cookedchunk">$chunk</a>);    # Walrus del (3)
735              return qq(<a title="$chunk" href="$url_cgi?$cookedchunk" class="wiki">$name</a>);     # Walrus add (3)              return qq(<a title="$chunk" href="$url_cgi?$cookedchunk" class="wiki">@{[&escape($name)]}</a>);     # Walrus add (3)
736          } else {          } else {
737              return qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=$cookedchunk" class="wiki">$name<span class="mark">$editchar</span></a>);              return qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=$cookedchunk" class="wiki">@{[&escape($name)]}<span class="mark">$editchar</span></a>);
738          }          }
739      }      }
740  }  }
741    
 # Walrus add (6) start  
 sub is_ignore_html {  
     my ($pagename) = @_;  
     foreach (@ignore_html_page) {  
         return 1 if ($pagename eq $_);  
     }  
     return 0;  
 }  
 # Walrus add (6) end  
   
 # Walrus add (6) start  
 sub html_to_ignored_html {  
     my $str = shift(@_);  
     my $text_regex        = q{[^<]*};  
     my $tag_regex_        = q{[^"'<>]*(?:"[^"]*"[^"'<>]*|'[^']*'[^"'<>]*)*(?:>|(?=<)|$(?!\n))}; #'}}}}  
     my $comment_tag_regex = '<!(?:--[^-]*-(?:[^-]+-)*?-(?:[^>-]*(?:-[^>-]+)*?)??)*(?:>|$(?!\n)|--.*$)';  
     my $tag_regex         = qq{$comment_tag_regex|<$tag_regex_};  
     my $ignored           = join('|', @ignore_html_tags);  
     my $result = '';  
     while ($str =~ /($text_regex)($tag_regex)?/gso) {  
       last if $1 eq '' and $2 eq '';  
       $result .= $1;  
       my $tag_tmp = $2;  
       $result .= ($tag_tmp =~ /^<\/?($ignored)(?![0-9A-Za-z])/i) ? $tag_tmp : &escape($tag_tmp);  
       if ($tag_tmp =~ /^<(XMP|PLAINTEXT|SCRIPT)(?![0-9A-Za-z])/i) {  
         $str =~ /(.*?)(?:<\/$1(?![0-9A-Za-z])$tag_regex_|$)/gsi;  
         $result .= &escape($1);  
       }  
     }  
     return $result;  
 }  
 # Walrus add (6) end  
   
742  sub print_message {  sub print_message {
743      my ($msg) = @_;      my ($msg) = @_;
744      print qq(<p><strong>$msg</strong></p>);      print qq(<p><strong>$msg</strong></p>);
# Line 976  sub print_editform { Line 935  sub print_editform {
935      }      }
936    
937      my $edit = $mode{admin} ? 'adminedit' : 'edit';      my $edit = $mode{admin} ? 'adminedit' : 'edit';
938        my $escapedmypage = &escape($form{mypage});
939        my $escapedmypassword = &escape($form{mypassword});
940    
941      print <<"EOD";      print <<"EOD";
942  <form action="$url_cgi" method="post">  <form action="$url_cgi" method="post">
943      @{[ $mode{admin} ? qq($resource{frozenpassword} <input type="password" name="mypassword" value="$form{mypassword}" size="10"><br>) : "" ]}      @{[ $mode{admin} ? qq($resource{frozenpassword} <input type="password" name="mypassword" value="$escapedmypassword" size="10"><br>) : "" ]}
944      <input type="hidden" name="myLastModified" value="$lastmodified">      <input type="hidden" name="myLastModified" value="$lastmodified">
945      <input type="hidden" name="mypage" value="@{[&escape($form{mypage})]}">      <input type="hidden" name="mypage" value="$escapedmypage">
946      <textarea cols="$cols" rows="$rows" name="mymsg" wrap="off" tabindex="1">$mymsg</textarea><br>      <textarea cols="$cols" rows="$rows" name="mymsg" wrap="off" tabindex="1">$mymsg</textarea><br>
947  @{[  @{[
948      $mode{admin} ?      $mode{admin} ?

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24