/[suikacvs]/webroot/swe/lib/suikawiki/main.pl
Suika

Diff of /webroot/swe/lib/suikawiki/main.pl

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

revision 1.22 by wakaba, Sun Jul 12 07:15:34 2009 UTC revision 1.23 by wakaba, Sun Jul 12 08:18:44 2009 UTC
# Line 122  if ($path[0] eq 'n' and @path == 2) { Line 122  if ($path[0] eq 'n' and @path == 2) {
122    }    }
123    
124    unless (defined $param) {    unless (defined $param) {
125      my $ids = get_ids_by_name ($name);      my ($id, $ids) = prepare_by_name ($name, $dollar);
     unless (ref $ids) {  
       $names_lock->lock;  
       $sw3_pages->reset;  
126    
127        $ids = convert_sw3_page ($ids => $name);      if (defined $dollar and not defined $id) {
128        $names_lock->unlock;        http_redirect (301, 'Not found', get_page_url ($name, undef));
     }  
   
     my $id;  
     if (defined $dollar) {  
       $dollar += 0;  
       for (0..$#$ids) {  
         if ($ids->[$_] == $dollar) {  
           $id = $dollar;  
           splice @$ids, $_, 1, ();  
           last;  
         }  
       }  
       unless (defined $id) {  
         http_redirect (301, 'Not found', get_page_url ($name, undef));  
       }  
     } else {  
       $id = shift @$ids;  
129      }      }
130    
131      my $format = $cgi->get_parameter ('format') // 'html';      my $format = $cgi->get_parameter ('format') // 'html';
# Line 1082  if ($path[0] eq 'n' and @path == 2) { Line 1062  if ($path[0] eq 'n' and @path == 2) {
1062    
1063  http_error (404, 'Not found');  http_error (404, 'Not found');
1064    
1065    sub prepare_by_name ($$) {
1066      my ($name, $id_cand) = @_;
1067      
1068      my $ids = get_ids_by_name ($name);
1069      unless (ref $ids) {
1070        $names_lock->lock;
1071        $sw3_pages->reset;
1072    
1073        $ids = convert_sw3_page ($ids => $name);
1074        $names_lock->unlock;
1075      }
1076    
1077      my $id;
1078      if (defined $id_cand) {
1079        $id_cand += 0;
1080        for (0..$#$ids) {
1081          if ($ids->[$_] == $id_cand) {
1082            $id = $id_cand;
1083            splice @$ids, $_, 1, ();
1084            last;
1085          }
1086        }
1087      } else {
1088        $id = shift @$ids;
1089      }
1090      
1091      return ($id, $ids);
1092    } # prepare_by_name
1093    
1094  sub get_content_type_parameter () {  sub get_content_type_parameter () {
1095    my $ct = $cgi->get_parameter ('content-type') // 'text/x-suikawiki';    my $ct = $cgi->get_parameter ('content-type') // 'text/x-suikawiki';
1096        

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24