diff options
author | louise <louise> | 2009-10-28 11:35:16 +0000 |
---|---|---|
committer | louise <louise> | 2009-10-28 11:35:16 +0000 |
commit | fda0e6d15da8af16db6542d34456e23688cd3260 (patch) | |
tree | 03685ca820b115e1ca8abe2e53a156442fe0f26e | |
parent | c544373442bb0a19c5cdf1a792ad00754454c3df (diff) |
Make redirects absolute with host
-rwxr-xr-x | web/alert.cgi | 10 | ||||
-rwxr-xr-x | web/reports.cgi | 12 |
2 files changed, 12 insertions, 10 deletions
diff --git a/web/alert.cgi b/web/alert.cgi index a29453445..29ef4a64f 100755 --- a/web/alert.cgi +++ b/web/alert.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: alert.cgi,v 1.54 2009-10-21 15:06:31 louise Exp $ +# $Id: alert.cgi,v 1.55 2009-10-28 11:35:16 louise Exp $ use strict; use Standard; @@ -304,16 +304,18 @@ sub alert_rss { my $q = shift; my $feed = $q->param('feed'); return alert_list($q, _('Please select the feed you want')) unless $feed; + my $cobrand = Page::get_cobrand($q); + my $base_url = Cobrand::base_url($cobrand); if ($feed =~ /^area:(?:\d+:)+(.*)$/) { (my $id = $1) =~ tr{:_}{/+}; - print $q->redirect('/rss/area/' . $id); + print $q->redirect($base_url . '/rss/area/' . $id); return; } elsif ($feed =~ /^(?:council|ward):(?:\d+:)+(.*)$/) { (my $id = $1) =~ tr{:_}{/+}; - print $q->redirect('/rss/reports/' . $id); + print $q->redirect($base_url . '/rss/reports/' . $id); return; } elsif ($feed =~ /^local:(\d+):(\d+)$/) { - print $q->redirect('/rss/' . $1 . ',' . $2); + print $q->redirect($base_url . '/rss/' . $1 . ',' . $2); return; } else { return alert_list($q, _('Illegal feed selection')); diff --git a/web/reports.cgi b/web/reports.cgi index 04d30fe76..2575be7c6 100755 --- a/web/reports.cgi +++ b/web/reports.cgi @@ -7,7 +7,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: reports.cgi,v 1.36 2009-10-21 15:13:18 louise Exp $ +# $Id: reports.cgi,v 1.37 2009-10-28 11:35:53 louise Exp $ use strict; use Standard; @@ -25,10 +25,10 @@ sub main { my $cobrand = Page::get_cobrand($q); # Look up council name, if given my $q_council = $q->param('council') || ''; - + my $base_url = Cobrand::base_url($cobrand); # Manual misspelling redirect if ($q_council =~ /^rhondda cynon taff$/i) { - print $q->redirect('/reports/Rhondda+Cynon+Taf'); + print $q->redirect($base_url . '/reports/Rhondda+Cynon+Taf'); return; } @@ -50,7 +50,7 @@ sub main { } } if (!$one_council) { # Given a false council name - print $q->redirect('/reports'); + print $q->redirect($base_url . '/reports'); return; } } elsif ($q_council =~ /^\d+$/) { @@ -72,7 +72,7 @@ sub main { } } if (!$ward) { # Given a false ward name - print $q->redirect('/reports/' . Page::short_name($q_council)); + print $q->redirect($base_url . '/reports/' . Page::short_name($q_council)); return; } } @@ -83,7 +83,7 @@ sub main { $url .= '/' . Page::short_name($q_ward) if $ward; if ($rss eq 'area' && $area_type ne 'DIS' && $area_type ne 'CTY') { # Two possibilites are the same for one-tier councils, so redirect one to the other - print $q->redirect('/rss/reports/' . $url); + print $q->redirect($base_url . '/rss/reports/' . $url); return; } my $type = 'council_problems'; # Problems sent to a council |