diff options
-rw-r--r-- | conf/httpd.conf | 3 | ||||
-rwxr-xr-x | web/rss.cgi | 16 |
2 files changed, 16 insertions, 3 deletions
diff --git a/conf/httpd.conf b/conf/httpd.conf index 6ef555c94..5de6ee252 100644 --- a/conf/httpd.conf +++ b/conf/httpd.conf @@ -20,7 +20,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org # -# $Id: httpd.conf,v 1.33 2008-09-10 18:06:30 matthew Exp $ +# $Id: httpd.conf,v 1.34 2008-09-25 12:53:42 matthew Exp $ DirectoryIndex index.cgi @@ -50,6 +50,7 @@ RewriteRule ^/rss/([0-9]+)[,/]([0-9]+)$ /rss.cgi?type=local_problem RewriteRule ^/rss/l/([0-9.-]+)[,/]([0-9.-]+)$ /rss.cgi?type=local_problems;lat=$1;lon=$2 [QSA] RewriteRule ^/rss/([0-9]+)[,/]([0-9]+)/([0-9]+)$ /rss.cgi?type=local_problems;x=$1;y=$2;d=$3 [QSA] RewriteRule ^/rss/l/([0-9.-]+)[,/]([0-9.-]+)/([0-9]+)$ /rss.cgi?type=local_problems;lat=$1;lon=$2;d=$3 [QSA] +RewriteRule ^/rss/pc/(.*)$ /rss.cgi?type=local_problems;pc=$1 [QSA] RewriteRule ^/rss/problems$ /rss.cgi?type=new_problems [QSA] # RSS feeds for voting areas diff --git a/web/rss.cgi b/web/rss.cgi index 3cdbb0355..60ffde186 100755 --- a/web/rss.cgi +++ b/web/rss.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: rss.cgi,v 1.23 2008-09-19 10:24:55 matthew Exp $ +# $Id: rss.cgi,v 1.24 2008-09-25 12:53:42 matthew Exp $ use strict; use Standard; @@ -53,6 +53,7 @@ Page::do_fastcgi(\&main); sub rss_local_problems { my $q = shift; + my $pc = $q->param('pc'); my $x = $q->param('x'); my $y = $q->param('y'); my $lat = $q->param('lat'); @@ -66,8 +67,19 @@ sub rss_local_problems { $e = Page::tile_to_os($x); $n = Page::tile_to_os($y); ($lat, $lon) = mySociety::GeoUtil::national_grid_to_wgs84($e, $n, 'G'); + } elsif ($pc) { + my $error; + try { + ($x, $y, $e, $n, $error) = Page::geocode($input{pc}); + } catch Error::Simple with { + $error = shift; + }; + unless ($error) { + print $q->redirect(-location => "http://www.fixmystreet.com/rss/$x/$y"); + } + return ''; } else { - die "Missing x/y or lat/lon parameter in RSS feed"; + die "Missing x/y, lat/lon, or postcode parameter in RSS feed"; } my $qs = "?x=$x;y=$y"; my $d = $q->param('d'); |