From 72c942b7c4f42564b51b129a9742a7b427b46588 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 13 Feb 2007 20:25:08 +0000 Subject: [PATCH] r1405: Beginning to move email text out of the code and into templates. This is done for the registration system, but bug change notifications still need to be done. --- register.php | 46 ++++++++----------------- templates/email/activateaccount.xml.tpl | 8 +++++ templates/email/welcome.xml.tpl | 8 +++++ 3 files changed, 30 insertions(+), 32 deletions(-) create mode 100644 templates/email/activateaccount.xml.tpl create mode 100644 templates/email/welcome.xml.tpl diff --git a/register.php b/register.php index 3da35c0..23677d2 100755 --- a/register.php +++ b/register.php @@ -96,19 +96,10 @@ if ($_POST['do'] == 'insert') $db->query("INSERT INTO " . TABLE_PREFIX . "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . TIMENOW . ", 2)"); - $mail->setSubject(sprintf(_('Welcome to %1$s'), $bugsys->options['trackertitle'])); - $mail->setBodyText(sprintf(_('Hi %1$s, - -Welcome to the %2$s tracker. Before you can begin posting bug reports, you\'ll need to activae your account. To do this, please click this link: - -%3$s/register.php?do=activate&userid=%4$s&activator=%5$s'), - - $bugsys->in['displayname'], - $bugsys->options['trackertitle'], - $bugsys->options['trackerurl'], - $userid, - $activationid - )); + eval('$email = "' . $template->fetch('email/activateaccount.xml') . '";'); + $email = $bugsys->xml->parse($email); + $mail->setSubject($email['email']['subject']['value']); + $mail->setBodyText($email['email']['bodyText']['value']); $mail->send($bugsys->in['email'], $bugsys->in['displayname']); @@ -118,16 +109,11 @@ Welcome to the %2$s tracker. Before you can begin posting bug reports, you\'ll n { if ($bugsys->options['sendwelcomemail']) { - $mail->setSubject(sprintf(_('Welcome to %1$s'), $bugsys->options['trackertitle'])); - $mail->setBodyText(sprintf(_('Hi %1$s, - -Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better. - -If you have any questions, please don\'t hesitate to contact the webmaster.'), - $bugsys->in['displayname'], - $bugsys->options['trackertitle'] - )); - + $displayName = $bugsys->in['displayname']; + eval('$email = "' . $template->fetch('email/welcome.xml') . '";'); + $email = $bugsys->xml->parse($email); + $mail->setSubject($email['email']['subject']['value']); + $mail->setBodyText($email['email']['bodyText']['value']); $mail->send($bugsys->in['email'], $bugsys->in['displayname']); } @@ -186,15 +172,11 @@ if ($_REQUEST['do'] == 'activate') if ($bugsys->options['sendwelcomemail']) { - $mail->setSubject(sprintf(_('Welcome to %1$s'), $bugsys->options['trackertitle'])); - $mail->setBodyText(sprintf(_('Hi %1$s, - -Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better. - -If you have any questions, please don\'t hesitate to contact the webmaster.'), - $user['displayname'], - $bugsys->options['trackertitle'] - )); + $displayName = $user['displayname']; + eval('$email = "' . $template->fetch('email/welcome.xml') . '";'); + $email = $bugsys->xml->parse($email); + $mail->setSubject($email['email']['subject']['value']); + $mail->setBodyText($email['email']['bodyText']['value']); $mail->send($user['email'], $user['displayname']); } diff --git a/templates/email/activateaccount.xml.tpl b/templates/email/activateaccount.xml.tpl new file mode 100644 index 0000000..ae4f98a --- /dev/null +++ b/templates/email/activateaccount.xml.tpl @@ -0,0 +1,8 @@ + + Welcome to {$bugsys->options['trackertitle']} + Hi {$bugsys->in['displayname']}, + +Welcome to the {$bugsys->options['trackertitle']} tracker. Before you can begin posting bug reports, you'll need to activae your account. To do this, please click this link: + +{$bugsys->options['trackerurl']}/register.php?do=activate&userid=$userid&activator=$activationid + \ No newline at end of file diff --git a/templates/email/welcome.xml.tpl b/templates/email/welcome.xml.tpl new file mode 100644 index 0000000..494779a --- /dev/null +++ b/templates/email/welcome.xml.tpl @@ -0,0 +1,8 @@ + + Welcome to {$bugsys->options['trackertitle']} + Hi {$displayName}, + +Thank you for taking the time to register at {$bugsys->options['trackertitle']}. We look forward to your contributations to making our products better. + +If you have any questions, please don't hesitate to contact the webmaster. + \ No newline at end of file -- 2.22.5