summaryrefslogtreecommitdiff
path: root/login.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2013-08-25 22:22:39 +0100
committerGreg Roach <fisharebest@gmail.com>2013-08-25 22:22:39 +0100
commit371e02754745d821f10dc92388e856ae60d6e6b3 (patch)
tree84845ac123228c76f08460ed441b833339510347 /login.php
parent0157353bb407c124a5fbf7bc145b78d4626e2354 (diff)
downloadwebtrees-371e02754745d821f10dc92388e856ae60d6e6b3.tar.gz
webtrees-371e02754745d821f10dc92388e856ae60d6e6b3.tar.bz2
webtrees-371e02754745d821f10dc92388e856ae60d6e6b3.zip
Switch from phpmailer class to Zend_Mail. Fix #1213289 - Issue with non-breaking space - fr file
Diffstat (limited to 'login.php')
-rw-r--r--login.php155
1 files changed, 83 insertions, 72 deletions
diff --git a/login.php b/login.php
index 51968a2cad..c456413a34 100644
--- a/login.php
+++ b/login.php
@@ -225,8 +225,14 @@ case 'requestpw':
$mail_body .= WT_SERVER_NAME.WT_SCRIPT_PATH;
}
- require_once WT_ROOT.'includes/functions/functions_mail.php';
- webtreesMail(getUserEmail($user_id), $WEBTREES_EMAIL, WT_I18N::translate('Lost password request'), $mail_body);
+ WT_Mail::send(
+ getUserEmail($user_id),
+ getUserName($user_id),
+ $WEBTREES_EMAIL,
+ WT_WEBTREES,
+ WT_I18N::translate('Lost password request'),
+ $mail_body
+ );
}
// Show a success message, even if the user account does not exist.
// Otherwise this page can be used to guess/test usernames.
@@ -285,67 +291,69 @@ case 'register':
$webmaster_user_id=get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID');
WT_I18N::init(get_user_setting($webmaster_user_id, 'language'));
- $mail1_body=
- WT_I18N::translate('Hello administrator…')."\r\n\r\n".
+ $mail1_body =
+ WT_I18N::translate('Hello administrator…') ."<br>\r\n<br>\r\n" .
/* I18N: %s is a server name/URL */
- WT_I18N::translate('A prospective user has registered with webtrees at %s.', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . strip_tags(WT_TREE_TITLE)) . "\r\n\r\n".
- WT_I18N::translate('Username') .' '.$user_name ."\r\n".
- WT_I18N::translate('Real name') .' '.$user_realname."\r\n".
- WT_I18N::translate('Email Address:').' '.$user_email ."\r\n\r\n".
- WT_I18N::translate('Comments') .' '.$user_comments."\r\n\r\n".
- WT_I18N::translate('The user has been sent an e-mail with the information necessary to confirm the access request') . "\r\n\r\n";
+ WT_I18N::translate('A prospective user has registered with webtrees at %s.', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . strip_tags(WT_TREE_TITLE)) . "<br>\r\n<br>\r\n" .
+ WT_I18N::translate('Username') .' '.$user_name . "<br>\r\n" .
+ WT_I18N::translate('Real name') .' '.$user_realname . "<br>\r\n" .
+ WT_I18N::translate('Email Address:').' '.$user_email . "<br>\r\n" .
+ WT_I18N::translate('Comments') .' '.$user_comments . "<br>\r\n<br>\r\n" .
+ WT_I18N::translate('The user has been sent an e-mail with the information necessary to confirm the access request') . "<br>\r\n<br>\r\n";
if ($REQUIRE_ADMIN_AUTH_REGISTRATION) {
- $mail1_body.=WT_I18N::translate('You will be informed by e-mail when this prospective user has confirmed the request. You can then complete the process by activating the user name. The new user will not be able to login until you activate the account.') . "\r\n";
+ $mail1_body .= WT_I18N::translate('You will be informed by e-mail when this prospective user has confirmed the request. You can then complete the process by activating the user name. The new user will not be able to login until you activate the account.');
} else {
- $mail1_body.=WT_I18N::translate('You will be informed by e-mail when this prospective user has confirmed the request. After this, the user will be able to login without any action on your part.') . "\r\n";
+ $mail1_body .= WT_I18N::translate('You will be informed by e-mail when this prospective user has confirmed the request. After this, the user will be able to login without any action on your part.');
}
- $mail1_body.=
- "\r\n".
- "=--------------------------------------=\r\nIP ADDRESS: ".$WT_REQUEST->getClientIp()."\r\n".
- "DNS LOOKUP: ".gethostbyaddr($WT_REQUEST->getClientIp())."\r\n".
- "LANGUAGE: ".WT_LOCALE."\r\n";
+ $mail1_body .= WT_Mail::auditFooter();
- $mail1_subject=/* I18N: %s is a server name/URL */ WT_I18N::translate('New registration at %s', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . strip_tags(WT_TREE_TITLE));
- $mail1_to =$WEBTREES_EMAIL;
- $mail1_from =$user_email;
- $mail1_method =get_user_setting($webmaster_user_id, 'contact_method');
+ $mail1_subject = /* I18N: %s is a server name/URL */ WT_I18N::translate('New registration at %s', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . strip_tags(WT_TREE_TITLE));
+ $mail1_to = $WEBTREES_EMAIL;
+ $mail1_from = $user_email;
+ $mail1_method = get_user_setting($webmaster_user_id, 'contact_method');
WT_I18N::init(WT_LOCALE);
echo '<div id="login-register-page">';
- require_once WT_ROOT.'includes/functions/functions_mail.php';
-
// Generate an email in the user’s language
$mail2_body=
- WT_I18N::translate('Hello %s…', $user_realname) . "\r\n\r\n".
+ WT_I18N::translate('Hello %s…', $user_realname) . "<br>\r\n<br>\r\n" .
/* I18N: %1$s is the site URL and %2$s is an email address */
WT_I18N::translate('You (or someone claiming to be you) has requested an account at %1$s using the email address %2$s.', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . strip_tags(WT_TREE_TITLE), $user_email) . ' '.
- WT_I18N::translate('Information about the request is shown under the link below.') . "\r\n\r\n".
- WT_I18N::translate('Please click on the following link and fill in the requested data to confirm your request and email address.') . "\r\n\r\n";
- if ($TEXT_DIRECTION=='rtl') {
- $mail2_body .= "<a href=\"";
- $mail2_body .= WT_LOGIN_URL . "?user_name=".urlencode($user_name)."&user_hashcode=".urlencode(get_user_setting($user_id, 'reg_hashcode'))."&action=userverify\">";
- }
- $mail2_body .= WT_LOGIN_URL . "?user_name=".urlencode($user_name)."&user_hashcode=".urlencode(get_user_setting($user_id, 'reg_hashcode'))."&action=userverify";
- if ($TEXT_DIRECTION=='rtl') {
- $mail2_body .= "</a>";
- }
- $mail2_body.=
- "\r\n".
- WT_I18N::translate('Username') . " " . $user_name . "\r\n".
- WT_I18N::translate('Verification code:') . " " . get_user_setting($user_id, 'reg_hashcode') . "\r\n\r\n".
- WT_I18N::translate('Comments').": " . $user_comments . "\r\n\r\n".
- WT_I18N::translate('If you didn’t request an account, you can just delete this message.') . " ".
- WT_I18N::translate('You won’t get any more email from this site, because the account request will be deleted automatically after seven days.') . "\r\n";
+ WT_I18N::translate('Information about the request is shown under the link below.') . "<br>\r\n" .
+ WT_I18N::translate('Please click on the following link and fill in the requested data to confirm your request and email address.') . "<br>\r\n<br>\r\n" .
+ '<a href="' . WT_LOGIN_URL . "?user_name=".urlencode($user_name)."&amp;user_hashcode=".urlencode(get_user_setting($user_id, 'reg_hashcode')) . '&amp;action=userverify">' .
+ WT_LOGIN_URL . "?user_name=".urlencode($user_name)."&user_hashcode=".urlencode(get_user_setting($user_id, 'reg_hashcode'))."&action=userverify" .
+ '</a>' . "<br>\r\n<br>\r\n" .
+ WT_I18N::translate('Username') . " " . $user_name . "<br>\r\n" .
+ WT_I18N::translate('Verification code:') . " " . get_user_setting($user_id, 'reg_hashcode') . "<br>\r\n" .
+ WT_I18N::translate('Comments').": " . $user_comments . "<br>\r\n" .
+ WT_I18N::translate('If you didn’t request an account, you can just delete this message.') .
+ ' '.
+ WT_I18N::translate('You won’t get any more email from this site, because the account request will be deleted automatically after seven days.') . "<br>\r\n";
$mail2_subject=/* I18N: %s is a server name/URL */ WT_I18N::translate('Your registration at %s', WT_SERVER_NAME.WT_SCRIPT_PATH);
$mail2_to =$user_email;
$mail2_from =$WEBTREES_EMAIL;
// Send user message by email only
- webtreesMail($mail2_to, $mail2_from, $mail2_subject, $mail2_body);
+ WT_Mail::send(
+ $mail2_to,
+ 'to',
+ $mail2_from,
+ 'from',
+ $mail2_subject,
+ $mail2_body
+ );
// Send admin message by email and/or internal messaging
- webtreesMail($mail1_to, $mail1_from, $mail1_subject, $mail1_body);
+ WT_Mail::send(
+ $mail1_to,
+ 'to',
+ $mail1_from,
+ 'from',
+ $mail1_subject,
+ $mail1_body
+ );
if ($mail1_method!='messaging3' && $mail1_method!='mailto' && $mail1_method!='none') {
WT_DB::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)")
->execute(array($user_email, $WT_REQUEST->getClientIp(), $webmaster_user_id, $mail1_subject, $mail1_body));
@@ -459,44 +467,41 @@ case 'userverify':
case 'verify_hash':
if (!WT_Site::preference('USE_REGISTRATION_MODULE')) {
- header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH);
+ header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
exit;
}
- AddToLog('User attempted to verify hashcode: '.$user_name, 'auth');
+ AddToLog('User attempted to verify hashcode: ' . $user_name, 'auth');
// switch language to webmaster settings
- $webmaster_user_id=get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID');
+ $webmaster_user_id = get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID');
WT_I18N::init(get_user_setting($webmaster_user_id, 'language'));
- $user_id=get_user_id($user_name);
- $mail1_body=
- WT_I18N::translate('Hello administrator…') . "\r\n\r\n".
+ $user_id = get_user_id($user_name);
+ $mail1_body =
+ WT_I18N::translate('Hello administrator…') . WT_Mail::EOL . WT_Mail::EOL .
/* I18N: %1$s is a real-name, %2$s is a username, %3$s is an email address */
- WT_I18N::translate('A new user (%1$s) has requested an account (%2$s) and verified an email address (%3$s).', getUserFullName($user_id), $user_name, getUserEmail($user_id))."\r\n\r\n";
+ WT_I18N::translate(
+ 'A new user (%1$s) has requested an account (%2$s) and verified an email address (%3$s).',
+ getUserFullName($user_id),
+ $user_name,
+ getUserEmail($user_id)
+ ) . WT_Mail::EOL . WT_Mail::EOL;
if ($REQUIRE_ADMIN_AUTH_REGISTRATION && !get_user_setting($user_id, 'verified_by_admin')) {
- $mail1_body .= WT_I18N::translate('You now need to review the account details, and set the “approved” status to “yes”.') . "\r\n";
+ $mail1_body .= WT_I18N::translate('You now need to review the account details, and set the “approved” status to “yes”.');
} else {
- $mail1_body .= WT_I18N::translate('You do not have to take any action; the user can now login.') . "\r\n";
- }
- if ($TEXT_DIRECTION=='rtl') {
- $mail1_body .= "<a href=\"";
- $mail1_body .= WT_SERVER_NAME.WT_SCRIPT_PATH."admin_users.php?filter=" . rawurlencode($user_name) . "\">";
+ $mail1_body .= WT_I18N::translate('You do not have to take any action; the user can now login.');
}
- $mail1_body .= WT_SERVER_NAME.WT_SCRIPT_PATH."admin_users.php?filter=" . rawurlencode($user_name);
- if ($TEXT_DIRECTION=="rtl") {
- $mail1_body .= "</a>";
- }
- $mail1_body.=
- "\r\n\r\n".
- "=--------------------------------------=\r\n".
- "IP ADDRESS: ".$WT_REQUEST->getClientIp()."\r\n".
- "DNS LOOKUP: ".gethostbyaddr($WT_REQUEST->getClientIp())."\r\n".
- "LANGUAGE: ".WT_LOCALE."\r\n";
+ $mail1_body .=
+ WT_Mail::EOL .
+ '<a href="'. WT_SERVER_NAME.WT_SCRIPT_PATH."admin_users.php?filter=" . rawurlencode($user_name) . '">' .
+ WT_SERVER_NAME.WT_SCRIPT_PATH."admin_users.php?filter=" . rawurlencode($user_name) .
+ '</a>' .
+ WT_Mail::auditFooter();
- $mail1_to=$WEBTREES_EMAIL;
- $mail1_from=getUserEmail($user_id);
- $mail1_subject=/* I18N: %s is a server name/URL */ WT_I18N::translate('New user at %s', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . strip_tags(WT_TREE_TITLE));
- $mail1_method=get_user_setting($webmaster_user_id, 'CONTACT_METHOD');
+ $mail1_to = $WEBTREES_EMAIL;
+ $mail1_from = getUserEmail($user_id);
+ $mail1_subject = /* I18N: %s is a server name/URL */ WT_I18N::translate('New user at %s', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . strip_tags(WT_TREE_TITLE));
+ $mail1_method = get_user_setting($webmaster_user_id, 'CONTACT_METHOD');
// Change to the new user’s language
WT_I18N::init(get_user_setting($user_id, 'language'));
@@ -512,8 +517,14 @@ case 'verify_hash':
$pw_ok = check_user_password($user_id, $user_password);
$hc_ok = get_user_setting($user_id, 'reg_hashcode') == $user_hashcode;
if ($pw_ok && $hc_ok) {
- require_once WT_ROOT.'includes/functions/functions_mail.php';
- webtreesMail($mail1_to, $mail1_from, $mail1_subject, $mail1_body);
+ WT_Mail::send(
+ $mail1_to,
+ 'to',
+ $mail1_from,
+ 'from',
+ $mail1_subject,
+ $mail1_body
+ );
if ($mail1_method!='messaging3' && $mail1_method!='mailto' && $mail1_method!='none') {
WT_DB::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)")
->execute(array($user_name, $WT_REQUEST->getClientIp(), $webmaster_user_id, $mail1_subject, $mail1_body));