Changeset 392
- Timestamp:
- 06/12/04 16:50:08 (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 modified
-
MANIFEST (modified) (1 diff)
-
lib/OpenGuides.pm (modified) (3 diffs)
-
t/54_redirect.t (added)
-
wiki.cgi (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/MANIFEST
r383 r392 60 60 t/52_display_diffs.t 61 61 t/53_show_index.t 62 t/54_redirect.t 62 63 t/61_bug_textareas.t 63 64 t/62_bug_os_coords.t -
trunk/lib/OpenGuides.pm
r391 r392 13 13 use vars qw( $VERSION ); 14 14 15 $VERSION = '0.33_0 4';15 $VERSION = '0.33_05'; 16 16 17 17 =head1 NAME … … 155 155 # See if this is a valid node, if not then just show the page as-is. 156 156 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; 158 161 } 159 162 } … … 474 477 } 475 478 479 sub 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 476 488 sub get_cookie { 477 489 my $self = shift; -
trunk/wiki.cgi
r391 r392 5 5 6 6 use vars qw( $VERSION ); 7 $VERSION = '0.33_0 4';7 $VERSION = '0.33_05'; 8 8 9 9 use CGI qw/:standard/; … … 77 77 my @nodes = $wiki->list_all_nodes(); 78 78 $node = $nodes[int(rand(scalar(@nodes) + 1)) + 1]; 79 redirect_to_node($node);79 $guide->redirect_to_node($node); 80 80 exit 0; 81 81 } elsif ($action eq 'find_within_distance') { … … 141 141 ############################ subroutines ################################### 142 142 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 149 143 sub show_userstats { 150 144 my $username = shift; … … 336 330 337 331 if ($written) { 338 redirect_to_node($node);332 $guide->redirect_to_node($node); 339 333 } else { 340 334 my %node_data = $wiki->retrieve_node($node);
