diff options
-rw-r--r-- | conf/httpd.conf | 3 | ||||
-rw-r--r-- | templates/web/default/around/around_map_list_items.html | 2 | ||||
-rwxr-xr-x | web/ajax.cgi | 107 | ||||
-rwxr-xr-x | web/faq.cgi | 24 | ||||
-rwxr-xr-x | web/tms-signup.cgi | 120 | ||||
-rwxr-xr-x | web/upload.cgi | 56 |
6 files changed, 1 insertions, 311 deletions
diff --git a/conf/httpd.conf b/conf/httpd.conf index 2b352f643..00532a3ab 100644 --- a/conf/httpd.conf +++ b/conf/httpd.conf @@ -53,7 +53,6 @@ RewriteRule ^(.+)/$ $1 [R=permanent] # RewriteRule ^/[Cc]/([0-9A-Za-z]{16,18}).*$ /confirm.cgi?type=update;token=$1 [QSA,L] # RewriteRule ^/[Qq]/([0-9A-Za-z]{16,18}).*$ /questionnaire.cgi?token=$1 [QSA,L] RewriteRule ^/[Ff]/([0-9A-Za-z]{16,18}).*$ /flickr.cgi?token=$1 [L] -RewriteRule ^/[Tt]/([0-9A-Za-z]{16,18}).*$ /tms-signup.cgi?token=$1 [L] # RSS feeds for updates on a problem #RewriteRule ^/rss/([0-9]+)$ /rss.cgi?type=new_updates;id=$1 [QSA,L] @@ -115,8 +114,6 @@ RewriteRule ^/flickr(.*) /flickr.cgi$1 [L] # RewriteRule ^/reports(.*) /reports.cgi$1 [L] # RewriteRule ^/rss(.*) /rss.cgi$1 [L] RewriteRule ^/test(.*) /test.cgi$1 [L] -RewriteRule ^/tms-signup(.*) /tms-signup.cgi$1 [L] -RewriteRule ^/upload(.*) /upload.cgi$1 [L] RewriteRule ^/jslib(.*) /jslib$1 [L,PT] diff --git a/templates/web/default/around/around_map_list_items.html b/templates/web/default/around/around_map_list_items.html index b6c2e6d9c..87416f7a1 100644 --- a/templates/web/default/around/around_map_list_items.html +++ b/templates/web/default/around/around_map_list_items.html @@ -5,7 +5,7 @@ <li> <a href="[% c.uri_for('/report', p.id ) %]">[% p.title | html %]</a> - <small>([% prettify_epoch( p.time, 1 ) %], [% dist %]km)</small>)</small> + <small>([% prettify_epoch( p.time, 1 ) %], [% dist %]km)</small> [% IF p.state == 'fixed' %] <small>[% loc('(fixed)') %]</small> [% END %] diff --git a/web/ajax.cgi b/web/ajax.cgi deleted file mode 100755 index a25269070..000000000 --- a/web/ajax.cgi +++ /dev/null @@ -1,107 +0,0 @@ -# #!/usr/bin/perl -w -I../perllib -# -# # ajax.cgi: -# # Updating the pins as you drag the map -# # -# # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. -# # Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# # -# # $Id: ajax.cgi,v 1.19 2009-12-15 17:53:52 louise Exp $ -# -# use strict; -# use Standard; -# use mySociety::Web qw(ent NewURL); -# -# sub main { -# my $q = shift; -# -# my @vars = qw(x y sx sy all_pins); -# my %input = map { $_ => $q->param($_) || '' } @vars; -# my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars; -# -# # Our current X/Y middle of visible map -# my $x = $input{x}; -# my $y = $input{y}; -# $x ||= 0; $x += 0; -# $y ||= 0; $y += 0; -# -# # Where we started as that's the (0,0) we have to work to -# my $sx = $input{sx}; -# my $sy = $input{sy}; -# $sx ||= 0; $sx += 0; -# $sy ||= 0; $sy += 0; -# -# my $interval; -# unless ($input{all_pins}) { -# $interval = '6 months'; -# } -# my ($pins, $on_map, $around_map, $dist) = FixMyStreet::Map::map_pins($q, $x, $y, $sx, $sy, $interval); -# my $cobrand = Page::get_cobrand($q); -# my $list = ''; -# my $link = ''; -# foreach (@$on_map) { -# $link = Cobrand::url($cobrand, NewURL($q, -retain => 1, -# -url => '/report/' . $_->{id}, -# pc => undef, -# x => undef, -# y => undef, -# sx => undef, -# sy => undef, -# all_pins => undef, -# no_pins => undef), $q); -# $list .= '<li><a href="' . $link . '">'; -# $list .= ent($_->{title}) . '</a> <small>('; -# $list .= Page::prettify_epoch($q, $_->{time}, 1) . ')</small>'; -# $list .= ' <small>' . _('(fixed)') . '</small>' if $_->{state} eq 'fixed'; -# $list .= '</li>'; -# } -# my $om_list = $list; -# -# $list = ''; -# foreach (@$around_map) { -# my $dist = int($_->{distance}*10+.5)/10; -# $link = Cobrand::url($cobrand, NewURL($q, -retain => 1, -# -url => '/report/' . $_->{id}, -# pc => undef, -# x => undef, -# y => undef, -# sx => undef, -# sy => undef, -# all_pins => undef, -# no_pins => undef), $q); -# $list .= '<li><a href="' . $link . '">'; -# $list .= ent($_->{title}) . '</a> <small>('; -# $list .= Page::prettify_epoch($q, $_->{time}, 1) . ', '; -# $list .= $dist . 'km)</small>'; -# $list .= ' <small>' . _('(fixed)') . '</small>' if $_->{state} eq 'fixed'; -# $list .= '</li>'; -# } -# my $am_list = $list; -# -# #$list = ''; -# #foreach (@$fixed) { -# # $list .= '<li><a href="/report/' . $_->{id} . '">'; -# # $list .= $_->{title} . ' <small>(' . int($_->{distance}*10+.5)/10 . 'km)</small>'; -# # $list .= '</a></li>'; -# #} -# #my $f_list = $list; -# -# # For now, assume this is not cacheable - may need to be more fine-grained later -# print $q->header(-charset => 'utf-8', -content_type => 'text/javascript', -Cache_Control => 'max-age=0'); -# -# -# $pins =~ s/'/\\'/g; -# $om_list =~ s/'/\\'/g; -# $am_list =~ s/'/\\'/g; -# #$f_list =~ s/'/\\'/g; -# print <<EOF; -# ({ -# 'pins': '$pins', -# 'current': '$om_list', -# 'current_near': '$am_list' -# }) -# EOF -# } -# -# Page::do_fastcgi(\&main); -# diff --git a/web/faq.cgi b/web/faq.cgi deleted file mode 100755 index 4d9c7413a..000000000 --- a/web/faq.cgi +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/perl -w -I../perllib - -# faq.cgi: -# FAQ page for FixMyStreet -# -# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: faq.cgi,v 1.42 2009-07-10 16:10:22 matthew Exp $ - -use strict; -use Standard -db; -use mySociety::Locale; - -my $lastmodified = (stat $0)[9]; -sub main { - my $q = shift; - print Page::header($q, title=>_('Frequently Asked Questions')); - my $lang = $mySociety::Locale::lang; - print Page::template_include("faq-$lang", $q, Page::template_root($q)); - print Page::footer($q); -} -Page::do_fastcgi(\&main, $lastmodified); - diff --git a/web/tms-signup.cgi b/web/tms-signup.cgi deleted file mode 100755 index 5975a324f..000000000 --- a/web/tms-signup.cgi +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/perl -w -I../perllib - -# tms-signup.cgi -# Showing interest in TextMyStreet -# -# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: tms-signup.cgi,v 1.5 2009-11-11 14:23:05 louise Exp $ - -use strict; -use Standard; -use Digest::SHA1 qw(sha1_hex); -use CrossSell; -use mySociety::AuthToken; -use mySociety::Config; -use mySociety::EmailUtil qw(is_valid_email); -use mySociety::PostcodeUtil qw(is_valid_postcode); -use mySociety::Web qw(ent); - - #dbh()->'insert into textmystreet (name, email, postcode, mobile) values ()'; - -sub main { - my $q = shift; - my $out = ''; - my $title = 'Confirmation'; - if (my $token = $q->param('token')) { - my $data = mySociety::AuthToken::retrieve('tms', $token); - if ($data->{email}) { - $out = tms_token($q, $data); - } else { - $out = $q->p(<<EOF); -Thank you for trying to confirm your interest. 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 - } - } elsif ($q->param('email')) { - $out = tms_do_subscribe($q); - } else { - $out = tms_updates_form($q); - } - - print Page::header($q, title => $title); - print $out; - print Page::footer($q); -} -Page::do_fastcgi(\&main); - -sub tms_updates_form { - my ($q, @errors) = @_; - my @vars = qw(email name postcode mobile signed_email); - my %input = map { $_ => $q->param($_) || '' } @vars; - my $out = ''; - if (@errors) { - $out .= '<ul class="error"><li>' . join('</li><li>', @errors) . '</li></ul>'; - } - my $cobrand = Page::get_cobrand($q); - my $display_advert = Cobrand::allow_crosssell_adverts($cobrand); - if ($display_advert) { - $out .= CrossSell::display_tms_form(%input); - } - return $out; -} - -sub tms_token { - my ($q, $data) = @_; - my $type = $data->{type}; - my $out = ''; - if ($type eq 'subscribe') { - tms_confirm(%$data); - $out = $q->p('You have successfully registered your interest.'); - $out .= CrossSell::display_advert($q, $data->{email}, $data->{name}, done_tms => 1); - } - return $out; -} - -sub tms_do_subscribe { - my ($q) = @_; - my @vars = qw(email name postcode mobile signed_email); - my %input = map { $_ => $q->param($_) || '' } @vars; - - my @errors; - push @errors, 'Please enter your name' unless $input{name}; - push @errors, 'Please enter a valid email address' unless is_valid_email($input{email}); - push @errors, 'Please enter a valid postcode' unless is_valid_postcode($input{postcode}); - push @errors, 'Please enter a mobile number' unless $input{mobile}; - if (@errors) { - return tms_updates_form($q, @errors); - } - - # See if email address has been signed - if ($input{signed_email}) { - my $out; - if (mySociety::AuthToken::verify_with_shared_secret($input{email}, mySociety::Config::get('AUTH_SHARED_SECRET'), $input{signed_email})) { - tms_confirm(%input); - $out = $q->p('You have successfully registered your interest.'); - return $out; - } - } - - my %h = (); - $h{url} = mySociety::Config::get('BASE_URL') . '/T/' - . mySociety::AuthToken::store('tms', { - type => 'subscribe', - name => $input{name}, - email => $input{email}, - postcode => $input{postcode}, - mobile => $input{mobile}, - }); - dbh()->commit(); - return Page::send_confirmation_email($q, $input{email}, $input{name}, 'tms', %h); -} - -sub tms_confirm { - my %input = @_; - dbh()->do("insert into textmystreet (name, email, postcode, mobile) values (?, ?, ?, ?)", {}, - $input{name}, $input{email}, $input{postcode}, $input{mobile}); - dbh()->commit(); -} - diff --git a/web/upload.cgi b/web/upload.cgi deleted file mode 100755 index aa3f8ce61..000000000 --- a/web/upload.cgi +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/perl -w -I../perllib -I../commonlib/perllib - -# upload.cgi: -# Receiver of flash upload files -# -# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: upload.cgi,v 1.2 2008-10-09 14:20:54 matthew Exp $ - -use strict; -use Standard -db; - -use Error qw(:try); -use Image::Magick; -use mySociety::Random qw(random_bytes); - -# Main code for index.cgi -sub main { - my $q = shift; - - print $q->header(-type => 'text/plain'); - my $out = ' '; - try { - my $fh = $q->upload('Filedata'); - my $image; - 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, 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; - }; - print $out; -} -Page::do_fastcgi(\&main); - -sub process_photo { - my $fh = shift; - my $photo = Image::Magick->new; - my $err = $photo->Read(file => \*$fh); # Mustn't be stringified - close $fh; - throw Error::Simple("read failed: $err") if "$err"; - $err = $photo->Scale(geometry => "250x250>"); - throw Error::Simple("resize failed: $err") if "$err"; - my @blobs = $photo->ImageToBlob(); - undef $photo; - $photo = $blobs[0]; - return $photo; -} - |