diff options
-rwxr-xr-x | bin/import-categories | 3 | ||||
-rwxr-xr-x | bin/load-contacts | 5 | ||||
-rwxr-xr-x | bin/send-reports | 8 | ||||
-rwxr-xr-x | web/alert.cgi | 4 | ||||
-rwxr-xr-x | web/confirm.cgi | 4 | ||||
-rwxr-xr-x | web/contact.cgi | 10 | ||||
-rwxr-xr-x | web/index.cgi | 14 |
7 files changed, 25 insertions, 23 deletions
diff --git a/bin/import-categories b/bin/import-categories index e269e9176..f7fceeeeb 100755 --- a/bin/import-categories +++ b/bin/import-categories @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: import-categories,v 1.2 2007-03-21 16:04:39 matthew Exp $ +# $Id: import-categories,v 1.3 2007-08-02 11:44:59 matthew Exp $ use strict; require 5.8.0; @@ -19,7 +19,6 @@ use lib "$FindBin::Bin/../../perllib"; use mySociety::Config; use mySociety::DBHandle qw(dbh select_all); use mySociety::MaPit; -use mySociety::Util; use mySociety::VotingArea; BEGIN { diff --git a/bin/load-contacts b/bin/load-contacts index d3f0681e2..9c0d460b3 100755 --- a/bin/load-contacts +++ b/bin/load-contacts @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: load-contacts,v 1.2 2007-01-26 22:48:30 matthew Exp $ +# $Id: load-contacts,v 1.3 2007-08-02 11:44:59 matthew Exp $ use strict; require 5.8.0; @@ -18,6 +18,7 @@ use lib "$FindBin::Bin/../../perllib"; use mySociety::Config; use mySociety::DBHandle qw(dbh select_all); +use mySociety::Random; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); @@ -31,7 +32,7 @@ BEGIN { if (!dbh()->selectrow_array('select secret from secret for update of secret')) { local dbh()->{HandleError}; - dbh()->do('insert into secret (secret) values (?)', {}, unpack('h*', mySociety::Util::random_bytes(32))); + dbh()->do('insert into secret (secret) values (?)', {}, unpack('h*', mySociety::Random::random_bytes(32))); } dbh()->commit(); } diff --git a/bin/send-reports b/bin/send-reports index a8faf3779..4d5546a55 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: send-reports,v 1.44 2007-07-11 16:39:02 matthew Exp $ +# $Id: send-reports,v 1.45 2007-08-02 11:44:59 matthew Exp $ use strict; require 5.8.0; @@ -20,8 +20,8 @@ use File::Slurp; use mySociety::Config; use mySociety::DBHandle qw(dbh select_all); use mySociety::Email; +use mySociety::EmailUtil; use mySociety::MaPit; -use mySociety::Util; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); @@ -136,9 +136,9 @@ If you know of an appropriate contact address, please do get in touch. ]\n\n"; if (mySociety::Config::get('STAGING_SITE') || $nomail) { $result = -1; } else { - $result = mySociety::Util::send_email($email, mySociety::Config::get('CONTACT_EMAIL'), @recips); + $result = mySociety::EmailUtil::send_email($email, mySociety::Config::get('CONTACT_EMAIL'), @recips); } - if ($result == mySociety::Util::EMAIL_SUCCESS) { + if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) { dbh()->do('UPDATE problem SET whensent=ms_current_timestamp(), lastupdate=ms_current_timestamp() WHERE id=?', {}, $row->{id}); dbh()->commit(); diff --git a/web/alert.cgi b/web/alert.cgi index daa94d8c2..2af4f93b0 100755 --- a/web/alert.cgi +++ b/web/alert.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: alert.cgi,v 1.8 2007-07-09 17:40:29 matthew Exp $ +# $Id: alert.cgi,v 1.9 2007-08-02 11:45:06 matthew Exp $ use strict; require 5.8.0; @@ -23,7 +23,7 @@ use mySociety::Alert; use mySociety::AuthToken; use mySociety::Config; use mySociety::DBHandle qw(dbh select_all); -use mySociety::Util qw(is_valid_email); +use mySociety::EmailUtil qw(is_valid_email); use mySociety::Web qw(ent); BEGIN { diff --git a/web/confirm.cgi b/web/confirm.cgi index 14c4ee679..78b0db0d6 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.27 2007-07-11 18:04:08 matthew Exp $ +# $Id: confirm.cgi,v 1.28 2007-08-02 11:45:06 matthew Exp $ use strict; require 5.8.0; @@ -22,7 +22,7 @@ use Page; use mySociety::AuthToken; use mySociety::Config; use mySociety::DBHandle qw(dbh select_all); -use mySociety::Util qw(random_bytes); +use mySociety::Random qw(random_bytes); BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); diff --git a/web/contact.cgi b/web/contact.cgi index f76f583a1..8a211a21a 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.21 2007-07-09 17:40:29 matthew Exp $ +# $Id: contact.cgi,v 1.22 2007-08-02 11:45:06 matthew Exp $ use strict; require 5.8.0; @@ -20,7 +20,7 @@ use Page; use mySociety::Config; use mySociety::DBHandle qw(dbh); use mySociety::Email; -use mySociety::Util; +use mySociety::EmailUtil; use mySociety::Web qw(ent); BEGIN { @@ -58,7 +58,7 @@ sub contact_submit { push(@errors, 'Please give your name') unless $input{name} =~ /\S/; if ($input{email} !~ /\S/) { push(@errors, 'Please give your email'); - } elsif (!mySociety::Util::is_valid_email($input{email})) { + } elsif (!mySociety::EmailUtil::is_valid_email($input{email})) { push(@errors, 'Please give a valid email address'); } push(@errors, 'Please give a subject') unless $input{subject} =~ /\S/; @@ -82,8 +82,8 @@ sub contact_submit { To => [[mySociety::Config::get('CONTACT_EMAIL'), 'FixMyStreet']], Subject => 'FMS message: ' . $subject }); - my $result = mySociety::Util::send_email($email, $input{email}, mySociety::Config::get('CONTACT_EMAIL')); - if ($result == mySociety::Util::EMAIL_SUCCESS) { + my $result = mySociety::EmailUtil::send_email($email, $input{email}, mySociety::Config::get('CONTACT_EMAIL')); + if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) { my $out = $q->p("Thanks for your feedback. We'll get back to you as soon as we can!"); $out .= CrossSell::display_advert($input{email}, $input{name}); return $out; diff --git a/web/index.cgi b/web/index.cgi index 3916f38e0..25cb2f671 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.153 2007-07-19 13:27:54 matthew Exp $ +# $Id: index.cgi,v 1.154 2007-08-02 11:45:06 matthew Exp $ use strict; require 5.8.0; @@ -28,10 +28,12 @@ use Page; use mySociety::AuthToken; use mySociety::Config; use mySociety::DBHandle qw(dbh select_all); +use mySociety::EmailUtil; use mySociety::Gaze; use mySociety::GeoUtil; -use mySociety::Util; use mySociety::MaPit; +use mySociety::PostcodeUtil; +use mySociety::Random; use mySociety::VotingArea; use mySociety::Web qw(ent NewURL); @@ -47,7 +49,7 @@ BEGIN { if (!dbh()->selectrow_array('select secret from secret for update of secret')) { local dbh()->{HandleError}; - dbh()->do('insert into secret (secret) values (?)', {}, unpack('h*', mySociety::Util::random_bytes(32))); + dbh()->do('insert into secret (secret) values (?)', {}, unpack('h*', mySociety::Random::random_bytes(32))); } dbh()->commit(); } @@ -183,7 +185,7 @@ sub submit_update { $input{name} = undef unless $input{name} =~ /\S/; if ($input{email} !~ /\S/) { push(@errors, 'Please enter your email'); - } elsif (!mySociety::Util::is_valid_email($input{email})) { + } elsif (!mySociety::EmailUtil::is_valid_email($input{email})) { push(@errors, 'Please enter a valid email'); } return display_problem($q, @errors) if (@errors); @@ -230,7 +232,7 @@ sub submit_problem { } if ($input{email} !~ /\S/) { push(@errors, 'Please enter your email'); - } elsif (!mySociety::Util::is_valid_email($input{email})) { + } elsif (!mySociety::EmailUtil::is_valid_email($input{email})) { push(@errors, 'Please enter a valid email'); } if ($input{category} && $input{category} eq '-- Pick a category --') { @@ -831,7 +833,7 @@ sub geocode_choice { sub geocode { my ($s) = @_; my ($x, $y, $easting, $northing, $island, $error); - if (mySociety::Util::is_valid_postcode($s)) { + if (mySociety::PostcodeUtil::is_valid_postcode($s)) { try { my $location = mySociety::MaPit::get_location($s); $island = $location->{coordsyst}; |