Ignore:
Timestamp:
Jul 21, 2005, 3:58:27 PM (17 years ago)
Author:
Earle Martin
Message:

fix redirect checking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides.pm

    r655 r656  
    174174        # Avoid loops by not generating redirects to the same node or the
    175175        # previous node.
    176     if ( $wiki->node_exists($redirect) && $redirect != $id && $redirect != $oldid ) {
     176      if ( $wiki->node_exists($redirect) ) {
     177        unless ($redirect eq $id) {
     178          unless ($redirect eq $oldid) {
    177179            my $output = $self->redirect_to_node($redirect, $id);
    178180            return $output if $return_output;
    179181            print $output;
    180182            exit 0;
    181     }
     183          }
     184        }
     185      }
    182186    }
    183187    my $content    = $wiki->format($raw);
     
    856860
    857861sub redirect_to_node {
    858     my ($self, $node, $redirect) = @_;
     862    my ($self, $node, $redirected_from) = @_;
    859863   
    860864    my $script_url = $self->config->script_url;
     
    864868    my $id = $formatter->node_name_to_node_param( $node );
    865869    my $oldid;
    866     $oldid = $formatter->node_name_to_node_param( $redirect ) if $redirect;
     870    $oldid = $formatter->node_name_to_node_param( $redirected_from ) if $redirected_from;
    867871
    868872    my $redir_param ='';
    869     $redir_param = "&oldid=$oldid" if $oldid;
     873    $redir_param = ";oldid=$oldid" if $oldid;
    870874
    871875    return CGI->redirect( "$script_url$script_name?id=$id$redir_param" );
Note: See TracChangeset for help on using the changeset viewer.