- Get the email system to work for register.php
[bugdar.git] / includes / emails.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright ©2002-2007 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * Returns an email's translated text, for use in sprintf(), given a variable
24 * name
25 *
26 * @param string Name of the email
27 *
28 * @return array Array of translated items (subject, bodyText, bodyHtml)
29 */
30 function get_email_text($name)
31 {
32 $_emails = array(
33 // welcome email
34 // vars: username, trackertitle
35 'welcome' => array(
36 'subject' => sprintf(T('Welcome to %1$s'), bugdar::$options['trackertitle']),
37 'bodyText' => T('Hi %1$s,
38
39 Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better.
40
41 If you have any questions, please don\'t hesitate to contact the webmaster.')
42 ),
43
44 // reset password
45 // vars: username, trackertitle, trackerurl, activation id
46 'password_reset' => array(
47 'subject' => sprintf(T('%1$s Password Reset'), bugdar::$options['trackertitle']),
48 'bodyText' => T('Hi %1$s,
49
50 You requested this lost password email at the %2$s bug tracker. To reset your password, simply click the link below (or paste it into your browser window exactly) and enter a new password.
51
52 %3$s/login.php?do=recoverpw&activator=%4$s
53
54 If you did not request this, do not worry as this notice will expire in 24 hours.')
55 ),
56
57 // account approved and active
58 // vars: username, trackertitle
59 'account_approved' => array(
60 'subject' => sprintf(T('Account Approved at %1$s'), bugdar::$options['trackertitle']),
61 'bodyText' => T('Hi %1$s,
62
63 Your account was awaiting moderation at %2$s. Today, an administrator approved your registration and you are now able to use the bug tracker fully.
64
65 If you have any questions, please don\'t hesitate to contact the webmaster.')
66 ),
67
68 // activation code
69 // vars: username, trackertitle, trackerurl, userid, activationid
70 'activate_account' => array(
71 'subject' => sprintf(T('Welcome to %1$s'), bugdar::$options['trackertitle']),
72 'bodyText' => T('Hi %1$s,
73
74 Welcome to the %2$s tracker. Before you can begin posting bug reports, you\'ll need to activate your account. To do this, please click this link:
75
76 %3$s/register.php?do=activate&userid=%4$d&activator=%5$s')
77 ),
78
79 // bug notification
80 // vars: trackertitle, bug.summary
81 // vars: username, trackertitle, bug.summary, bug.id, trackerurl, parts
82 'notification' => array(
83 'subject' => T('%1$s Bug Notification - %2$s'),
84 'bodyText' => T('Hi %1$s,
85
86 You are receiving this email because you have opted to get notifications for the %2$s bug tracker.
87
88 The bug is "%3$s" (id: %4$d) located at %5$s/showreport.php?bugid=%4$d
89
90 Here are the notices:
91 ###################################################################
92
93 %5$s
94
95 ###################################################################
96 If you no longer want to receive email from us, please log into your account and click the "My Controls" tab at the top of the screen to change email preferences.
97
98 %5$s')
99 )
100 );
101
102 if (!isset($_emails[$name]))
103 {
104 throw new Exception('Unknown email template "' . $name . '"');
105 }
106 return $_emails[$name];
107 }
108
109 ?>