diff options
Diffstat (limited to 'web')
-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 |
4 files changed, 17 insertions, 15 deletions
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}; |