Changeset 392

Show
Ignore:
Timestamp:
06/12/04 16:50:08 (5 years ago)
Author:
kake
Message:

Fix redirect bug.

Location:
trunk
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/MANIFEST

    r383 r392  
    6060t/52_display_diffs.t 
    6161t/53_show_index.t 
     62t/54_redirect.t 
    6263t/61_bug_textareas.t 
    6364t/62_bug_os_coords.t 
  • trunk/lib/OpenGuides.pm

    r391 r392  
    1313use vars qw( $VERSION ); 
    1414 
    15 $VERSION = '0.33_04'; 
     15$VERSION = '0.33_05'; 
    1616 
    1717=head1 NAME 
     
    155155        # See if this is a valid node, if not then just show the page as-is. 
    156156        if ( $wiki->node_exists($redirect) ) { 
    157             redirect_to_node($redirect); 
     157            my $output = $self->redirect_to_node($redirect); 
     158            return $output if $return_output; 
     159            print $output; 
     160            exit 0; 
    158161        } 
    159162    } 
     
    474477} 
    475478 
     479sub redirect_to_node { 
     480    my ($self, $node) = @_; 
     481    my $script_url = $self->config->{_}->{script_url}; 
     482    my $script_name = $self->config->{_}->{script_name}; 
     483    my $formatter = $self->wiki->formatter; 
     484    my $param = $formatter->node_name_to_node_param( $node ); 
     485    return CGI->redirect( "$script_url$script_name?$param" ); 
     486} 
     487 
    476488sub get_cookie { 
    477489    my $self = shift; 
  • trunk/wiki.cgi

    r391 r392  
    55 
    66use vars qw( $VERSION ); 
    7 $VERSION = '0.33_04'; 
     7$VERSION = '0.33_05'; 
    88 
    99use CGI qw/:standard/; 
     
    7777        my @nodes = $wiki->list_all_nodes(); 
    7878        $node = $nodes[int(rand(scalar(@nodes) + 1)) + 1]; 
    79         redirect_to_node($node); 
     79        $guide->redirect_to_node($node); 
    8080        exit 0; 
    8181    } elsif ($action eq 'find_within_distance') { 
     
    141141############################ subroutines ################################### 
    142142 
    143 sub redirect_to_node { 
    144     my $node = shift; 
    145     print $q->redirect("$script_url$script_name?" . $q->escape($formatter->node_name_to_node_param($node))); 
    146     exit 0; 
    147 } 
    148  
    149143sub show_userstats { 
    150144    my $username = shift; 
     
    336330 
    337331    if ($written) { 
    338         redirect_to_node($node); 
     332        $guide->redirect_to_node($node); 
    339333    } else { 
    340334        my %node_data = $wiki->retrieve_node($node);