diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/css/core.css | 4 | ||||
-rwxr-xr-x | web/index.cgi | 6 | ||||
-rwxr-xr-x | web/photo.cgi | 22 |
3 files changed, 22 insertions, 10 deletions
diff --git a/web/css/core.css b/web/css/core.css index 5a0fb652e..9a40bd052 100644 --- a/web/css/core.css +++ b/web/css/core.css @@ -254,6 +254,10 @@ p#copyright { margin: 0 0 0.25em; border-bottom: dotted 1px #5e552b; } +#updates p { + margin: 0; +} + #alert_links { float: right; } diff --git a/web/index.cgi b/web/index.cgi index 69cb598f7..ee2586f39 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: index.cgi,v 1.183 2008-03-28 15:11:48 matthew Exp $ +# $Id: index.cgi,v 1.184 2008-03-28 16:36:48 matthew Exp $ use strict; use Standard; @@ -205,7 +205,7 @@ sub submit_update { sub workaround_pg_bytea { my ($st, $img_idx, @elements) = @_; my $s = dbh()->prepare($st); - for ($i=1; $i<=@elements; $i++) { + for (my $i=1; $i<=@elements; $i++) { if ($i == $img_idx) { $s->bind_param($i, $elements[$i-1], { pg_type => DBD::Pg::PG_BYTEA }); } else { @@ -687,7 +687,7 @@ sub display_problem { # Get all information from database return display_location($q, 'Unknown problem ID') if $input{id} =~ /\D/; my $problem = dbh()->selectrow_hashref( - "select id, easting, northing, council, category, title, detail, photo, + "select id, easting, northing, council, category, title, detail, (photo is not null) as photo, used_map, name, anonymous, extract(epoch from confirmed) as time, state, extract(epoch from whensent-confirmed) as whensent, extract(epoch from ms_current_timestamp()-lastupdate) as duration diff --git a/web/photo.cgi b/web/photo.cgi index d6d920007..33bff0bd7 100755 --- a/web/photo.cgi +++ b/web/photo.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: photo.cgi,v 1.7 2007-08-29 23:03:16 matthew Exp $ +# $Id: photo.cgi,v 1.8 2008-03-28 16:36:48 matthew Exp $ use strict; use Standard; @@ -17,12 +17,20 @@ sub main { my $q = shift; print $q->header(-type => 'image/jpeg', -expires => '+1y' ); - my $id = $q->param('id') || return; - my $problem = dbh()->selectrow_arrayref( - "select photo from problem where id=? and state in ('confirmed', 'fixed', 'flickr') - and photo is not null", {}, $id); - return unless $problem; - my $photo = $problem->[0]; + my $id = $q->param('id'); + my $c = $q->param('c'); + return unless ($id || $c); + my $photo; + if ($c) { + $photo = dbh()->selectrow_arrayref("select photo from comment where + id=? and state = 'confirmed' and photo is not null", {}, $c); + } else { + $photo = dbh()->selectrow_arrayref( "select photo from problem where + id=? and state in ('confirmed', 'fixed', 'flickr') and photo is not + null", {}, $id); + } + return unless $photo; + $photo = $photo->[0]; if ($q->param('tn')) { use Image::Magick; my $image = Image::Magick->new; |