summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2008-06-20 01:15:36 -0400
committerEvan Prodromou <evan@controlyourself.ca>2008-06-20 01:15:36 -0400
commitbf0be3ddb7226f428a3cc00a87c5a64f2113c00b (patch)
treef39f275c5ada6dc79d835eb78101596fd003f368 /lib
parent8ecd2a6b1dcfb21fae9a70bba65dfff3bb7503f1 (diff)
confirm email addresses
darcs-hash:20080620051536-5ed1f-231e427832dd20c861eb7a6dc1171315e90f455b.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/action.php7
-rw-r--r--lib/common.php1
-rw-r--r--lib/mail.php28
3 files changed, 35 insertions, 1 deletions
diff --git a/lib/action.php b/lib/action.php
index 06d3901d1..81b228312 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -68,4 +68,11 @@ class Action { // lawsuit
common_debug("User error '$code' on '$action': $msg", __FILE__);
common_user_error($msg, $code);
}
+
+ function self_url() {
+ $action = $this->trimmed('action');
+ $args = $this->args;
+ unset($args['action']);
+ return common_local_url($action, $args);
+ }
}
diff --git a/lib/common.php b/lib/common.php
index 7435b0f4a..00f6d68a7 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -80,3 +80,4 @@ require_once(INSTALLDIR.'/classes/Profile.php');
require_once(INSTALLDIR.'/classes/Remote_profile.php');
require_once(INSTALLDIR.'/classes/Subscription.php');
require_once(INSTALLDIR.'/classes/User.php');
+require_once(INSTALLDIR.'/classes/Confirm_email.php');
diff --git a/lib/mail.php b/lib/mail.php
index 25253fd81..23fd24b25 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -54,4 +54,30 @@ function mail_notify_from() {
return $config['site']['name'] . ' <noreply@'.$config['site']['server'].'>';
}
}
- \ No newline at end of file
+
+# For confirming an email address
+
+function mail_confirm_address($code, $nickname, $address) {
+ $recipients = $address;
+ $headers['From'] = mail_notify_from();
+ $headers['To'] = $nickname . ' <' . $address . '>';
+ $headers['Subject'] = _t('Email address confirmation');
+
+ $body = "Hey, $nickname.";
+ $body .= "\n\n";
+ $body .= 'Someone just entered this email address on ' . common_config('site', 'name') . '.';
+ $body .= "\n\n";
+ $body .= 'If it was you, and you want to confirm your entry, use the URL below:';
+ $body .= "\n\n";
+ $body .= "\t".common_local_url('confirmemail',
+ array('code' => $code));
+ $body .= "\n\n";
+ $body .= 'If not, just ignore this message.';
+ $body .= "\n\n";
+ $body .= 'Thanks for your time, ';
+ $body .= "\n";
+ $body .= common_config('site', 'name');
+ $body .= "\n";
+
+ mail_send($recipients, $headers, $body);
+}