diff options
Diffstat (limited to 'web')
-rwxr-xr-x | web/ajax.cgi | 8 | ||||
-rwxr-xr-x | web/confirm.cgi | 6 | ||||
-rwxr-xr-x | web/contact.cgi | 6 | ||||
-rwxr-xr-x | web/faq.cgi | 12 | ||||
-rwxr-xr-x | web/flickr.cgi | 8 | ||||
-rwxr-xr-x | web/flickr2.cgi | 50 | ||||
-rwxr-xr-x | web/index.cgi | 169 | ||||
-rwxr-xr-x | web/photo.cgi | 4 | ||||
-rwxr-xr-x | web/posters/index.cgi | 4 | ||||
-rwxr-xr-x | web/questionnaire.cgi | 4 | ||||
-rwxr-xr-x | web/upload.cgi | 12 |
11 files changed, 129 insertions, 154 deletions
diff --git a/web/ajax.cgi b/web/ajax.cgi index d5cda6d0d..0a79fee6c 100755 --- a/web/ajax.cgi +++ b/web/ajax.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: ajax.cgi,v 1.3 2008-09-19 10:24:55 matthew Exp $ +# $Id: ajax.cgi,v 1.4 2008-10-09 14:20:54 matthew Exp $ use strict; use Standard; @@ -38,8 +38,8 @@ sub main { $list .= '<li><a href="/report/' . $_->{id} . '">'; $list .= $_->{title}; $list .= '</a>'; - $list .= ' <small>(fixed)</small>' if $_->{state} eq 'fixed'; - $list .= '</li>'; + $list .= ' <small>(fixed)</small>' if $_->{state} eq 'fixed'; + $list .= '</li>'; } my $om_list = $list; @@ -48,7 +48,7 @@ sub main { $list .= '<li><a href="/report/' . $_->{id} . '">'; $list .= $_->{title} . ' <small>(' . int($_->{distance}/100+.5)/10 . 'km)</small>'; $list .= '</a>'; - $list .= ' <small>(fixed)</small>' if $_->{state} eq 'fixed'; + $list .= ' <small>(fixed)</small>' if $_->{state} eq 'fixed'; $list .= '</li>'; } my $am_list = $list; diff --git a/web/confirm.cgi b/web/confirm.cgi index e3ec49242..8202ffa6c 100755 --- a/web/confirm.cgi +++ b/web/confirm.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: confirm.cgi,v 1.45 2008-10-08 16:57:56 matthew Exp $ +# $Id: confirm.cgi,v 1.46 2008-10-09 14:20:54 matthew Exp $ use strict; use Standard; @@ -122,7 +122,7 @@ sub confirm_problem { . sprintf(' <a href="%s">View the problem on this site</a>.', "/report/$id") )); } elsif ($q->{site} eq 'emptyhomes') { - $out = $q->p('Thank you for reporting an empty property on + $out = $q->p('Thank you for reporting an empty property on ReportEmptyHomes.com. I have emailed the empty property officer in the council responsible with the details and asked them to do whatever they can to get the empty property back into use as soon as possible.') . @@ -155,7 +155,7 @@ to resolve the UK’s empty homes crisis.'); sub advertise_updates { my ($q, $problem_id, $email) = @_; - my $salt = unpack('h*', random_bytes(8)); + my $salt = unpack('h*', random_bytes(8, 1)); my $secret = scalar(dbh()->selectrow_array('select secret from secret')); my $signed_email = sha1_hex("$problem_id-$email-$salt-$secret"); my $signup = <<EOF; diff --git a/web/contact.cgi b/web/contact.cgi index 7947c333f..1c6840e2d 100755 --- a/web/contact.cgi +++ b/web/contact.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: contact.cgi,v 1.33 2008-10-08 14:38:29 matthew Exp $ +# $Id: contact.cgi,v 1.34 2008-10-09 14:20:54 matthew Exp $ use strict; use Standard; @@ -62,7 +62,7 @@ sub contact_submit { From => [$input{em}, $input{name}], To => [[mySociety::Config::get('CONTACT_EMAIL'), _('FixMyStreet')]], Subject => 'FMS message: ' . $subject, - 'Message-ID' => sprintf('<contact-%s-%s@mysociety.org>', time(), unpack('h*', random_bytes(5))), + 'Message-ID' => sprintf('<contact-%s-%s@mysociety.org>', time(), unpack('h*', random_bytes(5, 1))), }); my $result = mySociety::EmailUtil::send_email($email, $input{em}, mySociety::Config::get('CONTACT_EMAIL')); if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) { @@ -111,7 +111,7 @@ sub contact_page { ); $out .= '<input type="hidden" name="id" value="' . $id . '">'; } elsif ($q->{site} eq 'emptyhomes') { - $out .= $q->p('We’d love to hear what you think about this + $out .= $q->p('We’d love to hear what you think about this website. Just fill in the form. Please don’t contact us about individual empty homes; use the box accessed from <a href="/">the front page</a>.'); } else { diff --git a/web/faq.cgi b/web/faq.cgi index 652a05f59..8afac06a6 100755 --- a/web/faq.cgi +++ b/web/faq.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: faq.cgi,v 1.34 2008-10-08 14:38:29 matthew Exp $ +# $Id: faq.cgi,v 1.35 2008-10-09 14:20:54 matthew Exp $ use strict; use Standard -db; @@ -139,23 +139,23 @@ sub emptyhomes_faq { my $out = $q->h1('Frequently Asked Questions'); $out .= $q->dl( $q->dt('What is this site for?'), - $q->dd('This site is to help make it as easy as possible for you to get + $q->dd('This site is to help make it as easy as possible for you to get empty homes in your area put back into use. It allows you, to view empty homes that have been reported and see what has been done about them. It makes councils accountable for responding and dealing with the empty homes you report.'), $q->dt('How do I use the site?'), - $q->dd('Enter a postcode or address in the box on the homepage and you + $q->dd('Enter a postcode or address in the box on the homepage and you are presented with a map of that area. Click where the empty property is, fill in the details, upload a photo if you have one and press submit. That’s it. You can also view other empty properties that have been reported and see what has been done about them.'), $q->dt('Is it free?'), - $q->dd('Yes. The costs of developing and running this site have been + $q->dd('Yes. The costs of developing and running this site have been paid for by The Empty Homes Agency and through the generosity of its funders. The Empty Homes Agency is a charity, so if you believe in our aims and would like to make a contribution, <a href="http://www.emptyhomes.com/donate.html">please do</a>.'), - $q->dt('Do you remove silly or illegal content?'), + $q->dt('Do you remove silly or illegal content?'), $q->dd('We reserve the right to remove any reports or updates which we consider to be inappropriate.'), $q->dt('How do councils bring empty properties back into use?'), @@ -185,7 +185,7 @@ yourself using a PROD: <a href="http://www.emptyhomes.com/usefulinformation/policy_docs/prods.html">http://www.emptyhomes.com/usefulinformation/policy_docs/prods.html</a> ')), $q->dt('Will reporting an empty home make any difference?'), - $q->dd($q->p('Yes. Councils can make a real difference, but they have lots of + $q->dd($q->p('Yes. Councils can make a real difference, but they have lots of things to do. Many councils only deal with empty homes that are reported to them. If people do not report empty homes, councils may well conclude that other areas of work are more important.'), $q->p(' diff --git a/web/flickr.cgi b/web/flickr.cgi index 29638ef25..0ccce316c 100755 --- a/web/flickr.cgi +++ b/web/flickr.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: flickr.cgi,v 1.8 2008-08-11 08:27:14 matthew Exp $ +# $Id: flickr.cgi,v 1.9 2008-10-09 14:20:54 matthew Exp $ use strict; use Standard; @@ -33,8 +33,8 @@ sub main { my ($name) = $result =~ /<realname>(.*?)<\/realname>/; $name ||= ''; - my $id = dbh()->selectrow_array("select nextval('flickr_id_seq');"); - dbh()->do("insert into flickr (id, nsid, name, email) values (?, ?, ?, ?)", {}, + my $id = dbh()->selectrow_array("select nextval('partial_user_id_seq');"); + dbh()->do("insert into partial_user (id, service, nsid, name, email, phone) values (?, 'flickr', ?, ?, ?, '')", {}, $id, $nsid, $name, $email); dbh()->commit(); $out .= $q->p('Thanks for confirming your email address. Please now tag @@ -58,7 +58,7 @@ EOF _parameters_ => \%h, To => $email, From => [ mySociety::Config::get('CONTACT_EMAIL'), 'FixMyStreet' ], - 'Message-ID' => sprintf('<flickr-%s-%s@mysociety.org>', time(), unpack('h*', random_bytes(5))), + 'Message-ID' => sprintf('<flickr-%s-%s@mysociety.org>', time(), unpack('h*', random_bytes(5, 1))), }); my $result; diff --git a/web/flickr2.cgi b/web/flickr2.cgi deleted file mode 100755 index 8ba6982a1..000000000 --- a/web/flickr2.cgi +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/perl -w -I../perllib - -# flickr2.cgi: -# Check photo details, and confirm for council -# -# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: flickr2.cgi,v 1.4 2008-01-28 15:27:00 matthew Exp $ - -use strict; -use Standard; -use URI::Escape; -use mySociety::AuthToken; -use mySociety::Email; -use mySociety::EmailUtil; - -sub main { - my $q = shift; - my $out = ''; - if (my $token = $q->param('token')) { - my $id = mySociety::AuthToken::retrieve('flickr', $token); - if ($id) { - my ($e, $n, $name, $email, $title) = dbh()->selectrow_array( - "select easting,northing,name,email,title from problem where id=? and state='flickr'", {}, $id); - if ($email) { - $name = uri_escape($name); - $email = uri_escape($email); - $title = uri_escape($title); - # XXX: Look up some of this stuff at the destination instead??? - print $q->redirect("/?flickr=$token;submit_map=1;easting=$e;northing=$n;name=$name;email=$email;title=$title;anonymous=1"); - return; - } - $out = $q->p("That report appears to have been checked already."); - } else { - $out = $q->p(_(<<EOF)); -Thank you for trying to register for your Flickr photos. We seem to have a -problem ourselves though, so <a href="/contact">please let us know what went on</a> -and we'll look into it. -EOF - } - } else { - $out .= $q->p('You need a token to get to this page!'); - } - - print Page::header($q, title=>'Flickr photo upload'); - print $out; - print Page::footer($q); -} -Page::do_fastcgi(\&main); diff --git a/web/index.cgi b/web/index.cgi index 415eea669..2aef65028 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.211 2008-09-19 17:47:19 matthew Exp $ +# $Id: index.cgi,v 1.212 2008-10-09 14:20:54 matthew Exp $ use strict; use Standard; @@ -18,6 +18,7 @@ use RABX; use CGI::Carp; use URI::Escape; +use CrossSell; use mySociety::AuthToken; use mySociety::Config; use mySociety::DBHandle qw(select_all); @@ -40,6 +41,25 @@ BEGIN { sub main { my $q = shift; + if (my $partial = $q->param('partial_token')) { + # We have a partial token, so fetch data from database and see where we're at. + my $id = mySociety::AuthToken::retrieve('partial', $partial); + if ($id) { + my @row = dbh()->selectrow_array( + "select easting, northing, name, email, title from problem where id=? and state='partial'", {}, $id); + if (@row) { + $q->param('anonymous', 1); + $q->param('submit_map', 1); + $q->param('easting', $row[0]); + $q->param('northing', $row[1]); + $q->param('name', $row[2]); + $q->param('email', $row[3]); + $q->param('title', $row[4]); + $q->param('partial', $partial); + } + } + } + my $out = ''; my %params; if ($q->param('submit_problem') || ($q->param('submit_map') && $q->param('submit_map')==2)) { @@ -88,22 +108,15 @@ sub front_page { $new_text = 'recently'; } $out .= '<form action="/" method="get" id="postcodeForm">'; - if (my $token = $q->param('flickr')) { - my $id = mySociety::AuthToken::retrieve('flickr', $token); + if (my $token = $q->param('partial')) { + my $id = mySociety::AuthToken::retrieve('partial', $token); if ($id) { - my $name = ent($q->param('name')); - my $email = ent($q->param('email')); - my $title = ent($q->param('title')); $out .= <<EOF; -<p style="margin-top:0;color: #cc0000;">Thanks for uploading your photo via Flickr! We need to locate your problem, -so please enter a nearby street name or postcode in the box below...</p> - -<input type="hidden" name="flickr" value="$token"> -<input type="hidden" name="submit_map" value="1"> -<input type="hidden" name="name" value="$name"> -<input type="hidden" name="email" value="$email"> -<input type="hidden" name="title" value="$title"> -<input type="hidden" name="anonymous" value="1"> +<p style="margin-top: 0; color: #cc0000;"><img align="right" src="/photo?id=$id" hspace="5"> +Thanks for uploading your photo. We now need to locate your problem, +so please enter a nearby street name or postcode in the box below :</p> + +<input type="hidden" name="partial_token" value="$token"> EOF } } @@ -117,7 +130,6 @@ EOF EOF $out .= $q->h2(_('How to report a problem')); my $step4 = $q->li(_('We send it to the council on your behalf')); - $step4 = '' if $q->{site} eq 'emptyhomes'; $step4 = $q->li('The council receives your report and acts upon it') if $q->{site} eq 'scambs'; $out .= $q->ol( @@ -194,7 +206,7 @@ sub submit_update { return display_problem($q, @errors) if (@errors); my $id = dbh()->selectrow_array("select nextval('comment_id_seq');"); - Page::workaround_pg_bytea("insert into comment + Utils::workaround_pg_bytea("insert into comment (id, problem_id, name, email, website, text, state, mark_fixed, photo) values (?, ?, ?, ?, '', ?, 'unconfirmed', ?, ?)", 7, $id, $input{id}, $input{name}, $input{email}, $input{update}, @@ -215,7 +227,7 @@ sub submit_update { sub submit_problem { my $q = shift; - my @vars = qw(council title detail name email phone pc easting northing skipped anonymous category flickr upload_fileid); + my @vars = qw(council title detail name email phone pc easting northing skipped anonymous category partial upload_fileid); my %input = map { $_ => scalar $q->param($_) } @vars; for (qw(title detail)) { $input{$_} = lc $input{$_} if $input{$_} !~ /[a-z]/; @@ -326,8 +338,8 @@ sub submit_problem { $input{category} = _('Other') unless $input{category}; my ($id, $out); - if (my $token = $input{flickr}) { - my $id = mySociety::AuthToken::retrieve('flickr', $token); + if (my $token = $input{partial}) { + my $id = mySociety::AuthToken::retrieve('partial', $token); if ($id) { dbh()->do("update problem set postcode=?, easting=?, northing=?, title=?, detail=?, name=?, email=?, phone=?, state='confirmed', council=?, used_map='t', @@ -338,12 +350,14 @@ sub submit_problem { $input{category}, $id); dbh()->commit(); $out = $q->p(sprintf(_('You have successfully confirmed your report and you can now <a href="%s">view it on the site</a>.'), "/report/$id")); + $out .= CrossSell::display_advert($q, $input{email}, $input{name}); } else { - $out = $q->p(_('There appears to have been a problem.')); + $out = $q->p('There appears to have been a problem updating the details of your report. +Please <a href="/contact">let us know what went on</a> and we\'ll look into it.'); } } else { $id = dbh()->selectrow_array("select nextval('problem_id_seq');"); - Page::workaround_pg_bytea("insert into problem + Utils::workaround_pg_bytea("insert into problem (id, postcode, easting, northing, title, detail, name, email, phone, photo, state, council, used_map, anonymous, category, areas, send_questionnaire) values @@ -371,7 +385,7 @@ sub submit_problem { sub display_form { my ($q, @errors) = @_; my ($pin_x, $pin_y, $pin_tile_x, $pin_tile_y) = (0,0,0,0); - my @vars = qw(title detail name email phone pc easting northing x y skipped council anonymous flickr upload_fileid); + my @vars = qw(title detail name email phone pc easting northing x y skipped council anonymous partial upload_fileid); my %input = map { $_ => $q->param($_) || '' } @vars; my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars; my @ps = $q->param; @@ -384,7 +398,7 @@ sub display_form { || ($input{easting} && $input{northing}) || ($input{skipped} && $input{x} && $input{y}) || ($input{skipped} && $input{pc}) - || ($input{flickr} && $input{pc}); + || ($input{partial} && $input{pc}); my $out = ''; my ($px, $py, $easting, $northing); @@ -407,7 +421,7 @@ sub display_form { $py = Page::tile_to_px($pin_y, $input{y}, 1); $easting = Page::tile_to_os($pin_x); $northing = Page::tile_to_os($pin_y); - } elsif ($input{flickr} && $input{pc} && !$input{easting} && !$input{northing}) { + } elsif ($input{partial} && $input{pc} && !$input{easting} && !$input{northing}) { my ($x, $y, $e, $n, $error) = Page::geocode($input{pc}); $easting = $e; $northing = $n; $input{x} = int(Page::os_to_tile($easting)); @@ -424,9 +438,12 @@ sub display_form { $northing = $input_h{northing}; } + my $parent_types = $mySociety::VotingArea::council_parent_types; + $parent_types = [qw(DIS LBO MTD UTA LGD COI)] # No CTY + if $q->{site} eq 'emptyhomes'; my $all_councils = mySociety::MaPit::get_voting_areas_by_location( { easting => $easting, northing => $northing }, - 'polygon', $mySociety::VotingArea::council_parent_types); + 'polygon', $parent_types); # Ipswich & St Edmundsbury are responsible for everything in their areas, no Suffolk delete $all_councils->{2241} if $all_councils->{2446} || $all_councils->{2443}; @@ -442,7 +459,7 @@ sub display_form { # Look up categories for this council or councils my $category = ''; my %council_ok; - if ($q->{site} ne 'emptyhomes') { # No category + if ($q->{site} ne 'emptyhomes') { my $categories = select_all("select area_id, category from contacts where deleted='f' and area_id in (" . join(',', @$all_councils) . ')'); @$categories = sort { $a->{category} cmp $b->{category} } @$categories; @@ -462,6 +479,13 @@ sub display_form { -attributes=>{id=>'form_category'}) ); } + } else { + my @categories = ('-- Pick a property type --', 'Empty house or bungalow', 'Empty flat or maisonette', 'Whole block of empty flats', 'Empty office or other commercial', 'Empty pub or bar', 'Empty public building - school, hospital, etc.'); + $category = $q->div($q->label({'for'=>'form_category'}, _('Property type:')), + $q->popup_menu(-name=>'category', -values=>\@categories, + -attributes=>{id=>'form_category'}) + ); + $council_ok{$all_councils->[0]} = 1; } my @councils = keys %council_ok; @@ -492,45 +516,44 @@ EOF If this is not the correct location, simply click on the map again. ')); } - if ($q->{site} ne 'emptyhomes') { # No "send to council" blurb - if ($details eq 'all') { - $out .= '<p>All the information you provide here will be sent to <strong>' - . join('</strong> or <strong>', map { $areas_info->{$_}->{name} } @$all_councils) - . '</strong>. On the site, we will show the subject and details of the problem, - plus your name if you give us permission.'; - $out .= '<input type="hidden" name="council" value="' . join(',',@$all_councils) . '">'; - } elsif ($details eq 'some') { - my $e = mySociety::Config::get('CONTACT_EMAIL'); - my %councils = map { $_ => 1 } @councils; - my @missing; - foreach (@$all_councils) { - push @missing, $_ unless $councils{$_}; - } - my $n = @missing; - my $list = join(' or ', map { $areas_info->{$_}->{name} } @missing); - $out .= '<p>All the information you provide here will be sent to <strong>' - . join('</strong> or <strong>', map { $areas_info->{$_}->{name} } @councils) - . '</strong>. On the site, we will show the subject and details of the problem, - plus your name if you give us permission.'; - $out .= ' We do <strong>not</strong> yet have details for the other council'; - $out .= ($n>1) ? 's that cover' : ' that covers'; - $out .= " this location. You can help us by finding a contact email address for local + if ($details eq 'all') { + $out .= '<p>All the information you provide here will be sent to <strong>' + . join('</strong> or <strong>', map { $areas_info->{$_}->{name} } @$all_councils) + . '</strong>. On the site, we will show the subject and details of the problem, + plus your name if you give us permission.'; + $out .= '<input type="hidden" name="council" value="' . join(',',@$all_councils) . '">'; + } elsif ($details eq 'some') { + my $e = mySociety::Config::get('CONTACT_EMAIL'); + my %councils = map { $_ => 1 } @councils; + my @missing; + foreach (@$all_councils) { + push @missing, $_ unless $councils{$_}; + } + my $n = @missing; + my $list = join(' or ', map { $areas_info->{$_}->{name} } @missing); + $out .= '<p>All the information you provide here will be sent to <strong>' + . join('</strong> or <strong>', map { $areas_info->{$_}->{name} } @councils) + . '</strong>. On the site, we will show the subject and details of the problem, + plus your name if you give us permission.'; + $out .= ' We do <strong>not</strong> yet have details for the other council'; + $out .= ($n>1) ? 's that cover' : ' that covers'; + $out .= " this location. You can help us by finding a contact email address for local problems for $list and emailing it to us at <a href='mailto:$e'>$e</a>."; - $out .= '<input type="hidden" name="council" value="' . join(',', @councils) - . '|' . join(',', @missing) . '">'; - } else { - my $e = mySociety::Config::get('CONTACT_EMAIL'); - my $list = join(' or ', map { $areas_info->{$_}->{name} } @$all_councils); - my $n = @$all_councils; - $out .= '<p>We do not yet have details for the council'; - $out .= ($n>1) ? 's that cover' : ' that covers'; - $out .= " this location. If you submit a problem here it will be + $out .= '<input type="hidden" name="council" value="' . join(',', @councils) + . '|' . join(',', @missing) . '">'; + } else { + my $e = mySociety::Config::get('CONTACT_EMAIL'); + my $list = join(' or ', map { $areas_info->{$_}->{name} } @$all_councils); + my $n = @$all_councils; + $out .= '<p>We do not yet have details for the council'; + $out .= ($n>1) ? 's that cover' : ' that covers'; + $out .= " this location. If you submit a problem here it will be left on the site, but <strong>not</strong> reported to the council. You can help us by finding a contact email address for local problems for $list and emailing it to us at <a href='mailto:$e'>$e</a>."; - $out .= '<input type="hidden" name="council" value="-1">'; - } + $out .= '<input type="hidden" name="council" value="-1">'; } + if ($input{skipped}) { $out .= $q->p(_('Please fill in the form below with details of the problem, and describe the location as precisely as possible in the details box.')); @@ -539,18 +562,20 @@ and describe the location as precisely as possible in the details box.')); to help unless you leave as much detail as you can, so please describe the exact location of the problem (e.g. on a wall), what it is, how long it has been there, a description (and a photo of the problem if you have one), etc.'; + } elsif ($q->{site} eq 'emptyhomes') { + $out .= $q->p(<<EOF); +Please fill in details of the empty property below, saying what type of +property it is e.g. an empty home, block of flats, office etc. Tell us +something about its condition and any other information you feel is relevant. +There is no need for you to give the exact address. Please be polite, concise +and to the point; writing your message entirely in block capitals makes it hard +to read, as does a lack of punctuation. +EOF } elsif ($details ne 'none') { $out .= '<p>Please fill in details of the problem below. The council won\'t be able to help unless you leave as much detail as you can, so please describe the exact location of the problem (e.g. on a wall), what it is, how long it has been there, a description (and a photo of the problem if you have one), etc.'; - } elsif ($q->{site} eq 'emptyhomes') { - $out .= <<EOF; -<p>Please fill in details of the empty property below, giving the state of the -property, what type of property is and any other information you feel is relevant. -Please be polite, concise and to the point; writing your message entirely in -block capitals makes it hard to read, as does a lack of punctuation.</p> -EOF } else { $out .= $q->p(_('Please fill in details of the problem below.')); } @@ -576,11 +601,11 @@ EOF <div><label for="form_detail">Details:</label> <textarea name="detail" id="form_detail" rows="7" cols="26">$input_h{detail}</textarea></div> EOF - if (my $token = $input{flickr}) { - my $id = mySociety::AuthToken::retrieve('flickr', $token); + if (my $token = $input{partial}) { + my $id = mySociety::AuthToken::retrieve('partial', $token); if ($id) { - $out .= '<p>The photo you uploaded was:</p> <input type="hidden" name="flickr" value="' . $token . '">'; - $out .= '<p align="center"><img src="/photo?id=' . $id . '"></p>'; + $out .= '<p>The photo you uploaded was:</p> <input type="hidden" name="partial" value="' . $token . '">'; + $out .= '<p><img src="/photo?id=' . $id . '"></p>'; } } else { $out .= <<EOF; diff --git a/web/photo.cgi b/web/photo.cgi index 543f1b31e..fc89fc0f7 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.10 2008-05-15 16:15:32 matthew Exp $ +# $Id: photo.cgi,v 1.11 2008-10-09 14:20:54 matthew Exp $ use strict; use Standard; @@ -26,7 +26,7 @@ sub main { 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 + id=? and state in ('confirmed', 'fixed', 'partial') and photo is not null", {}, $id); } return unless $photo; diff --git a/web/posters/index.cgi b/web/posters/index.cgi index e857810e3..54fb87bfa 100755 --- a/web/posters/index.cgi +++ b/web/posters/index.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: index.cgi,v 1.6 2008-01-28 15:27:01 matthew Exp $ +# $Id: index.cgi,v 1.7 2008-10-09 14:20:55 matthew Exp $ use strict; use Standard -db; @@ -28,7 +28,7 @@ Page::do_fastcgi(\&main); sub body { my $q = shift; return $q->h1(_('Publicity Material')) . - '<img align="right" hspace="5" src="poster.png" alt="Example poster">' . + '<img align="right" hspace="5" src="poster.png" alt="Example poster">' . $q->p(_('Here are some posters you can use to publicise FixMyStreet.')) . $q->h2(_('Posters')) . $q->ul( diff --git a/web/questionnaire.cgi b/web/questionnaire.cgi index aa79f1313..43868ad8e 100755 --- a/web/questionnaire.cgi +++ b/web/questionnaire.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: questionnaire.cgi,v 1.31 2008-09-19 10:24:55 matthew Exp $ +# $Id: questionnaire.cgi,v 1.32 2008-10-09 14:20:54 matthew Exp $ use strict; use Standard; @@ -121,7 +121,7 @@ sub submit_questionnaire { # Record an update if they've given one, or if there's a state change my $name = $problem->{anonymous} ? undef : $problem->{name}; my $update = $input{update} ? $input{update} : 'Questionnaire filled in by problem reporter'; - Page::workaround_pg_bytea("insert into comment + Utils::workaround_pg_bytea("insert into comment (problem_id, name, email, website, text, state, mark_fixed, mark_open, photo) values (?, ?, ?, '', ?, 'confirmed', ?, ?, ?)", 7, $problem->{id}, $name, $problem->{email}, $update, diff --git a/web/upload.cgi b/web/upload.cgi index bc42716f8..3114b7bb9 100755 --- a/web/upload.cgi +++ b/web/upload.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: upload.cgi,v 1.1 2008-03-29 03:03:35 matthew Exp $ +# $Id: upload.cgi,v 1.2 2008-10-09 14:20:54 matthew Exp $ use strict; use Standard -db; @@ -27,11 +27,11 @@ sub main { if ($fh) { $q->delete('photo'); # Can't check content/type when uploaded with Flash $image = process_photo($fh); - my $name = unpack('H*', random_bytes(12)); - open FP, '>/data/vhost/matthew.bci.mysociety.org/photos/' . $name or throw Error::Simple('could not open file'); - print FP $image; - close FP; - $out = $name; + my $name = unpack('H*', random_bytes(12, 1)); + open FP, '>/data/vhost/matthew.bci.mysociety.org/photos/' . $name or throw Error::Simple('could not open file'); + print FP $image; + close FP; + $out = $name; }; } catch Error::Simple with { my $e = shift; |