diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-06 08:05:54 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-06 10:33:57 +0100 |
commit | 01b426f5ec48bc8b9cd90c85bd3e8782aec03767 (patch) | |
tree | 19f1a20fa075993cc358b31486a164b04ec80560 | |
parent | f89681f9b900f0b20a099cb15ff8a01f1798d508 (diff) |
Stop using mySociety::Web and mySociety::Sundries.
Both uses can be covered by existing modules.
This means we can drop FCGI also.
-rw-r--r-- | cpanfile | 1 | ||||
-rw-r--r-- | cpanfile.snapshot | 6 | ||||
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Rss.pm | 24 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Angus.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/EastHants.pm | 6 |
6 files changed, 16 insertions, 24 deletions
@@ -54,7 +54,6 @@ requires 'Email::MIME'; requires 'Email::Sender'; requires 'Email::Valid'; requires 'Error'; -requires 'FCGI'; requires 'File::Find'; requires 'File::Path'; requires 'File::Slurp'; diff --git a/cpanfile.snapshot b/cpanfile.snapshot index 3b1cfe1dd..db00f48a7 100644 --- a/cpanfile.snapshot +++ b/cpanfile.snapshot @@ -2818,12 +2818,6 @@ DISTRIBUTIONS File::Spec 0.8 Pod::Man 0 perl 5.006 - FCGI-0.74 - pathname: F/FL/FLORA/FCGI-0.74.tar.gz - provides: - FCGI 0.74 - requirements: - ExtUtils::MakeMaker 0 File-ChangeNotify-0.23 pathname: D/DR/DROLSKY/File-ChangeNotify-0.23.tar.gz provides: diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm index 0e299d2c0..3497ad0e1 100755 --- a/perllib/FixMyStreet/App/Controller/Rss.pm +++ b/perllib/FixMyStreet/App/Controller/Rss.pm @@ -3,6 +3,7 @@ package FixMyStreet::App::Controller::Rss; use Moose; use namespace::autoclean; use POSIX qw(strftime); +use HTML::Entities; use URI::Escape; use XML::RSS; @@ -11,8 +12,7 @@ use FixMyStreet::App::Model::PhotoSet; use FixMyStreet::Gaze; use mySociety::Locale; use mySociety::MaPit; -use mySociety::Sundries qw(ordinal); -use mySociety::Web qw(ent); +use Lingua::EN::Inflect qw(ORD); BEGIN { extends 'Catalyst::Controller'; } @@ -250,7 +250,7 @@ sub add_row : Private { }; $row->{created} = strftime("%e %B", $6, $5, $4, $3, $2-1, $1-1900, -1, -1, 0); $row->{created} =~ s/^\s+//; - $row->{created} =~ s/^(\d+)/ordinal($1)/e if $c->stash->{lang_code} eq 'en-gb'; + $row->{created} =~ s/^(\d+)/ORD($1)/e if $c->stash->{lang_code} eq 'en-gb'; } if ($row->{confirmed}) { $row->{confirmed} =~ /^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/; @@ -259,7 +259,7 @@ sub add_row : Private { }; $row->{confirmed} = strftime("%e %B", $6, $5, $4, $3, $2-1, $1-1900, -1, -1, 0); $row->{confirmed} =~ s/^\s+//; - $row->{confirmed} =~ s/^(\d+)/ordinal($1)/e if $c->stash->{lang_code} eq 'en-gb'; + $row->{confirmed} =~ s/^(\d+)/ORD($1)/e if $c->stash->{lang_code} eq 'en-gb'; } (my $title = _($alert_type->item_title)) =~ s/\{\{(.*?)}}/$row->{$1}/g; @@ -270,13 +270,13 @@ sub add_row : Private { my $url = $base_url . $link; my %item = ( - title => ent($title), + title => encode_entities($title), link => $url, guid => $url, - description => ent(ent($desc)) # Yes, double-encoded, really. + description => encode_entities(encode_entities($desc)) # Yes, double-encoded, really. ); $item{pubDate} = $pubDate if $pubDate; - $item{category} = ent($row->{category}) if $row->{category}; + $item{category} = encode_entities($row->{category}) if $row->{category}; if ($c->cobrand->allow_photo_display($row) && $row->{photo}) { # Bit yucky as we don't have full objects here @@ -285,16 +285,16 @@ sub add_row : Private { my ($hash, $format) = split /\./, $first_fn; my $cachebust = substr($hash, 0, 8); my $key = $alert_type->item_table eq 'comment' ? 'c/' : ''; - $item{description} .= ent("\n<br><img src=\"". $base_url . "/photo/$key$row->{id}.0.$format?$cachebust\">"); + $item{description} .= encode_entities("\n<br><img src=\"". $base_url . "/photo/$key$row->{id}.0.$format?$cachebust\">"); } if ( $row->{used_map} ) { my $address = $c->cobrand->find_closest_address_for_rss($row); - $item{description} .= ent("\n<br>$address") if $address; + $item{description} .= encode_entities("\n<br>$address") if $address; } my $recipient_name = $c->cobrand->contact_name; - $item{description} .= ent("\n<br><a href='$url'>" . + $item{description} .= encode_entities("\n<br><a href='$url'>" . sprintf(_("Report on %s"), $recipient_name) . "</a>"); if ($row->{latitude} || $row->{longitude}) { @@ -329,9 +329,9 @@ sub add_parameters : Private { (my $desc = _($alert_type->head_description)) =~ s/\{\{(.*?)}}/$row->{$1}/g; $c->stash->{rss}->channel( - title => ent($title), + title => encode_entities($title), link => $c->uri_for($link) . ($c->stash->{qs} || ''), - description => ent($desc), + description => encode_entities($desc), language => 'en-gb', ); } diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index e067405ee..38f07dbfd 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -379,7 +379,7 @@ sub link_to_council_cobrand { my $handler = $self->get_body_handler_for_problem($problem); $self->{c}->log->debug( sprintf "bodies: %s areas: %s self: %s handler: %s", $problem->bodies_str, $problem->areas, $self->moniker, $handler->moniker ); my $bodies_str_ids = $problem->bodies_str_ids; - if ( !mySociety::Config::get('AREA_LINKS_FROM_PROBLEMS') && + if ( !FixMyStreet->config('AREA_LINKS_FROM_PROBLEMS') && scalar(@$bodies_str_ids) == 1 && $handler->is_council && $handler->moniker ne $self->{c}->cobrand->moniker ) { diff --git a/perllib/FixMyStreet/SendReport/Angus.pm b/perllib/FixMyStreet/SendReport/Angus.pm index cab5de173..b552fbd9d 100644 --- a/perllib/FixMyStreet/SendReport/Angus.pm +++ b/perllib/FixMyStreet/SendReport/Angus.pm @@ -7,7 +7,6 @@ BEGIN { extends 'FixMyStreet::SendReport'; } use Try::Tiny; use Encode; use XML::Simple; -use mySociety::Web qw(ent); sub get_auth_token { my ($self, $authxml) = @_; diff --git a/perllib/FixMyStreet/SendReport/EastHants.pm b/perllib/FixMyStreet/SendReport/EastHants.pm index 55ec79613..b24123f94 100644 --- a/perllib/FixMyStreet/SendReport/EastHants.pm +++ b/perllib/FixMyStreet/SendReport/EastHants.pm @@ -6,7 +6,7 @@ BEGIN { extends 'FixMyStreet::SendReport'; } use Try::Tiny; use Encode; -use mySociety::Web qw(ent); +use HTML::Entities; sub construct_message { my %h = @_; @@ -43,8 +43,8 @@ sub send { $eh_service ||= Integrations::EastHantsWSDL->on_fault(sub { my($soap, $res) = @_; die ref $res ? $res->faultstring : $soap->transport->status, "\n"; }); try { # ServiceName, RemoteCreatedBy, Salutation, FirstName, Name, Email, Telephone, HouseNoName, Street, Town, County, Country, Postcode, Comments, FurtherInfo, ImageURL - my $message = ent(encode_utf8($h->{message})); - my $name = ent(encode_utf8($h->{name})); + my $message = encode_entities(encode_utf8($h->{message})); + my $name = encode_entities(encode_utf8($h->{name})); my $result = $eh_service->INPUTFEEDBACK( $h->{category}, 'FixMyStreet', '', '', $name, $h->{email}, $h->{phone}, '', '', '', '', '', '', $message, 'Yes', $h->{image_url} |